change local setting prefix

This commit is contained in:
Patrick von Reth 2015-03-02 13:07:34 +01:00
parent a4fd9bfb72
commit f83bbe53a8
4 changed files with 12 additions and 3 deletions

View File

@ -38,7 +38,7 @@ SnoreCore::SnoreCore()
d_ptr = new SnoreCorePrivate();
Q_D(SnoreCore);
d->q_ptr = this;
setDefaultValue("Timeout", 10, LOCAL_SETTING);
d->setDefaults();
}
SnoreCore &SnoreCore::instance()

View File

@ -132,6 +132,12 @@ bool SnoreCorePrivate::initPrimaryNotificationBackend()
return false;
}
void SnoreCorePrivate::setDefaults()
{
Q_Q(SnoreCore);
q->setDefaultValue("Timeout", 10, LOCAL_SETTING);
}
void SnoreCorePrivate::syncSettings()
{
Q_Q(SnoreCore);
@ -177,6 +183,7 @@ QStringList SnoreCorePrivate::knownClients(){
void SnoreCorePrivate::setLocalSttingsPrefix(const QString &prefix)
{
m_localSettingsPrefix = prefix;
setDefaults();
syncSettings();
}

View File

@ -86,6 +86,8 @@ public:
void setLocalSttingsPrefix(const QString &prefix);
void setDefaults();
signals:
void applicationRegistered(const Snore::Application &);
void applicationDeregistered(const Snore::Application &);
@ -108,7 +110,7 @@ private:
Application m_defaultApp;
QString m_localSettingsPrefix = QString("%1.%2").arg(qApp->organizationName(), qApp->applicationName());
QString m_localSettingsPrefix = qApp->applicationName().isEmpty() ? "SnoreNotify" : qApp->applicationName();
QSettings *m_settings;
};

View File

@ -19,7 +19,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) :
connect(ui->widget, &Snore::SettingsDialog::finished, qApp, &QApplication::quit);
QStringList list = SnoreCorePrivate::instance()->knownClients();
list.removeAll(QString("%1.%2").arg(qApp->organizationName(), qApp->applicationName()));
list.removeAll(qApp->applicationName());
ui->comboBox->addItems(list);
}