mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
also provide revision control actions for the viewport-context-menu
svn path=/trunk/KDE/kdebase/apps/; revision=1001385
This commit is contained in:
parent
a9ef4bd96a
commit
9340a52cf8
|
@ -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) {
|
||||
|
|
|
@ -96,6 +96,7 @@ private:
|
|||
|
||||
private:
|
||||
KFileItemListProperties& capabilities();
|
||||
void addRevisionControlActions(KMenu* menu);
|
||||
void addCustomActions(KMenu* menu);
|
||||
|
||||
private:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue