From a8068ff2bba9eb70b4629ad6d2a36161f9f67919 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Sat, 9 Nov 2024 11:49:47 -0800 Subject: [PATCH] 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. --- containments/homescreens/folio/favouritesmodel.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/containments/homescreens/folio/favouritesmodel.cpp b/containments/homescreens/folio/favouritesmodel.cpp index 9f09f5b7..cfdf66f3 100644 --- a/containments/homescreens/folio/favouritesmodel.cpp +++ b/containments/homescreens/folio/favouritesmodel.cpp @@ -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(); } }