Commit 7b83cb9c authored by Alexander Lohnau's avatar Alexander Lohnau 💬 Committed by Harald Sitter
Browse files

Use KSharedConfig::openStateConfig for history items

See https://phabricator.kde.org/T12549 for rationale
parent 52915b7a
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#include <KAboutData> #include <KAboutData>
#include <KLocalizedString> #include <KLocalizedString>
#include <Kdelibs4ConfigMigrator> #include <Kdelibs4ConfigMigrator>
#include <KSharedConfig>
#include <KConfigGroup>
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
...@@ -34,6 +36,14 @@ int main(int argc, char *argv[]) ...@@ -34,6 +36,14 @@ int main(int argc, char *argv[])
migrate.setUiFiles(QStringList() << QStringLiteral("filelightui.rc")); migrate.setUiFiles(QStringList() << QStringLiteral("filelightui.rc"));
migrate.migrate(); migrate.migrate();
auto config = KSharedConfig::openConfig();
auto stateConfig = KSharedConfig::openStateConfig();
if (config->hasGroup("general")) {
auto grp = stateConfig->group("general");
config->group("general").copyTo(&grp);
config->deleteGroup("general");
}
using Filelight::MainWindow; using Filelight::MainWindow;
KAboutData about( KAboutData about(
......
...@@ -102,7 +102,7 @@ MainWindow::MainWindow() ...@@ -102,7 +102,7 @@ MainWindow::MainWindow()
connect(this, &MainWindow::canceled, this, &MainWindow::scanFailed); connect(this, &MainWindow::canceled, this, &MainWindow::scanFailed);
connect(this, &MainWindow::canceled, m_histories, &HistoryCollection::stop); connect(this, &MainWindow::canceled, m_histories, &HistoryCollection::stop);
const KConfigGroup config = KSharedConfig::openConfig()->group("general"); const KConfigGroup config = KSharedConfig::openStateConfig()->group("general");
m_combo->setHistoryItems(config.readPathEntry("comboHistory", QStringList())); m_combo->setHistoryItems(config.readPathEntry("comboHistory", QStringList()));
setAutoSaveSettings(QStringLiteral("window")); setAutoSaveSettings(QStringLiteral("window"));
...@@ -176,7 +176,7 @@ void MainWindow::setupActions() //singleton function ...@@ -176,7 +176,7 @@ void MainWindow::setupActions() //singleton function
m_histories = new HistoryCollection(ac, this); m_histories = new HistoryCollection(ac, this);
m_recentScans->loadEntries(KSharedConfig::openConfig()->group("general")); m_recentScans->loadEntries(KSharedConfig::openStateConfig()->group("general"));
connect(m_recentScans, &KRecentFilesAction::urlSelected, this, &MainWindow::slotScanUrl); connect(m_recentScans, &KRecentFilesAction::urlSelected, this, &MainWindow::slotScanUrl);
connect(m_combo, QOverload<const QString &>::of(&KHistoryComboBox::returnPressed), this, &MainWindow::slotComboScan); connect(m_combo, QOverload<const QString &>::of(&KHistoryComboBox::returnPressed), this, &MainWindow::slotComboScan);
...@@ -185,7 +185,7 @@ void MainWindow::setupActions() //singleton function ...@@ -185,7 +185,7 @@ void MainWindow::setupActions() //singleton function
void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::closeEvent(QCloseEvent *event)
{ {
KConfigGroup config = KSharedConfig::openConfig()->group("general"); KConfigGroup config = KSharedConfig::openStateConfig()->group("general");
m_recentScans->saveEntries(config); m_recentScans->saveEntries(config);
config.writePathEntry("comboHistory", m_combo->historyItems()); config.writePathEntry("comboHistory", m_combo->historyItems());
......
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