diff options
| author | Peter Penz <[email protected]> | 2011-09-09 19:21:22 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-09-09 19:22:13 +0200 |
| commit | 93cb7e02616df9746f7cdae09434e7488f4e7d28 (patch) | |
| tree | e28a940f1137dda286c662028d25906f1f0c4960 /src | |
| parent | 9dbd073951f999d6b6fad46864622baf0a25ef35 (diff) | |
Version control: Show context menu entries of plugins
Diffstat (limited to 'src')
| -rw-r--r-- | src/views/dolphinview.cpp | 12 | ||||
| -rw-r--r-- | src/views/versioncontrol/versioncontrolobserver.cpp | 23 |
2 files changed, 26 insertions, 9 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index bb9b52365..a53934ddc 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -518,8 +518,16 @@ QString DolphinView::statusBarText() const QList<QAction*> DolphinView::versionControlActions(const KFileItemList& items) const { - Q_UNUSED(items); - return QList<QAction*>(); //m_dolphinViewController->versionControlActions(items); + QList<QAction*> actions; + + if (items.isEmpty()) { + const KUrl url = fileItemModel()->rootDirectory(); + actions = m_versionControlObserver->contextMenuActions(url.path(KUrl::AddTrailingSlash)); + } else { + actions = m_versionControlObserver->contextMenuActions(items); + } + + return actions; } void DolphinView::setUrl(const KUrl& url) diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index ba83b7515..c8d9d6874 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -90,19 +90,28 @@ KFileItemModel* VersionControlObserver::model() const QList<QAction*> VersionControlObserver::contextMenuActions(const KFileItemList& items) const { QList<QAction*> actions; - if (isVersioned() && m_updateItemStatesThread->lockPlugin()) { - actions = m_plugin->contextMenuActions(items); - m_updateItemStatesThread->unlockPlugin(); + if (isVersioned()) { + if (m_updateItemStatesThread && m_updateItemStatesThread->lockPlugin()) { + actions = m_plugin->contextMenuActions(items); + m_updateItemStatesThread->unlockPlugin(); + } else { + actions = m_plugin->contextMenuActions(items); + } } + return actions; } QList<QAction*> VersionControlObserver::contextMenuActions(const QString& directory) const { QList<QAction*> actions; - if (isVersioned() && m_updateItemStatesThread->lockPlugin()) { - actions = m_plugin->contextMenuActions(directory); - m_updateItemStatesThread->unlockPlugin(); + if (isVersioned()) { + if (m_updateItemStatesThread && m_updateItemStatesThread->lockPlugin()) { + actions = m_plugin->contextMenuActions(directory); + m_updateItemStatesThread->unlockPlugin(); + } else { + actions = m_plugin->contextMenuActions(directory); + } } return actions; @@ -303,7 +312,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const KUrl& director bool VersionControlObserver::isVersioned() const { - return false; //m_dolphinModel->hasVersionData() && m_plugin; + return m_versionedDirectory && m_plugin; } #include "versioncontrolobserver.moc" |
