1 /* Copyright (C) 2014 Dan Chapman <dpniel@ubuntu.com>
2 Copyright (C) 2006 - 2016 Jan Kundrát <jkt@kde.org>
4 This file is part of the Trojita Qt IMAP e-mail client,
5 http://trojita.flaska.net/
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of
10 the License or (at your option) version 3 or any later version
11 accepted by the membership of KDE e.V. (or its successor approved
12 by the membership of KDE e.V.), which shall act as a proxy
13 defined in Section 14 of version 3 of the license.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
32 class Account
: public QObject
36 Q_PROPERTY(QString server READ server WRITE setServer NOTIFY serverChanged
)
37 Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged
)
38 Q_PROPERTY(QString username READ username WRITE setUsername NOTIFY usernameChanged
)
39 Q_PROPERTY(bool authenticateEnabled READ authenticateEnabled WRITE setAuthenticateEnabled NOTIFY authenticateEnabledChanged
)
40 Q_PROPERTY(bool reuseImapAuthentication READ reuseImapAuthentication WRITE setReuseImapAuthentication NOTIFY reuseImapAuthenticationChanged
)
41 Q_PROPERTY(QString pathToSendmail READ pathToSendmail WRITE setPathToSendmail NOTIFY pathToSendmailChanged
)
42 Q_PROPERTY(bool saveToImap READ saveToImap WRITE setSaveToImap NOTIFY saveToImapChanged
)
43 Q_PROPERTY(QString sentMailboxName READ sentMailboxName WRITE setSentMailboxName NOTIFY sentMailboxNameChanged
)
44 Q_PROPERTY(bool useBurl READ useBurl WRITE setUseBurl NOTIFY useBurlChanged
)
45 Q_PROPERTY(Method submissionMethod READ submissionMethod WRITE setSubmissionMethod NOTIFY submissionMethodChanged
)
49 Account(QObject
*parent
, QSettings
*settings
, const QString
&accountName
);
52 SMTP
, /**< Non-encrypted connection over network */
53 SSMTP
, /**< Encrypted network connection from the start */
54 SMTP_STARTTLS
, /**< Starts with a non-encrypted network connection. Which gets upgraded using STARTTLS */
55 SENDMAIL
, /**< Use a local Sendmail compatible transfer agent */
56 IMAP_SENDMAIL
, /**< Uses the IMAP SENDMAIL Extension */
59 Method
submissionMethod() const;
60 QString
server() const;
62 QString
username() const;
63 bool authenticateEnabled() const;
64 bool reuseImapAuthentication() const;
65 QString
pathToSendmail() const;
66 bool saveToImap() const;
67 QString
sentMailboxName() const;
70 static quint16
defaultPort(const Method method
);
72 Q_INVOKABLE
void saveSettings();
73 Q_INVOKABLE
void restoreSettings();
76 void submissionMethodChanged();
79 void usernameChanged();
80 void authenticateEnabledChanged();
81 void reuseImapAuthenticationChanged();
82 void pathToSendmailChanged();
83 void saveToImapChanged();
84 void sentMailboxNameChanged();
85 void useBurlChanged();
86 void showPortWarning(const QString
&message
);
88 void settingsRestored();
91 void setSubmissionMethod(const Method method
);
92 void setServer(const QString
&server
);
93 void setPort(const quint16 port
);
94 void setUsername(const QString
&username
);
95 void setAuthenticateEnabled(const bool auth
);
96 void setReuseImapAuthentication(const bool reuseImapAuth
);
97 void setPathToSendmail(const QString
&pathToSendmail
);
98 void setSaveToImap(const bool selected
);
99 void setSentMailboxName(const QString
&location
);
100 void setUseBurl(const bool selected
);
103 void maybeShowPortWarning();
106 QSettings
*m_settings
;
107 QString m_accountName
;
112 bool m_authenticateEnabled
;
113 bool m_reuseImapAuth
;
114 QString m_pathToSendmail
;
116 QString m_sentMailboxName
;
119 Method m_msaSubmissionMethod
;
125 Q_DECLARE_METATYPE(MSA::Account::Method
)
127 #endif // MSA_ACCOUNT_H