mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
use QStandardPaths locations for all file dialogs.
This commit is contained in:
parent
17b5cc32dc
commit
cb36050822
4 changed files with 15 additions and 6 deletions
|
@ -626,8 +626,9 @@ TextInputWidget::command(QString command, QString args)
|
||||||
void
|
void
|
||||||
TextInputWidget::openFileSelection()
|
TextInputWidget::openFileSelection()
|
||||||
{
|
{
|
||||||
|
const QString homeFolder = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
|
||||||
const auto fileName =
|
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())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
|
@ -513,7 +514,9 @@ UserSettingsPage::paintEvent(QPaintEvent *)
|
||||||
void
|
void
|
||||||
UserSettingsPage::importSessionKeys()
|
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);
|
QFile file(fileName);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
|
@ -572,7 +575,8 @@ UserSettingsPage::exportSessionKeys()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open file dialog to save the file.
|
// 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"), "", "");
|
QFileDialog::getSaveFileName(this, tr("File to save the exported session keys"), "", "");
|
||||||
|
|
||||||
QFile file(fileName);
|
QFile file(fileName);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QShowEvent>
|
#include <QShowEvent>
|
||||||
|
#include <QStandardPaths>
|
||||||
#include <QStyleOption>
|
#include <QStyleOption>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
@ -740,8 +741,10 @@ RoomSettings::resetErrorLabel()
|
||||||
void
|
void
|
||||||
RoomSettings::updateAvatar()
|
RoomSettings::updateAvatar()
|
||||||
{
|
{
|
||||||
const auto fileName =
|
const QString picturesFolder =
|
||||||
QFileDialog::getOpenFileName(this, tr("Select an avatar"), "", tr("All Files (*)"));
|
QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
|
||||||
|
const QString fileName = QFileDialog::getOpenFileName(
|
||||||
|
this, tr("Select an avatar"), picturesFolder, tr("All Files (*)"));
|
||||||
|
|
||||||
if (fileName.isEmpty())
|
if (fileName.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1299,7 +1299,8 @@ TimelineModel::saveMedia(QString eventId) const
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString filterString = QMimeDatabase().mimeTypeForName(mimeType).filterString();
|
const QString filterString = QMimeDatabase().mimeTypeForName(mimeType).filterString();
|
||||||
const QString downloadsFolder = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
const QString downloadsFolder =
|
||||||
|
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
const QString openLocation = downloadsFolder + "/" + originalFilename;
|
const QString openLocation = downloadsFolder + "/" + originalFilename;
|
||||||
|
|
||||||
const QString filename = QFileDialog::getSaveFileName(
|
const QString filename = QFileDialog::getSaveFileName(
|
||||||
|
|
Loading…
Reference in a new issue