Remove KActionCollection::setComponentData: this does not work on a KActionCollection...
[kdepim.git] / messagecomposer / composer.h
blob2c6768eed86348948c89c70a7b3e393b473eec9e
1 /*
2 Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
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 the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
20 #ifndef MESSAGECOMPOSER_COMPOSER_H
21 #define MESSAGECOMPOSER_COMPOSER_H
23 #include "jobbase.h"
24 #include "kleo/enum.h"
26 #include "messagecomposer_export.h"
27 #include <QtCore/QByteArray>
28 #include <QtCore/QStringList>
30 #include <kmime/kmime_message.h>
32 #include <messagecore/attachmentpart.h>
34 #include <vector>
35 #include <gpgme++/key.h>
37 namespace boost {
38 template <typename T> class shared_ptr;
41 namespace Message {
43 class ComposerPrivate;
44 class GlobalPart;
45 class InfoPart;
46 class TextPart;
48 /**
49 The message composer.
51 class MESSAGECOMPOSER_EXPORT Composer : public JobBase
53 Q_OBJECT
55 public:
56 explicit Composer( QObject *parent = 0 );
57 virtual ~Composer();
59 QList<KMime::Message::Ptr> resultMessages() const;
61 GlobalPart *globalPart() const;
62 InfoPart *infoPart() const;
63 TextPart *textPart() const;
64 MessageCore::AttachmentPart::List attachmentParts() const;
65 void addAttachmentPart( MessageCore::AttachmentPart::Ptr part );
66 void addAttachmentParts( const MessageCore::AttachmentPart::List &parts );
67 void removeAttachmentPart( MessageCore::AttachmentPart::Ptr part );
69 // if the message and attachments should not be encrypted regardless of settings
70 void setNoCrypto( bool noCrypto );
71 void setSignAndEncrypt( const bool doSign, const bool doEncrypt );
72 void setMessageCryptoFormat( Kleo::CryptoMessageFormat format );
73 void setSigningKeys( std::vector<GpgME::Key>& signers );
74 void setEncryptionKeys(QList<QPair<QStringList, std::vector<GpgME::Key> > > data );
76 /// Sets if this message being composed is an auto-saved message
77 /// if so, might need different handling, such as no crypto attachments.
78 void setAutoSave( bool isAutoSave );
79 bool autoSave() const;
81 bool finished() const;
83 public Q_SLOTS:
84 virtual void start();
86 protected Q_SLOTS:
87 virtual void slotResult( KJob *job );
89 private:
90 Q_DECLARE_PRIVATE( Composer )
92 Q_PRIVATE_SLOT( d_func(), void doStart() )
93 Q_PRIVATE_SLOT( d_func(), void skeletonJobFinished(KJob*) )
94 Q_PRIVATE_SLOT( d_func(), void contentJobFinished(KJob*) )
95 Q_PRIVATE_SLOT( d_func(), void contentJobPreCryptFinished(KJob*) )
96 Q_PRIVATE_SLOT( d_func(), void contentJobPreInlineFinished(KJob*) )
97 Q_PRIVATE_SLOT( d_func(), void signBeforeEncryptJobFinished(KJob*) )
98 Q_PRIVATE_SLOT( d_func(), void attachmentsFinished(KJob*) )
103 #endif