23 #ifndef __KMComposeWin
24 #define __KMComposeWin
28 #include "messagecomposer/recipient/recipientseditor.h"
35 #include <kglobalsettings.h>
38 #include <messagecomposer/composer/kmeditor.h>
40 #include "messagecomposer/sender/messagesender.h"
43 #include <kmime/kmime_message.h>
44 #include <kmime/kmime_headers.h>
47 #include "kleo/enum.h"
48 #include <composer/composerviewbase.h>
65 class KRecentFilesAction;
67 class SelectSpecialChar;
76 class DictionaryComboBox;
79 namespace KPIMIdentities {
83 namespace KPIMTextEdit {
84 class SelectSpecialChar;
91 namespace MessageComposer {
92 class ComposerLineEdit;
94 class SubjectLineEditWithAutoCorrection;
97 namespace MailCommon {
98 class FolderRequester;
101 namespace PimCommon {
102 class TranslatorWidget;
109 Q_CLASSINFO(
"D-Bus Interface",
"org.kde.kmail.mailcomposer")
115 uint
identity = 0, const QString & textSelection = QString(),
116 const QString & customTemplate = QString() );
121 uint identity = 0, const QString & textSelection = QString(),
122 const QString & customTemplate = QString() );
134 Q_SCRIPTABLE
void send(
int how );
137 const QString & comment,
141 const QString & comment );
144 KMime::Headers::contentEncoding cte,
145 const QString& charset,
146 const QByteArray & data,
147 const QByteArray & mimeType );
162 void setMessage( const KMime::Message::Ptr &newMsg,
bool lastSignState = false,
bool lastEncryptState = false,
163 bool mayAutoSign=true,
bool allowDecryption=false,
bool isModified=false );
172 void setFcc( const QString &idString );
193 bool isComposing()
const {
return mComposerBase && mComposerBase->isComposing(); }
208 mSigningAndEncryptionExplicitlyDisabled = v;
214 void setFolder(
const Akonadi::Collection &aFolder ) { mFolder = aFolder; }
241 void writeConfig(
void );
248 KMime::Message::Ptr msg()
const {
return mMsg; }
252 bool isModified()
const;
253 bool isComposerModified()
const;
254 void changeModifiedState(
bool modified );
261 bool inlineSigningEncryptionSelected();
269 static QString prettyMimeType(
const QString &type );
294 void disableHtml( MessageComposer::ComposerViewBase::Confirmation confirmation );
305 void slotPrintPreview();
307 void slotInsertRecentFile(
const KUrl & );
308 void slotRecentListFileClear();
310 void slotSendNowVia( QAction * );
311 void slotSendLater();
312 void slotSendLaterVia( QAction * );
313 void getTransportMenu();
318 void slotSaveDraft();
319 void slotSaveTemplate();
320 void slotNewComposer();
321 void slotNewMailReader();
329 void slotPasteAsAttachment();
331 void slotTranslatorWasClosed();
333 void slotFolderRemoved(
const Akonadi::Collection& );
334 void slotLanguageChanged(
const QString &language );
335 void slotFccFolderChanged(
const Akonadi::Collection&);
336 void slotEditorTextChanged();
337 void slotOverwriteModeChanged();
341 void slotUpdateFont();
351 void slotInsertFile();
356 void slotSpellcheckConfig();
362 void slotSelectCryptoModule(
bool init =
false );
367 void slotEditToolbars();
368 void slotUpdateToolbars();
374 void readConfig(
bool reload =
false );
379 void slotUpdWinTitle();
385 void slotEncryptToggled(
bool );
390 void slotSignToggled(
bool );
400 void slotIdentityChanged( uint uoid,
bool initalChange =
false );
402 void slotCursorPositionChanged();
404 void slotSpellCheckingStatus(
const QString & status );
406 void slotDelayedApplyTemplate(
KJob* );
408 void recipientEditorSizeHintChanged();
409 void setMaximumHeaderSize();
410 void slotDoDelayedSend(
KJob* );
412 void slotCompletionModeChanged( KGlobalSettings::Completion );
413 void slotConfigChanged();
415 void slotPrintComposeResult(
KJob *job );
419 void slotSendFailed(
const QString& msg , MessageComposer::ComposerViewBase::FailedType type);
420 void slotSendSuccessful();
425 void slotAutoSpellCheckingToggled(
bool );
430 void slotUpdateSignatureAndEncrypionStateIndicators();
432 virtual void setAutoSaveFileName(
const QString& fileName );
433 void slotSpellCheckingLanguage(
const QString& language);
434 void forceAutoSaveMessage();
435 void insertSpecialCharacter();
436 void charSelected(
const QChar& c);
437 void slotSaveAsFile();
438 void slotCreateAddressBookContact();
440 void slotAttachMissingFile();
441 void slotCloseAttachMissingFile();
442 void slotExplicitClosedMissingAttachment();
443 void slotVerifyMissingAttachmentTimeout();
444 void slotCheckSendNow();
446 void slotUpperCase();
447 void slotLowerCase();
449 void slotExternalEditorStarted();
450 void slotExternalEditorClosed();
455 void addAttach( KMime::Content *msgPart );
457 const KPIMIdentities::Identity &
identity()
const;
474 void updateSignature(uint uoid, uint uOldId);
475 Kleo::CryptoMessageFormat cryptoMessageFormat()
const;
476 QString overwriteModeStr()
const;
477 void printComposeResult(
KJob *job,
bool preview );
478 void printComposer(
bool preview);
484 void rethinkFields(
bool fromslot=
false );
494 void rethinkHeaderLine(
int aValue,
int aMask,
int &aRow,
496 QPushButton *aBtn = 0 );
498 void rethinkHeaderLine(
int value,
int mask,
int &row,
505 void applyTemplate(uint uoid , uint uOldId);
510 void setQuotePrefix( uint uoid );
516 bool checkRecipientNumber()
const;
518 bool checkTransport()
const;
523 void setupStatusBar(
QWidget *w);
529 QString subject()
const;
530 QString from()
const;
531 QString replyTo()
const;
533 void setCharset(
const QByteArray &charset );
534 void setAutoCharset();
539 virtual bool queryClose();
545 void setEncryption(
bool encrypt,
bool setByUser =
false );
551 void setSigning(
bool sign,
bool setByUser =
false );
553 MessageComposer::ComposerViewBase::MissingAttachment userForgotAttachment();
562 static void decryptOrStripOffCleartextSignature( QByteArray & );
567 void doSend( MessageComposer::MessageSender::SendMethod method=MessageComposer::MessageSender::SendDefault,
568 MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInNone );
570 void doDelayedSend( MessageComposer::MessageSender::SendMethod method, MessageComposer::MessageSender::SaveIn saveIn );
572 void changeCryptoAction();
573 void applyComposerSetting( MessageComposer::ComposerViewBase* mComposerBase );
581 MessageComposer::Composer* createSimpleComposer();
583 bool canSignEncryptAttachments()
const {
584 return cryptoMessageFormat() != Kleo::InlineOpenPGPFormat;
587 QString addQuotesToText(
const QString &inputText )
const;
589 int calcColumnWidth(
int which,
long allShowing,
int width )
const;
595 void initHeader( KMime::Message *message, uint
identity=0 );
597 inline bool encryptToSelf();
601 Sonnet::DictionaryComboBox *mDictionaryCombo;
602 MessageComposer::ComposerLineEdit *mEdtFrom, *mEdtReplyTo;
603 MessageComposer::SubjectLineEditWithAutoCorrection *mEdtSubject;
604 QLabel *mLblIdentity, *mLblTransport, *mLblFcc;
605 QLabel *mLblFrom, *mLblReplyTo;
608 QCheckBox *mBtnIdentity, *mBtnDictionary, *mBtnTransport, *mBtnFcc;
611 KMime::Message::Ptr mMsg;
613 QString mTextSelection;
614 QString mCustomTemplate;
615 bool mLastSignActionState, mLastEncryptActionState, mSigningAndEncryptionExplicitlyDisabled;
616 bool mLastIdentityHasSigningKey, mLastIdentityHasEncryptionKey;
617 Akonadi::Collection mFolder;
619 bool mForceDisableHtml;
622 QFont mBodyFont, mFixedFont;
626 KRecentFilesAction *mRecentAction;
628 KToggleAction *mSignAction, *mEncryptAction, *mRequestMDNAction;
629 KToggleAction *mUrgentAction, *mAllFieldsAction, *mFromAction;
630 KToggleAction *mReplyToAction;
631 KToggleAction *mSubjectAction;
632 KToggleAction *mIdentityAction, *mTransportAction, *mFccAction;
633 KToggleAction *mWordWrapAction, *mFixedFontAction, *mAutoSpellCheckingAction;
634 KToggleAction *mDictionaryAction, *mSnippetAction, *mTranslateAction;
636 KToggleAction *markupAction;
639 KSelectAction *mCryptoModuleAction;
641 KAction *mFindText, *mFindNextText, *mReplaceText, *mSelectAll;
646 QSplitter *mHeadersToEditorSplitter;
648 QSplitter *mSplitter;
649 QSplitter *mSnippetSplitter;
650 QByteArray mOriginalPreferredCharset;
654 MessageComposer::Composer *mDummyComposer;
661 QMenu *mActLaterMenu;
663 QString mdbusObjectPath;
664 static int s_composerNumber;
666 MessageComposer::ComposerViewBase* mComposerBase;
670 PimCommon::TranslatorWidget *mTranslatorWidget;
671 QPointer<KPIMTextEdit::SelectSpecialChar> mSelectSpecialChar;
674 QTimer *m_verifyMissingAttachment;
675 QLabel *mSignatureStateIndicator;
676 QLabel *mEncryptionStateIndicator;
677 MailCommon::FolderRequester *mFccFolder;
678 bool mPreventFccOverwrite;
679 bool mCheckForForgottenAttachments;
680 bool mIgnoreStickyFields;
682 Akonadi::Collection mCollectionForNewMessage;
void setFolder(const Akonadi::Collection &aFolder)
If this folder is set, the original message is inserted back after canceling.
void htmlToolBarVisibilityChanged(bool visible)
void slotSpellcheckDoneClearStatus()
void setTextSelection(const QString &selection)
Set the text selection the message is a response to.
void disableWordWrap()
Disables word wrap completely.
void slotWordWrapToggled(bool)
Switch wordWrap on/off.
KAction * lowerCaseAction() const
static Composer * create(const KMime::Message::Ptr &msg, bool lastSignState, bool lastEncryptState, TemplateContext context=NoTemplate, uint identity=0, const QString &textSelection=QString(), const QString &customTemplate=QString())
Q_SCRIPTABLE void addAttachmentsAndSend(const KUrl::List &urls, const QString &comment, int how)
void setCollectionForNewMessage(const Akonadi::Collection &folder)
const KPIMIdentities::Identity & identity() const
bool isComposing() const
Returns true while the message composing is in progress.
Q_SCRIPTABLE void addAttachment(const KUrl &url, const QString &comment)
void disableForgottenAttachmentsCheck()
Don't check for forgotten attachments for a mail, eg.
void identityChanged(const KPIMIdentities::Identity &identity)
End of D-Bus callable stuff.
void forceDisableHtml()
Disables HTML completely.
void setCurrentReplyTo(const QString &)
void setCustomTemplate(const QString &customTemplate)
Set custom template to be used for the message.
QString smartQuote(const QString &msg)
void setModified(bool modified)
Set whether the message should be treated as modified or not.
void slotFetchJob(KJob *)
void setFcc(const QString &idString)
Use the given folder as sent-mail folder if the given folder exists.
void slotTextModeChanged(KRichTextEdit::Mode)
KAction * upperCaseAction() const
Q_SCRIPTABLE void send(int how)
Start of D-Bus callable stuff.
void setMessage(const KMime::Message::Ptr &newMsg, bool lastSignState=false, bool lastEncryptState=false, bool mayAutoSign=true, bool allowDecryption=false, bool isModified=false)
Set the message the composer shall work with.
void setFocusToSubject()
Sets the focus to the subject line edit.
void setCurrentTransport(int transportId)
void addAttach(KMime::Content *msgPart)
Add an attachment to the list.
void setFocusToEditor()
Sets the focus to the edit-widget.
void addExtraCustomHeaders(const QMap< QByteArray, QString > &header)
Composer(const char *name=0)
void autoSaveMessage(bool force=false)
void ignoreStickyFields()
Ignore the "sticky" setting of the transport combo box and prefer the X-KMail-Transport header field ...
void setSigningAndEncryptionDisabled(bool v)
Disabled signing and encryption completely for this composer window.
bool insertFromMimeData(const QMimeData *source, bool forceAttachment=false)
QString dbusObjectPath() const