summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-10-10 13:23:21 +0200
committerMontel Laurent <[email protected]>2017-10-10 13:23:21 +0200
commit5cccc4c40c8e956ee4f6dff7cf5437de4d8c27a5 (patch)
treeca6607764373e2aae58488fcacb424a94996c577
parentdaa43b44f790795351ead5e7c91f90d26ebfeefc (diff)
Don't try to export when we don't have filters and fix mem leak when we cancel
-rw-r--r--src/filter/kmfilterdialog.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/filter/kmfilterdialog.cpp b/src/filter/kmfilterdialog.cpp
index 3c6cb48..b60f215 100644
--- a/src/filter/kmfilterdialog.cpp
+++ b/src/filter/kmfilterdialog.cpp
@@ -784,19 +784,26 @@ void KMFilterDialog::slotExportAsSieveScript()
KMessageBox::information(this, i18n("We cannot convert all KMail filters to sieve scripts but we can try :)"), i18n("Convert KMail filters to sieve scripts"));
bool wasCanceled = false;
const QList<MailFilter *> filters = mFilterList->filtersForSaving(false, wasCanceled);
- QPointer<FilterSelectionDialog> dlg = new FilterSelectionDialog(this);
- dlg->setFilters(filters);
- if (dlg->exec() == QDialog::Accepted) {
- QList<MailFilter *> lst = dlg->selectedFilters();
- if (!lst.isEmpty()) {
- FilterConvertToSieve convert(lst);
- convert.convert();
- qDeleteAll(lst);
- } else {
- KMessageBox::information(this, i18n("No filters selected."), i18n("Convert KMail filters to sieve scripts"));
+ if (!filters.isEmpty()) {
+ return;
+ }
+ if (!wasCanceled) {
+ QPointer<FilterSelectionDialog> dlg = new FilterSelectionDialog(this);
+ dlg->setFilters(filters);
+ if (dlg->exec() == QDialog::Accepted) {
+ QList<MailFilter *> lst = dlg->selectedFilters();
+ if (!lst.isEmpty()) {
+ FilterConvertToSieve convert(lst);
+ convert.convert();
+ qDeleteAll(lst);
+ } else {
+ KMessageBox::information(this, i18n("No filters selected."), i18n("Convert KMail filters to sieve scripts"));
+ }
}
+ delete dlg;
+ } else {
+ qDeleteAll(filters);
}
- delete dlg;
}
void KMFilterDialog::slotHelp()