Better image overlay handling when downloading

- hides the overlay when prompting for download location
 - cancel re-shows the dialog
 - success closes the overlay
 - would be nice to have a return code from the download fn in
 mtxclient.

Closes #140
This commit is contained in:
Adasauce 2020-03-20 10:05:12 -03:00
parent b41e2e6f18
commit d0a1e81f43
No known key found for this signature in database
GPG key ID: B4FD3151235211CB
3 changed files with 20 additions and 6 deletions

View file

@ -1271,7 +1271,7 @@ TimelineModel::addPendingMessage(mtx::events::collections::TimelineEvents event)
emit nextPendingMessage();
}
void
bool
TimelineModel::saveMedia(QString eventId) const
{
mtx::events::collections::TimelineEvents event = events.value(eventId);
@ -1309,7 +1309,7 @@ TimelineModel::saveMedia(QString eventId) const
manager_->getWidget(), dialogTitle, openLocation, filterString);
if (filename.isEmpty())
return;
return false;
const auto url = mxcUrl.toStdString();
@ -1340,10 +1340,13 @@ TimelineModel::saveMedia(QString eventId) const
file.write(QByteArray(temp.data(), (int)temp.size()));
file.close();
return;
} catch (const std::exception &e) {
nhlog::ui()->warn("Error while saving file to: {}", e.what());
}
});
return true;
}
void