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 CONFIGFILTER_H 00019 #define CONFIGFILTER_H 00020 00021 //QT headers 00022 #include <qlayout.h> 00023 #include <qgroupbox.h> 00024 #include <qtooltip.h> 00025 #include <qcheckbox.h> 00026 #include <QTreeWidget> 00027 #include <QPointer> 00028 #include <QStringList> 00029 00030 //KDE headers 00031 #include <kcmodule.h> 00032 #include <kconfig.h> 00033 #include <kgenericfactory.h> 00034 #include <kapplication.h> 00035 #include <kpushbutton.h> 00036 #include <kcombobox.h> 00037 #include <klineedit.h> 00038 #include <KConfigGroup> 00039 #include <KStandardDirs> 00040 #include <KFileDialog> 00041 #include <KUrl> 00042 00043 //Kshowmail headers 00044 #include "constants.h" 00045 #include "senderlistdialog.h" 00046 #include "filtersetupitem.h" 00047 #include "filtersetupdialog.h" 00048 //#include "mailboxwizard.h" 00049 00050 //radio button IDs 00051 #define ID_COMBO_FILTER_OTHERS_ACTION_PASS 0 00052 #define ID_COMBO_FILTER_OTHERS_ACTION_DELETE 1 00053 #define ID_COMBO_FILTER_OTHERS_ACTION_MARK 2 00054 #define ID_COMBO_FILTER_OTHERS_ACTION_MOVE 3 00055 #define ID_COMBO_FILTER_OTHERS_ACTION_SPAMCHECK 4 00056 #define ID_COMBO_FILTER_OTHERS_ACTION_IGNORE 5 00057 00058 00063 class ConfigFilter : public KCModule 00064 { 00065 Q_OBJECT 00066 00067 public: 00068 00074 explicit ConfigFilter( QWidget *parent = 0, const QVariantList & args = QVariantList() ); 00075 00079 ~ConfigFilter(); 00080 00086 virtual void load(); 00087 00093 virtual void defaults(); 00094 00101 virtual void save(); 00102 00103 private: 00104 00108 KSharedConfigPtr config; 00109 00113 QCheckBox* chkActivateFilter; 00114 00118 QGroupBox* gboxSenderLists; 00119 00123 QGroupBox* gboxFilters; 00124 00128 QGroupBox* gboxOthers; 00129 00133 QGroupBox* gBoxExImport; 00134 00138 KPushButton* btnOpenBlacklist; 00139 00143 KPushButton* btnOpenWhitelist; 00144 00148 QTreeWidget* listFilters; 00149 00153 KPushButton* btnMoveTop; 00154 00158 KPushButton* btnMoveBottom; 00159 00163 KPushButton* btnMoveUp; 00164 00168 KPushButton* btnMoveDown; 00169 00173 KPushButton* btnAdd; 00174 00178 KPushButton* btnEdit; 00179 00183 KPushButton* btnRemove; 00184 00188 KComboBox* cmbActionOthers; 00189 00193 KLineEdit* txtMailbox; 00194 00198 KPushButton* btnMailboxWizard; 00199 00203 KPushButton* btnExport; 00204 00208 KPushButton* btnImport; 00209 00214 uint lastFilterNumber; 00215 00219 QStringList blacklist; 00220 00225 int blacklistAction; 00226 00230 QStringList whitelist; 00231 00232 private slots: 00233 00238 void slotChanged(); 00239 00244 void slotOpenWhitelist(); 00245 00250 void slotOpenBlacklist(); 00251 00258 void slotAdd(); 00259 00264 void slotEdit(); 00265 00270 void slotRemove(); 00271 00277 void slotOtherActionChanged( int index ); 00278 00283 void slotMoveTop(); 00284 00289 void slotMoveBottom(); 00290 00295 void slotMoveUp(); 00296 00301 void slotMoveDown(); 00302 00308 void slotFilterActiveToggled( bool filterOn ); 00309 00314 void slotOpenMailBoxWizard(); 00315 00320 void slotExport(); 00321 00326 void slotImport(); 00327 00328 protected: 00329 00334 void decreaseNumbers( uint number ); 00335 00341 FilterSetupItem* getFilterItem( uint num ); 00342 00343 }; 00344 00345 #endif