summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Fieroni <[email protected]>2015-11-07 18:30:46 +0100
committerEmmanuel Pescosta <[email protected]>2015-11-07 18:30:46 +0100
commit1ae34a10471f109c7b4f9274954fa3500052c4d3 (patch)
tree2f386b0e4489c606894e0940294532aa1cbfebb2
parent117b76bdd73cdc4b23c19fb1009d853d7e00e0ca (diff)
[svn] Add the possibility to revert local changes via context menu.
REVIEW: 125653
-rw-r--r--svn/fileviewsvnplugin.cpp17
-rw-r--r--svn/fileviewsvnplugin.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/svn/fileviewsvnplugin.cpp b/svn/fileviewsvnplugin.cpp
index 6872eab..684d50f 100644
--- a/svn/fileviewsvnplugin.cpp
+++ b/svn/fileviewsvnplugin.cpp
@@ -89,6 +89,12 @@ FileViewSvnPlugin::FileViewSvnPlugin(QObject* parent, const QList<QVariant>& arg
connect(m_removeAction, SIGNAL(triggered()),
this, SLOT(removeFiles()));
+ m_revertAction = new QAction(this);
+ m_revertAction->setIcon(QIcon::fromTheme("document-revert"));
+ m_revertAction->setText(i18nc("@item:inmenu", "SVN Revert"));
+ connect(m_revertAction, SIGNAL(triggered()),
+ this, SLOT(revertFiles()));
+
m_showUpdatesAction = new QAction(this);
m_showUpdatesAction->setCheckable(true);
m_showUpdatesAction->setText(i18nc("@item:inmenu", "Show SVN Updates"));
@@ -261,10 +267,12 @@ QList<QAction*> FileViewSvnPlugin::actions(const KFileItemList& items) const
}
m_commitAction->setEnabled(editingCount > 0);
m_addAction->setEnabled(versionedCount == 0);
+ m_revertAction->setEnabled(editingCount == itemsCount);
m_removeAction->setEnabled(versionedCount == itemsCount);
} else {
m_commitAction->setEnabled(false);
m_addAction->setEnabled(false);
+ m_revertAction->setEnabled(false);
m_removeAction->setEnabled(false);
}
m_updateAction->setEnabled(noPendingOperation);
@@ -274,6 +282,7 @@ QList<QAction*> FileViewSvnPlugin::actions(const KFileItemList& items) const
actions.append(m_commitAction);
actions.append(m_addAction);
actions.append(m_removeAction);
+ actions.append(m_revertAction);
actions.append(m_showUpdatesAction);
return actions;
}
@@ -362,6 +371,14 @@ void FileViewSvnPlugin::removeFiles()
i18nc("@info:status", "Removed files from SVN repository."));
}
+void FileViewSvnPlugin::revertFiles()
+{
+ execSvnCommand(QStringLiteral("revert"), QStringList(),
+ i18nc("@info:status", "Reverting files from SVN repository..."),
+ i18nc("@info:status", "Reverting of files from SVN repository failed."),
+ i18nc("@info:status", "Reverted files from SVN repository."));
+}
+
void FileViewSvnPlugin::slotOperationCompleted(int exitCode, QProcess::ExitStatus exitStatus)
{
m_pendingOperation = false;
diff --git a/svn/fileviewsvnplugin.h b/svn/fileviewsvnplugin.h
index 8000595..88bcba6 100644
--- a/svn/fileviewsvnplugin.h
+++ b/svn/fileviewsvnplugin.h
@@ -53,6 +53,7 @@ private slots:
void commitFiles();
void addFiles();
void removeFiles();
+ void revertFiles();
void slotOperationCompleted(int exitCode, QProcess::ExitStatus exitStatus);
void slotOperationError();
@@ -89,6 +90,7 @@ private:
QAction* m_commitAction;
QAction* m_addAction;
QAction* m_removeAction;
+ QAction* m_revertAction;
QAction* m_showUpdatesAction;
QString m_command;