┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-07-23 06:10:01 +0000
committerPeter Penz <[email protected]>2009-07-23 06:10:01 +0000
commit9340a52cf8b310545fdb06f1f5aeec0f6a32d539 (patch)
treee4e8f0f677490a39092389d67a208bfd2f72697c /src
parenta9ef4bd96a6aa7f4b730bc0b4ff676c56e382507 (diff)
also provide revision control actions for the viewport-context-menu
svn path=/trunk/KDE/kdebase/apps/; revision=1001385
Diffstat (limited to 'src')
-rw-r--r--src/dolphincontextmenu.cpp25
-rw-r--r--src/dolphincontextmenu.h1
-rw-r--r--src/revisioncontrolplugin.cpp8
-rw-r--r--src/revisioncontrolplugin.h8
4 files changed, 25 insertions, 17 deletions
diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp
index 69b551493..cd3195e9a 100644
--- a/src/dolphincontextmenu.cpp
+++ b/src/dolphincontextmenu.cpp
@@ -65,7 +65,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent,
{
// The context menu either accesses the URLs of the selected items
// or the items itself. To increase the performance both lists are cached.
- DolphinView* view = m_mainWindow->activeViewContainer()->view();
+ const DolphinView* view = m_mainWindow->activeViewContainer()->view();
m_selectedUrls = view->selectedUrls();
m_selectedItems = view->selectedItems();
}
@@ -224,14 +224,7 @@ void DolphinContextMenu::openItemContextMenu()
}
// insert revision control actions
- DolphinView* view = m_mainWindow->activeViewContainer()->view();
- const QList<QAction*> revControlActions = view->revisionControlActions(m_selectedItems);
- if (revControlActions.count() > 0) {
- foreach (QAction* action, revControlActions) {
- popup->addAction(action);
- }
- popup->addSeparator();
- }
+ addRevisionControlActions(popup);
// insert 'Copy To' and 'Move To' sub menus
if (DolphinSettings::instance().generalSettings()->showCopyMoveMenu()) {
@@ -290,6 +283,8 @@ void DolphinContextMenu::openViewportContextMenu()
popup->addSeparator();
+ addRevisionControlActions(popup);
+
QAction* addToPlacesAction = popup->addAction(KIcon("bookmark-new"),
i18nc("@action:inmenu Add current folder to places", "Add to Places"));
@@ -395,6 +390,18 @@ KFileItemListProperties& DolphinContextMenu::capabilities()
return *m_capabilities;
}
+void DolphinContextMenu::addRevisionControlActions(KMenu* menu)
+{
+ const DolphinView* view = m_mainWindow->activeViewContainer()->view();
+ const QList<QAction*> revControlActions = view->revisionControlActions(m_selectedItems);
+ if (revControlActions.count() > 0) {
+ foreach (QAction* action, revControlActions) {
+ menu->addAction(action);
+ }
+ menu->addSeparator();
+ }
+}
+
void DolphinContextMenu::addCustomActions(KMenu* menu)
{
foreach (QAction* action, m_customActions) {
diff --git a/src/dolphincontextmenu.h b/src/dolphincontextmenu.h
index 59da57146..613e4a434 100644
--- a/src/dolphincontextmenu.h
+++ b/src/dolphincontextmenu.h
@@ -96,6 +96,7 @@ private:
private:
KFileItemListProperties& capabilities();
+ void addRevisionControlActions(KMenu* menu);
void addCustomActions(KMenu* menu);
private:
diff --git a/src/revisioncontrolplugin.cpp b/src/revisioncontrolplugin.cpp
index 295dbe1c0..6a833f622 100644
--- a/src/revisioncontrolplugin.cpp
+++ b/src/revisioncontrolplugin.cpp
@@ -133,13 +133,13 @@ RevisionControlPlugin::RevisionState SubversionPlugin::revisionState(const KFile
QList<QAction*> SubversionPlugin::contextMenuActions(const KFileItemList& items) const
{
- Q_UNUSED(items);
- // TODO...
QList<QAction*> actions;
actions.append(m_updateAction);
actions.append(m_commitAction);
- actions.append(m_addAction);
- actions.append(m_removeAction);
+ if (!items.isEmpty()) {
+ actions.append(m_addAction);
+ actions.append(m_removeAction);
+ }
return actions;
}
diff --git a/src/revisioncontrolplugin.h b/src/revisioncontrolplugin.h
index 055464b69..54bd10f03 100644
--- a/src/revisioncontrolplugin.h
+++ b/src/revisioncontrolplugin.h
@@ -93,10 +93,10 @@ public:
/**
* Returns the list of actions that should be shown in the context menu
- * for the files \p items. If an action cannot be applied to the list
- * of files, it is recommended to disable the action instead of removing it
- * from the returned list. If an action triggers a change of the revisions,
- * the signal RevisionControlPlugin::revisionStatesChanged() must be emitted.
+ * 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()).
+ * 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;