diff options
| author | Peter Penz <[email protected]> | 2009-07-12 14:00:45 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2009-07-12 14:00:45 +0000 |
| commit | fa4680cb38028aceb68d41e1937d27c71d1f121b (patch) | |
| tree | da709625c38a42bf448077d985c75b0365a58252 /src/revisioncontrolplugin.h | |
| parent | 2df2d4ea7ee63a43a327b4ffb1c5cddd176aff91 (diff) | |
Enable Dolphin to show the revision states of files that are under revision control systems like SVN, Git, CVS, ... The current code is an early draft and it is planned that all plugins (SVN, Git, CVS, ...) are maintained outside Dolphin. If the API is stable enough, a discussion will be done at [email protected] regarding the location of the plugins (the current implementation of SubversionPlugin is only temporary located in Dolphin for testing purposes).
RevisionControlObserver is implemented in a way that no recognizable slowdown is given for directories that are not under revision control.
CCBUG: 192158
svn path=/trunk/KDE/kdebase/apps/; revision=995351
Diffstat (limited to 'src/revisioncontrolplugin.h')
| -rw-r--r-- | src/revisioncontrolplugin.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/revisioncontrolplugin.h b/src/revisioncontrolplugin.h new file mode 100644 index 000000000..95850711d --- /dev/null +++ b/src/revisioncontrolplugin.h @@ -0,0 +1,103 @@ +/*************************************************************************** + * 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 REVISIONCONTROLPLUGIN_H +#define REVISIONCONTROLPLUGIN_H + +#include <libdolphin_export.h> + +#include <QString> + +/** + * @brief Base class for revision control plugins. + * + * Enables the file manager to show the revision state + * of a revisioned file. + */ +class LIBDOLPHINPRIVATE_EXPORT RevisionControlPlugin +{ +public: + enum RevisionState + { + LocalRevision, + LatestRevision + // TODO... + }; + + RevisionControlPlugin(); + virtual ~RevisionControlPlugin(); + + /** + * Returns the name of the file which stores + * the revision control informations. + * (e. g. .svn, .cvs, .git). + */ + virtual QString fileName() const = 0; + + /** + * Is invoked whenever the revision 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 revision control information has been + * received. It is assured that + * RevisionControlPlugin::beginInfoRetrieval() has been + * invoked before. + */ + virtual void endRetrieval() = 0; + + /** + * Returns the revision state for the file with the name \p fileName. + * It is assured that RevisionControlPlugin::beginInfoRetrieval() has been + * invoked before and that the file is part of the directory specified + * in beginInfoRetrieval(). + */ + virtual RevisionState revisionState(const QString& fileName) = 0; + +}; + + + + +// TODO: This is just a temporary test class. It will be made available as +// plugin outside Dolphin later. + +#include <QFileInfoList> +#include <QHash> + +class LIBDOLPHINPRIVATE_EXPORT SubversionPlugin : public RevisionControlPlugin +{ +public: + SubversionPlugin(); + virtual ~SubversionPlugin(); + virtual QString fileName() const; + virtual bool beginRetrieval(const QString& directory); + virtual void endRetrieval(); + virtual RevisionControlPlugin::RevisionState revisionState(const QString& fileName); + +private: + QString m_directory; + QHash<QString, QFileInfo> m_fileInfoHash; +}; +#endif // REVISIONCONTROLPLUGIN_H + |
