mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 11:00:48 +03:00
use the standard system download path for downloads
QFileDialog's dir arg (which was set to the incoming file name from the Matrix download) can take a full path to suggest. By prepending QStandardPaths::DownloadLocation, it opens to the system's download folder and proposes the filename as the download name. Using QStandardPaths should make this work on other platforms, and from what I read, its possible for this to return an empty string on platforms where it doesn't support it, so this should essentially revert to the previous functionality if Qt can't determine the system's download location.
This commit is contained in:
parent
6d5dbf450b
commit
17b5cc32dc
1 changed files with 5 additions and 3 deletions
|
@ -1298,10 +1298,12 @@ TimelineModel::saveMedia(QString eventId) const
|
||||||
dialogTitle = tr("Save file");
|
dialogTitle = tr("Save file");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString filterString = QMimeDatabase().mimeTypeForName(mimeType).filterString();
|
const QString filterString = QMimeDatabase().mimeTypeForName(mimeType).filterString();
|
||||||
|
const QString downloadsFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
|
const QString openLocation = downloadsFolder + "/" + originalFilename;
|
||||||
|
|
||||||
auto filename = QFileDialog::getSaveFileName(
|
const QString filename = QFileDialog::getSaveFileName(
|
||||||
manager_->getWidget(), dialogTitle, originalFilename, filterString);
|
manager_->getWidget(), dialogTitle, openLocation, filterString);
|
||||||
|
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue