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 <qobject.h>
00025
00026 class KMMessage;
00027 class QString;
00028 class KMFolder;
00029 class QObject;
00030 class KProcess;
00031
00054 class TemplateParser : public QObject
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 QString &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 QString &tmplName, KMMessage *aorig_msg,
00092 KMFolder *afolder = 0, bool append = false );
00093 virtual void processWithTemplate( const QString &tmpl );
00094
00099 virtual QString findTemplate();
00100
00104 virtual QString findCustomTemplate( const QString &tmpl );
00105
00106 virtual QString pipe( const QString &cmd, const QString &buf );
00107
00108 virtual QString getFName( const QString &str );
00109 virtual QString getLName( const QString &str );
00110
00111 protected:
00112 Mode mMode;
00113 KMFolder *mFolder;
00114 uint mIdentity;
00115 KMMessage *mMsg;
00116 KMMessage *mOrigMsg;
00117 QString mSelection;
00118 bool mAllowDecryption;
00119 int mPipeRc;
00120 QString mPipeOut;
00121 QString mPipeErr;
00122 bool mDebug;
00123 QString mQuoteString;
00124 bool mAppend;
00125 QString mTo, mCC;
00126 partNode *mOrigRoot;
00127
00135 QString messageText( bool allowSelectionOnly );
00136
00142 partNode* parsedObjectTree();
00143
00153 void addProcessedBodyToMessage( const QString &body );
00154
00159 bool shouldStripSignature() const;
00160
00161 int parseQuotes( const QString &prefix, const QString &str,
00162 QString "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__
|