Make .cache/.local/.config folders uniform.
This commit is contained in:
parent
c97e052a1f
commit
81f54e0d1c
@ -42,7 +42,7 @@ FormBackupDatabaseSettings::FormBackupDatabaseSettings(QWidget *parent) : QDialo
|
||||
connect(m_ui->m_txtBackupName->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton()));
|
||||
connect(m_ui->m_btnSelectFolder, SIGNAL(clicked()), this, SLOT(selectFolder()));
|
||||
|
||||
selectFolder(qApp->documentsFolderPath());
|
||||
selectFolder(qApp->getDocumentsFolderPath());
|
||||
m_ui->m_txtBackupName->lineEdit()->setText(QString(APP_LOW_NAME) + QL1S("_") + QDateTime::currentDateTime().toString(QSL("yyyyMMddHHmm")));
|
||||
m_ui->m_lblResult->setStatus(WidgetWithStatus::Warning, tr("No operation executed yet."), tr("No operation executed yet."));
|
||||
|
||||
|
@ -39,7 +39,7 @@ FormRestoreDatabaseSettings::FormRestoreDatabaseSettings(QWidget *parent)
|
||||
connect(m_ui->m_groupSettings, SIGNAL(toggled(bool)), this, SLOT(checkOkButton()));
|
||||
connect(m_ui->m_buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(performRestoration()));
|
||||
|
||||
selectFolder(qApp->documentsFolderPath());
|
||||
selectFolder(qApp->getDocumentsFolderPath());
|
||||
}
|
||||
|
||||
FormRestoreDatabaseSettings::~FormRestoreDatabaseSettings() {
|
||||
|
@ -122,7 +122,7 @@ void FormUpdate::updateProgress(qint64 bytes_received, qint64 bytes_total) {
|
||||
|
||||
void FormUpdate::saveUpdateFile(const QByteArray &file_contents) {
|
||||
const QString url_file = m_updateInfo.m_urls.value(OS_ID).m_fileUrl;;
|
||||
const QString temp_directory = qApp->tempFolderPath();
|
||||
const QString temp_directory = qApp->getTempFolderPath();
|
||||
|
||||
if (!temp_directory.isEmpty()) {
|
||||
const QString output_file_name = url_file.mid(url_file.lastIndexOf('/') + 1);
|
||||
|
@ -62,7 +62,7 @@ void SettingsBrowserMail::changeDefaultBrowserArguments(int index) {
|
||||
void SettingsBrowserMail::selectBrowserExecutable() {
|
||||
const QString executable_file = QFileDialog::getOpenFileName(this,
|
||||
tr("Select web browser executable"),
|
||||
qApp->homeFolderPath(),
|
||||
qApp->getHomeFolderPath(),
|
||||
//: File filter for external browser selection dialog.
|
||||
#if defined(Q_OS_LINUX)
|
||||
tr("Executables (*)")
|
||||
@ -110,7 +110,7 @@ void SettingsBrowserMail::changeDefaultEmailArguments(int index) {
|
||||
void SettingsBrowserMail::selectEmailExecutable() {
|
||||
QString executable_file = QFileDialog::getOpenFileName(this,
|
||||
tr("Select e-mail executable"),
|
||||
qApp->homeFolderPath(),
|
||||
qApp->getHomeFolderPath(),
|
||||
//: File filter for external e-mail selection dialog.
|
||||
#if defined(Q_OS_LINUX)
|
||||
tr("Executables (*)")
|
||||
|
@ -100,7 +100,11 @@ int main(int argc, char *argv[]) {
|
||||
// These settings needs to be set before any QSettings object.
|
||||
Application::setApplicationName(APP_NAME);
|
||||
Application::setApplicationVersion(APP_VERSION);
|
||||
|
||||
#if !defined(Q_OS_LINUX)
|
||||
Application::setOrganizationName(APP_AUTHOR);
|
||||
#endif
|
||||
|
||||
Application::setOrganizationDomain(APP_URL);
|
||||
Application::setWindowIcon(QIcon(APP_ICON_PATH));
|
||||
|
||||
|
@ -188,31 +188,19 @@ void Application::setMainForm(FormMain *main_form) {
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
QString Application::getXdgConfigHomePath() {
|
||||
// TODO: Return ".config" folder on Linux.
|
||||
// XDG_CONFIG_HOME
|
||||
// Where user-specific configurations should be written (analogous to /etc).
|
||||
// Should default to $HOME/.config.
|
||||
|
||||
const QString xdgConfigHome = qgetenv("XDG_CONFIG_HOME");
|
||||
|
||||
if (xdgConfigHome.isEmpty()) {
|
||||
return qgetenv("HOME") + QDir::separator() + ".config";
|
||||
}
|
||||
else {
|
||||
return xdgConfigHome;
|
||||
}
|
||||
return IOFactory::getSystemFolder(QStandardPaths::ConfigLocation);
|
||||
}
|
||||
#endif
|
||||
|
||||
QString Application::tempFolderPath() {
|
||||
QString Application::getTempFolderPath() {
|
||||
return IOFactory::getSystemFolder(QStandardPaths::TempLocation);
|
||||
}
|
||||
|
||||
QString Application::documentsFolderPath() {
|
||||
QString Application::getDocumentsFolderPath() {
|
||||
return IOFactory::getSystemFolder(QStandardPaths::DocumentsLocation);
|
||||
}
|
||||
|
||||
QString Application::homeFolderPath() {
|
||||
QString Application::getHomeFolderPath() {
|
||||
return IOFactory::getSystemFolder(QStandardPaths::HomeLocation);
|
||||
}
|
||||
|
||||
|
@ -80,9 +80,9 @@ class Application : public QtSingleApplication {
|
||||
QWidget *mainFormWidget();
|
||||
SystemTrayIcon *trayIcon();
|
||||
|
||||
QString tempFolderPath();
|
||||
QString documentsFolderPath();
|
||||
QString homeFolderPath();
|
||||
QString getTempFolderPath();
|
||||
QString getDocumentsFolderPath();
|
||||
QString getHomeFolderPath();
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
QString getXdgConfigHomePath();
|
||||
|
@ -322,17 +322,16 @@ QString Settings::getAppPathUserFolder() {
|
||||
return qApp->applicationDirPath() + QDir::separator() + QSL("data");
|
||||
}
|
||||
|
||||
|
||||
|
||||
QString Settings::getHomeUserFolder() {
|
||||
#if defined(Q_OS_LINUX)
|
||||
QString home_folder = qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QSL("data");
|
||||
// Fallback folder.
|
||||
QString home_folder = qApp->getHomeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QSL("data");
|
||||
|
||||
if (QDir().exists(home_folder)) {
|
||||
return home_folder;
|
||||
}
|
||||
else {
|
||||
return qApp->getXdgConfigHomePath() + QDir::separator() + QString(APP_LOW_NAME);
|
||||
return qApp->getXdgConfigHomePath() + QDir::separator() + QString(APP_NAME);
|
||||
}
|
||||
#else
|
||||
return qApp->homeFolderPath() + QDir::separator() + QString(APP_LOW_H_NAME) + QDir::separator() + QSL("data");
|
||||
|
@ -187,7 +187,7 @@ void FormFeedDetails::onNoIconSelected() {
|
||||
|
||||
void FormFeedDetails::onLoadIconFromFile() {
|
||||
QFileDialog dialog(this, tr("Select icon file for the feed"),
|
||||
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
qApp->getHomeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setWindowIcon(qApp->icons()->fromTheme(QSL("image-x-generic")));
|
||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||
|
@ -178,7 +178,7 @@ void FormStandardCategoryDetails::onNoIconSelected() {
|
||||
|
||||
void FormStandardCategoryDetails::onLoadIconFromFile() {
|
||||
QFileDialog dialog(this, tr("Select icon file for the category"),
|
||||
qApp->homeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
qApp->getHomeFolderPath(), tr("Images (*.bmp *.jpg *.jpeg *.png *.svg *.tga)"));
|
||||
dialog.setFileMode(QFileDialog::ExistingFile);
|
||||
dialog.setWindowIcon(qApp->icons()->fromTheme(QSL("image-x-generic")));
|
||||
dialog.setOptions(QFileDialog::DontUseNativeDialog | QFileDialog::ReadOnly);
|
||||
|
@ -163,7 +163,7 @@ void FormStandardImportExport::selectExportFile() {
|
||||
filter += filter_txt_url_per_line;
|
||||
|
||||
QString selected_file = QFileDialog::getSaveFileName(this, tr("Select file for feeds export"),
|
||||
qApp->homeFolderPath(), filter, &selected_filter);
|
||||
qApp->getHomeFolderPath(), filter, &selected_filter);
|
||||
|
||||
if (!selected_file.isEmpty()) {
|
||||
if (selected_filter == filter_opml20) {
|
||||
@ -199,7 +199,7 @@ void FormStandardImportExport::selectImportFile() {
|
||||
filter += ";;";
|
||||
filter += filter_txt_url_per_line;
|
||||
|
||||
const QString selected_file = QFileDialog::getOpenFileName(this, tr("Select file for feeds import"), qApp->homeFolderPath(),
|
||||
const QString selected_file = QFileDialog::getOpenFileName(this, tr("Select file for feeds import"), qApp->getHomeFolderPath(),
|
||||
filter, &selected_filter);
|
||||
|
||||
if (!selected_file.isEmpty()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user