diff --git a/containments/homescreens/folio/dragstate.cpp b/containments/homescreens/folio/dragstate.cpp index 010004f2..37c78dad 100644 --- a/containments/homescreens/folio/dragstate.cpp +++ b/containments/homescreens/folio/dragstate.cpp @@ -328,6 +328,11 @@ void DragState::onDelegateDragPositionOverFavouritesChanged() m_favouritesInsertBetweenTimer->stop(); } + // ignore this event if the favourites area is full already + if (FavouritesModel::self()->isFull()) { + return; + } + // ignore widget drop delegates (since they can't be placed in the favourites) if (m_dropDelegate && m_dropDelegate->type() == FolioDelegate::Widget) { return; diff --git a/containments/homescreens/folio/favouritesmodel.cpp b/containments/homescreens/folio/favouritesmodel.cpp index fb61d9df..6384f4c8 100644 --- a/containments/homescreens/folio/favouritesmodel.cpp +++ b/containments/homescreens/folio/favouritesmodel.cpp @@ -171,6 +171,17 @@ FolioDelegate *FavouritesModel::getEntryAt(int row) return m_delegates[row].delegate; } +bool FavouritesModel::isFull() const +{ + bool isLocationBottom = HomeScreenState::self()->favouritesBarLocation() == HomeScreenState::Bottom; + + if (isLocationBottom) { + return m_delegates.size() >= HomeScreenState::self()->pageColumns(); + } else { + return m_delegates.size() >= HomeScreenState::self()->pageRows(); + } +} + int FavouritesModel::getGhostEntryPosition() { for (int i = 0; i < m_delegates.size(); i++) { diff --git a/containments/homescreens/folio/favouritesmodel.h b/containments/homescreens/folio/favouritesmodel.h index e5a87f3d..0d021bf1 100644 --- a/containments/homescreens/folio/favouritesmodel.h +++ b/containments/homescreens/folio/favouritesmodel.h @@ -43,6 +43,9 @@ public: bool addEntry(int row, FolioDelegate *delegate); FolioDelegate *getEntryAt(int row); + // whether the dock is full, we can't add any more items + bool isFull() const; + // for use with drag and drop, as the delegate is dragged around // ghost - fake delegate exists at an index, so a gap is created // invisible - existing delegate looks like it doesn't exist