svn path=/trunk/KDE/kdebase/apps/; revision=
1001385
{
// The context menu either accesses the URLs of the selected items
// or the items itself. To increase the performance both lists are cached.
{
// 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();
}
m_selectedUrls = view->selectedUrls();
m_selectedItems = view->selectedItems();
}
}
// insert revision control actions
}
// 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()) {
// insert 'Copy To' and 'Move To' sub menus
if (DolphinSettings::instance().generalSettings()->showCopyMoveMenu()) {
+ addRevisionControlActions(popup);
+
QAction* addToPlacesAction = popup->addAction(KIcon("bookmark-new"),
i18nc("@action:inmenu Add current folder to places", "Add to Places"));
QAction* addToPlacesAction = popup->addAction(KIcon("bookmark-new"),
i18nc("@action:inmenu Add current folder to places", "Add to Places"));
return *m_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) {
void DolphinContextMenu::addCustomActions(KMenu* menu)
{
foreach (QAction* action, m_customActions) {
private:
KFileItemListProperties& capabilities();
private:
KFileItemListProperties& capabilities();
+ void addRevisionControlActions(KMenu* menu);
void addCustomActions(KMenu* menu);
private:
void addCustomActions(KMenu* menu);
private:
QList<QAction*> SubversionPlugin::contextMenuActions(const KFileItemList& items) const
{
QList<QAction*> SubversionPlugin::contextMenuActions(const KFileItemList& items) const
{
- Q_UNUSED(items);
- // TODO...
QList<QAction*> actions;
actions.append(m_updateAction);
actions.append(m_commitAction);
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);
+ }
/**
* Returns the list of actions that should be shown in the context menu
/**
* 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;
*/
virtual QList<QAction*> contextMenuActions(const KFileItemList& items) const = 0;