Commit 5cccc4c4 authored by Laurent Montel's avatar Laurent Montel 😁

Don't try to export when we don't have filters and fix mem leak when we cancel

parent daa43b44
......@@ -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()
......
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