1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

Settings: Allow nesting instances without breaking groups

Closes #1511
This commit is contained in:
David Rosca 2014-11-01 17:50:26 +01:00
parent 9359977d8b
commit 3a9f2f9e78
2 changed files with 9 additions and 7 deletions

View File

@ -25,8 +25,9 @@ QzSettings* Settings::s_qzSettings = 0;
Settings::Settings()
{
// Save currently opened group
if (!s_settings->group().isEmpty()) {
qDebug("Settings: Creating object with opened group!");
m_openedGroup = s_settings->group();
s_settings->endGroup();
}
}
@ -78,7 +79,11 @@ QzSettings* Settings::staticSettings()
Settings::~Settings()
{
if (!s_settings->group().isEmpty()) {
qDebug("Settings: Deleting object with opened group!");
qDebug() << "Settings: Deleting object with opened group!";
s_settings->endGroup();
}
// Restore opened group
if (!m_openedGroup.isEmpty())
s_settings->beginGroup(m_openedGroup);
}

View File

@ -18,7 +18,6 @@
#ifndef SETTINGS_H
#define SETTINGS_H
#include <qglobal.h>
#include <QVariant>
#include "qzcommon.h"
@ -45,14 +44,12 @@ public:
void beginGroup(const QString &prefix);
void endGroup();
signals:
public slots:
private:
static QSettings* s_settings;
static QzSettings* s_qzSettings;
QString m_openedGroup;
};
#endif // SETTINGS_H