Build with non-standard boost locations.
[kdepim.git] / messagecomposer / akonadisender.h
blob93760f77cdb8c5a5c5113d73894b1e2625212365
1 /*
2 * This file is part of KMail.
3 * Copyright (c) 2009 Constantin Berzan <exit3219@gmail.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef AKONADISENDER_H
20 #define AKONADISENDER_H
22 #include "messagesender.h"
23 #include "messagecomposer_export.h"
25 #include <QObject>
26 #include <QString>
27 #include <QSet>
29 #include <kmime/kmime_message.h>
31 class KJob;
33 namespace KPIM {
34 class ProgressItem;
37 class MESSAGECOMPOSER_EXPORT AkonadiSender: public QObject, public MessageSender
39 Q_OBJECT
41 public:
42 AkonadiSender();
44 protected:
45 /**
46 Send given message. The message is either queued or sent
47 immediately. The default behaviour, as selected with
48 setSendImmediate(), can be overwritten with the parameter
49 sendNow (by specifying true or false).
50 The sender takes ownership of the given message on success,
51 so DO NOT DELETE OR MODIFY the message further.
52 Returns true on success.
54 TODO cberzan: update docu...
56 virtual bool doSend( const KMime::Message::Ptr &msg, short sendNow );
58 /**
59 Send queued messages, using the specified transport or the
60 default, if none is given.
62 virtual bool doSendQueued( const QString &transport = QString() );
64 private:
65 /**
66 Queue or send immediately one message using MailTransport::MessageQueueJob.
68 void sendOrQueueMessage( const KMime::Message::Ptr &msg, MessageSender::SendMethod method = MessageSender::SendDefault );
70 private slots:
71 void queueJobResult( KJob *job );
73 private:
74 QString mCustomTransport;
75 KPIM::ProgressItem *mProgressItem;
76 QSet<KJob*> mPendingJobs;
80 #endif /* AKONADISENDER_H */