summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-10-31 20:11:26 (GMT)
committerMontel Laurent <montel@kde.org>2016-10-31 20:11:26 (GMT)
commitd2b6045714588a008d3e37ab93b9fb65cee284ac (patch)
tree433f399086c36d436015a2b00a10d63afd769426
parent125c4630a939ced16a4bd54ab8223783f867dcd6 (diff)
Now we can return error
-rw-r--r--src/ksieveui/managescriptsjob/renamescriptjob.cpp11
-rw-r--r--src/ksieveui/managescriptsjob/renamescriptjob.h2
-rw-r--r--src/ksieveui/widgets/managesievewidget.cpp5
-rw-r--r--src/ksieveui/widgets/managesievewidget.h2
4 files changed, 12 insertions, 8 deletions
diff --git a/src/ksieveui/managescriptsjob/renamescriptjob.cpp b/src/ksieveui/managescriptsjob/renamescriptjob.cpp
index 89011f1..f1527aa 100644
--- a/src/ksieveui/managescriptsjob/renamescriptjob.cpp
+++ b/src/ksieveui/managescriptsjob/renamescriptjob.cpp
@@ -17,9 +17,10 @@
#include "renamescriptjob.h"
-
#include <kmanagesieve/sievejob.h>
+#include <KLocalizedString>
+
using namespace KSieveUi;
class KSieveUi::RenameScriptJobPrivate
@@ -72,7 +73,7 @@ void RenameScriptJob::start()
KManageSieve::SieveJob *job = KManageSieve::SieveJob::get(d->mOldUrl);
connect(job, &KManageSieve::SieveJob::result, this, &RenameScriptJob::slotGetResult);
} else {
- Q_EMIT finished(false);
+ Q_EMIT finished(i18n("Impossible to start job"), false);
deleteLater();
}
}
@@ -82,7 +83,7 @@ void RenameScriptJob::slotGetResult(KManageSieve::SieveJob *job, bool success, c
Q_UNUSED(job);
Q_UNUSED(isActive);
if (!success) {
- Q_EMIT finished(false);
+ Q_EMIT finished(i18n("An error occurred during loading the sieve script."), false);
deleteLater();
return;
}
@@ -98,7 +99,7 @@ void RenameScriptJob::slotPutScript(KManageSieve::SieveJob *job, bool success)
{
Q_UNUSED(job);
if (!success) {
- Q_EMIT finished(false);
+ Q_EMIT finished(i18n("An error occurred during saving the sieve script."), false);
deleteLater();
return;
}
@@ -109,6 +110,6 @@ void RenameScriptJob::slotPutScript(KManageSieve::SieveJob *job, bool success)
void RenameScriptJob::slotDeleteResult(KManageSieve::SieveJob *job, bool success)
{
Q_UNUSED(job);
- Q_EMIT finished(success);
+ Q_EMIT finished(success ? QString() : i18n("An error occurred during deleting the sieve script."), success);
deleteLater();
}
diff --git a/src/ksieveui/managescriptsjob/renamescriptjob.h b/src/ksieveui/managescriptsjob/renamescriptjob.h
index d6047ea..db4a0b9 100644
--- a/src/ksieveui/managescriptsjob/renamescriptjob.h
+++ b/src/ksieveui/managescriptsjob/renamescriptjob.h
@@ -45,7 +45,7 @@ public:
void start();
Q_SIGNALS:
- void finished(bool success);
+ void finished(const QString &error, bool success);
private Q_SLOTS:
void slotDeleteResult(KManageSieve::SieveJob *job, bool success);
diff --git a/src/ksieveui/widgets/managesievewidget.cpp b/src/ksieveui/widgets/managesievewidget.cpp
index 192803f..2f5c827 100644
--- a/src/ksieveui/widgets/managesievewidget.cpp
+++ b/src/ksieveui/widgets/managesievewidget.cpp
@@ -403,8 +403,11 @@ void ManageSieveWidget::slotRenameScript()
#endif
}
-void ManageSieveWidget::slotRenameFinished(bool success)
+void ManageSieveWidget::slotRenameFinished(const QString &errorStr, bool success)
{
+ if (!success) {
+ KMessageBox::error(this, errorStr, i18n("Rename Script"));
+ }
qCDebug(LIBKSIEVE_LOG) << " void ManageSieveWidget::slotRenameResult(KManageSieve::SieveJob *job, bool success)"<<success;
slotRefresh();
}
diff --git a/src/ksieveui/widgets/managesievewidget.h b/src/ksieveui/widgets/managesievewidget.h
index e00a51d..d2654ef 100644
--- a/src/ksieveui/widgets/managesievewidget.h
+++ b/src/ksieveui/widgets/managesievewidget.h
@@ -72,7 +72,7 @@ private Q_SLOTS:
void slotCancelFetch();
void slotRenameResult(KManageSieve::SieveJob *job, bool success);
- void slotRenameFinished(bool success);
+ void slotRenameFinished(const QString &errorStr, bool success);
public Q_SLOTS:
void slotRenameScript();