# # # patch "guitone/src/model/InventoryItem.cpp" # from [3db1add900522f9151cf467f57c260804e538e6d] # to [d68575e41ee46580ad5e6fcdb68863e721e5cb56] # # patch "guitone/src/model/InventoryItem.h" # from [0d19b1a17a960675f36bd1e41087197a7316f169] # to [bde769fc52a089883ca9b0fff62677bf7c50a9ac] # ============================================================ --- guitone/src/model/InventoryItem.cpp 3db1add900522f9151cf467f57c260804e538e6d +++ guitone/src/model/InventoryItem.cpp d68575e41ee46580ad5e6fcdb68863e721e5cb56 @@ -66,8 +66,25 @@ QString InventoryItem::getLabel() const QString InventoryItem::getLabel() const { - if (label.size() > 0) return label; - return getFilename(); + QString labelString(getFilename()); + if (label.size() > 0) + { + labelString = label; + } + + if (!isDirectory()) return labelString; + + int rStatus = getStatusRecursive(); + + if ((rStatus & Added) == Added || + (rStatus & Dropped) == Dropped || + (rStatus & Patched) == Patched || + (rStatus & RenamedFrom) == RenamedFrom || + (rStatus & RenamedTo) == RenamedTo) + { + labelString = labelString.prepend(">"); + } + return labelString; } void InventoryItem::deleteAllChildren(void) @@ -217,6 +234,35 @@ bool InventoryItem::hasNotStatus(int sta return (status & statusBits) == 0; } +int InventoryItem::getStatusRecursive() const +{ + int overallStatus = status; + + if (!isDirectory()) + { + return overallStatus; + } + + for (int i=0,s=children.size(); i(children.at(i)); + overallStatus |= item->getStatusRecursive(); + } + + + return overallStatus; +} + +bool InventoryItem::hasStatusRecursive(int statusBits) const +{ + return (getStatusRecursive() & statusBits) == statusBits; +} + +bool InventoryItem::hasNotStatusRecursive(int statusBits) const +{ + return (getStatusRecursive() & statusBits) == 0; +} + QString InventoryItem::getStatusString() const { // do not return the status for @@ -262,3 +308,4 @@ QString InventoryItem::getStatusString() } return list.join(", "); } + ============================================================ --- guitone/src/model/InventoryItem.h 0d19b1a17a960675f36bd1e41087197a7316f169 +++ guitone/src/model/InventoryItem.h bde769fc52a089883ca9b0fff62677bf7c50a9ac @@ -51,6 +51,9 @@ class InventoryItem : public QObject bool hasStatus(int) const; bool hasNotStatus(int) const; + bool hasStatusRecursive(int) const; + bool hasNotStatusRecursive(int) const; + int getStatusRecursive() const; QString getStatusString(void) const; inline bool isDirectory(void) const { return dirFlag; }; inline bool isRootDirectory(void) const { return rootFlag; };