# # # patch "src/model/GetAttributes.cpp" # from [38fe6b353a659b1d7d58ca82f1d9cdf98e54b6d8] # to [3b5ed025eced153309ced638207ef104029a1686] # # patch "src/model/GetAttributes.h" # from [2db2efdcb1f3cefc6e157461a04953173426f271] # to [b2b0c44c14875c6f49a32a4e5ca57fe7ae71f4e3] # # patch "src/view/AttributesView.cpp" # from [3e2e21e988197318820cd197e94fbd3afb8f91dd] # to [0754902971fb811ba3471482eb6557e99676c4f8] # ============================================================ --- src/model/GetAttributes.cpp 38fe6b353a659b1d7d58ca82f1d9cdf98e54b6d8 +++ src/model/GetAttributes.cpp 3b5ed025eced153309ced638207ef104029a1686 @@ -26,7 +26,8 @@ GetAttributes::GetAttributes(QObject * p #include GetAttributes::GetAttributes(QObject * parent) - : QAbstractItemModel(parent), AutomateCommand(0), workspacePath() + : QAbstractItemModel(parent), AutomateCommand(0), + workspacePath(), itemPath() { attributes = new AttributeList(); } @@ -40,7 +41,7 @@ void GetAttributes::revert() void GetAttributes::revert() { attributes->clear(); - path = QString(); + itemPath = QString(); reset(); } void GetAttributes::setWorkspacePath(const WorkspacePath & ws) @@ -48,7 +49,7 @@ void GetAttributes::setWorkspacePath(con workspacePath = ws; } -void GetAttributes::readAttributes(const QString & p) +void GetAttributes::readAttributes(const QString & path) { I(!workspacePath.isEmpty()); @@ -60,12 +61,12 @@ void GetAttributes::readAttributes(const // empty paths are not allowed, if we get one, we certainly // mean the workspace' root directory, which we can address // with "." as well - if (p.isEmpty()) - path = "."; - else - path = p; + if (path.isEmpty() && itemPath.isEmpty()) + itemPath = "."; + else if (!path.isEmpty()) + itemPath = path; - MonotoneTask task(QStringList() << "get_attributes" << path); + MonotoneTask task(QStringList() << "get_attributes" << itemPath); AutomateCommand::enqueueWorkspaceTask(workspacePath, task); } @@ -277,7 +278,7 @@ bool GetAttributes::setAttribute(const Q { MonotoneTask out = MonotoneUtil::runSynchronousWorkspaceTask( workspacePath, - MonotoneTask(QStringList() << "set_attribute" << path << key << value) + MonotoneTask(QStringList() << "set_attribute" << itemPath << key << value) ); return out.getReturnCode() == 0; } @@ -286,7 +287,7 @@ bool GetAttributes::dropAttribute(const { MonotoneTask out = MonotoneUtil::runSynchronousWorkspaceTask( workspacePath, - MonotoneTask(QStringList() << "drop_attribute" << path << key) + MonotoneTask(QStringList() << "drop_attribute" << itemPath << key) ); return out.getReturnCode() == 0; } ============================================================ --- src/model/GetAttributes.h 2db2efdcb1f3cefc6e157461a04953173426f271 +++ src/model/GetAttributes.h b2b0c44c14875c6f49a32a4e5ca57fe7ae71f4e3 @@ -50,11 +50,11 @@ public: bool setAttribute(const QString &, const QString &); bool dropAttribute(const QString &); - inline bool attributesLoaded() const { return !path.isEmpty(); } + inline bool attributesLoaded() const { return !itemPath.isEmpty(); } public slots: void setWorkspacePath(const WorkspacePath &); - void readAttributes(const QString &); + void readAttributes(const QString & itemPath = QString()); void revert(); signals: @@ -63,8 +63,8 @@ private: private: void processTaskResult(const MonotoneTask &); AttributeList * attributes; - QString path; WorkspacePath workspacePath; + QString itemPath; }; #endif ============================================================ --- src/view/AttributesView.cpp 3e2e21e988197318820cd197e94fbd3afb8f91dd +++ src/view/AttributesView.cpp 0754902971fb811ba3471482eb6557e99676c4f8 @@ -64,7 +64,8 @@ void AttributesView::sectionClicked(int { // do not popup the menu if we haven't focused a valid item GetAttributes * attrModel = qobject_cast(model()); - if (attrModel->attributesLoaded()) return; + I(attrModel); + if (!attrModel->attributesLoaded()) return; if (logicalIndex != 0) return; @@ -127,6 +128,7 @@ void AttributesView::addAttribute() { C(QString("Couldn't set attribute")); } + attrModel->readAttributes(); } } @@ -156,6 +158,7 @@ void AttributesView::editAttribute() { C(QString("Couldn't set/update attribute")); } + attrModel->readAttributes(); } } @@ -168,5 +171,6 @@ void AttributesView::dropAttribute() { C(QString("Couldn't drop attribute")); } + attrModel->readAttributes(); }