Commit 47e4f93d authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Store last used export directory in state config

and change its config group to the more general "Export".

GnuPG-bug-id: 6121
parent 9994a362
......@@ -19,12 +19,19 @@
QString ApplicationState::lastUsedExportDirectory()
{
const KConfigGroup config{KSharedConfig::openConfig(), "ExportDialog"};
return config.readEntry("LastDirectory", QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
QString ret;
const KConfigGroup stateConfig{KSharedConfig::openStateConfig(), "Export"};
ret = stateConfig.readEntry("LastDirectory");
if (ret.isEmpty()) {
// try the normal config for backward compatibility
const KConfigGroup config{KSharedConfig::openConfig(), "ExportDialog"};
ret = config.readEntry("LastDirectory");
}
return ret.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) : ret;
}
void ApplicationState::setLastUsedExportDirectory(const QString &path)
{
KConfigGroup config{KSharedConfig::openConfig(), "ExportDialog"};
config.writeEntry("LastDirectory", QFileInfo{path}.absolutePath());
KConfigGroup stateConfig{KSharedConfig::openStateConfig(), "Export"};
stateConfig.writeEntry("LastDirectory", QFileInfo{path}.absolutePath());
}
Supports Markdown
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