summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorAdasauce <adasauce@with.parts>2020-02-14 16:24:53 -0400
committerAdasauce <adasauce@with.parts>2020-02-14 16:24:53 -0400
commit17b5cc32dc56552ac3ae7285f7ffdb194b907ffd (patch)
treedff8a71c0237b07cb498566d4ade3ecc431972c9 /src/timeline/TimelineModel.cpp
parentBump boost version to try to fix some arm crashes (diff)
downloadnheko-17b5cc32dc56552ac3ae7285f7ffdb194b907ffd.tar.xz
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.
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index f084b4dd..625377fb 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -1298,10 +1298,12 @@ TimelineModel::saveMedia(QString eventId) const 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( - manager_->getWidget(), dialogTitle, originalFilename, filterString); + const QString filename = QFileDialog::getSaveFileName( + manager_->getWidget(), dialogTitle, openLocation, filterString); if (filename.isEmpty()) return;