Skip to content

Commit b840aab

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
fix: Install new app will start from first page to fill.
as title PMS-BUG-317475
1 parent 0747c96 commit b840aab

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

src/models/itemarrangementproxymodel.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,27 @@ void ItemArrangementProxyModel::onSourceModelChanged()
363363
// add all existing ones if they are not already in
364364
if (folder == -1) {
365365
findItem(desktopId);
366-
m_topLevel->appendItem(desktopId);
366+
// Find first available page with space
367+
int targetPage = -1;
368+
int targetIndex = -1;
369+
370+
// Check each page for available space
371+
for (int page = 0; page < m_topLevel->pageCount(); page++) {
372+
int itemCount = m_topLevel->itemCount(page);
373+
if (itemCount < m_topLevel->maxItemCountPerPage()) {
374+
targetPage = page;
375+
targetIndex = itemCount;
376+
break;
377+
}
378+
}
379+
380+
if (targetPage != -1) {
381+
// Add to first available page with space
382+
m_topLevel->insertItem(desktopId, targetPage, targetIndex);
383+
} else {
384+
// All pages are full, append to new page
385+
m_topLevel->appendItem(desktopId);
386+
}
367387
}
368388
}
369389

0 commit comments

Comments
 (0)