# # # patch "src/model/Inventory.cpp" # from [300ecdfe2c509f6df1fb404f7536eb345caeb57e] # to [7f4b71095ad02c8b6941bc000850a9a25423e093] # # patch "src/model/Inventory.h" # from [323c88751637a3b78608bf9b980a0dde7bd25c0d] # to [a6b66122794d2742d293ff10885e6150c9c13e4a] # ============================================================ --- src/model/Inventory.cpp 300ecdfe2c509f6df1fb404f7536eb345caeb57e +++ src/model/Inventory.cpp 7f4b71095ad02c8b6941bc000850a9a25423e093 @@ -67,16 +67,13 @@ bool Inventory::canFetchMore(const QMode (item); // not an inventory item - if (!invitem) - return false; + if (!invitem) return false; - if (invitem->isExpanded()) - return false; + // do we process this path already? + if (lastRequests.contains(invitem->getPath())) return false; - if (lastRequests.size() > 0 && lastRequests.top() == invitem->getPath()) - return false; + if (invitem->isExpanded()) return false; - L(QString("fetching more for %1 (items: %2)").arg(invitem->getLabel()).arg(invitem->childCount())); return true; } @@ -95,6 +92,9 @@ void Inventory::fetchMore(const QModelIn // not an inventory item if (!invitem) return; + // do we process this path already? + if (lastRequests.contains(invitem->getPath())) return; + // mtn currently allows to restrict on ignored, but not on unknown // paths, check that! if (invitem->hasStatus(InventoryItem::Unknown)) return; @@ -112,6 +112,8 @@ void Inventory::readInventory(const QStr void Inventory::readInventory(const QString & path) { + lastRequests.insert(path); + I(!workspacePath.isEmpty()); QStringList cmd = QStringList() << "inventory"; @@ -120,8 +122,6 @@ void Inventory::readInventory(const QStr cmd << path; } - lastRequests.push(path); - QStringList opts; // if requested, just read one directory level ahead @@ -255,11 +255,12 @@ void Inventory::processTaskResult(const reset(); } - I(lastRequests.pop() == queriedPath); I(itemMap.contains(queriedPath)); QModelIndex index = indexFromItem(itemMap.value(queriedPath), 0); I(index.isValid()); emit dataChanged(index, index); + + lastRequests.remove(queriedPath); } QModelIndex Inventory::indexFromItem(ModelItem * item, int col) const ============================================================ --- src/model/Inventory.h 323c88751637a3b78608bf9b980a0dde7bd25c0d +++ src/model/Inventory.h a6b66122794d2742d293ff10885e6150c9c13e4a @@ -25,7 +25,7 @@ #include "InventoryItem.h" #include -#include +#include class Inventory : public QAbstractItemModel, public AutomateCommand { @@ -64,7 +64,7 @@ private: QString branchName; QMap itemMap; WorkspacePath workspacePath; - QStack lastRequests; + QSet lastRequests; private slots: void setWorkspacePath();