Commit 18253128 authored by David Faure's avatar David Faure

SieveEditor: port to libksieve API changes

Differential Revision: https://phabricator.kde.org/D2190
parent 42613b16
......@@ -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")
......
......@@ -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)
......
......@@ -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"));
}
}
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment