summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-31 19:58:23 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-31 19:58:23 (GMT)
commitc53debe3a4e4d19dbf48a917d8b7da8851d6b261 (patch)
treebac6b09f4156450024ef204badd123efa090130f
parentc856b69e695d98e1a8b6e240be544b727fefb260 (diff)
Allow to rename script
-rw-r--r--src/ksieveui/widgets/managesievewidget.cpp16
-rw-r--r--src/ksieveui/widgets/managesievewidget.h2
2 files changed, 16 insertions, 2 deletions
diff --git a/src/ksieveui/widgets/managesievewidget.cpp b/src/ksieveui/widgets/managesievewidget.cpp
index cb93aef..37bcbe8 100644
--- a/src/ksieveui/widgets/managesievewidget.cpp
+++ b/src/ksieveui/widgets/managesievewidget.cpp
@@ -18,6 +18,7 @@
#include "managesievewidget.h"
#include "managesievetreeview.h"
#include "widgets/sievetreewidgetitem.h"
+#include "managescriptsjob/renamescriptjob.h"
#include <kmanagesieve/sievejob.h>
#include <managescriptsjob/parseuserscriptjob.h>
@@ -385,9 +386,9 @@ void ManageSieveWidget::slotRenameScript()
return;
}
+
u = u.adjusted(QUrl::RemoveFilename);
u.setPath(u.path() + QLatin1Char('/') + currentItem->text(0));
-
#ifdef USE_RENAME_SIEVE_METHOD
qDebug()<<" u " << u;
KManageSieve::SieveJob *job = KManageSieve::SieveJob::rename(u, newName);
@@ -395,10 +396,21 @@ void ManageSieveWidget::slotRenameScript()
//TODO ? Q_EMIT scriptRenamed(u);
slotRefresh();
#else
- //TODO
+ KSieveUi::RenameScriptJob *job = new KSieveUi::RenameScriptJob(this);
+ job->setOldUrl(u);
+ job->setIsActive(itemIsActived(currentItem));
+ job->setNewName(newName);
+ connect(job, &RenameScriptJob::finished, this, &ManageSieveWidget::slotRenameFinished);
+ job->start();
#endif
}
+void ManageSieveWidget::slotRenameFinished(bool success)
+{
+ qDebug()<<" void ManageSieveWidget::slotRenameResult(KManageSieve::SieveJob *job, bool success)"<<success;
+ slotRefresh();
+}
+
void ManageSieveWidget::slotRenameResult(KManageSieve::SieveJob *job, bool success)
{
qDebug()<<" void ManageSieveWidget::slotRenameResult(KManageSieve::SieveJob *job, bool success)"<<success;
diff --git a/src/ksieveui/widgets/managesievewidget.h b/src/ksieveui/widgets/managesievewidget.h
index dd0307f..e00a51d 100644
--- a/src/ksieveui/widgets/managesievewidget.h
+++ b/src/ksieveui/widgets/managesievewidget.h
@@ -72,6 +72,8 @@ private Q_SLOTS:
void slotCancelFetch();
void slotRenameResult(KManageSieve::SieveJob *job, bool success);
+ void slotRenameFinished(bool success);
+
public Q_SLOTS:
void slotRenameScript();
void slotGotList(KManageSieve::SieveJob *job, bool success, const QStringList &listScript, const QString &activeScript);