filterlog.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef KMAIL_FILTERLOG_H
00030 #define KMAIL_FILTERLOG_H
00031
00032 #include <qobject.h>
00033 #include <qstringlist.h>
00034
00035 namespace KMail {
00036
00052 class FilterLog : public QObject
00053 {
00054 Q_OBJECT
00055
00056 public:
00058 static FilterLog * instance();
00059
00061 enum ContentType
00062 {
00063 meta = 1,
00064 patternDesc = 2,
00065 ruleResult = 4,
00066 patternResult = 8,
00067 appliedAction = 16
00068 };
00069
00070
00072 bool isLogging() { return mLogging; };
00074 void setLogging( bool active )
00075 {
00076 mLogging = active;
00077 emit logStateChanged();
00078 };
00079
00080
00082 void setMaxLogSize( long size = -1 );
00083 long getMaxLogSize() { return mMaxLogSize; };
00084
00085
00087 void setContentTypeEnabled( ContentType contentType, bool b )
00088 {
00089 if ( b )
00090 mAllowedTypes |= contentType;
00091 else
00092 mAllowedTypes &= ~contentType;
00093 emit logStateChanged();
00094 };
00095
00097 bool isContentTypeEnabled( ContentType contentType )
00098 {
00099 return mAllowedTypes & contentType;
00100 };
00101
00102
00104 void add( QString logEntry, ContentType contentType );
00106 void addSeparator() { add( "------------------------------", meta ); };
00108 void clear()
00109 {
00110 mLogEntries.clear();
00111 mCurrentLogSize = 0;
00112 emit logShrinked();
00113 };
00114
00115
00117 const QStringList & getLogEntries() { return mLogEntries; };
00119 void dump();
00121 bool saveToFile( QString fileName );
00122
00124 virtual ~FilterLog();
00125
00126 static QString & recode( QString s );
00127
00128 signals:
00129 void logEntryAdded( QString );
00130 void logShrinked();
00131 void logStateChanged();
00132
00133 protected:
00135 FilterLog();
00136
00138 QStringList mLogEntries;
00139
00141 bool mLogging;
00142
00146 long mMaxLogSize;
00147 long mCurrentLogSize;
00148
00150 int mAllowedTypes;
00151
00152 void checkLogSize();
00153
00154 private:
00155 static FilterLog * mSelf;
00156 };
00157
00158 }
00159
00160 #endif // KMAIL_FILTERLOG_H
This file is part of the documentation for kmail Library Version 3.3.2.