X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/67ebd66f94356b4e66005b1072919cb7b5e858bb..e018ecafca79a73f1e9d76c577b9529fc3a7ae03:/src/views/versioncontrol/kversioncontrolplugin.h diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h index 0de305d14..1a4111452 100644 --- a/src/views/versioncontrol/kversioncontrolplugin.h +++ b/src/views/versioncontrol/kversioncontrolplugin.h @@ -23,14 +23,15 @@ class KFileItem; * steps are required (in the example below it is assumed that a plugin for * Subversion will be written): * - * - Create a fileviewsvnplugin.desktop file with the following content: + * - Create a fileviewsvnplugin.json file with the following content: * - * [Desktop Entry] - * Type=Service - * Name=Subversion - * X-KDE-ServiceTypes=FileViewVersionControlPlugin - * MimeType=text/plain; - * X-KDE-Library=fileviewsvnplugin + * { + * "KPlugin": { + * "Description": "The svn plugin", + * "Name": "Svn" + * } + * } + * * * - Create a class FileViewSvnPlugin derived from KVersionControlPlugin and @@ -44,16 +45,13 @@ class KFileItem; * - Add the following lines at the top of fileviewsvnplugin.cpp: * * #include - * #include - * K_PLUGIN_FACTORY(FileViewSvnPluginFactory, registerPlugin();) - * K_EXPORT_PLUGIN(FileViewSvnPluginFactory("fileviewsvnplugin")) + * K_PLUGIN_CLASS_WITH_JSON(FileViewSvnPlugin, "fileviewsvnplugin.json") * * * - Add the following lines to your CMakeLists.txt file: * - * kde4_add_plugin(fileviewsvnplugin fileviewsvnplugin.cpp) - * target_link_libraries(fileviewsvnplugin konq) - * install(FILES fileviewsvnplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR}) + * kcoreaddons_add_plugin(fileviewsvnplugin SOURCES fileviewsvnplugin.cpp INSTALL_NAMESPACE "dolphin/vcs") + * target_link_libraries(fileviewsvnplugin DolphinVcs) * * * General implementation notes: @@ -75,8 +73,7 @@ class DOLPHINVCS_EXPORT KVersionControlPlugin : public QObject Q_OBJECT public: - enum ItemVersion - { + enum ItemVersion { /** The file is not under version control. */ UnversionedVersion, /** @@ -133,7 +130,7 @@ public: MissingVersion }; - KVersionControlPlugin(QObject* parent = nullptr); + KVersionControlPlugin(QObject *parent = nullptr); ~KVersionControlPlugin() override; /** @@ -143,13 +140,19 @@ public: */ virtual QString fileName() const = 0; + /** + * Returns the path of the local repository root for the versioned directory + * Returns an empty QString when directory is not part of a working copy + */ + virtual QString localRepositoryRoot(const QString &directory) const; + /** * Is invoked whenever the version control * information will get retrieved for the directory * \p directory. It is assured that the directory * contains a trailing slash. */ - virtual bool beginRetrieval(const QString& directory) = 0; + virtual bool beginRetrieval(const QString &directory) = 0; /** * Is invoked after the version control information has been @@ -165,20 +168,21 @@ public: * invoked before and that the file is part of the directory specified * in beginRetrieval(). */ - virtual ItemVersion itemVersion(const KFileItem& item) const = 0; + virtual ItemVersion itemVersion(const KFileItem &item) const = 0; /** * @return List of actions that are available for the \p items in a version controlled * path. */ - virtual QList versionControlActions(const KFileItemList& items) const = 0; + virtual QList 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. + * @since 21.04 */ - virtual QList outOfVersionControlActions(const KFileItemList& items) const = 0; + virtual QList outOfVersionControlActions(const KFileItemList &items) const = 0; Q_SIGNALS: /** @@ -196,20 +200,19 @@ Q_SIGNALS: * Is emitted if an information message with the content \a msg * should be shown. */ - void infoMessage(const QString& msg); + void infoMessage(const QString &msg); /** * Is emitted if an error message with the content \a msg * should be shown. */ - void errorMessage(const QString& msg); + void errorMessage(const QString &msg); /** * Is emitted if an "operation completed" message with the content \a msg * should be shown. */ - void operationCompletedMessage(const QString& msg); + void operationCompletedMessage(const QString &msg); }; #endif // KVERSIONCONTROLPLUGIN_H -