filterimporterexporter.h
00001 /* 00002 This file is part of KMail. 00003 Copyright (c) 2007 Till Adam <adam@kde.org> 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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 TQt library by Trolltech AS, Norway (or with modified versions 00021 of TQt that use the same license as TQt), 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 TQt. 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 00030 #ifndef __FILTERIMPORTEREXPORTER_H__ 00031 #define __FILTERIMPORTEREXPORTER_H__ 00032 00033 #include <tqvaluelist.h> 00034 #include <kdialogbase.h> 00035 class KMFilter; 00036 class KConfig; 00037 class TQWidget; 00038 class KPushButton; 00039 00040 namespace KMail 00041 { 00042 00047 class FilterImporterExporter 00048 { 00049 public: 00050 FilterImporterExporter( TQWidget* parent, bool popFilter = false ); 00051 virtual ~FilterImporterExporter(); 00052 00056 void exportFilters( const TQValueList<KMFilter*> & ); 00057 00060 TQValueList<KMFilter*> importFilters(); 00061 00062 static void writeFiltersToConfig( const TQValueList<KMFilter*>& filters, KConfig* config, bool bPopFilter ); 00063 static TQValueList<KMFilter*> readFiltersFromConfig( KConfig* config, bool bPopFilter ); 00064 private: 00065 TQWidget* mParent; 00066 bool mPopFilter; 00067 }; 00068 class FilterSelectionDialog : public KDialogBase 00069 { 00070 Q_OBJECT 00071 TQ_OBJECT 00072 public: 00073 FilterSelectionDialog( TQWidget * parent = 0 ); 00074 00075 virtual ~FilterSelectionDialog(); 00076 virtual void slotCancel(); 00077 bool cancelled(); 00078 void setFilters( const TQValueList<KMFilter*>& filters ); 00079 00080 TQValueList<KMFilter*> selectedFilters() const; 00081 public slots: 00082 void slotUnselectAllButton(); 00083 void slotSelectAllButton(); 00084 private: 00085 KListView *filtersListView; 00086 TQValueList<KMFilter*> originalFilters; 00087 bool wasCancelled; 00088 KPushButton *selectAllButton; 00089 KPushButton *unselectAllButton; 00090 }; 00091 00092 } 00093 00094 #endif /* __FILTERIMPORTEREXPORTER_H__ */