]> cloud.milkyroute.net Git - dolphin.git/blob - src/revisioncontrolplugin.h
Enable Dolphin to show the revision states of files that are under revision control...
[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 <QString>
26
27 /**
28 * @brief Base class for revision control plugins.
29 *
30 * Enables the file manager to show the revision state
31 * of a revisioned file.
32 */
33 class LIBDOLPHINPRIVATE_EXPORT RevisionControlPlugin
34 {
35 public:
36 enum RevisionState
37 {
38 LocalRevision,
39 LatestRevision
40 // TODO...
41 };
42
43 RevisionControlPlugin();
44 virtual ~RevisionControlPlugin();
45
46 /**
47 * Returns the name of the file which stores
48 * the revision control informations.
49 * (e. g. .svn, .cvs, .git).
50 */
51 virtual QString fileName() const = 0;
52
53 /**
54 * Is invoked whenever the revision control
55 * information will get retrieved for the directory
56 * \p directory. It is assured that the directory
57 * contains a trailing slash.
58 */
59 virtual bool beginRetrieval(const QString& directory) = 0;
60
61 /**
62 * Is invoked after the revision control information has been
63 * received. It is assured that
64 * RevisionControlPlugin::beginInfoRetrieval() has been
65 * invoked before.
66 */
67 virtual void endRetrieval() = 0;
68
69 /**
70 * Returns the revision state for the file with the name \p fileName.
71 * It is assured that RevisionControlPlugin::beginInfoRetrieval() has been
72 * invoked before and that the file is part of the directory specified
73 * in beginInfoRetrieval().
74 */
75 virtual RevisionState revisionState(const QString& fileName) = 0;
76
77 };
78
79
80
81
82 // TODO: This is just a temporary test class. It will be made available as
83 // plugin outside Dolphin later.
84
85 #include <QFileInfoList>
86 #include <QHash>
87
88 class LIBDOLPHINPRIVATE_EXPORT SubversionPlugin : public RevisionControlPlugin
89 {
90 public:
91 SubversionPlugin();
92 virtual ~SubversionPlugin();
93 virtual QString fileName() const;
94 virtual bool beginRetrieval(const QString& directory);
95 virtual void endRetrieval();
96 virtual RevisionControlPlugin::RevisionState revisionState(const QString& fileName);
97
98 private:
99 QString m_directory;
100 QHash<QString, QFileInfo> m_fileInfoHash;
101 };
102 #endif // REVISIONCONTROLPLUGIN_H
103