Commit 795c4eee authored by David Faure's avatar David Faure
Browse files

Port from QStandardPaths::DataLocation to QStandardPaths::AppDataLocation

They are the same on Linux (but DataLocation is deprecated). On Windows this enables the use of the roaming path.

NO_CHANGELOG
parent e281eb35
......@@ -359,7 +359,7 @@ void KonqClosedWindowsManager::saveConfig()
// Create / overwrite the saved closed windows list
QString filename = QStringLiteral("closeditems_saved");
QString file = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + filename;
QString file = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + filename;
QFile::remove(file);
KConfig *config = new KConfig(file, KConfig::SimpleConfig);
......@@ -394,7 +394,7 @@ void KonqClosedWindowsManager ::readConfig()
}
QString filename = QStringLiteral("closeditems_saved");
QString file = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + filename;
QString file = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + filename;
m_konqClosedItemsConfig = new KConfig(file, KConfig::SimpleConfig);
......
......@@ -51,7 +51,7 @@
static void listSessions()
{
const QString dir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "sessions/";
const QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + "sessions/";
QDirIterator it(dir, QDir::Readable | QDir::NoDotAndDotDot | QDir::Dirs);
while (it.hasNext()) {
QFileInfo fileInfo(it.next());
......@@ -72,7 +72,7 @@ static KonqMainWindow* handleCommandLine(QCommandLineParser &parser, const QStri
const QString session = parser.value("open-session");
QString sessionPath = session;
if (!session.startsWith('/')) {
sessionPath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "sessions/" + session;
sessionPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + "sessions/" + session;
}
QDirIterator it(sessionPath, QDir::Readable | QDir::Files);
......
......@@ -2887,7 +2887,7 @@ void KonqMainWindow::slotSessionsListAboutToShow()
connect(manageSessionsAction, &QAction::triggered, this, &KonqMainWindow::manageSessions);
popup->addSeparator();
QString dir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "sessions/";
QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + "sessions/";
QDirIterator it(dir, QDir::Readable | QDir::NoDotAndDotDot | QDir::Dirs);
while (it.hasNext()) {
......
......@@ -80,7 +80,7 @@ KonqSessionDlg::KonqSessionDlg(KonqViewManager *manager, QWidget *parent)
d->m_pDeleteButton->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
d->m_pNewButton->setIcon(QIcon::fromTheme(QStringLiteral("document-new")));
QString dir = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/sessions/");
QString dir = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1String("/sessions/");
QDir().mkpath(dir);
d->m_pModel = new KDirModel(d->m_pListView);
......@@ -187,7 +187,7 @@ void KonqSessionDlg::slotRename(QUrl dirpathTo)
if (dir.exists()) {
slotRename(dirpathTo);
} else {
QDir dir(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/sessions/"));
QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1String("/sessions/"));
dir.rename(dirpathFrom.fileName(), dlg.newDestUrl().fileName());
}
}
......@@ -255,7 +255,7 @@ KonqNewSessionDlg::KonqNewSessionDlg(QWidget *parent, KonqMainWindow *mainWindow
void KonqNewSessionDlg::slotAddSession()
{
QString dirpath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/sessions/") + KIO::encodeFileName(d->m_pSessionName->text());
QString dirpath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1String("/sessions/") + KIO::encodeFileName(d->m_pSessionName->text());
QDir dir(dirpath);
if (dir.exists()) {
......
......@@ -356,7 +356,7 @@ bool SessionRestoreDialog::shouldBeShown(const QString &dontShowAgainName, int *
}
KonqSessionManager::KonqSessionManager()
: m_autosaveDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + "autosave")
: m_autosaveDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + "autosave")
, m_autosaveEnabled(false) // so that enableAutosave works
, m_createdOwnedByDir(false)
, m_sessionConfig(nullptr)
......@@ -423,7 +423,7 @@ void KonqSessionManager::enableAutosave()
// Create the config file for autosaving current session
QString filename = QLatin1String("autosave/") + m_baseService;
const QString filePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1Char('/') + filename;
const QString filePath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + QLatin1Char('/') + filename;
delete m_sessionConfig;
m_sessionConfig = new KConfig(filePath, KConfig::SimpleConfig);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment