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>
66 class KRecentFilesAction;
78 namespace MailTransport {
81 namespace KPIMIdentities {
85 namespace KPIMTextEdit {
86 class SelectSpecialChar;
93 namespace MessageComposer {
94 class ComposerLineEdit;
98 namespace MailCommon {
99 class FolderRequester;
102 namespace PimCommon {
103 class CustomToolsWidget;
104 class LineEditWithAutoCorrection;
105 class SplitterCollapser;
112 Q_CLASSINFO(
"D-Bus Interface",
"org.kde.kmail.mailcomposer")
119 const QString & customTemplate = QString() );
124 uint identity = 0, const QString & textSelection = QString(),
125 const QString & customTemplate = QString() );
137 Q_SCRIPTABLE
void send(
int how );
140 const QString & comment,
144 const QString & comment );
147 KMime::Headers::contentEncoding cte,
148 const QString& charset,
165 void setMessage( const KMime::Message::Ptr &newMsg,
bool lastSignState = false,
bool lastEncryptState = false,
166 bool mayAutoSign=true,
bool allowDecryption=false,
bool isModified=false );
175 void setFcc( const QString &idString );
214 void setFolder(const Akonadi::Collection &aFolder );
243 void writeConfig(
void );
249 bool isModified()
const;
250 bool isComposerModified()
const;
251 void changeModifiedState(
bool modified );
277 void disableHtml( MessageComposer::ComposerViewBase::Confirmation confirmation );
288 void slotPrintPreview();
290 void slotInsertRecentFile(
const KUrl & );
291 void slotRecentListFileClear();
293 void slotSendNowVia(MailTransport::Transport *transport );
294 void slotSendLater();
295 void slotSendLaterVia(MailTransport::Transport *transport );
300 void slotSaveDraft();
301 void slotSaveTemplate();
302 void slotNewComposer();
305 void slotPasteAsAttachment();
306 void slotFolderRemoved(
const Akonadi::Collection& );
307 void slotLanguageChanged(
const QString &language );
308 void slotFccFolderChanged(
const Akonadi::Collection&);
309 void slotEditorTextChanged();
310 void slotOverwriteModeChanged();
314 void slotUpdateFont();
319 void slotAddressBook();
324 void slotInsertFile();
329 void slotSpellcheckConfig();
335 void slotSelectCryptoModule(
bool init =
false );
340 void slotEditToolbars();
341 void slotUpdateToolbars();
347 void readConfig(
bool reload =
false );
352 void slotUpdWinTitle();
358 void slotEncryptToggled(
bool );
363 void slotSignToggled(
bool );
365 void slotUpdateView();
373 void slotIdentityChanged( uint uoid,
bool initalChange =
false );
375 void slotCursorPositionChanged();
377 void slotSpellCheckingStatus(
const QString & status );
379 void slotDelayedApplyTemplate(
KJob* );
381 void recipientEditorSizeHintChanged();
382 void setMaximumHeaderSize();
383 void slotDoDelayedSend(
KJob* );
385 void slotCompletionModeChanged( KGlobalSettings::Completion );
386 void slotConfigChanged();
388 void slotPrintComposeResult(
KJob *job );
390 void slotSendFailed(
const QString& msg , MessageComposer::ComposerViewBase::FailedType type);
396 void slotAutoSpellCheckingToggled(
bool );
399 virtual void setAutoSaveFileName(
const QString& fileName );
400 void slotSpellCheckingLanguage(
const QString& language);
401 void forceAutoSaveMessage();
402 void insertSpecialCharacter();
403 void charSelected(
const QChar& c);
404 void slotSaveAsFile();
405 void slotCreateAddressBookContact();
407 void slotAttachMissingFile();
408 void slotExplicitClosedMissingAttachment();
409 void slotVerifyMissingAttachmentTimeout();
410 void slotCheckSendNow();
412 void slotUpperCase();
413 void slotLowerCase();
414 void slotSentenceCase();
416 void slotExternalEditorStarted();
417 void slotExternalEditorClosed();
419 void slotInsertShortUrl(
const QString &url);
421 void slotShareLinkDone(
const QString &fileName);
423 void slotTransportChanged();
424 void slotFollowUpMail(
bool toggled);
425 void slotSendNowByShortcut();
426 void slotSnippetWidgetVisibilityChanged(
bool b);
427 void slotOverwriteModeWasChanged(
bool state);
428 void slotExpandGroupResult(
KJob *job);
429 void slotCheckSendNowStep2();
430 void slotPotentialPhishingEmailsFound(
const QStringList &list);
431 void slotInsertTextFile(
KJob *job);
434 void addAttach( KMime::Content *msgPart );
436 const KPIMIdentities::Identity &
identity()
const;
457 void updateSignatureAndEncryptionStateIndicators();
460 void confirmBeforeSend();
461 void sendNow(
bool shortcutUsed);
463 void updateSignature(uint uoid, uint uOldId);
464 Kleo::CryptoMessageFormat cryptoMessageFormat()
const;
465 void printComposeResult(
KJob *job,
bool preview );
466 void printComposer(
bool preview);
472 void rethinkFields(
bool fromslot=
false );
482 void rethinkHeaderLine(
int aValue,
int aMask,
int &aRow,
486 void rethinkHeaderLine(
int value,
int mask,
int &row,
493 void applyTemplate(uint uoid , uint uOldId);
498 void setQuotePrefix( uint uoid );
504 bool checkRecipientNumber()
const;
510 void setupStatusBar(
QWidget *w);
523 virtual bool queryClose();
529 void setEncryption(
bool encrypt,
bool setByUser =
false );
535 void setSigning(
bool sign,
bool setByUser =
false );
537 MessageComposer::ComposerViewBase::MissingAttachment userForgotAttachment();
546 static void decryptOrStripOffCleartextSignature(
QByteArray & );
551 void doSend( MessageComposer::MessageSender::SendMethod method=MessageComposer::MessageSender::SendDefault,
552 MessageComposer::MessageSender::SaveIn saveIn = MessageComposer::MessageSender::SaveInNone );
554 void doDelayedSend( MessageComposer::MessageSender::SendMethod method, MessageComposer::MessageSender::SaveIn saveIn );
556 void changeCryptoAction();
557 void applyComposerSetting( MessageComposer::ComposerViewBase* mComposerBase );
565 MessageComposer::Composer* createSimpleComposer();
567 bool canSignEncryptAttachments()
const;
570 int calcColumnWidth(
int which,
long allShowing,
int width )
const;
576 void initHeader( KMime::Message *message, uint
identity=0 );
578 inline bool encryptToSelf()
const;
581 bool showErrorMessage(
KJob *job);
582 int validateLineWrapWidth();
583 Akonadi::Collection mCollectionForNewMessage;
588 MessageComposer::ComposerLineEdit *mEdtFrom, *mEdtReplyTo;
589 PimCommon::LineEditWithAutoCorrection *mEdtSubject;
590 QLabel *mLblIdentity, *mLblTransport, *mLblFcc;
591 QLabel *mLblFrom, *mLblReplyTo;
594 QCheckBox *mBtnIdentity, *mBtnDictionary, *mBtnTransport, *mBtnFcc;
597 KMime::Message::Ptr mMsg;
601 bool mLastSignActionState, mLastEncryptActionState, mSigningAndEncryptionExplicitlyDisabled;
602 bool mLastIdentityHasSigningKey, mLastIdentityHasEncryptionKey;
603 Akonadi::Collection mFolder;
605 bool mForceDisableHtml;
608 QFont mBodyFont, mFixedFont;
612 KRecentFilesAction *mRecentAction;
614 KToggleAction *mSignAction, *mEncryptAction, *mRequestMDNAction;
615 KToggleAction *mUrgentAction, *mAllFieldsAction, *mFromAction;
616 KToggleAction *mReplyToAction;
617 KToggleAction *mSubjectAction;
618 KToggleAction *mIdentityAction, *mTransportAction, *mFccAction;
619 KToggleAction *mWordWrapAction, *mFixedFontAction, *mAutoSpellCheckingAction;
620 KToggleAction *mDictionaryAction, *mSnippetAction, *mTranslateAction;
621 KAction *mAppendSignature;
622 KAction *mPrependSignature;
623 KAction *mInsertSignatureAtCursorPosition;
624 KToggleAction *mGenerateShortenUrl;
626 KToggleAction *markupAction;
629 KSelectAction *mCryptoModuleAction;
631 KAction *mFindText, *mFindNextText, *mReplaceText, *mSelectAll;
639 MessageComposer::Composer *mDummyComposer;
648 static int s_composerNumber;
650 MessageComposer::ComposerViewBase* mComposerBase;
654 PimCommon::CustomToolsWidget *mCustomToolsWidget;
658 QTimer *m_verifyMissingAttachment;
659 MailCommon::FolderRequester *mFccFolder;
660 bool mPreventFccOverwrite;
661 bool mCheckForForgottenAttachments;
662 bool mIgnoreStickyFields;
666 bool mSendNowByShortcutUsed;
667 PimCommon::SplitterCollapser *mSnippetSplitterCollapser;
668 KToggleAction *mFollowUpToggleAction;
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.
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)
KToggleAction * generateShortenUrlAction() const
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 messageId() const
QString smartQuote(const QString &msg)
KToggleAction * translateAction() const
void setModified(bool modified)
Set whether the message should be treated as modified or not.
virtual void setCurrentIdentity(uint identity)
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)
Q_SCRIPTABLE void send(int how)
Start of D-Bus callable stuff.
uint currentIdentity() const
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
KActionMenuChangeCase * changeCaseMenu() const