┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-07-23 06:28:28 +0000
committerPeter Penz <[email protected]>2009-07-23 06:28:28 +0000
commit47d50032839e70f847adc1cc0de784f001936954 (patch)
treee898fc215932aba8fff7c9cb4f077a546b1b0e1d
parentfddd17030cf1da66415aad51e31575d2a1e2dda0 (diff)
The revision control plugin must be aware on which directory the context-menu-actions should get applied. Relying on the directory that has been used in beginRetrieval() does not work when having a treeview.
svn path=/trunk/KDE/kdebase/apps/; revision=1001388
-rw-r--r--src/dolphinview.cpp4
-rw-r--r--src/revisioncontrolobserver.cpp8
-rw-r--r--src/revisioncontrolobserver.h1
-rw-r--r--src/revisioncontrolplugin.cpp18
-rw-r--r--src/revisioncontrolplugin.h11
5 files changed, 35 insertions, 7 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp
index a979ecdd2..a12e7a991 100644
--- a/src/dolphinview.cpp
+++ b/src/dolphinview.cpp
@@ -611,7 +611,9 @@ QString DolphinView::statusBarText() const
QList<QAction*> DolphinView::revisionControlActions(const KFileItemList& items) const
{
- return m_revisionControlObserver->contextMenuActions(items);
+ return items.isEmpty()
+ ? m_revisionControlObserver->contextMenuActions(url().path(KUrl::AddTrailingSlash))
+ : m_revisionControlObserver->contextMenuActions(items);
}
void DolphinView::setUrl(const KUrl& url)
diff --git a/src/revisioncontrolobserver.cpp b/src/revisioncontrolobserver.cpp
index 5b3c38947..f3bf08ce4 100644
--- a/src/revisioncontrolobserver.cpp
+++ b/src/revisioncontrolobserver.cpp
@@ -131,6 +131,14 @@ QList<QAction*> RevisionControlObserver::contextMenuActions(const KFileItemList&
if (m_dolphinModel->hasRevisionData() && (m_plugin != 0)) {
return m_plugin->contextMenuActions(items);
}
+ return QList<QAction*>();
+}
+
+QList<QAction*> RevisionControlObserver::contextMenuActions(const QString& directory) const
+{
+ if (m_dolphinModel->hasRevisionData() && (m_plugin != 0)) {
+ return m_plugin->contextMenuActions(directory);
+ }
return QList<QAction*>();
}
diff --git a/src/revisioncontrolobserver.h b/src/revisioncontrolobserver.h
index 2fc21ed59..27c7a27a0 100644
--- a/src/revisioncontrolobserver.h
+++ b/src/revisioncontrolobserver.h
@@ -55,6 +55,7 @@ public:
virtual ~RevisionControlObserver();
QList<QAction*> contextMenuActions(const KFileItemList& items) const;
+ QList<QAction*> contextMenuActions(const QString& directory) const;
private slots:
void delayedDirectoryVerification();
diff --git a/src/revisioncontrolplugin.cpp b/src/revisioncontrolplugin.cpp
index 6a833f622..b3b407c61 100644
--- a/src/revisioncontrolplugin.cpp
+++ b/src/revisioncontrolplugin.cpp
@@ -133,13 +133,23 @@ RevisionControlPlugin::RevisionState SubversionPlugin::revisionState(const KFile
QList<QAction*> SubversionPlugin::contextMenuActions(const KFileItemList& items) const
{
+ Q_UNUSED(items);
+
+ QList<QAction*> actions;
+ actions.append(m_updateAction);
+ actions.append(m_commitAction);
+ actions.append(m_addAction);
+ actions.append(m_removeAction);
+ return actions;
+}
+
+QList<QAction*> SubversionPlugin::contextMenuActions(const QString& directory) const
+{
+ Q_UNUSED(directory);
+
QList<QAction*> actions;
actions.append(m_updateAction);
actions.append(m_commitAction);
- if (!items.isEmpty()) {
- actions.append(m_addAction);
- actions.append(m_removeAction);
- }
return actions;
}
diff --git a/src/revisioncontrolplugin.h b/src/revisioncontrolplugin.h
index 54bd10f03..bbe66b3c3 100644
--- a/src/revisioncontrolplugin.h
+++ b/src/revisioncontrolplugin.h
@@ -93,13 +93,19 @@ public:
/**
* Returns the list of actions that should be shown in the context menu
- * for the files \p items. If no files are provided by \p items, the context
- * menu is valid for the current directory (see RevisionControlPlugin::beginRetrieval()).
+ * for the files \p items. It is assured that the passed list is not empty.
* If an action triggers a change of the revisions, the signal
* RevisionControlPlugin::revisionStatesChanged() must be emitted.
*/
virtual QList<QAction*> contextMenuActions(const KFileItemList& items) const = 0;
+ /**
+ * Returns the list of actions that should be shown in the context menu
+ * for the directory \p directory. If an action triggers a change of the revisions,
+ * the signal RevisionControlPlugin::revisionStatesChanged() must be emitted.
+ */
+ virtual QList<QAction*> contextMenuActions(const QString& directory) const = 0;
+
signals:
/**
* Should be emitted when the revision state of files has been changed
@@ -131,6 +137,7 @@ public:
virtual void endRetrieval();
virtual RevisionControlPlugin::RevisionState revisionState(const KFileItem& item);
virtual QList<QAction*> contextMenuActions(const KFileItemList& items) const;
+ virtual QList<QAction*> contextMenuActions(const QString& directory) const;
private:
/**