mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-10-30 09:30:47 +03:00
Merge pull request #117 from adasauce/file-download-path
use the standard system download path for file downloads
This commit is contained in:
commit
f70923f374
4 changed files with 19 additions and 8 deletions
|
@ -626,8 +626,9 @@ TextInputWidget::command(QString command, QString args)
|
|||
void
|
||||
TextInputWidget::openFileSelection()
|
||||
{
|
||||
const QString homeFolder = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
const auto fileName =
|
||||
QFileDialog::getOpenFileName(this, tr("Select a file"), "", tr("All Files (*)"));
|
||||
QFileDialog::getOpenFileName(this, tr("Select a file"), homeFolder, tr("All Files (*)"));
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QScrollArea>
|
||||
#include <QSettings>
|
||||
#include <QStandardPaths>
|
||||
#include <QString>
|
||||
#include <QTextStream>
|
||||
|
||||
|
@ -513,7 +514,9 @@ UserSettingsPage::paintEvent(QPaintEvent *)
|
|||
void
|
||||
UserSettingsPage::importSessionKeys()
|
||||
{
|
||||
auto fileName = QFileDialog::getOpenFileName(this, tr("Open Sessions File"), "", "");
|
||||
const QString homeFolder = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
const QString fileName =
|
||||
QFileDialog::getOpenFileName(this, tr("Open Sessions File"), homeFolder, "");
|
||||
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
|
@ -572,7 +575,8 @@ UserSettingsPage::exportSessionKeys()
|
|||
}
|
||||
|
||||
// Open file dialog to save the file.
|
||||
auto fileName =
|
||||
const QString homeFolder = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||
const QString fileName =
|
||||
QFileDialog::getSaveFileName(this, tr("File to save the exported session keys"), "", "");
|
||||
|
||||
QFile file(fileName);
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <QPushButton>
|
||||
#include <QShortcut>
|
||||
#include <QShowEvent>
|
||||
#include <QStandardPaths>
|
||||
#include <QStyleOption>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
|
@ -740,8 +741,10 @@ RoomSettings::resetErrorLabel()
|
|||
void
|
||||
RoomSettings::updateAvatar()
|
||||
{
|
||||
const auto fileName =
|
||||
QFileDialog::getOpenFileName(this, tr("Select an avatar"), "", tr("All Files (*)"));
|
||||
const QString picturesFolder =
|
||||
QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||
const QString fileName = QFileDialog::getOpenFileName(
|
||||
this, tr("Select an avatar"), picturesFolder, tr("All Files (*)"));
|
||||
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
|
|
@ -1298,10 +1298,13 @@ 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;
|
||||
|
|
Loading…
Reference in a new issue