X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/050992c5641e2de3d98df78ecfe91e9a5504c4cf..c8d8556950005dfd96ebdb41d2f43ad90356367c:/src/views/versioncontrol/versioncontrolobserver.h diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h index eb1e74580..501af7d6f 100644 --- a/src/views/versioncontrol/versioncontrolobserver.h +++ b/src/views/versioncontrol/versioncontrolobserver.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 by Peter Penz * + * Copyright (C) 2009 by Peter Penz * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -22,18 +22,15 @@ #include -#include -#include +#include +#include #include #include #include -#include #include -class DolphinModel; -class KDirLister; class KFileItemList; -class QAbstractItemView; +class KFileItemModel; class QAction; class QTimer; class UpdateItemStatesThread; @@ -41,8 +38,8 @@ class UpdateItemStatesThread; /** * @brief Observes all version control plugins. * - * The item view gets updated automatically if the currently shown - * directory is under version control. + * The items of the directory-model get updated automatically if the currently + * shown directory is under version control. * * @see VersionControlPlugin */ @@ -51,12 +48,14 @@ class LIBDOLPHINPRIVATE_EXPORT VersionControlObserver : public QObject Q_OBJECT public: - VersionControlObserver(QAbstractItemView* view); + explicit VersionControlObserver(QObject* parent = 0); virtual ~VersionControlObserver(); - QList contextMenuActions(const KFileItemList& items) const; - QList contextMenuActions(const QString& directory) const; - + void setModel(KFileItemModel* model); + KFileItemModel* model() const; + + QList actions(const KFileItemList& items) const; + signals: /** * Is emitted if an information message with the content \a msg @@ -75,7 +74,7 @@ signals: * should be shown. */ void operationCompletedMessage(const QString& msg); - + private slots: /** * Invokes verifyDirectory() with a small delay. If delayedDirectoryVerification() @@ -90,7 +89,7 @@ private slots: * delayedDirectoryVerification() it and assures that the verification of * the directory is done silently without information messages. */ - void silentDirectoryVerification(); + void silentDirectoryVerification(); void verifyDirectory(); @@ -99,23 +98,17 @@ private slots: * and applys the item states. */ void slotThreadFinished(); - + private: struct ItemState { - QPersistentModelIndex index; + int index; KFileItem item; - KVersionControlPlugin::VersionState version; + KVersionControlPlugin2::ItemVersion version; }; void updateItemStates(); - /** - * Adds recursively all items from the directory \p parentIndex into - * the list \p itemStates. - */ - void addDirectory(const QModelIndex& parentIndex, QList& itemStates); - /** * Returns a matching plugin for the given directory. * 0 is returned, if no matching plugin has been found. @@ -132,11 +125,9 @@ private: bool m_versionedDirectory; bool m_silentUpdate; // if true, no messages will be send during the update // of version states - - QAbstractItemView* m_view; - KDirLister* m_dirLister; - DolphinModel* m_dolphinModel; - + + KFileItemModel* m_model; + QTimer* m_dirVerificationTimer; KVersionControlPlugin* m_plugin;