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
00032 class TemplateParser : public QObject
00033 {
00034 Q_OBJECT
00035
00036 public:
00037 enum Mode {
00038 NewMessage,
00039 Reply,
00040 ReplyAll,
00041 Forward
00042 };
00043
00044 static const int PipeTimeout = 15;
00045
00046 public:
00047 TemplateParser( KMMessage *amsg, const Mode amode, const QString aselection,
00048 bool aSmartQuote, bool anoQuote, bool aallowDecryption,
00049 bool aselectionIsBody );
00050 ~TemplateParser();
00051
00052 virtual void process( KMMessage *aorig_msg, KMFolder *afolder = 0, bool append = false );
00053 virtual void process( const QString &tmplName, KMMessage *aorig_msg,
00054 KMFolder *afolder = 0, bool append = false );
00055 virtual void processWithTemplate( const QString &tmpl );
00056
00061 virtual QString findTemplate();
00062
00066 virtual QString findCustomTemplate( const QString &tmpl );
00067
00068 virtual QString pipe( const QString &cmd, const QString &buf );
00069
00070 virtual QString getFName( const QString &str );
00071 virtual QString getLName( const QString &str );
00072
00073 protected:
00074 Mode mMode;
00075 KMFolder *mFolder;
00076 uint mIdentity;
00077 KMMessage *mMsg;
00078 KMMessage *mOrigMsg;
00079 QString mSelection;
00080 bool mSmartQuote;
00081 bool mNoQuote;
00082 bool mAllowDecryption;
00083 bool mSelectionIsBody;
00084 int mPipeRc;
00085 QString mPipeOut;
00086 QString mPipeErr;
00087 bool mDebug;
00088 QString mQuoteString;
00089 bool mAppend;
00090 QString mTo, mCC;
00091 partNode *mOrigRoot;
00092
00100 QString messageText( bool allowSelectionOnly );
00101
00107 partNode* parsedObjectTree();
00108
00118 void addProcessedBodyToMessage( const QString &body );
00119
00120 int parseQuotes( const QString &prefix, const QString &str,
00121 QString "e ) const;
00122
00123 protected slots:
00124 void onProcessExited( KProcess *proc );
00125 void onReceivedStdout( KProcess *proc, char *buffer, int buflen );
00126 void onReceivedStderr( KProcess *proc, char *buffer, int buflen );
00127 void onWroteStdin( KProcess *proc );
00128 };
00129
00130 #endif // __KMAIL_TEMPLATEPARSER_H__
|