1 /***************************************************************************
2 * Copyright (C) 2009 by Peter Penz <peter.penz@gmx.at> *
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. *
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. *
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 ***************************************************************************/
20 #ifndef FILEVIEWSVNPLUGIN_H
21 #define FILEVIEWSVNPLUGIN_H
23 #include <kfileitem.h>
24 #include <kversioncontrolplugin.h>
26 #include <QTemporaryFile>
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
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
);
47 void showLocalChanges();
52 void slotOperationCompleted();
53 void slotOperationError();
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
62 * @param operationCompletedMsg
63 * Message that should be shown if the execution of the command
64 * has been completed successfully.
66 void execSvnCommand(const QString
& svnCommand
,
67 const QString
& infoMsg
,
68 const QString
& errorMsg
,
69 const QString
& operationCompletedMsg
);
71 void startSvnCommandProcess();
74 QHash
<QString
, VersionState
> m_versionInfoHash
;
75 QList
<QString
> m_versionInfoKeys
; // cache for accessing the keys of the hash
77 QAction
* m_updateAction
;
78 QAction
* m_showLocalChangesAction
;
79 QAction
* m_commitAction
;
81 QAction
* m_removeAction
;
85 QString m_operationCompletedMsg
;
88 KFileItemList m_contextItems
;
90 QTemporaryFile m_tempFile
;
92 #endif // FILEVIEWSVNPLUGIN_H