Commit 07d8c51b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Prepare to desactivate and delete script

parent d092e4ff
Pipeline #68799 passed with stage
in 17 minutes and 6 seconds
......@@ -339,7 +339,7 @@ bool ManageSieveWidget::updateGlobalScript(QTreeWidgetItem *item, const QUrl &u)
return false;
}
void ManageSieveWidget::changeActiveScript(QTreeWidgetItem *item, bool activate)
void ManageSieveWidget::changeActiveScript(QTreeWidgetItem *item, bool activate, bool deleteScript)
{
if (!item) {
return;
......@@ -371,7 +371,14 @@ void ManageSieveWidget::changeActiveScript(QTreeWidgetItem *item, bool activate)
job = KManageSieve::SieveJob::deactivate(u);
}
d->mBlockSignal = true;
connect(job, &KManageSieve::SieveJob::result, this, &ManageSieveWidget::slotRefresh);
connect(job, &KManageSieve::SieveJob::result, this, [this, u, deleteScript]() {
slotRefresh();
if (deleteScript) {
KManageSieve::SieveJob *job = KManageSieve::SieveJob::del(u);
connect(job, &KManageSieve::SieveJob::result, this, &ManageSieveWidget::slotDeleteResult);
Q_EMIT scriptDeleted(u);
}
});
}
void ManageSieveWidget::slotGenerateGlobalScriptError(const QString &errorStr)
......
......@@ -100,9 +100,9 @@ private:
bool serverHasError(QTreeWidgetItem *item) const;
void killAllJobs();
void clear();
bool isFileNameItem(QTreeWidgetItem *item) const;
bool itemIsActived(QTreeWidgetItem *item) const;
void changeActiveScript(QTreeWidgetItem *item, bool activate);
Q_REQUIRED_RESULT bool isFileNameItem(QTreeWidgetItem *item) const;
Q_REQUIRED_RESULT bool itemIsActived(QTreeWidgetItem *item) const;
void changeActiveScript(QTreeWidgetItem *item, bool activate, bool deleteScript = false);
Q_REQUIRED_RESULT bool updateGlobalScript(QTreeWidgetItem *item, const QUrl &u);
void slotGenerateGlobalScriptError(const QString &errorStr);
std::unique_ptr<ManageSieveWidgetPrivate> const d;
......
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