Cutelyst  1.5.0
viewemail.h
1 /*
2  * Copyright (C) 2015-2016 Daniel Nicoletti <dantti12@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef VIEWEMAIL_H
21 #define VIEWEMAIL_H
22 
23 #include <Cutelyst/cutelyst_global.h>
24 #include <Cutelyst/view.h>
25 
26 namespace Cutelyst {
27 
28 class ViewEmailPrivate;
33 class CUTELYST_VIEW_EMAIL_EXPORT ViewEmail : public Cutelyst::View
34 {
35  Q_OBJECT
36  Q_PROPERTY(QString stashKey READ stashKey WRITE setStashKey)
37  Q_PROPERTY(QByteArray defaultContentType READ defaultContentType WRITE setDefaultContentType)
38  Q_PROPERTY(QByteArray defaultCharset READ defaultCharset WRITE setDefaultCharset)
39  Q_PROPERTY(QByteArray defaultEncoding READ defaultEncoding WRITE setDefaultEncoding)
40 public:
41  enum ConnectionType
42  {
43  TcpConnection,
44  SslConnection,
45  TlsConnection
46  };
47 
48  enum AuthMethod
49  {
50  AuthNone,
51  AuthPlain,
52  AuthLogin
53  };
54 
55  explicit ViewEmail(QObject *parent, const QString &name = QString());
56  virtual ~ViewEmail();
57 
58  QString stashKey() const;
59  void setStashKey(const QString &stashKey);
60 
64  QByteArray defaultContentType() const;
65 
69  void setDefaultContentType(const QByteArray &contentType);
70 
75  QByteArray defaultCharset() const;
76 
85  void setDefaultCharset(const QByteArray &charset);
86 
87  QByteArray defaultEncoding() const;
88  void setDefaultEncoding(const QByteArray &encoding);
89 
90  QString senderHost() const;
91  void setSenderHost(const QString &host);
92 
93  int senderPort() const;
94  void setSenderPort(int port);
95 
96  ConnectionType senderConnectionType() const;
97  void setSenderConnectionType(ConnectionType ct);
98 
99  AuthMethod senderAuthMethod() const;
100  void setSenderAuthMethod(AuthMethod method);
101 
102  QString senderUser() const;
103  void setSenderUser(const QString &user);
104 
105  QString senderPassword() const;
106  void setSenderPassword(const QString &password);
107 
108  QByteArray render(Context *c) const override;
109 
110 protected:
111  ViewEmail(ViewEmailPrivate *d, QObject *parent, const QString &name = QString());
112 
113  Q_DECLARE_PRIVATE(ViewEmail)
114  ViewEmailPrivate *d_ptr;
115 
116 private:
117  void initSender();
118 };
119 
120 }
121 
122 #endif // VIEWEMAIL_H
The Cutelyst Context.
Definition: context.h:52
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7