doc update to 4.11
[kdepim.git] / messagecomposer / messagesender.h
blobb6743b2793f1ba64658721db65fb1e08383ab7c9
1 /*
2 messagesender.h
4 This file is part of KMail, the KDE mail client
5 Copyright (c) 2005 Klarälvdalens Datakonsult AB
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 KMail is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 In addition, as a special exception, the copyright holders give
22 permission to link the code of this program with any edition of
23 the Qt library by Trolltech AS, Norway (or with modified versions
24 of Qt that use the same license as Qt), and distribute linked
25 combinations including the two. You must obey the GNU General
26 Public License in all respects for all of the code used other than
27 Qt. If you modify this file, you may extend this exception to
28 your version of the file, but you are not obligated to do so. If
29 you do not wish to do so, delete this exception statement from
30 your version.
33 #ifndef __KMAIL_MESSAGESENDER_H__
34 #define __KMAIL_MESSAGESENDER_H__
35 #include <QString>
37 #include <kmime/kmime_message.h>
39 class MessageSender {
40 protected:
41 virtual ~MessageSender() = 0;
43 public:
44 enum SendMethod {
45 SendDefault = -1,
46 SendImmediate = true,
47 SendLater = false
49 enum SaveIn {
50 SaveInNone,
51 SaveInDrafts,
52 SaveInTemplates
54 /**
55 Send given message.
57 The message is either queued (@p method == SendLater) or sent
58 immediately (@p method = SendImmediate). The default behaviour,
59 as selected with setSendImmediate(), can be overwritten with the
60 parameter @p method. The sender takes ownership of the given
61 message on success, so DO NOT DELETE OR MODIFY the message
62 further.
64 FIXME: what about send() == false?
66 @return true on success.
68 bool send( const KMime::Message::Ptr &msg, SendMethod method=SendDefault ) { return doSend( msg, method ); }
70 /**
71 Start sending all queued messages.
73 FIXME: what does success mean here, if it's only _start_ sending?
75 Optionally a transport can be specified that will be used as the
76 default transport.
78 @return true on success.
80 bool sendQueued( const QString & transport=QString() ) { return doSendQueued( transport ); }
82 protected:
83 virtual bool doSend( const KMime::Message::Ptr &msg, short sendNow ) = 0;
84 virtual bool doSendQueued( const QString& transport ) = 0;
87 inline MessageSender::~MessageSender() {}
90 #endif /* __KMAIL_MESSAGESENDER_H__ */