diff options
Diffstat (limited to 'framework/src/domain/composercontroller.h')
-rw-r--r-- | framework/src/domain/composercontroller.h | 57 |
1 files changed, 11 insertions, 46 deletions
diff --git a/framework/src/domain/composercontroller.h b/framework/src/domain/composercontroller.h index 995f4a2e..70a88900 100644 --- a/framework/src/domain/composercontroller.h +++ b/framework/src/domain/composercontroller.h | |||
@@ -41,6 +41,8 @@ inline bool operator !=(const KMime::Types::Mailbox &l, const KMime::Types::Mail | |||
41 | 41 | ||
42 | Q_DECLARE_METATYPE(KMime::Types::Mailbox); | 42 | Q_DECLARE_METATYPE(KMime::Types::Mailbox); |
43 | 43 | ||
44 | Q_DECLARE_METATYPE(GpgME::Key); | ||
45 | |||
44 | namespace KMime { | 46 | namespace KMime { |
45 | class Message; | 47 | class Message; |
46 | } | 48 | } |
@@ -57,7 +59,6 @@ class ComposerController : public Kube::Controller | |||
57 | KUBE_CONTROLLER_PROPERTY(bool, HtmlBody, htmlBody) | 59 | KUBE_CONTROLLER_PROPERTY(bool, HtmlBody, htmlBody) |
58 | KUBE_CONTROLLER_PROPERTY(bool, Encrypt, encrypt) | 60 | KUBE_CONTROLLER_PROPERTY(bool, Encrypt, encrypt) |
59 | KUBE_CONTROLLER_PROPERTY(bool, Sign, sign) | 61 | KUBE_CONTROLLER_PROPERTY(bool, Sign, sign) |
60 | KUBE_CONTROLLER_PROPERTY(bool, EncryptionAvailable, encryptionAvailable) | ||
61 | 62 | ||
62 | //Set by identitySelector | 63 | //Set by identitySelector |
63 | KUBE_CONTROLLER_PROPERTY(KMime::Types::Mailbox, Identity, identity) | 64 | KUBE_CONTROLLER_PROPERTY(KMime::Types::Mailbox, Identity, identity) |
@@ -67,26 +68,21 @@ class ComposerController : public Kube::Controller | |||
67 | KUBE_CONTROLLER_PROPERTY(KMime::Message::Ptr, ExistingMessage, existingMessage) | 68 | KUBE_CONTROLLER_PROPERTY(KMime::Message::Ptr, ExistingMessage, existingMessage) |
68 | KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::Mail, ExistingMail, existingMail) | 69 | KUBE_CONTROLLER_PROPERTY(Sink::ApplicationDomain::Mail, ExistingMail, existingMail) |
69 | 70 | ||
71 | KUBE_CONTROLLER_PROPERTY(/*std::vector<GpgME::Key>*/QVariant, PersonalKeys, personalKeys) | ||
72 | KUBE_CONTROLLER_PROPERTY(bool, FoundPersonalKeys, foundPersonalKeys) | ||
73 | |||
74 | KUBE_CONTROLLER_LISTCONTROLLER(to) | ||
75 | KUBE_CONTROLLER_LISTCONTROLLER(cc) | ||
76 | KUBE_CONTROLLER_LISTCONTROLLER(bcc) | ||
77 | KUBE_CONTROLLER_LISTCONTROLLER(attachments) | ||
78 | |||
70 | Q_PROPERTY (Completer* recipientCompleter READ recipientCompleter CONSTANT) | 79 | Q_PROPERTY (Completer* recipientCompleter READ recipientCompleter CONSTANT) |
71 | Q_PROPERTY (Selector* identitySelector READ identitySelector CONSTANT) | 80 | Q_PROPERTY (Selector* identitySelector READ identitySelector CONSTANT) |
72 | //Q_PROPERTY (QValidator* subjectValidator READ subjectValidator CONSTANT) | ||
73 | |||
74 | Q_PROPERTY (QAbstractItemModel* toModel READ toModel CONSTANT) | ||
75 | Q_PROPERTY (QAbstractItemModel* ccModel READ ccModel CONSTANT) | ||
76 | Q_PROPERTY (QAbstractItemModel* bccModel READ bccModel CONSTANT) | ||
77 | Q_PROPERTY (QAbstractItemModel* attachmentModel READ attachmentModel CONSTANT) | ||
78 | 81 | ||
79 | KUBE_CONTROLLER_ACTION(send) | 82 | KUBE_CONTROLLER_ACTION(send) |
80 | KUBE_CONTROLLER_ACTION(saveAsDraft) | 83 | KUBE_CONTROLLER_ACTION(saveAsDraft) |
81 | 84 | ||
82 | public: | 85 | public: |
83 | enum AddresseeRoles { | ||
84 | KeyFoundRole = Qt::UserRole + 1, | ||
85 | KeyMissingRole, | ||
86 | KeyRole, | ||
87 | AddresseeNameRole | ||
88 | }; | ||
89 | |||
90 | explicit ComposerController(); | 86 | explicit ComposerController(); |
91 | 87 | ||
92 | Completer *recipientCompleter() const; | 88 | Completer *recipientCompleter() const; |
@@ -94,50 +90,19 @@ public: | |||
94 | 90 | ||
95 | Q_INVOKABLE void loadMessage(const QVariant &draft, bool loadAsDraft); | 91 | Q_INVOKABLE void loadMessage(const QVariant &draft, bool loadAsDraft); |
96 | 92 | ||
97 | QAbstractItemModel *toModel() const; | ||
98 | QAbstractItemModel *ccModel() const; | ||
99 | QAbstractItemModel *bccModel() const; | ||
100 | QAbstractItemModel *attachmentModel() const; | ||
101 | |||
102 | Q_INVOKABLE void addTo(const QString &); | ||
103 | Q_INVOKABLE void removeTo(const QString &); | ||
104 | Q_INVOKABLE void addCc(const QString &); | ||
105 | Q_INVOKABLE void removeCc(const QString &); | ||
106 | Q_INVOKABLE void addBcc(const QString &); | ||
107 | Q_INVOKABLE void removeBcc(const QString &); | ||
108 | Q_INVOKABLE void addAttachment(const QUrl &); | ||
109 | Q_INVOKABLE void removeAttachment(const QUrl &); | ||
110 | |||
111 | public slots: | 93 | public slots: |
112 | virtual void clear() Q_DECL_OVERRIDE; | 94 | virtual void clear() Q_DECL_OVERRIDE; |
113 | 95 | ||
114 | private slots: | 96 | private slots: |
115 | void updateSendAction(); | ||
116 | void updateSaveAsDraftAction(); | ||
117 | void findPersonalKey(); | 97 | void findPersonalKey(); |
118 | 98 | ||
119 | private: | 99 | private: |
120 | enum AttachmentRoles { | ||
121 | NameRole = Qt::UserRole + 1, | ||
122 | FilenameRole, | ||
123 | ContentRole, | ||
124 | MimeTypeRole, | ||
125 | DescriptionRole, | ||
126 | InlineRole, | ||
127 | IconNameRole, | ||
128 | UrlRole | ||
129 | }; | ||
130 | |||
131 | void recordForAutocompletion(const QByteArray &addrSpec, const QByteArray &displayName); | 100 | void recordForAutocompletion(const QByteArray &addrSpec, const QByteArray &displayName); |
132 | void setMessage(const QSharedPointer<KMime::Message> &msg); | 101 | void setMessage(const QSharedPointer<KMime::Message> &msg); |
133 | void addAttachmentPart(KMime::Content *partToAttach); | 102 | void addAttachmentPart(KMime::Content *partToAttach); |
134 | KMime::Message::Ptr assembleMessage(); | 103 | KMime::Message::Ptr assembleMessage(); |
104 | std::vector<GpgME::Key> getRecipientKeys(); | ||
135 | 105 | ||
136 | QScopedPointer<Completer> mRecipientCompleter; | 106 | QScopedPointer<Completer> mRecipientCompleter; |
137 | QScopedPointer<Selector> mIdentitySelector; | 107 | QScopedPointer<Selector> mIdentitySelector; |
138 | QSharedPointer<AddresseeModel> mToModel; | ||
139 | QSharedPointer<AddresseeModel> mCcModel; | ||
140 | QSharedPointer<AddresseeModel> mBccModel; | ||
141 | QScopedPointer<QStandardItemModel> mAttachmentModel; | ||
142 | std::vector<GpgME::Key> mPersonalKeys; | ||
143 | }; | 108 | }; |