]> cloud.milkyroute.net Git - dolphin.git/blob - src/fileviewsvnplugin.h
Initial ServiceMenu-KHotNewStuff-stuff
[dolphin.git] / src / fileviewsvnplugin.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 FILEVIEWSVNPLUGIN_H
21 #define FILEVIEWSVNPLUGIN_H
22
23 #include <kfileitem.h>
24 #include <kversioncontrolplugin.h>
25 #include <QHash>
26 #include <QTemporaryFile>
27
28 // TODO: This class will be moved to kdevplatform as soon as kdevplatform will
29 // be released. Moving it to kdevplatform allows to reuse code for the context
30 // menu actions like commit, add, update, ...
31 class FileViewSvnPlugin : public KVersionControlPlugin
32 {
33 Q_OBJECT
34
35 public:
36 FileViewSvnPlugin();
37 virtual ~FileViewSvnPlugin();
38 virtual QString fileName() const;
39 virtual bool beginRetrieval(const QString& directory);
40 virtual void endRetrieval();
41 virtual KVersionControlPlugin::VersionState versionState(const KFileItem& item);
42 virtual QList<QAction*> contextMenuActions(const KFileItemList& items);
43 virtual QList<QAction*> contextMenuActions(const QString& directory);
44
45 private slots:
46 void updateFiles();
47 void showLocalChanges();
48 void commitFiles();
49 void addFiles();
50 void removeFiles();
51
52 void slotOperationCompleted();
53 void slotOperationError();
54
55 private:
56 /**
57 * Executes the command "svn {svnCommand}" for the files that have been
58 * set by getting the context menu actions (see contextMenuActions()).
59 * @param infoMsg Message that should be shown before the command is executed.
60 * @param errorMsg Message that should be shown if the execution of the command
61 * has been failed.
62 * @param operationCompletedMsg
63 * Message that should be shown if the execution of the command
64 * has been completed successfully.
65 */
66 void execSvnCommand(const QString& svnCommand,
67 const QString& infoMsg,
68 const QString& errorMsg,
69 const QString& operationCompletedMsg);
70
71 void startSvnCommandProcess();
72
73 private:
74 QHash<QString, VersionState> m_versionInfoHash;
75 QList<QString> m_versionInfoKeys; // cache for accessing the keys of the hash
76
77 QAction* m_updateAction;
78 QAction* m_showLocalChangesAction;
79 QAction* m_commitAction;
80 QAction* m_addAction;
81 QAction* m_removeAction;
82
83 QString m_command;
84 QString m_errorMsg;
85 QString m_operationCompletedMsg;
86
87 QString m_contextDir;
88 KFileItemList m_contextItems;
89
90 QTemporaryFile m_tempFile;
91 };
92 #endif // FILEVIEWSVNPLUGIN_H
93