diff --git a/src/gui/dialogs/formbackupdatabasesettings.cpp b/src/gui/dialogs/formbackupdatabasesettings.cpp index 65df8951f..bac66a4aa 100755 --- a/src/gui/dialogs/formbackupdatabasesettings.cpp +++ b/src/gui/dialogs/formbackupdatabasesettings.cpp @@ -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.")); diff --git a/src/gui/dialogs/formrestoredatabasesettings.cpp b/src/gui/dialogs/formrestoredatabasesettings.cpp index 9f9e52f82..f81ba7195 100755 --- a/src/gui/dialogs/formrestoredatabasesettings.cpp +++ b/src/gui/dialogs/formrestoredatabasesettings.cpp @@ -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() { diff --git a/src/gui/dialogs/formupdate.cpp b/src/gui/dialogs/formupdate.cpp index 6a83420fa..5f2cc601a 100755 --- a/src/gui/dialogs/formupdate.cpp +++ b/src/gui/dialogs/formupdate.cpp @@ -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); diff --git a/src/gui/settings/settingsbrowsermail.cpp b/src/gui/settings/settingsbrowsermail.cpp index ae3c8a9dc..997dc491d 100755 --- a/src/gui/settings/settingsbrowsermail.cpp +++ b/src/gui/settings/settingsbrowsermail.cpp @@ -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 (*)") diff --git a/src/main.cpp b/src/main.cpp index 3277cae53..9148238db 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -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)); diff --git a/src/miscellaneous/application.cpp b/src/miscellaneous/application.cpp index aa104bc3b..9b64be8cf 100755 --- a/src/miscellaneous/application.cpp +++ b/src/miscellaneous/application.cpp @@ -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); } diff --git a/src/miscellaneous/application.h b/src/miscellaneous/application.h index 4b1cd6f5f..feaed0fee 100755 --- a/src/miscellaneous/application.h +++ b/src/miscellaneous/application.h @@ -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(); diff --git a/src/miscellaneous/settings.cpp b/src/miscellaneous/settings.cpp index aa3a48fbf..3aa99b91d 100755 --- a/src/miscellaneous/settings.cpp +++ b/src/miscellaneous/settings.cpp @@ -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"); diff --git a/src/services/abstract/gui/formfeeddetails.cpp b/src/services/abstract/gui/formfeeddetails.cpp index f1e84573c..a78674dfb 100755 --- a/src/services/abstract/gui/formfeeddetails.cpp +++ b/src/services/abstract/gui/formfeeddetails.cpp @@ -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); diff --git a/src/services/standard/gui/formstandardcategorydetails.cpp b/src/services/standard/gui/formstandardcategorydetails.cpp index 9c1af9ec1..9abe9b28f 100755 --- a/src/services/standard/gui/formstandardcategorydetails.cpp +++ b/src/services/standard/gui/formstandardcategorydetails.cpp @@ -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); diff --git a/src/services/standard/gui/formstandardimportexport.cpp b/src/services/standard/gui/formstandardimportexport.cpp index 334e9ba0c..a16572194 100755 --- a/src/services/standard/gui/formstandardimportexport.cpp +++ b/src/services/standard/gui/formstandardimportexport.cpp @@ -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()) {