mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-05 16:19:10 +00:00
For VCS-plugin interface added pure virtual function outOfVersionControlActions()
Summary: This commit changes VCS-plugin interface in order to provide actions for unversioned items (for example clone or checkout repository), updates to dolphin-plugins comes in the separate commit D29042. Reviewers: #dolphin, meven, elvisangelaccio Reviewed By: #dolphin, meven, elvisangelaccio Subscribers: kfm-devel Tags: #dolphin Differential Revision: https://phabricator.kde.org/D29041
This commit is contained in:
parent
0f1c015809
commit
67a5ec53ef
|
@ -180,14 +180,17 @@ public:
|
|||
virtual ItemVersion itemVersion(const KFileItem& item) const = 0;
|
||||
|
||||
/**
|
||||
* @return List of actions that are available for the items \p items.
|
||||
* It is recommended to keep the number of returned actions small
|
||||
* in case if an item is an unversioned directory that is not
|
||||
* inside the hierarchy tree of the version control system. This
|
||||
* prevents having a cluttered context menu for directories
|
||||
* outside the version control system.
|
||||
* @return List of actions that are available for the \p items in a version controlled
|
||||
* path.
|
||||
*/
|
||||
virtual QList<QAction*> actions(const KFileItemList& items) const = 0;
|
||||
virtual QList<QAction*> versionControlActions(const KFileItemList& items) const = 0;
|
||||
|
||||
/**
|
||||
* @return List of actions that are available for the out of version control
|
||||
* items \p items. It's opposed to the \p versionedActions. Common usage
|
||||
* is for clone/checkout actions.
|
||||
*/
|
||||
virtual QList<QAction*> outOfVersionControlActions(const KFileItemList& items) const = 0;
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
|
|
|
@ -118,11 +118,19 @@ QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) cons
|
|||
}
|
||||
}
|
||||
|
||||
if (!m_model || hasNullItems || !isVersioned()) {
|
||||
if (!m_model || hasNullItems) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return m_plugin->actions(items);
|
||||
if (isVersionControlled()) {
|
||||
return m_plugin->versionControlActions(items);
|
||||
} else {
|
||||
QList<QAction*> actions;
|
||||
for (const auto &plugin : qAsConst(m_plugins)) {
|
||||
actions << plugin.first->outOfVersionControlActions(items);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
}
|
||||
|
||||
void VersionControlObserver::delayedDirectoryVerification()
|
||||
|
@ -360,7 +368,7 @@ KVersionControlPlugin* VersionControlObserver::searchPlugin(const QUrl& director
|
|||
return bestPlugin;
|
||||
}
|
||||
|
||||
bool VersionControlObserver::isVersioned() const
|
||||
bool VersionControlObserver::isVersionControlled() const
|
||||
{
|
||||
return m_versionedDirectory && m_plugin;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ private:
|
|||
/**
|
||||
* Returns true, if the directory contains a version control information.
|
||||
*/
|
||||
bool isVersioned() const;
|
||||
bool isVersionControlled() const;
|
||||
|
||||
private:
|
||||
bool m_pendingItemStatesUpdate;
|
||||
|
|
Loading…
Reference in a new issue