]> cloud.milkyroute.net Git - dolphin.git/blob - src/revisioncontrolplugin.h
When pressing a key after entering a directory, QAbstractItemView::scrollTo() must...
[dolphin.git] / src / revisioncontrolplugin.h
1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 ***************************************************************************/
19
20 #ifndef REVISIONCONTROLPLUGIN_H
21 #define REVISIONCONTROLPLUGIN_H
22
23 #include <libdolphin_export.h>
24
25 #include <QDateTime>
26 #include <QString>
27
28 class KFileItem;
29
30 /**
31 * @brief Base class for revision control plugins.
32 *
33 * Enables the file manager to show the revision state
34 * of a revisioned file.
35 */
36 class LIBDOLPHINPRIVATE_EXPORT RevisionControlPlugin
37 {
38 public:
39 enum RevisionState
40 {
41 LocalRevision,
42 LatestRevision,
43 ConflictingRevision
44 // TODO...
45 };
46
47 RevisionControlPlugin();
48 virtual ~RevisionControlPlugin();
49
50 /**
51 * Returns the name of the file which stores
52 * the revision control informations.
53 * (e. g. .svn, .cvs, .git).
54 */
55 virtual QString fileName() const = 0;
56
57 /**
58 * Is invoked whenever the revision control
59 * information will get retrieved for the directory
60 * \p directory. It is assured that the directory
61 * contains a trailing slash.
62 */
63 virtual bool beginRetrieval(const QString& directory) = 0;
64
65 /**
66 * Is invoked after the revision control information has been
67 * received. It is assured that
68 * RevisionControlPlugin::beginInfoRetrieval() has been
69 * invoked before.
70 */
71 virtual void endRetrieval() = 0;
72
73 /**
74 * Returns the revision state for the file \p item.
75 * It is assured that RevisionControlPlugin::beginInfoRetrieval() has been
76 * invoked before and that the file is part of the directory specified
77 * in beginInfoRetrieval().
78 */
79 virtual RevisionState revisionState(const KFileItem& item) = 0;
80
81 };
82
83
84
85
86 // TODO: This is just a temporary test class. It will be made available as
87 // plugin outside Dolphin later.
88
89 #include <QFileInfoList>
90 #include <QHash>
91
92 class LIBDOLPHINPRIVATE_EXPORT SubversionPlugin : public RevisionControlPlugin
93 {
94 public:
95 SubversionPlugin();
96 virtual ~SubversionPlugin();
97 virtual QString fileName() const;
98 virtual bool beginRetrieval(const QString& directory);
99 virtual void endRetrieval();
100 virtual RevisionControlPlugin::RevisionState revisionState(const KFileItem& item);
101
102 private:
103 struct RevisionInfo
104 {
105 // TODO...
106 QDateTime timeStamp;
107 };
108
109 QString m_directory;
110 QHash<QString, RevisionInfo> m_revisionInfoHash;
111 };
112 #endif // REVISIONCONTROLPLUGIN_H
113