File indexing completed on 2024-12-22 04:52:48

0001 /*
0002    SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "abstractbase.h"
0010 #include "libimportwizard_export.h"
0011 #include <KSharedConfig>
0012 #include <QMap>
0013 
0014 namespace KIdentityManagementCore
0015 {
0016 class Identity;
0017 class IdentityManager;
0018 }
0019 
0020 namespace MailTransport
0021 {
0022 class Transport;
0023 }
0024 
0025 class LIBIMPORTWIZARD_EXPORT AbstractSettings : public LibImportWizard::AbstractBase
0026 {
0027     Q_OBJECT
0028 public:
0029     AbstractSettings();
0030     ~AbstractSettings() override;
0031 
0032 protected:
0033     void addImportInfo(const QString &log) override;
0034     void addImportError(const QString &log) override;
0035 
0036     void syncKmailConfig();
0037 
0038     QString uniqueIdentityName(const QString &name);
0039 
0040     QString createResource(const QString &resources, const QString &name, const QMap<QString, QVariant> &settings);
0041 
0042     KIdentityManagementCore::Identity *createIdentity(QString &name);
0043 
0044     MailTransport::Transport *createTransport();
0045 
0046     void storeTransport(MailTransport::Transport *mt, bool isDefault = false);
0047 
0048     void storeIdentity(KIdentityManagementCore::Identity *identity);
0049 
0050     void addKmailConfig(const QString &groupName, const QString &key, const QString &value);
0051     void addKmailConfig(const QString &groupName, const QString &key, bool value);
0052     void addKmailConfig(const QString &groupName, const QString &key, int value);
0053 
0054     void addComposerHeaderGroup(const QString &groupName, const QString &name, const QString &value);
0055 
0056     void addCheckMailOnStartup(const QString &agentIdentifyName, bool loginAtStartup);
0057     void addToManualCheck(const QString &agentIdentifyName, bool manualCheck);
0058     int readKmailSettings(const QString &groupName, const QString &key);
0059 
0060     KIdentityManagementCore::IdentityManager *mManager = nullptr;
0061     KSharedConfigPtr mKmailConfig;
0062 };