mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/folio: Prevent items from being added to favourites area if it's full
Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/323
This commit is contained in:
parent
e84989afee
commit
95d3be0531
3 changed files with 19 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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++) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue