kmail Library API Documentation

filterlog.h

00001 /* 00002 This file is part of KMail. 00003 Copyright (c) 2003 Andreas Gungl <a.gungl@gmx.de> 00004 00005 KMail is free software; you can redistribute it and/or modify it 00006 under the terms of the GNU General Public License, version 2, as 00007 published by the Free Software Foundation. 00008 00009 KMail is distributed in the hope that it will be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 In addition, as a special exception, the copyright holders give 00019 permission to link the code of this program with any edition of 00020 the Qt library by Trolltech AS, Norway (or with modified versions 00021 of Qt that use the same license as Qt), and distribute linked 00022 combinations including the two. You must obey the GNU General 00023 Public License in all respects for all of the code used other than 00024 Qt. If you modify this file, you may extend this exception to 00025 your version of the file, but you are not obligated to do so. If 00026 you do not wish to do so, delete this exception statement from 00027 your version. 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 } // namespace KMail 00159 00160 #endif // KMAIL_FILTERLOG_H
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:52:15 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003