diff --git a/src/PrpShop/Main.cpp b/src/PrpShop/Main.cpp index 3357f9d..1b089a4 100644 --- a/src/PrpShop/Main.cpp +++ b/src/PrpShop/Main.cpp @@ -576,10 +576,10 @@ QPlasmaTreeItem* PrpShopMain::ensurePath(const plLocation& loc, short objType) plPageInfo* page = fResMgr.FindPage(loc); QPlasmaTreeItem* ageItem = NULL; QString ageName = st2qstr(page->getAge()); - QString pageName = st2qstr(page->getPage()); for (int i=0; itopLevelItemCount(); i++) { - if (fBrowserTree->topLevelItem(i)->text(0) == ageName) { - ageItem = (QPlasmaTreeItem*)fBrowserTree->topLevelItem(i); + auto topLevelItem = static_cast(fBrowserTree->topLevelItem(i)); + if (topLevelItem->age() == ageName) { + ageItem = topLevelItem; break; } } @@ -588,8 +588,9 @@ QPlasmaTreeItem* PrpShopMain::ensurePath(const plLocation& loc, short objType) QPlasmaTreeItem* pageItem = NULL; for (int i=0; ichildCount(); i++) { - if (ageItem->child(i)->text(0) == pageName) { - pageItem = (QPlasmaTreeItem*)ageItem->child(i); + auto child = static_cast(ageItem->child(i)); + if (child->page()->getLocation() == loc) { + pageItem = child; break; } } @@ -1082,8 +1083,9 @@ QPlasmaTreeItem* PrpShopMain::loadPage(plPageInfo* page, QString filename) // Find or create the Age folder QString ageName = st2qstr(page->getAge()); for (int i=0; itopLevelItemCount(); i++) { - if (fBrowserTree->topLevelItem(i)->text(0) == ageName) { - parent = (QPlasmaTreeItem*)fBrowserTree->topLevelItem(i); + auto topLevelItem = static_cast(fBrowserTree->topLevelItem(i)); + if (topLevelItem->age() == ageName) { + parent = topLevelItem; break; } }