summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <[email protected]>2016-07-16 10:54:59 +0200
committerDavid Faure <[email protected]>2016-07-20 00:04:55 +0200
commit182531280c34f5ea6b427f642d78f457eb50601f (patch)
tree56abeb33f1261ddc7d499122987cff48807c2314
parent42613b16bce81429af0cb020abee05abc17da94a (diff)
SieveEditor: port to libksieve API changes
Differential Revision: https://phabricator.kde.org/D2190
-rw-r--r--CMakeLists.txt2
-rw-r--r--sieveeditor/CMakeLists.txt2
-rw-r--r--sieveeditor/src/sieveeditorpagewidget.cpp19
-rw-r--r--sieveeditor/src/sieveeditorpagewidget.h2
4 files changed, 16 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 00113e7..efd903b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -146,7 +146,7 @@ else()
set(CALENDARSUPPORT_LIB_VERSION_LIB "5.2.80")
set(EVENTVIEW_LIB_VERSION_LIB "5.2.80")
set(KDGANTT2_LIB_VERSION_LIB "5.2.80")
- set(LIBKSIEVE_LIB_VERSION_LIB "5.2.82")
+ set(LIBKSIEVE_LIB_VERSION_LIB "5.2.83")
find_package(KF5WebEngineViewer ${MESSAGELIB_LIB_VERSION_LIB} CONFIG REQUIRED)
set(WEBENGINE_TYPE "QtWebEngine")
diff --git a/sieveeditor/CMakeLists.txt b/sieveeditor/CMakeLists.txt
index 85e8c42..a9af6db 100644
--- a/sieveeditor/CMakeLists.txt
+++ b/sieveeditor/CMakeLists.txt
@@ -43,7 +43,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${sieveeditor_SOURCE_DIR})
set(MESSAGELIB_LIB_VERSION_LIB "5.2.91")
set(PIMCOMMON_LIB_VERSION_LIB "5.2.80")
- set(LIBKSIEVE_LIB_VERSION_LIB "5.2.82")
+ set(LIBKSIEVE_LIB_VERSION_LIB "5.2.83")
set(QT_REQUIRED_VERSION "5.6.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network Test)
diff --git a/sieveeditor/src/sieveeditorpagewidget.cpp b/sieveeditor/src/sieveeditorpagewidget.cpp
index 2c47672..a53e62e 100644
--- a/sieveeditor/src/sieveeditorpagewidget.cpp
+++ b/sieveeditor/src/sieveeditorpagewidget.cpp
@@ -56,17 +56,19 @@ void SieveEditorPageWidget::slotCheckSyntaxClicked()
const QString script = mSieveEditorWidget->script();
if (script.isEmpty()) {
return;
+
}
+ mSieveEditorWidget->addNormalMessage(i18n("Uploading script to server for checking it, please wait..."));
KManageSieve::SieveJob *job = KManageSieve::SieveJob::put(mCurrentURL, script, mWasActive, mWasActive);
- job->setInteractive(false);
- connect(job, &KManageSieve::SieveJob::errorMessage, this, &SieveEditorPageWidget::slotPutResultDebug);
+ connect(job, &KManageSieve::SieveJob::result, this, &SieveEditorPageWidget::slotPutResultDebug);
}
-void SieveEditorPageWidget::slotPutResultDebug(KManageSieve::SieveJob *, bool success, const QString &errorMsg)
+void SieveEditorPageWidget::slotPutResultDebug(KManageSieve::SieveJob *job, bool success)
{
if (success) {
mSieveEditorWidget->addOkMessage(i18n("No errors found."));
} else {
+ const QString errorMsg = job->errorString();
if (errorMsg.isEmpty()) {
mSieveEditorWidget->addFailedMessage(i18n("An unknown error was encountered."));
} else {
@@ -74,8 +76,7 @@ void SieveEditorPageWidget::slotPutResultDebug(KManageSieve::SieveJob *, bool su
}
}
//Put original script after check otherwise we will put a script even if we don't click on ok
- KManageSieve::SieveJob *job = KManageSieve::SieveJob::put(mCurrentURL, mSieveEditorWidget->originalScript(), mWasActive, mWasActive);
- job->setInteractive(false);
+ KManageSieve::SieveJob *restoreJob = KManageSieve::SieveJob::put(mCurrentURL, mSieveEditorWidget->originalScript(), mWasActive, mWasActive);
mSieveEditorWidget->resultDone();
}
@@ -134,7 +135,13 @@ void SieveEditorPageWidget::slotPutResult(KManageSieve::SieveJob *job, bool succ
mSieveEditorWidget->updateOriginalScript();
mSieveEditorWidget->setModified(false);
} else {
- //TODO error
+ const QString msg = job->errorString();
+ if (msg.isEmpty())
+ KMessageBox::error(Q_NULLPTR, i18n("Uploading the Sieve script failed.\n"
+ "The server responded:\n%1", msg, i18n("Sieve Error")));
+ else {
+ KMessageBox::error(Q_NULLPTR, msg, i18n("Sieve Error"));
+ }
}
}
diff --git a/sieveeditor/src/sieveeditorpagewidget.h b/sieveeditor/src/sieveeditorpagewidget.h
index c644bc1..607f655 100644
--- a/sieveeditor/src/sieveeditorpagewidget.h
+++ b/sieveeditor/src/sieveeditorpagewidget.h
@@ -97,7 +97,7 @@ Q_SIGNALS:
private Q_SLOTS:
void slotGetResult(KManageSieve::SieveJob *, bool success, const QString &script, bool isActive);
void slotCheckSyntaxClicked();
- void slotPutResultDebug(KManageSieve::SieveJob *, bool success, const QString &errorMsg);
+ void slotPutResultDebug(KManageSieve::SieveJob *, bool success);
void slotPutResult(KManageSieve::SieveJob *, bool success);
void slotValueChanged(bool b);