Commit dacd9697 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Use method for getting default config name

parent e75e334d
......@@ -18,7 +18,7 @@
*/
#include "dkimmanagerkey.h"
#include "dkimutil.h"
#include <KSharedConfig>
#include <KConfig>
#include <KConfigGroup>
......@@ -84,7 +84,7 @@ QVector<KeyInfo> DKIMManagerKey::keys() const
void DKIMManagerKey::loadKeys()
{
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(QStringLiteral("dkimsettingsrc"), KConfig::NoGlobals);
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals);
const QStringList keyGroups
= config->groupList().filter(QRegularExpression(QStringLiteral("DKIM Key Record #\\d+")));
......@@ -100,7 +100,7 @@ void DKIMManagerKey::loadKeys()
void DKIMManagerKey::saveKeys()
{
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(QStringLiteral("dkimsettingsrc"), KConfig::NoGlobals);
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(MessageViewer::DKIMUtil::defaultConfigFileName(), KConfig::NoGlobals);
const QStringList filterGroups
= config->groupList().filter(QRegularExpression(QStringLiteral("DKIM Key Record #\\d+")));
......
......@@ -18,7 +18,7 @@
*/
#include "dkimmanagerrules.h"
#include "dkimutil.h"
#include <KConfigGroup>
#include <KSharedConfig>
#include <QRegularExpression>
......@@ -61,7 +61,7 @@ QStringList DKIMManagerRules::ruleGroups(const KSharedConfig::Ptr &config) const
void DKIMManagerRules::loadRules(const QString &fileName)
{
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(fileName.isEmpty() ? QStringLiteral("dkimsettingsrc") : fileName, KConfig::NoGlobals);
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(fileName.isEmpty() ? MessageViewer::DKIMUtil::defaultConfigFileName() : fileName, KConfig::NoGlobals);
const QStringList rulesGroups = ruleGroups(config);
mRules.clear();
......@@ -108,7 +108,7 @@ void DKIMManagerRules::exportRules(const QString &fileName)
void DKIMManagerRules::save(const QString &fileName)
{
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(fileName.isEmpty() ? QStringLiteral("dkimsettingsrc") : fileName, KConfig::NoGlobals);
const KSharedConfig::Ptr &config = KSharedConfig::openConfig(fileName.isEmpty() ? MessageViewer::DKIMUtil::defaultConfigFileName() : fileName, KConfig::NoGlobals);
const QStringList rulesGroups = ruleGroups(config);
for (const QString &group : rulesGroups) {
......
......@@ -158,3 +158,8 @@ QString MessageViewer::DKIMUtil::emailSubDomain(const QString &emailDomain)
}
return emailDomain;
}
QString MessageViewer::DKIMUtil::defaultConfigFileName()
{
return QStringLiteral("dkimsettingsrc");
}
......@@ -32,6 +32,7 @@ MESSAGEVIEWER_TESTS_EXPORT Q_REQUIRED_RESULT QString headerCanonizationRelaxed(c
MESSAGEVIEWER_TESTS_EXPORT Q_REQUIRED_RESULT QString cleanString(QString str);
MESSAGEVIEWER_TESTS_EXPORT Q_REQUIRED_RESULT QString emailDomain(const QString &emailDomain);
MESSAGEVIEWER_TESTS_EXPORT Q_REQUIRED_RESULT QString emailSubDomain(const QString &emailDomain);
MESSAGEVIEWER_TESTS_EXPORT Q_REQUIRED_RESULT QString defaultConfigFileName();
}
}
......
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