TDE personal information management applications
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kmcomposewin.h 25KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955
  1. /* -*- mode: C++; c-file-style: "gnu" -*-
  2. * KMComposeWin Header File
  3. * Author: Markus Wuebben <markus.wuebben@kde.org>
  4. */
  5. #ifndef __KMComposeWin
  6. #define __KMComposeWin
  7. #ifndef KDE_USE_FINAL
  8. # ifndef REALLY_WANT_KMCOMPOSEWIN_H
  9. # error Do not include kmcomposewin.h anymore. Include composer.h instead.
  10. # endif
  11. #endif
  12. #include "composer.h"
  13. #include "messagesender.h"
  14. #include <set>
  15. #include <tqlabel.h>
  16. #include <tqlistview.h>
  17. #include <tqcheckbox.h>
  18. #include <tqpushbutton.h>
  19. #include <tqclipboard.h>
  20. #include <tqpalette.h>
  21. #include <tqfont.h>
  22. #include <tqptrlist.h>
  23. #include <tqvaluevector.h>
  24. #include <tqsplitter.h>
  25. #include <tdeio/job.h>
  26. #include <tdeglobalsettings.h>
  27. #include <tdeversion.h>
  28. #include <keditcl.h>
  29. #include <ktempdir.h>
  30. #include "mailcomposerIface.h"
  31. #include "accountmanager.h"
  32. #include <libtdepim/addresseelineedit.h>
  33. #include <mimelib/mediatyp.h>
  34. #include <kleo/enum.h>
  35. class TQCloseEvent;
  36. class TQComboBox;
  37. class TQFrame;
  38. class TQGridLayout;
  39. class TQListView;
  40. class TQPopupMenu;
  41. class TQPushButton;
  42. class TQCString;
  43. class TDECompletion;
  44. class KMEdit;
  45. class KMComposeWin;
  46. class KMFolderComboBox;
  47. class KMFolder;
  48. class KMMessage;
  49. class KMMessagePart;
  50. class TDEProcess;
  51. class KDirWatch;
  52. class TDESelectAction;
  53. class TDEFontAction;
  54. class TDEFontSizeAction;
  55. class TDESelectAction;
  56. class KStatusBar;
  57. class TDEAction;
  58. class TDEToggleAction;
  59. class KTempFile;
  60. class TDEToolBar;
  61. class TDEToggleAction;
  62. class TDESelectColorAction;
  63. class KURL;
  64. class TDERecentFilesAction;
  65. class SpellingFilter;
  66. class MessageComposer;
  67. class RecipientsEditor;
  68. class KMLineEdit;
  69. class KMLineEditSpell;
  70. class KMAtmListViewItem;
  71. class SnippetWidget;
  72. namespace KPIM {
  73. class IdentityCombo;
  74. class Identity;
  75. }
  76. namespace KMail {
  77. class AttachmentListView;
  78. class DictionaryComboBox;
  79. class EditorWatcher;
  80. }
  81. namespace GpgME {
  82. class Error;
  83. }
  84. //-----------------------------------------------------------------------------
  85. class KMComposeWin : public KMail::Composer, public MailComposerIface
  86. {
  87. Q_OBJECT
  88. friend class ::KMEdit;
  89. friend class ::MessageComposer;
  90. private: // mailserviceimpl, kmkernel, kmcommands, callback, kmmainwidget
  91. KMComposeWin( KMMessage* msg=0, uint identity=0 );
  92. ~KMComposeWin();
  93. public:
  94. static Composer * create( KMMessage * msg = 0, uint identity = 0 );
  95. MailComposerIface * asMailComposerIFace() { return this; }
  96. const MailComposerIface * asMailComposerIFace() const { return this; }
  97. public: // mailserviceimpl
  98. /**
  99. * From MailComposerIface
  100. */
  101. void send(int how);
  102. void addAttachmentsAndSend(const KURL::List &urls, const TQString &comment, int how);
  103. void addAttachment(KURL url,TQString comment);
  104. void addAttachment(const TQString &name,
  105. const TQCString &cte,
  106. const TQByteArray &data,
  107. const TQCString &type,
  108. const TQCString &subType,
  109. const TQCString &paramAttr,
  110. const TQString &paramValue,
  111. const TQCString &contDisp);
  112. public: // kmcommand
  113. void setBody (TQString body);
  114. private:
  115. /**
  116. * To catch palette changes
  117. */
  118. virtual bool event(TQEvent *e);
  119. /**
  120. * update colors
  121. */
  122. void readColorConfig();
  123. /**
  124. * Write settings to app's config file.
  125. */
  126. void writeConfig(void);
  127. /**
  128. * If necessary increases the word wrap of the editor so that it will
  129. * not wrap the body string
  130. */
  131. void verifyWordWrapLengthIsAdequate(const TQString&);
  132. public: // kmkernel, kmcommands, callback
  133. /**
  134. * Set the message the composer shall work with. This discards
  135. * previous messages without calling applyChanges() on them before.
  136. */
  137. void setMsg(KMMessage* newMsg, bool mayAutoSign=TRUE,
  138. bool allowDecryption=FALSE, bool isModified=FALSE);
  139. void disableWordWrap();
  140. /** Don't check if there are too many recipients for a mail,
  141. * eg. when sending out invitations.
  142. */
  143. void disableRecipientNumberCheck();
  144. /** Don't check for forgotten attachments for a mail,
  145. * eg. when sending out invitations.
  146. */
  147. void disableForgottenAttachmentsCheck();
  148. /**
  149. * Ignore the "sticky" setting of the transport combo box and prefer the X-KMail-Transport
  150. * header field of the message instead.
  151. * Do the same for the identity combo box, don't obey the "sticky" setting but use the
  152. * X-KMail-Identity header field instead.
  153. *
  154. * This is useful when sending out invitations, since you don't see the GUI and want the
  155. * identity and transport to be set to the values stored in the messages.
  156. */
  157. void ignoreStickyFields();
  158. /**
  159. * Returns @c true while the message composing is in progress.
  160. */
  161. bool isComposing() const { return mComposer != 0; }
  162. private: // kmedit
  163. /**
  164. * Returns message of the composer. To apply the user changes to the
  165. * message, call applyChanges() first.
  166. */
  167. KMMessage* msg() const { return mMsg; }
  168. public: // kmkernel
  169. /**
  170. * Set the filename which is used for autosaving.
  171. */
  172. void setAutoSaveFilename( const TQString & filename );
  173. private:
  174. /**
  175. * Returns true if the message was modified by the user.
  176. */
  177. bool isModified() const;
  178. /**
  179. * Set whether the message should be treated as modified or not.
  180. */
  181. void setModified( bool modified );
  182. public: // kmkernel, callback
  183. /**
  184. * If this flag is set the message of the composer is deleted when
  185. * the composer is closed and the message was not sent. Default: FALSE
  186. */
  187. inline void setAutoDelete(bool f) { mAutoDeleteMsg = f; }
  188. /**
  189. * If this flag is set, the compose window will delete itself after
  190. * the window has been closed.
  191. */
  192. void setAutoDeleteWindow( bool f );
  193. public: // kmcommand
  194. /**
  195. * If this folder is set, the original message is inserted back after
  196. * cancelling
  197. */
  198. void setFolder(KMFolder* aFolder) { mFolder = aFolder; }
  199. public: // kmkernel, kmcommand, mailserviceimpl
  200. /**
  201. * Recode to the specified charset
  202. */
  203. void setCharset(const TQCString& aCharset, bool forceDefault = FALSE);
  204. public: // kmcommand
  205. /**
  206. * Sets the focus to the edit-widget and the cursor below the
  207. * "On ... you wrote" line when hasMessage is true.
  208. * Make sure you call this _after_ setMsg().
  209. */
  210. void setReplyFocus( bool hasMessage = true );
  211. /**
  212. * Sets the focus to the subject line edit. For use when creating a
  213. * message to a known recipient.
  214. */
  215. void setFocusToSubject();
  216. private:
  217. /**
  218. * determines whether inline signing/encryption is selected
  219. */
  220. bool inlineSigningEncryptionSelected();
  221. /**
  222. * Tries to find the given mimetype @p type in the KDE Mimetype registry.
  223. * If found, returns its localized description, otherwise the @p type
  224. * in lowercase.
  225. */
  226. static TQString prettyMimeType( const TQString& type );
  227. TQString quotePrefixName() const;
  228. private: // kmedit:
  229. KMLineEditSpell *sujectLineWidget() const { return mEdtSubject;}
  230. void setSubjectTextWasSpellChecked( bool _spell ) {
  231. mSubjectTextWasSpellChecked = _spell;
  232. }
  233. bool subjectTextWasSpellChecked() const { return mSubjectTextWasSpellChecked; }
  234. void paste( TQClipboard::Mode mode );
  235. public: // callback
  236. /** Disabled signing and encryption completely for this composer window. */
  237. void setSigningAndEncryptionDisabled( bool v )
  238. {
  239. mSigningAndEncryptionExplicitlyDisabled = v;
  240. }
  241. private slots:
  242. void polish();
  243. /**
  244. * Actions:
  245. */
  246. void slotPrint();
  247. void slotAttachFile();
  248. void slotInsertRecentFile(const KURL&);
  249. void slotAttachedFile(const KURL&);
  250. public slots: // kmkernel, callback
  251. void slotSendNow();
  252. private slots:
  253. void slotSendNowVia( int item );
  254. void slotSendLater();
  255. void slotSendLaterVia( int item );
  256. void getTransportMenu();
  257. /**
  258. * Returns true when saving was successful.
  259. */
  260. void slotSaveDraft();
  261. void slotSaveTemplate();
  262. void slotNewComposer();
  263. void slotNewMailReader();
  264. void slotClose();
  265. void slotHelp();
  266. void slotFind();
  267. void slotSearchAgain();
  268. void slotReplace();
  269. void slotUndo();
  270. void slotRedo();
  271. void slotCut();
  272. void slotCopy();
  273. void slotPasteClipboard();
  274. void slotPasteClipboardAsQuotation();
  275. void slotPasteClipboardAsAttachment();
  276. void slotAddQuotes();
  277. void slotRemoveQuotes();
  278. void slotAttachPNGImageData(const TQByteArray &image);
  279. void slotMarkAll();
  280. void slotFolderRemoved(KMFolder*);
  281. void slotEditDone( KMail::EditorWatcher* watcher );
  282. public slots: // kmkernel
  283. /**
  284. Tell the composer to always send the message, even if the user
  285. hasn't changed the next. This is useful if a message is
  286. autogenerated (e.g., via a DCOP call), and the user should
  287. simply be able to confirm the message and send it.
  288. */
  289. void slotSetAlwaysSend( bool bAlwaysSend );
  290. private slots:
  291. /**
  292. * toggle fixed width font.
  293. */
  294. void slotUpdateFont();
  295. /**
  296. * Open addressbook editor dialog.
  297. */
  298. void slotAddrBook();
  299. /**
  300. * Insert a file to the end of the text in the editor.
  301. */
  302. void slotInsertFile();
  303. void slotSetCharset();
  304. /**
  305. * Check spelling of text.
  306. */
  307. void slotSpellcheck();
  308. void slotSpellcheckConfig();
  309. void slotSubjectTextSpellChecked();
  310. /**
  311. * Change crypto plugin to be used for signing/encrypting messages,
  312. * or switch to built-in OpenPGP code.
  313. */
  314. void slotSelectCryptoModule( bool init = false );
  315. /**
  316. * XML-GUI stuff
  317. */
  318. void slotStatusMessage(const TQString &message);
  319. void slotEditToolbars();
  320. void slotUpdateToolbars();
  321. void slotEditKeys();
  322. /**
  323. * Read settings from app's config file.
  324. */
  325. void readConfig( bool reload = false );
  326. /**
  327. * Change window title to given string.
  328. */
  329. void slotUpdWinTitle(const TQString& );
  330. /**
  331. * Switch the icon to lock or unlock respectivly.
  332. * Change states of all encrypt check boxes in the attachments listview
  333. */
  334. void slotEncryptToggled(bool);
  335. /**
  336. * Change states of all sign check boxes in the attachments listview
  337. */
  338. void slotSignToggled(bool);
  339. public slots: // kmkernel, callback
  340. /**
  341. * Switch wordWrap on/off
  342. */
  343. void slotWordWrapToggled(bool);
  344. private slots:
  345. /**
  346. * Append signature file to the end of the text in the editor.
  347. */
  348. void slotAppendSignature();
  349. /**
  350. * Prepend signature file at the beginning of the text in the editor.
  351. */
  352. void slotPrependSignature();
  353. /**
  354. * Insert signature file at the cursor position of the text in the editor.
  355. */
  356. void slotInsertSignatureAtCursor();
  357. /**
  358. * Attach sender's public key.
  359. */
  360. void slotInsertMyPublicKey();
  361. /**
  362. * Insert arbitary public key from public keyring in the editor.
  363. */
  364. void slotInsertPublicKey();
  365. /**
  366. * Enable/disable some actions in the Attach menu
  367. */
  368. void slotUpdateAttachActions();
  369. /**
  370. * Open a popup-menu in the attachments-listbox.
  371. */
  372. void slotAttachPopupMenu(TQListViewItem *, const TQPoint &, int);
  373. /**
  374. * Returns the number of the current attachment in the listbox,
  375. * or -1 if there is no current attachment
  376. */
  377. int currentAttachmentNum();
  378. /**
  379. * Attachment operations.
  380. */
  381. void slotAttachOpen();
  382. void slotAttachView();
  383. void slotAttachRemove();
  384. void slotAttachSave();
  385. void slotAttachProperties();
  386. void slotAttachOpenWith();
  387. void slotAttachEdit();
  388. void slotAttachEditWith();
  389. void slotAttachmentDragStarted();
  390. /**
  391. * Select an email from the addressbook and add it to the line
  392. * the pressed button belongs to.
  393. */
  394. void slotAddrBookTo();
  395. void slotAddrBookFrom();
  396. void slotAddrBookReplyTo();
  397. void slotCleanSpace();
  398. void slotToggleMarkup();
  399. void toggleMarkup(bool markup);
  400. void htmlToolBarVisibilityChanged( bool visible );
  401. // void slotSpellConfigure();
  402. void slotSpellcheckDone(int result);
  403. void slotSpellcheckDoneClearStatus();
  404. public slots: // kmkernel
  405. void autoSaveMessage();
  406. private slots:
  407. void updateCursorPosition();
  408. void slotView();
  409. /**
  410. * Update composer field to reflect new identity
  411. */
  412. void slotIdentityChanged(uint);
  413. /**
  414. * TDEIO slots for attachment insertion
  415. */
  416. void slotAttachFileData(TDEIO::Job *, const TQByteArray &);
  417. void slotAttachFileResult(TDEIO::Job *);
  418. void slotListAction(const TQString &);
  419. void slotFontAction(const TQString &);
  420. void slotSizeAction(int);
  421. void slotAlignLeft();
  422. void slotAlignCenter();
  423. void slotAlignRight();
  424. void slotTextBold();
  425. void slotTextItalic();
  426. void slotTextUnder();
  427. void slotFormatReset();
  428. void slotTextColor();
  429. void fontChanged( const TQFont & );
  430. void alignmentChanged( int );
  431. public: // kmkernel, attachmentlistview
  432. bool addAttach(const KURL url);
  433. public: // kmcommand
  434. /**
  435. * Add an attachment to the list.
  436. */
  437. void addAttach(const KMMessagePart* msgPart);
  438. private:
  439. const KPIM::Identity & identity() const;
  440. uint identityUid() const;
  441. Kleo::CryptoMessageFormat cryptoMessageFormat() const;
  442. bool encryptToSelf() const;
  443. signals:
  444. void applyChangesDone( bool );
  445. void attachmentAdded( const KURL&, bool success );
  446. private:
  447. /**
  448. * Applies the user changes to the message object of the composer
  449. * and signs/encrypts the message if activated. Returns FALSE in
  450. * case of an error (e.g. if PGP encryption fails).
  451. * Disables the controls of the composer window unless @dontDisable
  452. * is true.
  453. */
  454. void applyChanges( bool dontSignNorEncrypt, bool dontDisable=false );
  455. /**
  456. * Install grid management and header fields. If fields exist that
  457. * should not be there they are removed. Those that are needed are
  458. * created if necessary.
  459. */
  460. void rethinkFields(bool fromslot=false);
  461. /**
  462. Connect signals for moving focus by arrow keys. Returns next edit.
  463. */
  464. TQWidget *connectFocusMoving( TQWidget *prev, TQWidget *next );
  465. /**
  466. * Show or hide header lines
  467. */
  468. void rethinkHeaderLine( int aValue, int aMask, int& aRow,
  469. TQLabel* aLbl,
  470. TQLineEdit* aEdt, TQPushButton* aBtn = 0,
  471. const TQString &toolTip = TQString(),
  472. const TQString &whatsThis = TQString() );
  473. void rethinkHeaderLine( int value, int mask, int& row,
  474. TQLabel* lbl, TQComboBox* cbx, TQCheckBox *chk );
  475. /**
  476. * Checks how many recipients are and warns if there are too many.
  477. * @return true, if the user accepted the warning and the message should be sent
  478. */
  479. bool checkRecipientNumber() const;
  480. bool checkTransport() const;
  481. /**
  482. * Initialization methods
  483. */
  484. void setupActions();
  485. void setupStatusBar();
  486. void setupEditor();
  487. /**
  488. * Header fields.
  489. */
  490. TQString subject() const;
  491. TQString to() const;
  492. TQString cc() const;
  493. TQString bcc() const;
  494. TQString from() const;
  495. TQString replyTo() const;
  496. /**
  497. * Use the given folder as sent-mail folder if the given folder exists.
  498. * Else show an error message and use the default sent-mail folder as
  499. * sent-mail folder.
  500. */
  501. void setFcc( const TQString &idString );
  502. /**
  503. * Ask for confirmation if the message was changed before close.
  504. */
  505. virtual bool queryClose ();
  506. /**
  507. * prevent kmail from exiting when last window is deleted (kernel rules)
  508. */
  509. virtual bool queryExit ();
  510. /**
  511. * Open the attachment with the given index and with ("Open with")
  512. */
  513. void openAttach( int index, bool with );
  514. /**
  515. * View the attachment with the given index.
  516. */
  517. void viewAttach( int index );
  518. /**
  519. Edit the attachment with the given index.
  520. */
  521. void editAttach( int index, bool openWith );
  522. /**
  523. * Remove an attachment from the list.
  524. */
  525. void removeAttach(const TQString &url);
  526. void removeAttach(int idx);
  527. /**
  528. * Updates an item in the TQListView to represnet a given message part
  529. */
  530. void msgPartToItem(const KMMessagePart* msgPart, KMAtmListViewItem *lvi,
  531. bool loadDefaults = true );
  532. /**
  533. * Open addressbook and append selected addresses to the given
  534. * edit field.
  535. */
  536. void addrBookSelInto();
  537. void addrBookSelIntoOld();
  538. void addrBookSelIntoNew();
  539. private:
  540. /**
  541. * Turn encryption on/off. If setByUser is true then a message box is shown
  542. * in case encryption isn't possible.
  543. */
  544. void setEncryption( bool encrypt, bool setByUser = false );
  545. /**
  546. * Turn signing on/off. If setByUser is true then a message box is shown
  547. * in case signing isn't possible.
  548. */
  549. void setSigning( bool sign, bool setByUser = false );
  550. /**
  551. Returns true if the user forgot to attach something.
  552. */
  553. bool userForgotAttachment();
  554. /**
  555. * Retrieve encrypt flag of an attachment
  556. * ( == state of it's check box in the attachments list view )
  557. */
  558. bool encryptFlagOfAttachment(int idx);
  559. /**
  560. * Retrieve sign flag of an attachment
  561. * ( == state of it's check box in the attachments list view )
  562. */
  563. bool signFlagOfAttachment(int idx);
  564. /**
  565. * Decrypt an OpenPGP block or strip off the OpenPGP envelope of a text
  566. * block with a clear text signature. This is only done if the given
  567. * string contains exactly one OpenPGP block.
  568. * This function is for example used to restore the unencrypted/unsigned
  569. * message text for editting.
  570. */
  571. static void decryptOrStripOffCleartextSignature( TQCString& );
  572. /**
  573. * Save the message into the Drafts or Templates folder.
  574. */
  575. bool saveDraftOrTemplate( const TQString &folderName, KMMessage *msg );
  576. /**
  577. * Send the message. Returns true if the message was sent successfully.
  578. */
  579. enum SaveIn { None, Drafts, Templates };
  580. void doSend( KMail::MessageSender::SendMethod method=KMail::MessageSender::SendDefault,
  581. KMComposeWin::SaveIn saveIn = KMComposeWin::None );
  582. /**
  583. * Returns the autosave interval in milliseconds (as needed for TQTimer).
  584. */
  585. int autoSaveInterval() const;
  586. /**
  587. * Initialize autosaving (timer and filename).
  588. */
  589. void initAutoSave();
  590. /**
  591. * Enables/disables autosaving depending on the value of the autosave
  592. * interval.
  593. */
  594. void updateAutoSave();
  595. /**
  596. * Stop autosaving and delete the autosaved message.
  597. */
  598. void cleanupAutoSave();
  599. /**
  600. * Validates a list of email addresses.
  601. * @return true if all addresses are valid.
  602. * @return false if one or several addresses are invalid.
  603. */
  604. static bool validateAddresses( TQWidget * parent, const TQString & addresses );
  605. /**
  606. * Sets the transport combobox to @p transport. If @p transport is empty
  607. * then the combobox remains unchanged. If @p transport is neither a known transport
  608. * nor a custom transport then the combobox is set to the default transport.
  609. * @param transport the transport the combobox should be set to
  610. */
  611. void setTransport( const TQString & transport );
  612. enum SignaturePlacement { Append, Prepend, AtCursor };
  613. /**
  614. * Helper to insert the signature of the current identy at the
  615. * beginning or end of the editor.
  616. */
  617. void insertSignature( SignaturePlacement placement = Append );
  618. private slots:
  619. /**
  620. * Compress an attachemnt with the given index
  621. */
  622. void compressAttach(int idx);
  623. void uncompressAttach(int idx);
  624. void editorFocusChanged(bool gained);
  625. void recipientEditorSizeHintChanged();
  626. void setMaximumHeaderSize();
  627. private:
  628. TQWidget *mMainWidget;
  629. TQComboBox *mTransport;
  630. KMail::DictionaryComboBox *mDictionaryCombo;
  631. KPIM::IdentityCombo *mIdentity;
  632. KMFolderComboBox *mFcc;
  633. KMLineEdit *mEdtFrom, *mEdtReplyTo, *mEdtTo, *mEdtCc, *mEdtBcc;
  634. KMLineEditSpell *mEdtSubject;
  635. TQLabel *mLblIdentity, *mLblTransport, *mLblFcc;
  636. TQLabel *mLblFrom, *mLblReplyTo, *mLblTo, *mLblCc, *mLblBcc, *mLblSubject;
  637. TQLabel *mDictionaryLabel;
  638. TQCheckBox *mBtnIdentity, *mBtnDictionary, *mBtnTransport, *mBtnFcc;
  639. TQPushButton *mBtnTo, *mBtnCc, *mBtnBcc, /* *mBtnFrom, */ *mBtnReplyTo;
  640. bool mSpellCheckInProgress;
  641. bool mDone;
  642. bool mAtmModified;
  643. TQListViewItem *mAtmSelectNew;
  644. KMEdit* mEditor;
  645. TQGridLayout* mGrid;
  646. KMMessage *mMsg;
  647. TQValueVector<KMMessage*> mComposedMessages;
  648. KMail::AttachmentListView* mAtmListView;
  649. int mAtmColEncrypt;
  650. int mAtmColSign;
  651. int mAtmColCompress;
  652. int mAtmEncryptColWidth;
  653. int mAtmSignColWidth;
  654. int mAtmCompressColWidth;
  655. TQPtrList<TQListViewItem> mAtmItemList;
  656. TQPtrList<KMMessagePart> mAtmList;
  657. TQPopupMenu *mAttachMenu;
  658. int mOpenId, mOpenWithId, mViewId, mRemoveId, mSaveAsId, mPropertiesId, mEditId, mEditWithId;
  659. bool mAutoDeleteMsg;
  660. bool mSigningAndEncryptionExplicitlyDisabled;
  661. bool mLastSignActionState, mLastEncryptActionState;
  662. bool mLastIdentityHasSigningKey, mLastIdentityHasEncryptionKey;
  663. KMFolder *mFolder;
  664. long mShowHeaders;
  665. bool mConfirmSend;
  666. bool mDisableBreaking; // Move
  667. int mNumHeaders;
  668. bool mUseHTMLEditor;
  669. bool mHtmlMarkup;
  670. TQFont mBodyFont, mFixedFont;
  671. TQPtrList<KTempFile> mAtmTempList;
  672. TQPalette mPalette;
  673. uint mId;
  674. TQString mOldSigText;
  675. TDEAction *mAttachPK, *mAttachMPK,
  676. *mAttachRemoveAction, *mAttachSaveAction, *mAttachPropertiesAction,
  677. *mPasteQuotation, *mAddQuoteChars, *mRemQuoteChars;
  678. TDERecentFilesAction *mRecentAction;
  679. TDEAction *mAppendSignatureAction, *mPrependSignatureAction, *mInsertSignatureAction;
  680. TDEToggleAction *mSignAction, *mEncryptAction, *mRequestMDNAction;
  681. TDEToggleAction *mUrgentAction, *mAllFieldsAction, *mFromAction;
  682. TDEToggleAction *mReplyToAction, *mToAction, *mCcAction, *mBccAction;
  683. TDEToggleAction *mSubjectAction;
  684. TDEToggleAction *mIdentityAction, *mTransportAction, *mFccAction;
  685. TDEToggleAction *mWordWrapAction, *mFixedFontAction, *mAutoSpellCheckingAction;
  686. TDEToggleAction *mDictionaryAction, *mSnippetAction;
  687. TDESelectAction *listAction;
  688. TDEFontAction *fontAction;
  689. TDEFontSizeAction *fontSizeAction;
  690. TDEToggleAction *alignLeftAction, *alignCenterAction, *alignRightAction;
  691. TDEToggleAction *textBoldAction, *textItalicAction, *textUnderAction;
  692. TDEToggleAction *plainTextAction, *markupAction;
  693. TDEAction *actionFormatColor, *actionFormatReset;
  694. TDEAction *mHtmlToolbar;
  695. TDESelectAction *mEncodingAction;
  696. TDESelectAction *mCryptoModuleAction;
  697. TQCString mCharset;
  698. TQCString mDefCharset;
  699. TQStringList mCharsets;
  700. bool mAutoCharset;
  701. bool mAlwaysSend;
  702. TQStringList mFolderNames;
  703. TQValueList<TQGuardedPtr<KMFolder> > mFolderList;
  704. TQMap<TDEIO::Job*, KURL> mAttachJobs;
  705. KURL::List mAttachFilesPending;
  706. int mAttachFilesSend;
  707. private:
  708. // helper method for slotInsert(My)PublicKey()
  709. void startPublicKeyExport();
  710. bool canSignEncryptAttachments() const {
  711. return cryptoMessageFormat() != Kleo::InlineOpenPGPFormat;
  712. }
  713. bool mSubjectTextWasSpellChecked;
  714. TQString addQuotesToText( const TQString &inputText );
  715. TQString removeQuotesFromText( const TQString &inputText );
  716. // helper method for rethinkFields
  717. int calcColumnWidth(int which, long allShowing, int width);
  718. private slots:
  719. void slotCompletionModeChanged( TDEGlobalSettings::Completion );
  720. void slotConfigChanged();
  721. void slotComposerDone( bool );
  722. void slotContinueDoSend( bool );
  723. void slotContinuePrint( bool );
  724. void slotContinueAutoSave();
  725. void slotEncryptChiasmusToggled( bool );
  726. /**
  727. * Helper method (you could call is a bottom-half :) for
  728. * startPublicKeyExport()
  729. */
  730. void slotPublicKeyExportResult( const GpgME::Error & err, const TQByteArray & keydata );
  731. /**
  732. * toggle automatic spellchecking
  733. */
  734. void slotAutoSpellCheckingToggled(bool);
  735. /**
  736. * Updates signature actions when identity changes.
  737. */
  738. void slotUpdateSignatureActions();
  739. /**
  740. * Updates the visibility and text of the signature and encryption state indicators.
  741. */
  742. void slotUpdateSignatureAndEncrypionStateIndicators();
  743. private:
  744. TQColor mForeColor,mBackColor;
  745. TQFont mSaveFont;
  746. TQSplitter *mHeadersToEditorSplitter;
  747. TQWidget* mHeadersArea;
  748. TQSplitter *mSplitter;
  749. TQSplitter *mSnippetSplitter;
  750. struct atmLoadData
  751. {
  752. KURL url;
  753. TQByteArray data;
  754. bool insert;
  755. TQCString encoding;
  756. };
  757. TQMap<TDEIO::Job *, atmLoadData> mMapAtmLoadData;
  758. // These are for passing on methods over the applyChanges calls
  759. KMail::MessageSender::SendMethod mSendMethod;
  760. KMComposeWin::SaveIn mSaveIn;
  761. TDEToggleAction *mEncryptChiasmusAction;
  762. bool mEncryptWithChiasmus;
  763. // This is the temporary object that constructs the message out of the
  764. // window
  765. MessageComposer* mComposer;
  766. // Temp var for slotPrint:
  767. bool mMessageWasModified;
  768. // Temp var for slotInsert(My)PublicKey():
  769. TQString mFingerprint;
  770. // Temp ptr for saving image from clipboard
  771. KTempDir *mTempDir;
  772. bool mClassicalRecipients;
  773. RecipientsEditor *mRecipientsEditor;
  774. int mLabelWidth;
  775. TQTimer *mAutoSaveTimer;
  776. TQString mAutoSaveFilename;
  777. int mLastAutoSaveErrno; // holds the errno of the last try to autosave
  778. TQPopupMenu *mActNowMenu;
  779. TQPopupMenu *mActLaterMenu;
  780. TQMap<KMail::EditorWatcher*, KMMessagePart*> mEditorMap;
  781. TQMap<KMail::EditorWatcher*, KTempFile*> mEditorTempFiles;
  782. TQLabel *mSignatureStateIndicator;
  783. TQLabel *mEncryptionStateIndicator;
  784. SnippetWidget *mSnippetWidget;
  785. std::set<KTempDir*> mTempDirs;
  786. /** If the message in this composer has a cursor position set (for
  787. * instance because it comes from a template containing %CURSOR)
  788. * then we need to preserve that cursor position even when auto-
  789. * appending (or prepending) the signature during composer setup.
  790. * Set to true *once* (and only in setMsg() at that) to avoid
  791. * accidentally moving the cursor.
  792. */
  793. bool mPreserveUserCursorPosition;
  794. bool mPreventFccOverwrite;
  795. bool mCheckForRecipients;
  796. bool mCheckForForgottenAttachments;
  797. bool mIgnoreStickyFields;
  798. };
  799. #endif