kmail
templateparser.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __KMAIL_TEMPLATEPARSER_H__
00022 #define __KMAIL_TEMPLATEPARSER_H__
00023
00024 #include <tqobject.h>
00025
00026 class KMMessage;
00027 class TQString;
00028 class KMFolder;
00029 class TQObject;
00030 class KProcess;
00031
00054 class TemplateParser : public TQObject
00055 {
00056 Q_OBJECT
00057
00058 public:
00059 enum Mode {
00060 NewMessage,
00061 Reply,
00062 ReplyAll,
00063 Forward
00064 };
00065
00066 static const int PipeTimeout = 15;
00067
00068 public:
00069 TemplateParser( KMMessage *amsg, const Mode amode );
00070 ~TemplateParser();
00071
00078 void setSelection( const TQString &selection );
00079
00088 void setAllowDecryption( const bool allowDecryption );
00089
00090 virtual void process( KMMessage *aorig_msg, KMFolder *afolder = 0, bool append = false );
00091 virtual void process( const TQString &tmplName, KMMessage *aorig_msg,
00092 KMFolder *afolder = 0, bool append = false );
00093 virtual void processWithTemplate( const TQString &tmpl );
00094
00099 virtual TQString findTemplate();
00100
00104 virtual TQString findCustomTemplate( const TQString &tmpl );
00105
00106 virtual TQString pipe( const TQString &cmd, const TQString &buf );
00107
00108 virtual TQString getFName( const TQString &str );
00109 virtual TQString getLName( const TQString &str );
00110
00111 protected:
00112 Mode mMode;
00113 KMFolder *mFolder;
00114 uint mIdentity;
00115 KMMessage *mMsg;
00116 KMMessage *mOrigMsg;
00117 TQString mSelection;
00118 bool mAllowDecryption;
00119 int mPipeRc;
00120 TQString mPipeOut;
00121 TQString mPipeErr;
00122 bool mDebug;
00123 TQString mQuoteString;
00124 bool mAppend;
00125 TQString mTo, mCC;
00126 partNode *mOrigRoot;
00127
00135 TQString messageText( bool allowSelectionOnly );
00136
00142 partNode* parsedObjectTree();
00143
00153 void addProcessedBodyToMessage( const TQString &body );
00154
00159 bool shouldStripSignature() const;
00160
00161 int parseQuotes( const TQString &prefix, const TQString &str,
00162 TQString "e ) const;
00163
00164 protected slots:
00165 void onProcessExited( KProcess *proc );
00166 void onReceivedStdout( KProcess *proc, char *buffer, int buflen );
00167 void onReceivedStderr( KProcess *proc, char *buffer, int buflen );
00168 void onWroteStdin( KProcess *proc );
00169 };
00170
00171 #endif // __KMAIL_TEMPLATEPARSER_H__
|