Commit e794a848 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Delay quitting import until notification was shown

If we quit immediately then the notification is never shown
parent 286a0d55
Pipeline #217314 passed with stage
in 1 minute and 16 seconds
......@@ -33,13 +33,20 @@ void Palapeli::ImportHelper::doWork()
//show notification
puzzle->get(Palapeli::PuzzleComponent::Metadata);
const Palapeli::MetadataComponent* cmp = puzzle->component<Palapeli::MetadataComponent>();
puzzle->get(Palapeli::PuzzleComponent::ArchiveStorage);
if (cmp)
{
KNotification::event(QStringLiteral("importingPuzzle"),
auto *noti = KNotification::event(QStringLiteral("importingPuzzle"),
i18n("Importing puzzle \"%1\" into your collection", cmp->metadata.name),
QPixmap::fromImage(cmp->metadata.thumbnail)
);
// Delay quitting until the notification expires
// Otherwise the notification is never shown
connect(noti, &KNotification::closed, this, []{
qApp->quit ();
});
} else {
qApp->quit ();
}
puzzle->get(Palapeli::PuzzleComponent::ArchiveStorage);
qApp->quit ();
}
Supports Markdown
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