00001 /* 00002 Copyright 2010 Ulrich Weigelt <ulrich.weigelt@gmx.de> 00003 00004 This program is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public License as 00006 published by the Free Software Foundation; either version 2 of 00007 the License, or (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU 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, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00018 #ifndef FILTERSETUPITEM_H 00019 #define FILTERSETUPITEM_H 00020 00021 //QT headers 00022 #include <QTreeWidgetItem> 00023 00024 //KDE headers 00025 #include <kapplication.h> 00026 #include <kconfig.h> 00027 #include <kdebug.h> 00028 #include <klocale.h> 00029 #include <KConfigGroup> 00030 00031 //KShowmail headers 00032 #include "constants.h" 00033 #include "types.h" 00034 00035 using namespace Types; 00036 00041 class FilterSetupItem : public QTreeWidgetItem 00042 { 00043 00044 public: 00045 00049 enum Column{ ColNumber = 0, ColName = 1, ColAction = 2 }; 00050 00055 FilterSetupItem( QTreeWidget* parent ); 00056 00062 FilterSetupItem( QTreeWidget* parent, uint num ); 00063 00067 ~FilterSetupItem(); 00068 00075 void setName( QString name ); 00076 00083 QString getName() const; 00084 00091 void setNumber( uint number ); 00092 00099 uint getNumber() const; 00100 00107 void setAction( int action ); 00108 00116 int getAction() const; 00117 00124 void setMailBox( QString mailbox ); 00125 00132 QString getMailBox() const; 00133 00140 void setCriteriaLinkage( int linkage ); 00141 00149 int getCriteriaLinkage() const; 00150 00158 void setCriteriaList( FilterCriteriaList_Type list ); 00159 00167 FilterCriteriaList_Type getCriteriaList() const; 00168 00173 void save(); 00174 00182 virtual int compare( FilterSetupItem* i, int col, bool ascending ) const; 00183 00192 void load( KConfigGroup* configGroup = NULL ); 00193 00194 00195 private: 00196 00200 QString name; 00201 00205 KSharedConfigPtr config; 00206 00210 FilterCriteriaList_Type criteriaList; 00211 00216 int action; 00217 00221 QString mailbox; 00222 00227 uint number; 00228 00233 int linkage; 00234 00235 protected: 00236 00240 void init(); 00241 00245 void updateActionColumn(); 00246 00247 00248 00249 00250 }; 00251 00252 #endif