X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/b7ad5fb99d32d43fe4e083a8ffc2ebfbd046d2db..99cc976a8564cbdae63e4261fcb2292a33148dbc:/src/views/versioncontrol/kversioncontrolplugin.h diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h index 1696f975c..c908be247 100644 --- a/src/views/versioncontrol/kversioncontrolplugin.h +++ b/src/views/versioncontrol/kversioncontrolplugin.h @@ -1,29 +1,18 @@ -/***************************************************************************** - * Copyright (C) 2011 by Vishesh Yadav * - * Copyright (C) 2011 by Peter Penz * - * * - * This library is free software; you can redistribute it and/or * - * modify it under the terms of the GNU Library General Public * - * License version 2 as published by the Free Software Foundation. * - * * - * This library is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * - * Library General Public License for more details. * - * * - * You should have received a copy of the GNU Library General Public License * - * along with this library; see the file COPYING.LIB. If not, write to * - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * - * Boston, MA 02110-1301, USA. * - *****************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Vishesh Yadav + * SPDX-FileCopyrightText: 2011 Peter Penz + * + * SPDX-License-Identifier: LGPL-2.0-only + */ #ifndef KVERSIONCONTROLPLUGIN_H #define KVERSIONCONTROLPLUGIN_H #include -#include #include +#include + class KFileItemList; class KFileItem; /** @@ -34,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 @@ -56,15 +46,13 @@ class KFileItem; * * #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: @@ -136,7 +124,7 @@ public: */ IgnoredVersion, /** - * The file is is tracked by the version control system, but + * The file is tracked by the version control system, but * is missing in the directory (e.g. by deleted without using * a version control command). * @since 4.8 @@ -144,8 +132,8 @@ public: MissingVersion }; - KVersionControlPlugin(QObject* parent = 0); - virtual ~KVersionControlPlugin(); + KVersionControlPlugin(QObject* parent = nullptr); + ~KVersionControlPlugin() override; /** * Returns the name of the file which stores @@ -154,6 +142,12 @@ public: */ virtual QString fileName() const = 0; + /** + * Returns the path of the local repository root for the versionned directory + * Returns an emtpy 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 @@ -179,14 +173,18 @@ 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 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 actions(const KFileItemList& items) const = 0; + virtual QList outOfVersionControlActions(const KFileItemList& items) const = 0; Q_SIGNALS: /**