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
00051 virtual void process( KMMessage *aorig_msg, KMFolder *afolder = 0, bool append = false );
00052 virtual void process( const QString &tmplName, KMMessage *aorig_msg,
00053 KMFolder *afolder = 0, bool append = false );
00054 virtual void processWithTemplate( const QString &tmpl );
00055
00060 virtual QString findTemplate();
00061
00065 virtual QString findCustomTemplate( const QString &tmpl );
00066
00067 virtual QString pipe( const QString &cmd, const QString &buf );
00068
00069 virtual QString getFName( const QString &str );
00070 virtual QString getLName( const QString &str );
00071
00072 protected:
00073 Mode mMode;
00074 KMFolder *mFolder;
00075 uint mIdentity;
00076 KMMessage *mMsg;
00077 KMMessage *mOrigMsg;
00078 QString mSelection;
00079 bool mSmartQuote;
00080 bool mNoQuote;
00081 bool mAllowDecryption;
00082 bool mSelectionIsBody;
00083 int mPipeRc;
00084 QString mPipeOut;
00085 QString mPipeErr;
00086 bool mDebug;
00087 QString mQuoteString;
00088 bool mAppend;
00089 QString mTo, mCC;
00090
00100 void addProcessedBodyToMessage( const QString &body );
00101
00102 int parseQuotes( const QString &prefix, const QString &str,
00103 QString "e ) const;
00104
00105 protected slots:
00106 void onProcessExited( KProcess *proc );
00107 void onReceivedStdout( KProcess *proc, char *buffer, int buflen );
00108 void onReceivedStderr( KProcess *proc, char *buffer, int buflen );
00109 void onWroteStdin( KProcess *proc );
00110 };
00111
00112 #endif // __KMAIL_TEMPLATEPARSER_H__
|