Commit e8a9a0e9 authored by Laurent Montel's avatar Laurent Montel 😁

Avoid potential problem about config name

parent 6177f693
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
#include <QPushButton> #include <QPushButton>
using namespace KABGravatar; using namespace KABGravatar;
namespace {
static const char myConfigGroupName[] = "GravatarUpdateDialog";
}
GravatarUpdateDialog::GravatarUpdateDialog(QWidget *parent) GravatarUpdateDialog::GravatarUpdateDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
...@@ -96,7 +98,7 @@ void GravatarUpdateDialog::setOriginalPixmap(const QPixmap &pix) ...@@ -96,7 +98,7 @@ void GravatarUpdateDialog::setOriginalPixmap(const QPixmap &pix)
void GravatarUpdateDialog::readConfig() void GravatarUpdateDialog::readConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "GravatarUpdateDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
const QSize size = grp.readEntry("Size", QSize(300, 200)); const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) { if (size.isValid()) {
resize(size); resize(size);
...@@ -105,7 +107,7 @@ void GravatarUpdateDialog::readConfig() ...@@ -105,7 +107,7 @@ void GravatarUpdateDialog::readConfig()
void GravatarUpdateDialog::writeConfig() void GravatarUpdateDialog::writeConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "GravatarUpdateDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("Size", size()); grp.writeEntry("Size", size());
grp.sync(); grp.sync();
} }
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
#include <QStackedWidget> #include <QStackedWidget>
using namespace KABMergeContacts; using namespace KABMergeContacts;
namespace {
static const char myConfigGroupName[] = "MergeContactsDialog";
}
MergeContactsDialog::MergeContactsDialog(QWidget *parent) MergeContactsDialog::MergeContactsDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
...@@ -89,7 +92,7 @@ void MergeContactsDialog::slotCustomizeMergeContact(const Akonadi::Item::List &l ...@@ -89,7 +92,7 @@ void MergeContactsDialog::slotCustomizeMergeContact(const Akonadi::Item::List &l
void MergeContactsDialog::readConfig() void MergeContactsDialog::readConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "MergeContactsDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
const QSize size = grp.readEntry("Size", QSize(300, 200)); const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) { if (size.isValid()) {
resize(size); resize(size);
...@@ -98,7 +101,7 @@ void MergeContactsDialog::readConfig() ...@@ -98,7 +101,7 @@ void MergeContactsDialog::readConfig()
void MergeContactsDialog::writeConfig() void MergeContactsDialog::writeConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "MergeContactsDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("Size", size()); grp.writeEntry("Size", size());
grp.sync(); grp.sync();
} }
......
...@@ -22,7 +22,9 @@ ...@@ -22,7 +22,9 @@
#include <QVBoxLayout> #include <QVBoxLayout>
using namespace KABMergeContacts; using namespace KABMergeContacts;
namespace {
static const char myConfigGroupName[] = "SearchAndMergeContactDuplicateContactDialog";
}
SearchAndMergeContactDuplicateContactDialog::SearchAndMergeContactDuplicateContactDialog(QWidget *parent) SearchAndMergeContactDuplicateContactDialog::SearchAndMergeContactDuplicateContactDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
...@@ -91,7 +93,7 @@ void SearchAndMergeContactDuplicateContactDialog::searchPotentialDuplicateContac ...@@ -91,7 +93,7 @@ void SearchAndMergeContactDuplicateContactDialog::searchPotentialDuplicateContac
void SearchAndMergeContactDuplicateContactDialog::readConfig() void SearchAndMergeContactDuplicateContactDialog::readConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "MergeContactDuplicateContactDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
const QSize size = grp.readEntry("Size", QSize(300, 200)); const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) { if (size.isValid()) {
resize(size); resize(size);
...@@ -100,7 +102,7 @@ void SearchAndMergeContactDuplicateContactDialog::readConfig() ...@@ -100,7 +102,7 @@ void SearchAndMergeContactDuplicateContactDialog::readConfig()
void SearchAndMergeContactDuplicateContactDialog::writeConfig() void SearchAndMergeContactDuplicateContactDialog::writeConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "MergeContactDuplicateContactDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("Size", size()); grp.writeEntry("Size", size());
grp.sync(); grp.sync();
} }
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <QCheckBox> #include <QCheckBox>
#include <QVBoxLayout> #include <QVBoxLayout>
namespace {
static const char myConfigGroupName[] = "Markdown";
}
MarkdownConfigureWidget::MarkdownConfigureWidget(QWidget *parent) MarkdownConfigureWidget::MarkdownConfigureWidget(QWidget *parent)
: MessageComposer::PluginEditorConvertTextConfigureWidget(parent) : MessageComposer::PluginEditorConvertTextConfigureWidget(parent)
{ {
...@@ -33,14 +36,14 @@ MarkdownConfigureWidget::~MarkdownConfigureWidget() ...@@ -33,14 +36,14 @@ MarkdownConfigureWidget::~MarkdownConfigureWidget()
void MarkdownConfigureWidget::loadSettings() void MarkdownConfigureWidget::loadSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Markdown"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
mLatexSupport->setChecked(grp.readEntry("Enable Embedded Latex", false)); mLatexSupport->setChecked(grp.readEntry("Enable Embedded Latex", false));
mExtraDefinitionLists->setChecked(grp.readEntry("Enable Extra Definition Lists", false)); mExtraDefinitionLists->setChecked(grp.readEntry("Enable Extra Definition Lists", false));
} }
void MarkdownConfigureWidget::saveSettings() void MarkdownConfigureWidget::saveSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Markdown"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("Enable Embedded Latex", mLatexSupport->isChecked()); grp.writeEntry("Enable Embedded Latex", mLatexSupport->isChecked());
grp.writeEntry("Enable Extra Definition Lists", mExtraDefinitionLists->isChecked()); grp.writeEntry("Enable Extra Definition Lists", mExtraDefinitionLists->isChecked());
} }
......
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <KSharedConfig> #include <KSharedConfig>
namespace {
static const char myConfigGroupName[] = "SelectMailDialog";
}
SelectMailDialog::SelectMailDialog(QWidget *parent) SelectMailDialog::SelectMailDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
{ {
...@@ -46,7 +49,7 @@ void SelectMailDialog::accept() ...@@ -46,7 +49,7 @@ void SelectMailDialog::accept()
void SelectMailDialog::readConfig() void SelectMailDialog::readConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "SelectMailDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
const QSize size = grp.readEntry("Size", QSize(300, 200)); const QSize size = grp.readEntry("Size", QSize(300, 200));
if (size.isValid()) { if (size.isValid()) {
resize(size); resize(size);
...@@ -55,7 +58,7 @@ void SelectMailDialog::readConfig() ...@@ -55,7 +58,7 @@ void SelectMailDialog::readConfig()
void SelectMailDialog::writeConfig() void SelectMailDialog::writeConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "SelectMailDialog"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("Size", size()); grp.writeEntry("Size", size());
grp.sync(); grp.sync();
} }
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
#include <QComboBox> #include <QComboBox>
#include <QLabel> #include <QLabel>
#include <QVBoxLayout> #include <QVBoxLayout>
namespace {
static const char myConfigGroupName[] = "ShortUrl";
}
InsertShorturlConfigureWidget::InsertShorturlConfigureWidget(QWidget *parent) InsertShorturlConfigureWidget::InsertShorturlConfigureWidget(QWidget *parent)
: QWidget(parent) : QWidget(parent)
{ {
...@@ -49,7 +51,7 @@ void InsertShorturlConfigureWidget::slotChanged() ...@@ -49,7 +51,7 @@ void InsertShorturlConfigureWidget::slotChanged()
void InsertShorturlConfigureWidget::loadConfig() void InsertShorturlConfigureWidget::loadConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "ShortUrl"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
const QString engineName = grp.readEntry("EngineName"); const QString engineName = grp.readEntry("EngineName");
int index = mShortUrlServer->findData(engineName); int index = mShortUrlServer->findData(engineName);
if (index < 0) { if (index < 0) {
...@@ -62,7 +64,7 @@ void InsertShorturlConfigureWidget::loadConfig() ...@@ -62,7 +64,7 @@ void InsertShorturlConfigureWidget::loadConfig()
void InsertShorturlConfigureWidget::writeConfig() void InsertShorturlConfigureWidget::writeConfig()
{ {
if (mChanged) { if (mChanged) {
KConfigGroup grp(KSharedConfig::openConfig(), "ShortUrl"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("EngineName", mShortUrlServer->itemData(mShortUrlServer->currentIndex()).toString()); grp.writeEntry("EngineName", mShortUrlServer->itemData(mShortUrlServer->currentIndex()).toString());
grp.sync(); grp.sync();
} }
......
...@@ -10,7 +10,9 @@ ...@@ -10,7 +10,9 @@
#include <QCheckBox> #include <QCheckBox>
#include <KConfigGroup> #include <KConfigGroup>
#include <KSharedConfig> #include <KSharedConfig>
namespace {
static const char myConfigGroupName[] = "Check Before Send";
}
CheckBeforeSendConfigureWidget::CheckBeforeSendConfigureWidget(QWidget *parent) CheckBeforeSendConfigureWidget::CheckBeforeSendConfigureWidget(QWidget *parent)
: MessageComposer::PluginEditorCheckBeforeSendConfigureWidget(parent) : MessageComposer::PluginEditorCheckBeforeSendConfigureWidget(parent)
{ {
...@@ -47,7 +49,7 @@ CheckBeforeSendConfigureWidget::~CheckBeforeSendConfigureWidget() ...@@ -47,7 +49,7 @@ CheckBeforeSendConfigureWidget::~CheckBeforeSendConfigureWidget()
void CheckBeforeSendConfigureWidget::loadSettings() void CheckBeforeSendConfigureWidget::loadSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Check Before Send"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
mCheckPlainTextMail->setChecked(grp.readEntry("SendPlainText", false)); mCheckPlainTextMail->setChecked(grp.readEntry("SendPlainText", false));
mCheckMailTransport->setChecked(grp.readEntry("SmtpDefinedInIdentity", false)); mCheckMailTransport->setChecked(grp.readEntry("SmtpDefinedInIdentity", false));
mCheckDuplicateEmailsAddresses->setChecked(grp.readEntry("CheckDuplicatedEmails", false)); mCheckDuplicateEmailsAddresses->setChecked(grp.readEntry("CheckDuplicatedEmails", false));
...@@ -56,7 +58,7 @@ void CheckBeforeSendConfigureWidget::loadSettings() ...@@ -56,7 +58,7 @@ void CheckBeforeSendConfigureWidget::loadSettings()
void CheckBeforeSendConfigureWidget::saveSettings() void CheckBeforeSendConfigureWidget::saveSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Check Before Send"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry("SendPlainText", mCheckPlainTextMail->isChecked()); grp.writeEntry("SendPlainText", mCheckPlainTextMail->isChecked());
grp.writeEntry("SmtpDefinedInIdentity", mCheckMailTransport->isChecked()); grp.writeEntry("SmtpDefinedInIdentity", mCheckMailTransport->isChecked());
grp.writeEntry("CheckDuplicatedEmails", mCheckDuplicateEmailsAddresses->isChecked()); grp.writeEntry("CheckDuplicatedEmails", mCheckDuplicateEmailsAddresses->isChecked());
......
...@@ -17,7 +17,9 @@ ...@@ -17,7 +17,9 @@
#include <KIdentityManagement/Identity> #include <KIdentityManagement/Identity>
#include <MessageComposer/AliasesExpandJob> #include <MessageComposer/AliasesExpandJob>
#include <PimCommon/PimUtil> #include <PimCommon/PimUtil>
namespace {
static const char myConfigGroupName[] = "Confirm Address";
}
ConfirmAddressInterface::ConfirmAddressInterface(QObject *parent) ConfirmAddressInterface::ConfirmAddressInterface(QObject *parent)
: MessageComposer::PluginEditorCheckBeforeSendInterface(parent) : MessageComposer::PluginEditorCheckBeforeSendInterface(parent)
{ {
...@@ -82,7 +84,7 @@ bool ConfirmAddressInterface::exec(const MessageComposer::PluginEditorCheckBefor ...@@ -82,7 +84,7 @@ bool ConfirmAddressInterface::exec(const MessageComposer::PluginEditorCheckBefor
void ConfirmAddressInterface::slotAddWhiteListEmails(const QStringList &lst, uint currentIdentity) void ConfirmAddressInterface::slotAddWhiteListEmails(const QStringList &lst, uint currentIdentity)
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Confirm Address"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
KConfigGroup identityGroup = grp.group(QStringLiteral("Confirm Address %1").arg(currentIdentity)); KConfigGroup identityGroup = grp.group(QStringLiteral("Confirm Address %1").arg(currentIdentity));
QStringList oldWhiteList = identityGroup.readEntry("Emails", QStringList()); QStringList oldWhiteList = identityGroup.readEntry("Emails", QStringList());
for (const QString &email : lst) { for (const QString &email : lst) {
...@@ -97,7 +99,7 @@ void ConfirmAddressInterface::slotAddWhiteListEmails(const QStringList &lst, uin ...@@ -97,7 +99,7 @@ void ConfirmAddressInterface::slotAddWhiteListEmails(const QStringList &lst, uin
void ConfirmAddressInterface::reloadConfig() void ConfirmAddressInterface::reloadConfig()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Confirm Address"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
mHashSettings.clear(); mHashSettings.clear();
KIdentityManagement::IdentityManager *im = KIdentityManagement::IdentityManager::self(); KIdentityManagement::IdentityManager *im = KIdentityManagement::IdentityManager::self();
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
#include <KConfigGroup> #include <KConfigGroup>
#include <KSharedConfig> #include <KSharedConfig>
#include <QStandardPaths> #include <QStandardPaths>
namespace {
static const char myConfigGroupName[] = "Grammalecte";
}
GrammalecteManager::GrammalecteManager(QObject *parent) GrammalecteManager::GrammalecteManager(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
...@@ -27,7 +29,7 @@ GrammalecteManager *GrammalecteManager::self() ...@@ -27,7 +29,7 @@ GrammalecteManager *GrammalecteManager::self()
void GrammalecteManager::saveSettings() void GrammalecteManager::saveSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Grammalecte"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry(QStringLiteral("pythonpath"), mPythonPath); grp.writeEntry(QStringLiteral("pythonpath"), mPythonPath);
grp.writeEntry(QStringLiteral("grammalectepath"), mGrammalectePath); grp.writeEntry(QStringLiteral("grammalectepath"), mGrammalectePath);
grp.writeEntry(QStringLiteral("options"), mOptions); grp.writeEntry(QStringLiteral("options"), mOptions);
...@@ -45,7 +47,7 @@ void GrammalecteManager::setOptions(const QStringList &saveOptions) ...@@ -45,7 +47,7 @@ void GrammalecteManager::setOptions(const QStringList &saveOptions)
void GrammalecteManager::loadSettings() void GrammalecteManager::loadSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "Grammalecte"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
mPythonPath = grp.readEntry(QStringLiteral("pythonpath")); mPythonPath = grp.readEntry(QStringLiteral("pythonpath"));
if (mPythonPath.isEmpty()) { if (mPythonPath.isEmpty()) {
mPythonPath = QStandardPaths::findExecutable(QStringLiteral("python3")); mPythonPath = QStandardPaths::findExecutable(QStringLiteral("python3"));
......
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#include <QColor> #include <QColor>
#include <QRandomGenerator> #include <QRandomGenerator>
namespace {
static const char myConfigGroupName[] = "LanguageTool";
}
LanguageToolManager::LanguageToolManager(QObject *parent) LanguageToolManager::LanguageToolManager(QObject *parent)
: QObject(parent) : QObject(parent)
, mNetworkAccessManager(new QNetworkAccessManager(this)) , mNetworkAccessManager(new QNetworkAccessManager(this))
...@@ -82,7 +84,7 @@ void LanguageToolManager::setLanguageToolPath(const QString &path) ...@@ -82,7 +84,7 @@ void LanguageToolManager::setLanguageToolPath(const QString &path)
void LanguageToolManager::loadSettings() void LanguageToolManager::loadSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "LanguageTool"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
mLanguageToolPath = grp.readEntry(QStringLiteral("languagetoolpath"), QStringLiteral("https://languagetool.org/api/v2")); mLanguageToolPath = grp.readEntry(QStringLiteral("languagetoolpath"), QStringLiteral("https://languagetool.org/api/v2"));
mLanguage = grp.readEntry(QStringLiteral("language"), QStringLiteral("en")); mLanguage = grp.readEntry(QStringLiteral("language"), QStringLiteral("en"));
mUseLocalInstance = grp.readEntry(QStringLiteral("useLocalInstance"), false); mUseLocalInstance = grp.readEntry(QStringLiteral("useLocalInstance"), false);
...@@ -91,7 +93,7 @@ void LanguageToolManager::loadSettings() ...@@ -91,7 +93,7 @@ void LanguageToolManager::loadSettings()
void LanguageToolManager::saveSettings() void LanguageToolManager::saveSettings()
{ {
KConfigGroup grp(KSharedConfig::openConfig(), "LanguageTool"); KConfigGroup grp(KSharedConfig::openConfig(), myConfigGroupName);
grp.writeEntry(QStringLiteral("languagetoolpath"), mLanguageToolPath); grp.writeEntry(QStringLiteral("languagetoolpath"), mLanguageToolPath);
grp.writeEntry(QStringLiteral("language"), mLanguage); grp.writeEntry(QStringLiteral("language"), mLanguage);
grp.writeEntry(QStringLiteral("useLocalInstance"), mUseLocalInstance); grp.writeEntry(QStringLiteral("useLocalInstance"), mUseLocalInstance);
......
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