┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views
diff options
context:
space:
mode:
authorEmmanuel Pescosta <[email protected]>2015-02-25 12:12:55 +0100
committerEmmanuel Pescosta <[email protected]>2015-02-25 17:21:10 +0100
commit25751088c33ce507096a3e25ee1eeaa7de38c76b (patch)
treef3c046a0d41819f2081d4787d75bdb46a5262c94 /src/views
parentf6b4f562167969365d4aae14d73060c6fdb8270f (diff)
Move the KVersionControlPlugin2 interface from konqlib to Dolphin and remove the deprecated KVersionControlPlugin interface from konqlib
REVIEW: 122687
Diffstat (limited to 'src/views')
-rw-r--r--src/views/dolphinfileitemlistwidget.cpp29
-rw-r--r--src/views/dolphinfileitemlistwidget.h8
-rw-r--r--src/views/dolphinitemlistview.h4
-rw-r--r--src/views/dolphinnewfilemenuobserver.h4
-rw-r--r--src/views/dolphinremoteencoding.h4
-rw-r--r--src/views/dolphinview.h4
-rw-r--r--src/views/dolphinviewactionhandler.h4
-rw-r--r--src/views/draganddrophelper.h4
-rw-r--r--src/views/renamedialog.h4
-rw-r--r--src/views/versioncontrol/kversioncontrolplugin.cpp29
-rw-r--r--src/views/versioncontrol/kversioncontrolplugin.h223
-rw-r--r--src/views/versioncontrol/updateitemstatesthread.cpp20
-rw-r--r--src/views/versioncontrol/updateitemstatesthread.h6
-rw-r--r--src/views/versioncontrol/versioncontrolobserver.cpp41
-rw-r--r--src/views/versioncontrol/versioncontrolobserver.h10
-rw-r--r--src/views/viewmodecontroller.h4
-rw-r--r--src/views/viewproperties.h4
17 files changed, 306 insertions, 96 deletions
diff --git a/src/views/dolphinfileitemlistwidget.cpp b/src/views/dolphinfileitemlistwidget.cpp
index e8345435e..f15230841 100644
--- a/src/views/dolphinfileitemlistwidget.cpp
+++ b/src/views/dolphinfileitemlistwidget.cpp
@@ -21,7 +21,6 @@
#include <QIcon>
#include <KIconLoader>
-#include <kversioncontrolplugin2.h>
#include <QColor>
#include "dolphindebug.h"
@@ -43,7 +42,7 @@ void DolphinFileItemListWidget::refreshCache()
if (values.contains("version")) {
// The item is under version control. Apply the text color corresponding
// to its version state.
- const KVersionControlPlugin2::ItemVersion version = static_cast<KVersionControlPlugin2::ItemVersion>(values.value("version").toInt());
+ const KVersionControlPlugin::ItemVersion version = static_cast<KVersionControlPlugin::ItemVersion>(values.value("version").toInt());
const QColor textColor = styleOption().palette.text().color();
QColor tintColor = textColor;
@@ -51,16 +50,16 @@ void DolphinFileItemListWidget::refreshCache()
// as tint colors and are mixed with the current set text color. The tint colors
// have been optimized for the base colors of the corresponding Oxygen emblems.
switch (version) {
- case KVersionControlPlugin2::UpdateRequiredVersion: tintColor = Qt::yellow; break;
- case KVersionControlPlugin2::LocallyModifiedUnstagedVersion: tintColor = Qt::green; break;
- case KVersionControlPlugin2::LocallyModifiedVersion: tintColor = Qt::green; break;
- case KVersionControlPlugin2::AddedVersion: tintColor = Qt::green; break;
- case KVersionControlPlugin2::RemovedVersion: tintColor = Qt::darkRed; break;
- case KVersionControlPlugin2::ConflictingVersion: tintColor = Qt::red; break;
- case KVersionControlPlugin2::IgnoredVersion: tintColor = Qt::white; break;
- case KVersionControlPlugin2::MissingVersion: tintColor = Qt::red; break;
- case KVersionControlPlugin2::NormalVersion:
- case KVersionControlPlugin2::UnversionedVersion:
+ case KVersionControlPlugin::UpdateRequiredVersion: tintColor = Qt::yellow; break;
+ case KVersionControlPlugin::LocallyModifiedUnstagedVersion: tintColor = Qt::green; break;
+ case KVersionControlPlugin::LocallyModifiedVersion: tintColor = Qt::green; break;
+ case KVersionControlPlugin::AddedVersion: tintColor = Qt::green; break;
+ case KVersionControlPlugin::RemovedVersion: tintColor = Qt::darkRed; break;
+ case KVersionControlPlugin::ConflictingVersion: tintColor = Qt::red; break;
+ case KVersionControlPlugin::IgnoredVersion: tintColor = Qt::white; break;
+ case KVersionControlPlugin::MissingVersion: tintColor = Qt::red; break;
+ case KVersionControlPlugin::NormalVersion:
+ case KVersionControlPlugin::UnversionedVersion:
default:
break;
}
@@ -78,7 +77,7 @@ void DolphinFileItemListWidget::refreshCache()
setTextColor(color);
}
-QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemVersion version, int size)
+QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin::ItemVersion version, int size)
{
int overlayHeight = KIconLoader::SizeSmall;
if (size >= KIconLoader::SizeEnormous) {
@@ -115,8 +114,8 @@ QPixmap DolphinFileItemListWidget::overlayForState(KVersionControlPlugin2::ItemV
iconName = "vcs-conflicting";
break;
case KVersionControlPlugin::UnversionedVersion:
- case KVersionControlPlugin2::IgnoredVersion:
- case KVersionControlPlugin2::MissingVersion:
+ case KVersionControlPlugin::IgnoredVersion:
+ case KVersionControlPlugin::MissingVersion:
break;
default:
Q_ASSERT(false);
diff --git a/src/views/dolphinfileitemlistwidget.h b/src/views/dolphinfileitemlistwidget.h
index 5f9cc3a5a..af73ac937 100644
--- a/src/views/dolphinfileitemlistwidget.h
+++ b/src/views/dolphinfileitemlistwidget.h
@@ -20,10 +20,10 @@
#ifndef DOLPHINFILEITEMLISTWIDGET_H
#define DOLPHINFILEITEMLISTWIDGET_H
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
#include <kitemviews/kfileitemlistwidget.h>
-#include <kversioncontrolplugin2.h>
+#include "versioncontrol/kversioncontrolplugin.h"
/**
* @brief Extends KFileItemListWidget to handle the "version" role.
@@ -31,7 +31,7 @@
* The "version" role is set if version-control-plugins have been enabled.
* @see KVersionControlPlugin
*/
-class LIBDOLPHINPRIVATE_EXPORT DolphinFileItemListWidget : public KFileItemListWidget
+class DOLPHIN_EXPORT DolphinFileItemListWidget : public KFileItemListWidget
{
Q_OBJECT
@@ -43,7 +43,7 @@ protected:
virtual void refreshCache() Q_DECL_OVERRIDE;
private:
- static QPixmap overlayForState(KVersionControlPlugin2::ItemVersion version, int size);
+ static QPixmap overlayForState(KVersionControlPlugin::ItemVersion version, int size);
};
diff --git a/src/views/dolphinitemlistview.h b/src/views/dolphinitemlistview.h
index 2b16825f4..7eec6f17a 100644
--- a/src/views/dolphinitemlistview.h
+++ b/src/views/dolphinitemlistview.h
@@ -23,7 +23,7 @@
#include <kitemviews/kfileitemlistview.h>
#include <settings/viewmodes/viewmodesettings.h>
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
class KFileItemListView;
@@ -34,7 +34,7 @@ class KFileItemListView;
* the view-properties into the corresponding KItemListView
* properties.
*/
-class LIBDOLPHINPRIVATE_EXPORT DolphinItemListView : public KFileItemListView
+class DOLPHIN_EXPORT DolphinItemListView : public KFileItemListView
{
Q_OBJECT
diff --git a/src/views/dolphinnewfilemenuobserver.h b/src/views/dolphinnewfilemenuobserver.h
index b9b18e229..df4621f17 100644
--- a/src/views/dolphinnewfilemenuobserver.h
+++ b/src/views/dolphinnewfilemenuobserver.h
@@ -22,7 +22,7 @@
#include <QObject>
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
class DolphinNewFileMenu;
@@ -33,7 +33,7 @@ class DolphinNewFileMenu;
* As soon as a DolphinNewFileMenu instance created a new item,
* the observer will emit the signal itemCreated().
*/
-class LIBDOLPHINPRIVATE_EXPORT DolphinNewFileMenuObserver : public QObject
+class DOLPHIN_EXPORT DolphinNewFileMenuObserver : public QObject
{
Q_OBJECT
diff --git a/src/views/dolphinremoteencoding.h b/src/views/dolphinremoteencoding.h
index 0351abad7..28ff52cb3 100644
--- a/src/views/dolphinremoteencoding.h
+++ b/src/views/dolphinremoteencoding.h
@@ -23,7 +23,7 @@
#include <QStringList>
#include <QAction>
#include <QUrl>
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
class KActionMenu;
@@ -35,7 +35,7 @@ class DolphinViewActionHandler;
* When browsing remote url, its possible to change encoding from Tools Menu.
*/
-class LIBDOLPHINPRIVATE_EXPORT DolphinRemoteEncoding: public QObject
+class DOLPHIN_EXPORT DolphinRemoteEncoding: public QObject
{
Q_OBJECT
public:
diff --git a/src/views/dolphinview.h b/src/views/dolphinview.h
index aa4492bc3..24b560f10 100644
--- a/src/views/dolphinview.h
+++ b/src/views/dolphinview.h
@@ -23,7 +23,7 @@
#include <config-baloo.h>
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
#include <kparts/part.h>
#include <KFileItem>
@@ -57,7 +57,7 @@ class QRegExp;
* - show previews
* - enable grouping
*/
-class LIBDOLPHINPRIVATE_EXPORT DolphinView : public QWidget
+class DOLPHIN_EXPORT DolphinView : public QWidget
{
Q_OBJECT
diff --git a/src/views/dolphinviewactionhandler.h b/src/views/dolphinviewactionhandler.h
index bf664f731..eb375b5c9 100644
--- a/src/views/dolphinviewactionhandler.h
+++ b/src/views/dolphinviewactionhandler.h
@@ -22,7 +22,7 @@
#ifndef DOLPHINVIEWACTIONHANDLER_H
#define DOLPHINVIEWACTIONHANDLER_H
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
#include "views/dolphinview.h"
#include <QObject>
@@ -46,7 +46,7 @@ class KActionCollection;
* @see DolphinMainWindow
* @see DolphinPart
*/
-class LIBDOLPHINPRIVATE_EXPORT DolphinViewActionHandler : public QObject
+class DOLPHIN_EXPORT DolphinViewActionHandler : public QObject
{
Q_OBJECT
diff --git a/src/views/draganddrophelper.h b/src/views/draganddrophelper.h
index 0fbe3a128..fe77b1e6e 100644
--- a/src/views/draganddrophelper.h
+++ b/src/views/draganddrophelper.h
@@ -21,7 +21,7 @@
#ifndef DRAGANDDROPHELPER_H
#define DRAGANDDROPHELPER_H
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
class QUrl;
@@ -29,7 +29,7 @@ class QDropEvent;
class QWidget;
namespace KIO { class DropJob; }
-class LIBDOLPHINPRIVATE_EXPORT DragAndDropHelper
+class DOLPHIN_EXPORT DragAndDropHelper
{
public:
/**
diff --git a/src/views/renamedialog.h b/src/views/renamedialog.h
index 7c02d1b87..a1953e8b3 100644
--- a/src/views/renamedialog.h
+++ b/src/views/renamedialog.h
@@ -20,7 +20,7 @@
#ifndef RENAMEDIALOG_H
#define RENAMEDIALOG_H
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
#include <QDialog>
#include <KFileItem>
@@ -33,7 +33,7 @@ class QPushButton;
/**
* @brief Dialog for renaming a variable number of files.
*/
-class LIBDOLPHINPRIVATE_EXPORT RenameDialog : public QDialog
+class DOLPHIN_EXPORT RenameDialog : public QDialog
{
Q_OBJECT
diff --git a/src/views/versioncontrol/kversioncontrolplugin.cpp b/src/views/versioncontrol/kversioncontrolplugin.cpp
new file mode 100644
index 000000000..2c0632878
--- /dev/null
+++ b/src/views/versioncontrol/kversioncontrolplugin.cpp
@@ -0,0 +1,29 @@
+/*****************************************************************************
+ * Copyright (C) 2011 by Vishesh Yadav <[email protected]> *
+ * Copyright (C) 2011 by Peter Penz <[email protected]> *
+ * *
+ * 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. *
+ *****************************************************************************/
+
+#include "kversioncontrolplugin.h"
+
+KVersionControlPlugin::KVersionControlPlugin(QObject* parent) :
+ QObject(parent)
+{
+}
+
+KVersionControlPlugin::~KVersionControlPlugin()
+{
+}
diff --git a/src/views/versioncontrol/kversioncontrolplugin.h b/src/views/versioncontrol/kversioncontrolplugin.h
new file mode 100644
index 000000000..e5a267848
--- /dev/null
+++ b/src/views/versioncontrol/kversioncontrolplugin.h
@@ -0,0 +1,223 @@
+/*****************************************************************************
+ * Copyright (C) 2011 by Vishesh Yadav <[email protected]> *
+ * Copyright (C) 2011 by Peter Penz <[email protected]> *
+ * *
+ * 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. *
+ *****************************************************************************/
+
+#ifndef KVERSIONCONTROLPLUGIN_H
+#define KVERSIONCONTROLPLUGIN_H
+
+#include <dolphin_export.h>
+
+#include <QObject>
+#include <KFileItem>
+#include <QAction>
+
+/**
+ * @brief Base class for version control plugins.
+ *
+ * Enables the file manager to show the version state
+ * of a versioned file. To write a custom plugin, the following
+ * 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:
+ * <code>
+ * [Desktop Entry]
+ * Type=Service
+ * Name=Subversion
+ * X-KDE-ServiceTypes=FileViewVersionControlPlugin
+ * MimeType=text/plain;
+ * X-KDE-Library=fileviewsvnplugin
+ * </code>
+ *
+ * - Create a class FileViewSvnPlugin derived from KVersionControlPlugin and
+ * implement all abstract interfaces (fileviewsvnplugin.h, fileviewsvnplugin.cpp).
+ *
+ * - Take care that the constructor has the following signature:
+ * <code>
+ * FileViewSvnPlugin(QObject* parent, const QList<QVariant>& args);
+ * </code>
+ *
+ * - Add the following lines at the top of fileviewsvnplugin.cpp:
+ * <code>
+ * #include <KPluginFactory>
+ * #include <KPluginLoader>
+ * K_PLUGIN_FACTORY(FileViewSvnPluginFactory, registerPlugin<FileViewSvnPlugin>();)
+ * K_EXPORT_PLUGIN(FileViewSvnPluginFactory("fileviewsvnplugin"))
+ * </code>
+ *
+ * - Add the following lines to your CMakeLists.txt file:
+ * <code>
+ * kde4_add_plugin(fileviewsvnplugin fileviewsvnplugin.cpp)
+ * target_link_libraries(fileviewsvnplugin konq)
+ * install(FILES fileviewsvnplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+ * </code>
+ *
+ * General implementation notes:
+ *
+ * - The implementations of beginRetrieval(), endRetrieval() and versionState()
+ * can contain blocking operations, as Dolphin will execute
+ * those methods in a separate thread. It is assured that
+ * all other methods are invoked in a serialized way, so that it is not necessary for
+ * the plugin to use any mutex.
+ *
+ * - Dolphin keeps only one instance of the plugin, which is instantiated shortly after
+ * starting Dolphin. Take care that the constructor does no expensive and time
+ * consuming operations.
+ *
+ * @since 4.8
+ */
+class DOLPHIN_EXPORT KVersionControlPlugin : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum ItemVersion
+ {
+ /** The file is not under version control. */
+ UnversionedVersion,
+ /**
+ * The file is under version control and represents
+ * the latest version.
+ */
+ NormalVersion,
+ /**
+ * The file is under version control and a newer
+ * version exists on the main branch.
+ */
+ UpdateRequiredVersion,
+ /**
+ * The file is under version control and has been
+ * modified locally. All modifications will be part
+ * of the next commit.
+ */
+ LocallyModifiedVersion,
+ /**
+ * The file has not been under version control but
+ * has been marked to get added with the next commit.
+ */
+ AddedVersion,
+ /**
+ * The file is under version control but has been marked
+ * for getting removed with the next commit.
+ */
+ RemovedVersion,
+ /**
+ * The file is under version control and has been locally
+ * modified. A modification has also been done on the main
+ * branch.
+ */
+ ConflictingVersion,
+ /**
+ * The file is under version control and has local
+ * modifications, which will not be part of the next
+ * commit (or are "unstaged" in git jargon).
+ * @since 4.6
+ */
+ LocallyModifiedUnstagedVersion,
+ /**
+ * The file is not under version control and is listed
+ * in the ignore list of the version control system.
+ * @since 4.8
+ */
+ IgnoredVersion,
+ /**
+ * The file is 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
+ */
+ MissingVersion
+ };
+
+ KVersionControlPlugin(QObject* parent = 0);
+ virtual ~KVersionControlPlugin();
+
+ /**
+ * Returns the name of the file which stores
+ * the version controls information.
+ * (e. g. .svn, .cvs, .git).
+ */
+ virtual QString fileName() const = 0;
+
+ /**
+ * 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;
+
+ /**
+ * Is invoked after the version control information has been
+ * received. It is assured that
+ * KVersionControlPluginV2::beginInfoRetrieval() has been
+ * invoked before.
+ */
+ virtual void endRetrieval() = 0;
+
+ /**
+ * @return The version for the item \p item.
+ * It is assured that KVersionControlPlugin::beginInfoRetrieval() has been
+ * invoked before and that the file is part of the directory specified
+ * in beginInfoRetrieval().
+ */
+ 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.
+ */
+ virtual QList<QAction*> actions(const KFileItemList& items) const = 0;
+
+Q_SIGNALS:
+ /**
+ * Should be emitted when the version state of items might have been changed
+ * after the last retrieval (e. g. by executing a context menu action
+ * of the version control plugin). The file manager will be triggered to
+ * update the version states of the directory \p directory by invoking
+ * KVersionControlPlugin::beginRetrieval(),
+ * KVersionControlPlugin::itemVersion() and
+ * KVersionControlPlugin::endRetrieval().
+ */
+ void itemVersionsChanged();
+
+ /**
+ * Is emitted if an information message with the content \a msg
+ * should be shown.
+ */
+ void infoMessage(const QString& msg);
+
+ /**
+ * Is emitted if an error message with the content \a msg
+ * should be shown.
+ */
+ 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);
+};
+
+#endif // KVERSIONCONTROLPLUGIN_H
+
diff --git a/src/views/versioncontrol/updateitemstatesthread.cpp b/src/views/versioncontrol/updateitemstatesthread.cpp
index 4f0122e0f..e4413fabf 100644
--- a/src/views/versioncontrol/updateitemstatesthread.cpp
+++ b/src/views/versioncontrol/updateitemstatesthread.cpp
@@ -19,9 +19,7 @@
#include "updateitemstatesthread.h"
-#include <kversioncontrolplugin2.h>
#include <QVector>
-
#include <QMutexLocker>
UpdateItemStatesThread::UpdateItemStatesThread(KVersionControlPlugin* plugin,
@@ -53,20 +51,10 @@ void UpdateItemStatesThread::run()
if (m_plugin->beginRetrieval(it.key())) {
QVector<VersionControlObserver::ItemState>& items = it.value();
const int count = items.count();
-
- KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
- if (pluginV2) {
- for (int i = 0; i < count; ++i) {
- const KFileItem& item = items.at(i).first;
- const KVersionControlPlugin2::ItemVersion version = pluginV2->itemVersion(item);
- items[i].second = version;
- }
- } else {
- for (int i = 0; i < count; ++i) {
- const KFileItem& item = items.at(i).first;
- const KVersionControlPlugin::VersionState state = m_plugin->versionState(item);
- items[i].second = static_cast<KVersionControlPlugin2::ItemVersion>(state);
- }
+ for (int i = 0; i < count; ++i) {
+ const KFileItem& item = items.at(i).first;
+ const KVersionControlPlugin::ItemVersion version = m_plugin->itemVersion(item);
+ items[i].second = version;
}
}
diff --git a/src/views/versioncontrol/updateitemstatesthread.h b/src/views/versioncontrol/updateitemstatesthread.h
index 92a9d59c9..3dc03fc75 100644
--- a/src/views/versioncontrol/updateitemstatesthread.h
+++ b/src/views/versioncontrol/updateitemstatesthread.h
@@ -20,20 +20,18 @@
#ifndef UPDATEITEMSTATESTHREAD_H
#define UPDATEITEMSTATESTHREAD_H
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
#include <views/versioncontrol/versioncontrolobserver.h>
#include <QMutex>
#include <QThread>
-class KVersionControlPlugin;
-
/**
* The performance of updating the version state of items depends
* on the used plugin. To prevent that Dolphin gets blocked by a
* slow plugin, the updating is delegated to a thread.
*/
-class LIBDOLPHINPRIVATE_EXPORT UpdateItemStatesThread : public QThread
+class DOLPHIN_EXPORT UpdateItemStatesThread : public QThread
{
Q_OBJECT
diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp
index 47e3da357..13481cc7a 100644
--- a/src/views/versioncontrol/versioncontrolobserver.cpp
+++ b/src/views/versioncontrol/versioncontrolobserver.cpp
@@ -26,7 +26,6 @@
#include "dolphindebug.h"
#include <KServiceTypeTrader>
#include <kitemviews/kfileitemmodel.h>
-#include <kversioncontrolplugin2.h>
#include "updateitemstatesthread.h"
@@ -89,8 +88,6 @@ KFileItemModel* VersionControlObserver::model() const
QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) const
{
- QList<QAction*> actions;
-
bool hasNullItems = false;
foreach (const KFileItem& item, items) {
if (item.isNull()) {
@@ -101,30 +98,10 @@ QList<QAction*> VersionControlObserver::actions(const KFileItemList& items) cons
}
if (!m_model || hasNullItems) {
- return actions;
- }
-
- KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
- if (pluginV2) {
- // Use version 2 of the KVersionControlPlugin which allows providing actions
- // also for non-versioned directories.
- actions = pluginV2->actions(items);
- } else if (isVersioned()) {
- // Support deprecated interfaces from KVersionControlPlugin version 1.
- // Context menu actions where only available for versioned directories.
- QString directory;
- if (items.count() == 1) {
- const KFileItem rootItem = m_model->rootItem();
- if (!rootItem.isNull() && items.first().url() == rootItem.url()) {
- directory = rootItem.url().path();
- }
- }
-
- actions = directory.isEmpty() ? m_plugin->contextMenuActions(items)
- : m_plugin->contextMenuActions(directory);
+ return {};
}
- return actions;
+ return m_plugin->actions(items);
}
void VersionControlObserver::delayedDirectoryVerification()
@@ -156,14 +133,8 @@ void VersionControlObserver::verifyDirectory()
m_plugin = searchPlugin(rootItem.url());
if (m_plugin) {
- KVersionControlPlugin2* pluginV2 = qobject_cast<KVersionControlPlugin2*>(m_plugin);
- if (pluginV2) {
- connect(pluginV2, &KVersionControlPlugin2::itemVersionsChanged,
- this, &VersionControlObserver::silentDirectoryVerification);
- } else {
- connect(m_plugin, &KVersionControlPlugin::versionStatesChanged,
- this, &VersionControlObserver::silentDirectoryVerification);
- }
+ connect(m_plugin, &KVersionControlPlugin::itemVersionsChanged,
+ this, &VersionControlObserver::silentDirectoryVerification);
connect(m_plugin, &KVersionControlPlugin::infoMessage,
this, &VersionControlObserver::infoMessage);
connect(m_plugin, &KVersionControlPlugin::errorMessage,
@@ -205,7 +176,7 @@ void VersionControlObserver::slotThreadFinished()
foreach (const ItemState& item, items) {
const KFileItem& fileItem = item.first;
- const KVersionControlPlugin2::ItemVersion version = item.second;
+ const KVersionControlPlugin::ItemVersion version = item.second;
QHash<QByteArray, QVariant> values;
values.insert("version", QVariant(version));
m_model->setData(m_model->index(fileItem), values);
@@ -268,7 +239,7 @@ int VersionControlObserver::createItemStatesList(QMap<QString, QVector<ItemState
if (expansionLevel == currentExpansionLevel) {
ItemState itemState;
itemState.first = m_model->fileItem(index);
- itemState.second = KVersionControlPlugin2::UnversionedVersion;
+ itemState.second = KVersionControlPlugin::UnversionedVersion;
items.append(itemState);
} else if (expansionLevel > currentExpansionLevel) {
diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h
index a43dc3415..c817c2187 100644
--- a/src/views/versioncontrol/versioncontrolobserver.h
+++ b/src/views/versioncontrol/versioncontrolobserver.h
@@ -20,11 +20,13 @@
#ifndef VERSIONCONTROLOBSERVER_H
#define VERSIONCONTROLOBSERVER_H
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
+
+#include "kversioncontrolplugin.h"
#include <KFileItem>
+
#include <QUrl>
-#include <kversioncontrolplugin2.h>
#include <QList>
#include <QObject>
#include <QString>
@@ -43,7 +45,7 @@ class UpdateItemStatesThread;
*
* @see VersionControlPlugin
*/
-class LIBDOLPHINPRIVATE_EXPORT VersionControlObserver : public QObject
+class DOLPHIN_EXPORT VersionControlObserver : public QObject
{
Q_OBJECT
@@ -100,7 +102,7 @@ private slots:
void slotThreadFinished();
private:
- typedef QPair<KFileItem, KVersionControlPlugin2::ItemVersion> ItemState;
+ typedef QPair<KFileItem, KVersionControlPlugin::ItemVersion> ItemState;
void updateItemStates();
diff --git a/src/views/viewmodecontroller.h b/src/views/viewmodecontroller.h
index 89f1020b5..4b1ff2083 100644
--- a/src/views/viewmodecontroller.h
+++ b/src/views/viewmodecontroller.h
@@ -22,7 +22,7 @@
#include <QUrl>
#include <QObject>
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
#include <views/dolphinview.h>
/**
@@ -33,7 +33,7 @@
* connect to signals of the ViewModeController to react on changes. The view
* implementations get only read-access to the ViewModeController.
*/
-class LIBDOLPHINPRIVATE_EXPORT ViewModeController : public QObject
+class DOLPHIN_EXPORT ViewModeController : public QObject
{
Q_OBJECT
diff --git a/src/views/viewproperties.h b/src/views/viewproperties.h
index b9c2fa546..dc118e2d7 100644
--- a/src/views/viewproperties.h
+++ b/src/views/viewproperties.h
@@ -23,7 +23,7 @@
#include <views/dolphinview.h>
#include <QUrl>
-#include "libdolphin_export.h"
+#include "dolphin_export.h"
class ViewPropertySettings;
/**
@@ -47,7 +47,7 @@ class ViewPropertySettings;
* (see GeneralSettings::globalViewMode()), the values from the global .directory file
* are used for initialization.
*/
-class LIBDOLPHINPRIVATE_EXPORT ViewProperties
+class DOLPHIN_EXPORT ViewProperties
{
public:
explicit ViewProperties(const QUrl& url);