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>
27 #include <QTemporaryFile>
29 // TODO: This class will be moved to kdevplatform as soon as kdevplatform will
30 // be released. Moving it to kdevplatform allows to reuse code for the context
31 // menu actions like commit, add, update, ...
32 class FileViewSvnPlugin
: public KVersionControlPlugin
37 FileViewSvnPlugin(QObject
* parent
, const QList
<QVariant
>& args
);
38 virtual ~FileViewSvnPlugin();
39 virtual QString
fileName() const;
40 virtual bool beginRetrieval(const QString
& directory
);
41 virtual void endRetrieval();
42 virtual KVersionControlPlugin::VersionState
versionState(const KFileItem
& item
);
43 virtual QList
<QAction
*> contextMenuActions(const KFileItemList
& items
);
44 virtual QList
<QAction
*> contextMenuActions(const QString
& directory
);
48 void showLocalChanges();
53 void slotOperationCompleted(int exitCode
, QProcess::ExitStatus exitStatus
);
54 void slotOperationError();
58 * Executes the command "svn {svnCommand}" for the files that have been
59 * set by getting the context menu actions (see contextMenuActions()).
60 * @param infoMsg Message that should be shown before the command is executed.
61 * @param errorMsg Message that should be shown if the execution of the command
63 * @param operationCompletedMsg
64 * Message that should be shown if the execution of the command
65 * has been completed successfully.
67 void execSvnCommand(const QString
& svnCommand
,
68 const QString
& infoMsg
,
69 const QString
& errorMsg
,
70 const QString
& operationCompletedMsg
);
72 void startSvnCommandProcess();
75 QHash
<QString
, VersionState
> m_versionInfoHash
;
76 QList
<QString
> m_versionInfoKeys
; // cache for accessing the keys of the hash
78 QAction
* m_updateAction
;
79 QAction
* m_showLocalChangesAction
;
80 QAction
* m_commitAction
;
82 QAction
* m_removeAction
;
86 QString m_operationCompletedMsg
;
89 KFileItemList m_contextItems
;
91 QTemporaryFile m_tempFile
;
93 #endif // FILEVIEWSVNPLUGIN_H