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
This commit is contained in:
Peter Penz 2009-07-23 06:28:28 +00:00
parent fddd17030c
commit 47d5003283
5 changed files with 35 additions and 7 deletions

View file

@ -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)

View file

@ -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*>();
}

View file

@ -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();

View file

@ -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;
}

View file

@ -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:
/**