summaryrefslogtreecommitdiffstats
path: root/archivecontroller.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-07-12 17:23:33 +0200
committerArno <am@disconnect.de>2013-07-12 17:23:33 +0200
commite8edacfc5175e91d27d6fcba8e3ffa1b1c80754c (patch)
tree799a4731f2b5ed5c5993c1fbf83341f228061303 /archivecontroller.cpp
parentea96c5b64b1fd1a0ae152363c5ec804eaf960dcf (diff)
downloadSheMov-e8edacfc5175e91d27d6fcba8e3ffa1b1c80754c.tar.gz
SheMov-e8edacfc5175e91d27d6fcba8e3ffa1b1c80754c.tar.bz2
SheMov-e8edacfc5175e91d27d6fcba8e3ffa1b1c80754c.zip
Dis/enable QActions for ContextMenu
Handle actions dependent on type node.
Diffstat (limited to 'archivecontroller.cpp')
-rw-r--r--archivecontroller.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/archivecontroller.cpp b/archivecontroller.cpp
index 50e9982..869ffb0 100644
--- a/archivecontroller.cpp
+++ b/archivecontroller.cpp
@@ -12,6 +12,7 @@
#include <QInputDialog>
#include <QTextEdit>
#include <QStandardItemModel>
+#include <QAction>
#include "archivecontroller.h"
#include "archivemodel.h"
@@ -162,6 +163,11 @@ void ArchiveController::editFileNo(){
}
}
+void ArchiveController::addActionForTree(QAction *a){
+ mActionsForTree << a;
+ mArchiveTree->addAction(a);
+}
+
void ArchiveController::treeSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected){
Q_UNUSED(selected);
Q_UNUSED(deselected);
@@ -190,6 +196,10 @@ void ArchiveController::treeSelectionChanged(const QItemSelection &selected, con
}
QString metaData = mArchiveModel->metadata(*ids.begin());
mMetadataView->setHtml(metaData);
+ int nodeType = sel.first().data(ArchiveModel::TypeRole).toInt();
+ foreach(QAction *a, mActionsForTree){
+ a->setEnabled(a->data().toInt() & nodeType);
+ }
}
void ArchiveController::fileDoubleClicked(const QModelIndex &idx){