┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/versioncontrol/updateitemstatesthread.h
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2009-11-06 15:43:08 +0000
committerPeter Penz <[email protected]>2009-11-06 15:43:08 +0000
commit896ee459af10c73d20d0ae093b4c02348ffedb18 (patch)
treea84fda9222985379f6e764de495536c62702b14e /src/versioncontrol/updateitemstatesthread.h
parent5114ab58bcf9ccc7fed7cfdd057bffeb87a2ad94 (diff)
* enable the loading of version control plugins (thanks to Aaron for the hint)
* Don't terminate the thread that receives the item states when changing a view. Instead let the thread get finished and ignore the result. svn path=/trunk/KDE/kdebase/apps/; revision=1045674
Diffstat (limited to 'src/versioncontrol/updateitemstatesthread.h')
-rw-r--r--src/versioncontrol/updateitemstatesthread.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/versioncontrol/updateitemstatesthread.h b/src/versioncontrol/updateitemstatesthread.h
new file mode 100644
index 000000000..36768d0e9
--- /dev/null
+++ b/src/versioncontrol/updateitemstatesthread.h
@@ -0,0 +1,68 @@
+/***************************************************************************
+ * Copyright (C) 2009 by Peter Penz <[email protected]> *
+ * *
+ * 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 *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program 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 General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef UPDATEITEMSTATESTHREAD_H
+#define UPDATEITEMSTATESTHREAD_H
+
+#include <libdolphin_export.h>
+#include <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
+{
+ Q_OBJECT
+
+public:
+ UpdateItemStatesThread(QObject* parent);
+ virtual ~UpdateItemStatesThread();
+
+ void setData(KVersionControlPlugin* plugin,
+ const QList<VersionControlObserver::ItemState>& itemStates);
+
+ bool beginReadItemStates();
+ void endReadItemStates();
+ QList<VersionControlObserver::ItemState> itemStates() const;
+
+ bool retrievedItems() const;
+
+ void deleteWhenFinished();
+
+protected:
+ virtual void run();
+
+private slots:
+ void slotFinished();
+
+private:
+ bool m_retrievedItems;
+ KVersionControlPlugin* m_plugin;
+ QMutex m_mutex;
+ QList<VersionControlObserver::ItemState> m_itemStates;
+};
+
+#endif // UPDATEITEMSTATESTHREAD_H