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) ...@@ -200,6 +200,7 @@ void WebImageFetcher::slotImageFetched(KJob* j)
connect(buttonBox, &QDialogButtonBox::rejected, d->dialog, &QDialog::reject); connect(buttonBox, &QDialogButtonBox::rejected, d->dialog, &QDialog::reject);
connect(d->dialog, &QDialog::accepted, this, &WebImageFetcher::slotCoverChosen); connect(d->dialog, &QDialog::accepted, this, &WebImageFetcher::slotCoverChosen);
connect(d->dialog, &QDialog::rejected, this, &WebImageFetcher::destroyDialog);
d->dialog->setWindowIcon(realImage); d->dialog->setWindowIcon(realImage);
d->dialog->show(); d->dialog->show();
...@@ -215,10 +216,18 @@ void WebImageFetcher::slotCoverChosen() ...@@ -215,10 +216,18 @@ void WebImageFetcher::slotCoverChosen()
if (newId != CoverManager::NoMatch) { if (newId != CoverManager::NoMatch) {
emit signalCoverChanged(newId); emit signalCoverChanged(newId);
d->dialog->close(); destroyDialog();
d->dialog = 0;
} }
} }
void WebImageFetcher::destroyDialog()
if (!d->dialog)
d->dialog = 0;
// vim: set et sw=4 tw=0 sta: // vim: set et sw=4 tw=0 sta:
...@@ -45,6 +45,7 @@ private slots: ...@@ -45,6 +45,7 @@ private slots:
void slotWebRequestFinished(KJob *job); void slotWebRequestFinished(KJob *job);
void slotImageFetched(KJob *job); void slotImageFetched(KJob *job);
void slotCoverChosen(); void slotCoverChosen();
void destroyDialog();
private: private:
class Private; class Private;
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment