Commit 441cb735 authored by Pino Toscano's avatar Pino Toscano

WebImageFetcher: properly destroy dialog after any request

The dialog with the cover result is destroyed only if the user accepts
the result, showing no results for further searches in case the cover
dialog is cancelled.

Instead, make sure to destroy the cover dialog also in case the user
cancels it.
parent 923871e1
......@@ -200,6 +200,7 @@ void WebImageFetcher::slotImageFetched(KJob* j)
connect(buttonBox, &QDialogButtonBox::rejected, d->dialog, &QDialog::reject);
connect(d->dialog, &QDialog::accepted, this, &WebImageFetcher::slotCoverChosen);
connect(d->dialog, &QDialog::rejected, this, &WebImageFetcher::destroyDialog);
d->dialog->setWindowIcon(realImage);
d->dialog->show();
......@@ -215,10 +216,18 @@ void WebImageFetcher::slotCoverChosen()
if (newId != CoverManager::NoMatch) {
emit signalCoverChanged(newId);
d->dialog->close();
d->dialog->deleteLater();
d->dialog = 0;
destroyDialog();
}
}
void WebImageFetcher::destroyDialog()
{
if (!d->dialog)
return;
d->dialog->close();
d->dialog->deleteLater();
d->dialog = 0;
}
// vim: set et sw=4 tw=0 sta:
......@@ -45,6 +45,7 @@ private slots:
void slotWebRequestFinished(KJob *job);
void slotImageFetched(KJob *job);
void slotCoverChosen();
void destroyDialog();
private:
class Private;
......
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