# # # patch "src/model/Inventory.cpp" # from [49b90828ab3f978f3a509428be97dd789f2ddb45] # to [e7154346ede2a64e46ce4f5a613e34ca044de4f2] # ============================================================ --- src/model/Inventory.cpp 49b90828ab3f978f3a509428be97dd789f2ddb45 +++ src/model/Inventory.cpp e7154346ede2a64e46ce4f5a613e34ca044de4f2 @@ -70,10 +70,16 @@ bool Inventory::canFetchMore(const QMode // not an inventory item if (!invitem) + { + D(QString("skipping %1 (not an inventory item)").arg(item->getLabel())); return false; + } if (invitem->isExpanded(QueryLevel)) + { + D(QString("skipping %1 (already expanded)").arg(item->getLabel())); return false; + } return true; } @@ -91,16 +97,28 @@ void Inventory::fetchMore(const QModelIn (item); // not an inventory item - if (!invitem) return; + if (!invitem) + { + D(QString("skipping %1 (not an inventory item)").arg(item->getLabel())); + return; + } // mtn currently allows to restrict on ignored, but not on unknown // paths, check that! - if (invitem->hasStatus(InventoryItem::Unknown)) return; + if (invitem->hasStatus(InventoryItem::Unknown)) + { + D(QString("skipping %1 (unknown path)").arg(invitem->getPath())); + return; + } // 'inventory' can only be restricted with existing file paths // and not with invalid file/directory combinations or missing paths // restricting to single files makes no sense for us here either - if (invitem->getFSType() != InventoryItem::Directory) return; + if (invitem->getFSType() == InventoryItem::None) + { + D(QString("skipping %1 (not an existing path)").arg(invitem->getPath())); + return; + } // again, if this item is already expanded, don't expand it again if (invitem->isExpanded(QueryLevel)) return; @@ -541,8 +559,12 @@ void Inventory::insertRowsRecursive(Mode if (itemMap.contains(path)) { InventoryItem * oldItem = itemMap.value(path); + ModelItem * oldParent = oldItem->parent(); + QModelIndex oldParentIndex = indexFromItem(oldParent, 0); + I(oldParentIndex.isValid()); + int row = oldItem->row(); - removeRowsRecursive(parentIndex, row, row); + removeRowsRecursive(oldParentIndex, row, row); } }