1 /* -*- mode: C++; c-file-style: "gnu" -*-
2 This file is part of KMail, the KDE mail client.
3 Copyright (c) 1997 Markus Wuebben <markus.wuebben@kde.org>
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.
20 #ifndef __KMAIL_COMPOSER_H__
21 #define __KMAIL_COMPOSER_H__
23 #include "secondarywindow.h"
26 #include <kglobalsettings.h>
27 #include <kmime/kmime_message.h>
28 #include <akonadi/collection.h>
31 #include <boost/shared_ptr.hpp>
33 class MailComposerIface
;
41 class Composer
: public KMail::SecondaryWindow
45 Composer( const char *name
=0 ) : KMail::SecondaryWindow( name
) {}
48 enum TemplateContext
{ New
, Reply
, ReplyToAll
, Forward
, NoTemplate
};
49 enum VisibleHeaderFlag
{
53 HDR_NEWSGROUPS
= 0x40,
54 HDR_FOLLOWUP_TO
= 0x80,
56 HDR_TRANSPORT
= 0x200,
58 HDR_DICTIONARY
= 0x800,
61 typedef QFlags
<VisibleHeaderFlag
> VisibleHeaderFlags
;
63 public: // mailserviceimpl
65 * From MailComposerIface
67 virtual void send( int how
) = 0;
68 virtual void addAttachmentsAndSend( const KUrl::List
&urls
,
69 const QString
&comment
, int how
) = 0;
70 virtual void addAttachment( const KUrl
&url
, const QString
&comment
) = 0;
71 virtual void addAttachment( const QString
& name
,
72 KMime::Headers::contentEncoding cte
,
73 const QString
& charset
,
74 const QByteArray
& data
,
75 const QByteArray
& mimeType
) = 0;
77 virtual QString
dbusObjectPath() const = 0;
78 public: // kmkernel, kmcommands, callback
80 * Set the message the composer shall work with. This discards
81 * previous messages without calling applyChanges() on them before.
83 virtual void setMsg( const KMime::Message::Ptr
&newMsg
, bool mayAutoSign
=true,
84 bool allowDecryption
=false, bool isModified
=false ) = 0;
87 * Returns @c true while the message composing is in progress.
89 virtual bool isComposing() const = 0;
92 * Set the text selection the message is a response to.
94 virtual void setTextSelection( const QString
& selection
) = 0;
97 * Set custom template to be used for the message.
99 virtual void setCustomTemplate( const QString
& customTemplate
) = 0;
101 virtual void setAutoSaveFileName( const QString
&fileName
) = 0;
105 * If this folder is set, the original message is inserted back after
108 virtual void setFolder( const Akonadi::Collection
& ) = 0;
112 * Sets the focus to the edit-widget and the cursor below the
113 * "On ... you wrote" line when hasMessage is true.
114 * Make sure you call this _after_ setMsg().
116 virtual void setReplyFocus( bool hasMessage
=true ) = 0;
119 * Sets the focus to the subject line edit. For use when creating a
120 * message to a known recipient.
122 virtual void setFocusToSubject() = 0;
125 /** Disabled signing and encryption completely for this composer window. */
126 virtual void setSigningAndEncryptionDisabled( bool v
) = 0;
128 public slots
: // kmkernel, callback
129 virtual void slotSendNow() = 0;
131 public slots
: // kmkernel
133 Tell the composer to always send the message, even if the user
134 hasn't changed the text. This is useful if a message is
135 autogenerated (e.g., via a D-Bus call), and the user should
136 simply be able to confirm the message and send it.
138 virtual void slotSetAlwaysSend( bool bAlwaysSend
) = 0;
140 public slots
: // kmkernel, callback
142 * Switch wordWrap on/off
144 virtual void slotWordWrapToggled( bool ) = 0;
146 public slots
: // kmkernel
147 virtual void autoSaveMessage() = 0;
149 public: // kmkernel, attachmentlistview
150 virtual void disableWordWrap() = 0;
152 virtual void forceDisableHtml() = 0;
154 virtual void disableRecipientNumberCheck() = 0;
156 virtual void disableForgottenAttachmentsCheck() = 0;
158 virtual void ignoreStickyFields() = 0;
162 * Add an attachment to the list.
164 virtual void addAttach( KMime::Content
*msgPart
) = 0;
167 Composer
*makeComposer( const KMime::Message::Ptr
&msg
= KMime::Message::Ptr(),
168 Composer::TemplateContext context
= Composer::NoTemplate
,
169 uint identity
= 0, const QString
& textSelection
= QString(),
170 const QString
& customTemplate
= QString() );
174 #endif // __KMAIL_COMPOSER_H__