| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#ifndef SERVERCONFIGURATION_H |
| 17 |
#define SERVERCONFIGURATION_H |
| 18 |
|
| 19 |
#include <QObject> |
| 20 |
#include <QVariantMap> |
| 21 |
|
| 22 |
class ServerConfiguration : public QObject |
| 23 |
{ |
| 24 |
Q_OBJECT |
| 25 |
Q_PROPERTY(QString imapHostName READ imapHost NOTIFY configChanged ) |
| 26 |
Q_PROPERTY(int imapPort READ imapPort NOTIFY configChanged ) |
| 27 |
Q_PROPERTY(NetworkMethod imapMethod READ imapMethod NOTIFY configChanged) |
| 28 |
Q_PROPERTY(QString smtpHostName READ smtpHost NOTIFY configChanged ) |
| 29 |
Q_PROPERTY(int smtpPort READ smtpPort NOTIFY configChanged ) |
| 30 |
Q_PROPERTY(NetworkMethod smtpMethod READ smtpMethod NOTIFY configChanged ) |
| 31 |
Q_PROPERTY(bool isValid READ isValid NOTIFY configChanged) |
| 32 |
Q_ENUMS(NetworkMethod) |
| 33 |
Q_ENUMS(DefaultPorts) |
| 34 |
|
| 35 |
public: |
| 36 |
explicit ServerConfiguration(QObject *parent = 0); |
| 37 |
|
| 38 |
enum NetworkMethod { |
| 39 |
INVALID, |
| 40 |
CLEAR_TEXT, |
| 41 |
STARTTLS, |
| 42 |
SSL_TLS, |
| 43 |
}; |
| 44 |
|
| 45 |
enum DefaultPorts { |
| 46 |
PORT_IMAP = 143, |
| 47 |
PORT_IMAPS = 993, |
| 48 |
PORT_SMTP = 587, |
| 49 |
PORT_SSMTP = 465 |
| 50 |
}; |
| 51 |
|
| 52 |
|
| 53 |
QString imapHost() const; |
| 54 |
void setImapHost(const QString &hostname); |
| 55 |
int imapPort() const; |
| 56 |
void setImapPort(const int &port); |
| 57 |
NetworkMethod imapMethod() const; |
| 58 |
void setImapMethod(const NetworkMethod &method); |
| 59 |
|
| 60 |
|
| 61 |
QString smtpHost() const; |
| 62 |
void setSmtpHost(const QString &hostname); |
| 63 |
int smtpPort() const; |
| 64 |
void setSmtpPort(const int &port); |
| 65 |
NetworkMethod smtpMethod() const; |
| 66 |
void setSmtpMethod(const NetworkMethod &method); |
| 67 |
|
| 68 |
bool isValid() const; |
| 69 |
Q_INVOKABLE QVariantMap toMap() const; |
| 70 |
|
| 71 |
bool operator ==(const ServerConfiguration *config) const; |
| 72 |
|
| 73 |
signals: |
| 74 |
void configChanged(); |
| 75 |
|
| 76 |
private: |
| 77 |
QString m_imapHost; |
| 78 |
QString m_smtpHost; |
| 79 |
int m_imapPort; |
| 80 |
int m_smtpPort; |
| 81 |
NetworkMethod m_imapMethod; |
| 82 |
NetworkMethod m_smtpMethod; |
| 83 |
|
| 84 |
}; |
| 85 |
|
| 86 |
#endif |