# # # patch "src/model/Inventory.cpp" # from [9c9d01b53256247c2e4061062ef2b350d21945bf] # to [300ecdfe2c509f6df1fb404f7536eb345caeb57e] # ============================================================ --- src/model/Inventory.cpp 9c9d01b53256247c2e4061062ef2b350d21945bf +++ src/model/Inventory.cpp 300ecdfe2c509f6df1fb404f7536eb345caeb57e @@ -112,13 +112,6 @@ void Inventory::readInventory(const QStr void Inventory::readInventory(const QString & path) { - static bool debugRead = false; - if (debugRead) - { - return; - } - debugRead = true; - I(!workspacePath.isEmpty()); QStringList cmd = QStringList() << "inventory"; @@ -133,7 +126,6 @@ void Inventory::readInventory(const QStr // if requested, just read one directory level ahead // (useful for big directory trees) - if (Settings::getBool("ReadWorkspaceIncrementally", true)) { opts << "depth" << QString::number(1); @@ -182,7 +174,7 @@ void Inventory::processTaskResult(const queriedDepth = task.getOptions().at(1).toInt(); if (!queriedPath.isEmpty()) { - queriedDepth += queriedPath.split("/").size() + 1; + queriedDepth += queriedPath.split("/", QString::SkipEmptyParts).size(); } } @@ -215,12 +207,12 @@ void Inventory::processTaskResult(const int itemDepth = 0; if (!path.isEmpty()) { - itemDepth = path.split("/").size() + 1; + itemDepth = path.split("/", QString::SkipEmptyParts).size(); } // add a cdup item for this item if we either queried everything // already or the current directory level corresponds to the queried one - if (item->isDirectory() && (queriedDepth == -1 || queriedDepth < itemDepth)) + if (item->isDirectory() && (queriedDepth == -1 || queriedDepth >= itemDepth)) { PseudoItem * cdUp = new PseudoItem("..", PseudoItem::CdUp); parentChildRelations[item].append(cdUp); @@ -262,6 +254,7 @@ void Inventory::processTaskResult(const // index we're going to present her afterwards reset(); } + I(lastRequests.pop() == queriedPath); I(itemMap.contains(queriedPath)); QModelIndex index = indexFromItem(itemMap.value(queriedPath), 0); @@ -553,7 +546,6 @@ void Inventory::insertRowsRecursive(Mode { InventoryItem * oldItem = itemMap.value(path); int row = oldItem->row(); - L(QString("removing %1 and children").arg(oldItem->getLabel())); removeRowsRecursive(parentIndex, row, row); } } @@ -561,7 +553,6 @@ void Inventory::insertRowsRecursive(Mode // // now do the actual row insertion while notifying Qt properly about that // - L(QString("adding %1 children for %2").arg(children.size()).arg(parentItem->getLabel())); int parentRowCount = rowCount(parentIndex); beginInsertRows(parentIndex, parentRowCount, parentRowCount + children.size() - 1); foreach (ModelItem * item, children) @@ -570,7 +561,6 @@ void Inventory::insertRowsRecursive(Mode if (invitem) { QString path = invitem->getPath(); - L(QString("inserting %1").arg(path)); I(!itemMap.contains(path)); itemMap.insert(path, invitem); }