Debian Codegraph @

Dekko/backend/accounts/quick/PresetProviderModel.h

raw symbols SCIP
1 /* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef PRESETPROVIDERMODEL_H
19 #define PRESETPROVIDERMODEL_H
20
21 #include <QObject>
22 #include <QSettings>
23 #include <QmlObjectListModel.h>
24 #include <Helpers.h>
25
26 typedef QSettings ProviderFile;
27
28 class Provider : public QObject
29 {
30 public:
31 Provider(QObject *parent, const QString &description, const int &type);
32 Provider(QObject *parent, const QString &providerFilePath, const QString &group);
33
34 enum Type {
35 INVALID,
36 PRESET,
37 IMAP,
38 POP3,
39 SMTP
40 };
41 QString icon();
42
43 private:
44 Q_OBJECT
45 Q_ENUMS(Type)
46 QML_READONLY_PROPERTY(QString, description)
47 QML_READONLY_PROPERTY(QString, domain)
48 QML_READONLY_PROPERTY(QString, imapHost)
49 QML_READONLY_PROPERTY(int, imapPort)
50 QML_READONLY_PROPERTY(bool, imapUseSSL)
51 QML_READONLY_PROPERTY(bool, imapStartTLS)
52 QML_READONLY_PROPERTY(QString, smtpHost)
53 QML_READONLY_PROPERTY(int, smtpPort)
54 QML_READONLY_PROPERTY(bool, smtpUseSSL)
55 QML_READONLY_PROPERTY(bool, smtpStartTLS)
56 QML_READONLY_PROPERTY(Type, type)
57 Q_PROPERTY(QString icon READ icon CONSTANT)
58
59 };
60
61 class PresetProviderModel : public QObject
62 {
63 Q_OBJECT
64 Q_PROPERTY(QObject *model READ model NOTIFY modelChanged)
65 public:
66 explicit PresetProviderModel(QObject *parent = 0);
67
68 QObject *model() const { return m_model; }
69
70 signals:
71 void modelChanged();
72 public slots:
73 void init();
74
75 private:
76 QQmlObjectListModel<Provider> *m_model;
77 QString m_providers;
78 };
79
80 #endif // PRESETPROVIDERMODEL_H