File indexing completed on 2024-10-27 04:58:02
0001 /* 0002 SPDX-FileCopyrightText: 2009 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 // This code was taken from kmail-account-wizard 0008 0009 #pragma once 0010 0011 #include "setupobject.h" 0012 0013 #include <Akonadi/AgentInstance> 0014 0015 #include <QMap> 0016 0017 class KJob; 0018 0019 class Resource : public SetupObject 0020 { 0021 Q_OBJECT 0022 public: 0023 explicit Resource(const QString &type, QObject *parent = nullptr); 0024 void create() override; 0025 void destroy() override; 0026 void edit(); 0027 0028 public Q_SLOTS: 0029 Q_SCRIPTABLE void setName(const QString &name); 0030 Q_SCRIPTABLE void setOption(const QString &key, const QVariant &value); 0031 Q_SCRIPTABLE Q_REQUIRED_RESULT QString identifier(); 0032 Q_SCRIPTABLE void reconfigure(); 0033 Q_SCRIPTABLE void setEditMode(const bool editMode); 0034 0035 private: 0036 void instanceCreateResult(KJob *job); 0037 0038 const QString m_typeIdentifier; 0039 QString m_name; 0040 QMap<QString, QVariant> m_settings; 0041 Akonadi::AgentInstance m_instance; 0042 0043 bool m_editMode = false; 0044 };