Debian Codegraph @

Dekko/backend/autoconfig/autoconfig.h

raw symbols SCIP
1 /* Copyright (C) 2015 Dan Chapman <[email protected]>
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License as
5 published by the Free Software Foundation; either version 2 of
6 the License or (at your option) version 3
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #ifndef AUTOCONFIG_H
17 #define AUTOCONFIG_H
18
19 #include <QObject>
20 #include <QUrl>
21 #include <QNetworkAccessManager>
22 #include <QNetworkRequest>
23 #include <QNetworkReply>
24 #include <QPointer>
25 #include "emailprovider.h"
26
27 #ifdef USE_CONNECTIVITY_API
28 #include <connectivityqt/connectivity.h>
29 using connectivityqt::Connectivity;
30 #endif
31
32 class AutoDiscover;
33 class AutoConfig : public QObject
34 {
35 Q_OBJECT
36 public:
37 AutoConfig(QObject *parent, EmailProvider *config);
38
39 public slots:
40 void findLocal(const QString &domain);
41 void lookUp(const QUrl &url);
42 bool networkAccessible() const;
43
44 signals:
45 void success(EmailProvider *serverConfig);
46 void failed();
47
48 private slots:
49 void handleRequestResponse(QNetworkReply *reply);
50
51 private:
52 #ifdef USE_CONNECTIVITY_API
53 QScopedPointer<Connectivity> m_netStatus;
54 #endif
55 QPointer<EmailProvider> m_config;
56 QPointer<QNetworkAccessManager> m_nam;
57 // For unit tests
58 friend class AutoDiscover;
59 void fakeLookUp(const QUrl &url);
60
61 };
62
63 #endif // AUTOCONFIG_H
64