┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Penz <[email protected]>2010-04-02 16:00:14 +0000
committerPeter Penz <[email protected]>2010-04-02 16:00:14 +0000
commit2dc23d4e6dc8a3b5d9e4f816fe9ddab13f957cc6 (patch)
tree5626d6833cff5a854f7df4ee2a45933bb090659f
parent47d31139224f9bfded4626803626a58afe3eb748 (diff)
Remove the SVN plugin from the Dolphin sources. The plugin will get part of kdesdk (request will be submitted on reviewboard during the next days).
svn path=/trunk/KDE/kdebase/apps/; revision=1110250
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/versioncontrol/fileviewsvnplugin.cpp386
-rw-r--r--src/versioncontrol/fileviewsvnplugin.desktop67
-rw-r--r--src/versioncontrol/fileviewsvnplugin.h94
4 files changed, 0 insertions, 555 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3ab04f5c3..25261bce3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -81,22 +81,14 @@ set(dolphinpart_SRCS
dolphinpart.cpp
)
-set(fileviewsvnplugin_SRCS
- versioncontrol/fileviewsvnplugin.cpp
-)
-
kde4_add_plugin(dolphinpart ${dolphinpart_SRCS})
-kde4_add_plugin(fileviewsvnplugin ${fileviewsvnplugin_SRCS})
target_link_libraries(dolphinpart dolphinprivate konq ${KDE4_KPARTS_LIBS} ${KDE4_KFILE_LIBS})
-target_link_libraries(fileviewsvnplugin ${KDE4_KIO_LIBS} konq)
install(TARGETS dolphinpart DESTINATION ${PLUGIN_INSTALL_DIR})
-install(TARGETS fileviewsvnplugin DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES dolphinpart.rc DESTINATION ${DATA_INSTALL_DIR}/dolphinpart)
install(FILES dolphinpart.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-install(FILES versioncontrol/fileviewsvnplugin.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES versioncontrol/fileviewversioncontrolplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
##########################################
diff --git a/src/versioncontrol/fileviewsvnplugin.cpp b/src/versioncontrol/fileviewsvnplugin.cpp
deleted file mode 100644
index 00bb373fe..000000000
--- a/src/versioncontrol/fileviewsvnplugin.cpp
+++ /dev/null
@@ -1,386 +0,0 @@
-/***************************************************************************
- * 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 *
- ***************************************************************************/
-
-#include "fileviewsvnplugin.h"
-
-#include <kaction.h>
-#include <kdemacros.h>
-#include <kdialog.h>
-#include <kfileitem.h>
-#include <kicon.h>
-#include <klocale.h>
-#include <krun.h>
-#include <kshell.h>
-#include <kvbox.h>
-#include <QDir>
-#include <QLabel>
-#include <QProcess>
-#include <QString>
-#include <QStringList>
-#include <QTextEdit>
-#include <QTextStream>
-
-#include <KPluginFactory>
-#include <KPluginLoader>
-K_PLUGIN_FACTORY(FileViewSvnPluginFactory, registerPlugin<FileViewSvnPlugin>();)
-K_EXPORT_PLUGIN(FileViewSvnPluginFactory("fileviewsvnplugin"))
-
-FileViewSvnPlugin::FileViewSvnPlugin(QObject* parent, const QList<QVariant>& args) :
- KVersionControlPlugin(parent),
- m_pendingOperation(false),
- m_versionInfoHash(),
- m_updateAction(0),
- m_showLocalChangesAction(0),
- m_commitAction(0),
- m_addAction(0),
- m_removeAction(0),
- m_command(),
- m_errorMsg(),
- m_operationCompletedMsg(),
- m_contextDir(),
- m_contextItems(),
- m_tempFile()
-{
- Q_UNUSED(args);
-
- m_updateAction = new KAction(this);
- m_updateAction->setIcon(KIcon("view-refresh"));
- m_updateAction->setText(i18nc("@item:inmenu", "SVN Update"));
- connect(m_updateAction, SIGNAL(triggered()),
- this, SLOT(updateFiles()));
-
- m_showLocalChangesAction = new KAction(this);
- m_showLocalChangesAction->setIcon(KIcon("view-split-left-right"));
- m_showLocalChangesAction->setText(i18nc("@item:inmenu", "Show Local SVN Changes"));
- connect(m_showLocalChangesAction, SIGNAL(triggered()),
- this, SLOT(showLocalChanges()));
-
- m_commitAction = new KAction(this);
- m_commitAction->setText(i18nc("@item:inmenu", "SVN Commit..."));
- connect(m_commitAction, SIGNAL(triggered()),
- this, SLOT(commitFiles()));
-
- m_addAction = new KAction(this);
- m_addAction->setIcon(KIcon("list-add"));
- m_addAction->setText(i18nc("@item:inmenu", "SVN Add"));
- connect(m_addAction, SIGNAL(triggered()),
- this, SLOT(addFiles()));
-
- m_removeAction = new KAction(this);
- m_removeAction->setIcon(KIcon("list-remove"));
- m_removeAction->setText(i18nc("@item:inmenu", "SVN Delete"));
- connect(m_removeAction, SIGNAL(triggered()),
- this, SLOT(removeFiles()));
-}
-
-FileViewSvnPlugin::~FileViewSvnPlugin()
-{
-}
-
-QString FileViewSvnPlugin::fileName() const
-{
- return ".svn";
-}
-
-bool FileViewSvnPlugin::beginRetrieval(const QString& directory)
-{
- Q_ASSERT(directory.endsWith('/'));
-
- // Clear all entries for this directory including the entries
- // for sub directories
- QMutableHashIterator<QString, VersionState> it(m_versionInfoHash);
- while (it.hasNext()) {
- it.next();
- if (it.key().startsWith(directory)) {
- it.remove();
- }
- }
-
- QStringList arguments;
- arguments << "status" << "--show-updates" << directory;
-
- QProcess process;
- process.start("svn", arguments);
- while (process.waitForReadyRead()) {
- char buffer[1024];
- while (process.readLine(buffer, sizeof(buffer)) > 0) {
- VersionState state = NormalVersion;
- QString filePath(buffer);
-
- switch (buffer[0]) {
- case '?': state = UnversionedVersion; break;
- case 'M': state = LocallyModifiedVersion; break;
- case 'A': state = AddedVersion; break;
- case 'D': state = RemovedVersion; break;
- case 'C': state = ConflictingVersion; break;
- default:
- if (filePath.contains('*')) {
- state = UpdateRequiredVersion;
- }
- break;
- }
-
- // Only values with a different state as 'NormalVersion'
- // are added to the hash table. If a value is not in the
- // hash table, it is automatically defined as 'NormalVersion'
- // (see FileViewSvnPlugin::versionState()).
- if (state != NormalVersion) {
- int pos = filePath.indexOf('/');
- const int length = filePath.length() - pos - 1;
- filePath = filePath.mid(pos, length);
- if (!filePath.isEmpty()) {
- m_versionInfoHash.insert(filePath, state);
- }
- }
- }
- }
-
- return true;
-}
-
-void FileViewSvnPlugin::endRetrieval()
-{
-}
-
-KVersionControlPlugin::VersionState FileViewSvnPlugin::versionState(const KFileItem& item)
-{
- const QString itemUrl = item.localPath();
- if (m_versionInfoHash.contains(itemUrl)) {
- return m_versionInfoHash.value(itemUrl);
- }
-
- if (!item.isDir()) {
- // files that have not been listed by 'svn status' (= m_versionInfoHash)
- // are under version control per definition
- return NormalVersion;
- }
-
- // The item is a directory. Check whether an item listed by 'svn status' (= m_versionInfoHash)
- // is part of this directory. In this case a local modification should be indicated in the
- // directory already.
- QHash<QString, VersionState>::const_iterator it = m_versionInfoHash.constBegin();
- while (it != m_versionInfoHash.constEnd()) {
- if (it.key().startsWith(itemUrl)) {
- const VersionState state = m_versionInfoHash.value(it.key());
- if (state == LocallyModifiedVersion) {
- return LocallyModifiedVersion;
- }
- }
- ++it;
- }
-
- return NormalVersion;
-}
-
-QList<QAction*> FileViewSvnPlugin::contextMenuActions(const KFileItemList& items)
-{
- Q_ASSERT(!items.isEmpty());
- foreach (const KFileItem& item, items) {
- m_contextItems.append(item);
- }
- m_contextDir.clear();
-
- // iterate all items and check the version state to know which
- // actions can be enabled
- const int itemsCount = items.count();
- int versionedCount = 0;
- int editingCount = 0;
- foreach (const KFileItem& item, items) {
- const VersionState state = versionState(item);
- if (state != UnversionedVersion) {
- ++versionedCount;
- }
-
- switch (state) {
- case LocallyModifiedVersion:
- case ConflictingVersion:
- ++editingCount;
- break;
- default:
- break;
- }
- }
- m_commitAction->setEnabled(editingCount > 0);
- m_addAction->setEnabled(versionedCount == 0);
- m_removeAction->setEnabled(versionedCount == itemsCount);
-
- QList<QAction*> actions;
- actions.append(m_updateAction);
- actions.append(m_commitAction);
- actions.append(m_addAction);
- actions.append(m_removeAction);
- return actions;
-}
-
-QList<QAction*> FileViewSvnPlugin::contextMenuActions(const QString& directory)
-{
- const bool enabled = !m_pendingOperation;
- if (enabled) {
- m_contextDir = directory;
- }
-
- // Only enable the SVN actions if no SVN commands are
- // executed currently (see slotOperationCompleted() and
- // startSvnCommandProcess()).
- m_updateAction->setEnabled(enabled);
- m_showLocalChangesAction->setEnabled(enabled);
- m_commitAction->setEnabled(enabled);
-
- QList<QAction*> actions;
- actions.append(m_updateAction);
- actions.append(m_showLocalChangesAction);
- actions.append(m_commitAction);
- return actions;
-}
-
-void FileViewSvnPlugin::updateFiles()
-{
- execSvnCommand("update",
- i18nc("@info:status", "Updating SVN repository..."),
- i18nc("@info:status", "Update of SVN repository failed."),
- i18nc("@info:status", "Updated SVN repository."));
-}
-
-void FileViewSvnPlugin::showLocalChanges()
-{
- Q_ASSERT(!m_contextDir.isEmpty());
- Q_ASSERT(m_contextItems.isEmpty());
-
- const QString command = "mkfifo /tmp/fifo; svn diff " +
- KShell::quoteArg(m_contextDir) +
- " > /tmp/fifo & kompare /tmp/fifo; rm /tmp/fifo";
- KRun::runCommand(command, 0);
-}
-
-void FileViewSvnPlugin::commitFiles()
-{
- KDialog dialog(0, Qt::Dialog);
-
- KVBox* box = new KVBox(&dialog);
- new QLabel(i18nc("@label", "Description:"), box);
- QTextEdit* editor = new QTextEdit(box);
-
- dialog.setMainWidget(box);
- dialog.setCaption(i18nc("@title:window", "SVN Commit"));
- dialog.setButtons(KDialog::Ok | KDialog::Cancel);
- dialog.setDefaultButton(KDialog::Ok);
- dialog.setButtonText(KDialog::Ok, i18nc("@action:button", "Commit"));
-
- KConfigGroup dialogConfig(KSharedConfig::openConfig("dolphinrc"),
- "SvnCommitDialog");
- dialog.restoreDialogSize(dialogConfig);
-
- if (dialog.exec() == QDialog::Accepted) {
- // Write the commit description into a temporary file, so
- // that it can be read by the command "svn commit -F". The temporary
- // file must stay alive until slotOperationCompleted() is invoked and will
- // be destroyed when the version plugin is destructed.
- if (!m_tempFile.open()) {
- emit errorMessage(i18nc("@info:status", "Commit of SVN changes failed."));
- return;
- }
-
- QTextStream out(&m_tempFile);
- const QString fileName = m_tempFile.fileName();
- out << editor->toPlainText();
- m_tempFile.close();
-
- execSvnCommand("commit -F " + KShell::quoteArg(fileName),
- i18nc("@info:status", "Committing SVN changes..."),
- i18nc("@info:status", "Commit of SVN changes failed."),
- i18nc("@info:status", "Committed SVN changes."));
- }
-
- dialog.saveDialogSize(dialogConfig, KConfigBase::Persistent);
-}
-
-void FileViewSvnPlugin::addFiles()
-{
- execSvnCommand("add",
- i18nc("@info:status", "Adding files to SVN repository..."),
- i18nc("@info:status", "Adding of files to SVN repository failed."),
- i18nc("@info:status", "Added files to SVN repository."));
-}
-
-void FileViewSvnPlugin::removeFiles()
-{
- execSvnCommand("remove",
- i18nc("@info:status", "Removing files from SVN repository..."),
- i18nc("@info:status", "Removing of files from SVN repository failed."),
- i18nc("@info:status", "Removed files from SVN repository."));
-}
-
-void FileViewSvnPlugin::slotOperationCompleted(int exitCode, QProcess::ExitStatus exitStatus)
-{
- m_pendingOperation = false;
-
- if ((exitStatus != QProcess::NormalExit) || (exitCode != 0)) {
- emit errorMessage(m_errorMsg);
- } else if (m_contextItems.isEmpty()) {
- emit operationCompletedMessage(m_operationCompletedMsg);
- emit versionStatesChanged();
- } else {
- startSvnCommandProcess();
- }
-}
-
-void FileViewSvnPlugin::slotOperationError()
-{
- // don't do any operation on other items anymore
- m_contextItems.clear();
- m_pendingOperation = false;
-
- emit errorMessage(m_errorMsg);
-}
-
-void FileViewSvnPlugin::execSvnCommand(const QString& svnCommand,
- const QString& infoMsg,
- const QString& errorMsg,
- const QString& operationCompletedMsg)
-{
- emit infoMessage(infoMsg);
-
- m_command = svnCommand;
- m_errorMsg = errorMsg;
- m_operationCompletedMsg = operationCompletedMsg;
-
- startSvnCommandProcess();
-}
-
-void FileViewSvnPlugin::startSvnCommandProcess()
-{
- m_pendingOperation = true;
-
- QProcess* process = new QProcess(this);
- connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
- this, SLOT(slotOperationCompleted(int, QProcess::ExitStatus)));
- connect(process, SIGNAL(error(QProcess::ProcessError)),
- this, SLOT(slotOperationError()));
-
- const QString program = "svn " + m_command + ' ';
- if (!m_contextDir.isEmpty()) {
- process->start(program + KShell::quoteArg(m_contextDir));
- m_contextDir.clear();
- } else {
- const KFileItem item = m_contextItems.takeLast();
- process->start(program + KShell::quoteArg(item.localPath()));
- // the remaining items of m_contextItems will be executed
- // after the process has finished (see slotOperationFinished())
- }
-}
diff --git a/src/versioncontrol/fileviewsvnplugin.desktop b/src/versioncontrol/fileviewsvnplugin.desktop
deleted file mode 100644
index be62344f2..000000000
--- a/src/versioncontrol/fileviewsvnplugin.desktop
+++ /dev/null
@@ -1,67 +0,0 @@
-[Desktop Entry]
-Type=Service
-Name=Subversion
-Name[bg]=Subversion
-Name[ca]=Subversió
-Name[ca@valencia]=Subversió
-Name[cs]=Subversion
-Name[csb]=Pòdwersëjô
-Name[da]=Subversion
-Name[de]=Subversion
-Name[el]=Υποέκδοση
-Name[en_GB]=Subversion
-Name[eo]=Subversion
-Name[es]=Subversion
-Name[et]=Subversion
-Name[eu]=Subversion
-Name[fi]=Subversion
-Name[fr]=Subversion
-Name[fy]=Sub-ferzje
-Name[gl]=Subversion
-Name[gu]=સબવર્ઝન
-Name[he]=תת-גרסה
-Name[hi]=सबवर्शन
-Name[hr]=Subversion
-Name[hu]=Subversion
-Name[id]=Subversion
-Name[is]=Subversion
-Name[it]=Subversion
-Name[ja]=Subversion
-Name[kk]=Subversion
-Name[km]=Subversion
-Name[kn]=ಸಬ್‌ವರ್ಶನ್
-Name[ko]=서브버전
-Name[lt]=Subversion
-Name[lv]=Subversion
-Name[mk]=Subversion
-Name[ml]=സബ്‌വേര്‍ഷന്‍
-Name[ms]=Subversion
-Name[nb]=Subversion
-Name[nds]=Subversion
-Name[nl]=Subversion
-Name[nn]=Subversion
-Name[pa]=ਸਬਵਰਜਨ
-Name[pl]=Subversion
-Name[pt]=Subversion
-Name[pt_BR]=Subversion
-Name[ro]=Subversion
-Name[ru]=Subversion
-Name[si]=අනුසංස්කරණය
-Name[sk]=Subversion
-Name[sl]=Subversion
-Name[sr]=Субверзија
-Name[sr@ijekavian]=Субверзија
-Name[sr@ijekavianlatin]=Subversion
-Name[sr@latin]=Subversion
-Name[sv]=Subversion
-Name[tg]=Subversion
-Name[th]=ซับเวอร์ชัน
-Name[tr]=Subversion
-Name[uk]=Subversion
-Name[wa]=Subversion
-Name[x-test]=xxSubversionxx
-Name[zh_CN]=Subversion
-Name[zh_TW]=Subversion
-X-KDE-ServiceTypes=FileViewVersionControlPlugin
-MimeType=text/plain;
-X-KDE-Library=fileviewsvnplugin
diff --git a/src/versioncontrol/fileviewsvnplugin.h b/src/versioncontrol/fileviewsvnplugin.h
deleted file mode 100644
index 854652329..000000000
--- a/src/versioncontrol/fileviewsvnplugin.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/***************************************************************************
- * 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 FILEVIEWSVNPLUGIN_H
-#define FILEVIEWSVNPLUGIN_H
-
-#include <kfileitem.h>
-#include <kversioncontrolplugin.h>
-#include <QHash>
-#include <QProcess>
-#include <QTemporaryFile>
-
-// TODO: This class will be moved to kdevplatform as soon as kdevplatform will
-// be released. Moving it to kdevplatform allows to reuse code for the context
-// menu actions like commit, add, update, ...
-class FileViewSvnPlugin : public KVersionControlPlugin
-{
- Q_OBJECT
-
-public:
- FileViewSvnPlugin(QObject* parent, const QList<QVariant>& args);
- virtual ~FileViewSvnPlugin();
- virtual QString fileName() const;
- virtual bool beginRetrieval(const QString& directory);
- virtual void endRetrieval();
- virtual KVersionControlPlugin::VersionState versionState(const KFileItem& item);
- virtual QList<QAction*> contextMenuActions(const KFileItemList& items);
- virtual QList<QAction*> contextMenuActions(const QString& directory);
-
-private slots:
- void updateFiles();
- void showLocalChanges();
- void commitFiles();
- void addFiles();
- void removeFiles();
-
- void slotOperationCompleted(int exitCode, QProcess::ExitStatus exitStatus);
- void slotOperationError();
-
-private:
- /**
- * Executes the command "svn {svnCommand}" for the files that have been
- * set by getting the context menu actions (see contextMenuActions()).
- * @param infoMsg Message that should be shown before the command is executed.
- * @param errorMsg Message that should be shown if the execution of the command
- * has been failed.
- * @param operationCompletedMsg
- * Message that should be shown if the execution of the command
- * has been completed successfully.
- */
- void execSvnCommand(const QString& svnCommand,
- const QString& infoMsg,
- const QString& errorMsg,
- const QString& operationCompletedMsg);
-
- void startSvnCommandProcess();
-
-private:
- bool m_pendingOperation;
- QHash<QString, VersionState> m_versionInfoHash;
-
- QAction* m_updateAction;
- QAction* m_showLocalChangesAction;
- QAction* m_commitAction;
- QAction* m_addAction;
- QAction* m_removeAction;
-
- QString m_command;
- QString m_errorMsg;
- QString m_operationCompletedMsg;
-
- QString m_contextDir;
- KFileItemList m_contextItems;
-
- QTemporaryFile m_tempFile;
-};
-#endif // FILEVIEWSVNPLUGIN_H
-