diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 046a0fe50..a93926dc9 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -18,9 +18,9 @@ #include "Config.h" #include -#include #include #include +#include #include Config* Config::m_instance(Q_NULLPTR); @@ -53,7 +53,7 @@ Config::Config(QObject* parent) QString homePath = QDir::homePath(); #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) - // we can't use QDesktopServices on X11 as it uses XDG_DATA_HOME instead of XDG_CONFIG_HOME + // we can't use QStandardPaths on X11 as it uses XDG_DATA_HOME instead of XDG_CONFIG_HOME QByteArray env = qgetenv("XDG_CONFIG_HOME"); if (env.isEmpty()) { userPath = homePath; @@ -70,7 +70,7 @@ Config::Config(QObject* parent) userPath += "/keepassx/"; #else - userPath = QDir::fromNativeSeparators(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); + userPath = QDir::fromNativeSeparators(QStandardPaths::writableLocation(QDesktopServices::AppDataLocation)); // storageLocation() appends the application name ("/keepassx") to the end userPath += "/"; #endif diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index beeda2ab8..c4668bb14 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -589,7 +590,7 @@ void EditEntryWidget::insertAttachment() QString defaultDir = config()->get("LastAttachmentDir").toString(); if (defaultDir.isEmpty() || !QDir(defaultDir).exists()) { - defaultDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); + defaultDir = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).value(0); } QString filename = fileDialog()->getOpenFileName(this, tr("Select file"), defaultDir); if (filename.isEmpty() || !QFile::exists(filename)) { @@ -623,7 +624,7 @@ void EditEntryWidget::saveCurrentAttachment() QString filename = m_attachmentsModel->keyByIndex(index); QString defaultDirName = config()->get("LastAttachmentDir").toString(); if (defaultDirName.isEmpty() || !QDir(defaultDirName).exists()) { - defaultDirName = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); + defaultDirName = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); } QDir dir(defaultDirName); QString savePath = fileDialog()->getSaveFileName(this, tr("Save attachment"), diff --git a/src/main.cpp b/src/main.cpp index d189db94c..1a69e181a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -37,7 +37,7 @@ int main(int argc, char** argv) Application::setApplicationName("keepassx"); Application::setApplicationVersion(KEEPASSX_VERSION); // don't set organizationName as that changes the return value of - // QDesktopServices::storageLocation(QDesktopServices::DataLocation) + // QStandardPaths::writableLocation(QDesktopServices::AppDataLocation) QApplication::setQuitOnLastWindowClosed(false);