summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-31 19:44:20 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-31 19:44:20 (GMT)
commit4475a62794be62575f7ab21747d259af5632f43d (patch)
tree4e6955bbaafc1857cd0320d469f23614917a2431
parent93c937e8313e87fe1f7538d4e891ed5b566b1068 (diff)
We can activate new method
-rw-r--r--src/ksieveui/managesievescriptsdialog.cpp8
-rw-r--r--src/ksieveui/widgets/managesievewidget.cpp6
2 files changed, 13 insertions, 1 deletions
diff --git a/src/ksieveui/managesievescriptsdialog.cpp b/src/ksieveui/managesievescriptsdialog.cpp
index 0757974..b2536d9 100644
--- a/src/ksieveui/managesievescriptsdialog.cpp
+++ b/src/ksieveui/managesievescriptsdialog.cpp
@@ -42,6 +42,7 @@
#include <KStandardGuiItem>
using namespace KSieveUi;
+//#define USE_CHECK_SIEVE_METHOD 0
class KSieveUi::ManageSieveScriptsDialogPrivate
{
@@ -211,8 +212,13 @@ void ManageSieveScriptsDialog::slotSieveEditorCheckSyntaxClicked()
return;
}
d->mSieveEditor->addNormalMessage(i18n("Uploading script to server for checking it, please wait..."));
+#ifdef USE_CHECK_SIEVE_METHOD
+ KManageSieve::SieveJob *job = KManageSieve::SieveJob::check(d->mCurrentURL, script);
+ connect(job, &KManageSieve::SieveJob::result, this, &ManageSieveScriptsDialog::slotPutCheckSyntaxResultDebug);
+#else
KManageSieve::SieveJob *job = KManageSieve::SieveJob::put(d->mCurrentURL, script, d->mWasActive, d->mWasActive);
connect(job, &KManageSieve::SieveJob::result, this, &ManageSieveScriptsDialog::slotPutCheckSyntaxResultDebug);
+#endif
}
void ManageSieveScriptsDialog::slotSieveEditorOkClicked()
@@ -250,8 +256,10 @@ void ManageSieveScriptsDialog::slotPutCheckSyntaxResultDebug(KManageSieve::Sieve
d->mSieveEditor->addFailedMessage(errorMsg);
}
}
+#ifndef USE_CHECK_SIEVE_METHOD
//Put original script after check otherwise we will put a script even if we don't click on ok
KManageSieve::SieveJob *restoreJob = KManageSieve::SieveJob::put(d->mCurrentURL, d->mSieveEditor->originalScript(), d->mWasActive, d->mWasActive);
+#endif
d->mSieveEditor->resultDone();
}
diff --git a/src/ksieveui/widgets/managesievewidget.cpp b/src/ksieveui/widgets/managesievewidget.cpp
index 3bbc3e0..cb93aef 100644
--- a/src/ksieveui/widgets/managesievewidget.cpp
+++ b/src/ksieveui/widgets/managesievewidget.cpp
@@ -35,7 +35,7 @@
#include "libksieve_debug.h"
#include <QNetworkConfigurationManager>
#include <QMetaType>
-
+//#define USE_RENAME_SIEVE_METHOD 1
using namespace KSieveUi;
Q_DECLARE_METATYPE(QTreeWidgetItem *)
@@ -388,11 +388,15 @@ void ManageSieveWidget::slotRenameScript()
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);
connect(job, &KManageSieve::SieveJob::result, this, &ManageSieveWidget::slotRenameResult);
//TODO ? Q_EMIT scriptRenamed(u);
slotRefresh();
+#else
+ //TODO
+#endif
}
void ManageSieveWidget::slotRenameResult(KManageSieve::SieveJob *job, bool success)