| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
|
| 58 |
friend class AutoDiscover; |
| 59 |
void fakeLookUp(const QUrl &url); |
| 60 |
|
| 61 |
}; |
| 62 |
|
| 63 |
#endif |
| 64 |
|