homescreen/folio: Fix favourites bar reordering when full

Fix the favourites bar reordering when it is already full, currently it
prevents any changes on a full bar, requiring users to move the delegate
out and back in again.
This commit is contained in:
Devin Lin 2024-11-09 11:49:47 -08:00
parent a54503419e
commit a8068ff2bb

View file

@ -143,10 +143,19 @@ bool FavouritesModel::isFull() const
auto homeScreenState = m_homeScreen->homeScreenState();
bool isLocationBottom = homeScreenState->favouritesBarLocation() == HomeScreenState::Bottom;
// we should not include the ghost entry in the delegate count
int count = 0;
for (const auto &delegate : m_delegates) {
if (delegate.delegate->type() == FolioDelegate::None) {
continue;
}
++count;
}
if (isLocationBottom) {
return m_delegates.size() >= homeScreenState->pageColumns();
return count >= homeScreenState->pageColumns();
} else {
return m_delegates.size() >= homeScreenState->pageRows();
return count >= homeScreenState->pageRows();
}
}