knode
knfiltermanager.h
Go to the documentation of this file.00001 /* 00002 KNode, the KDE newsreader 00003 Copyright (c) 1999-2005 the KNode authors. 00004 See file AUTHORS for details 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 You should have received a copy of the GNU General Public License 00011 along with this program; if not, write to the Free Software Foundation, 00012 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US 00013 */ 00014 00015 #ifndef KNFILTERMANAGER_H 00016 #define KNFILTERMANAGER_H 00017 00018 #include <qglobal.h> 00019 #include <QList> 00020 00021 #include <kactionmenu.h> 00022 #include <kactioncollection.h> 00023 00024 namespace KNode { 00025 class FilterListWidget; 00026 } 00027 00028 class KNArticleFilter; 00029 00030 00032 class KNFilterSelectAction : public KActionMenu 00033 { 00034 Q_OBJECT 00035 00036 public: 00037 KNFilterSelectAction( const QString& text, const QString& pix, 00038 KActionCollection* parent, const char *name ); 00039 ~KNFilterSelectAction(); 00040 00041 void setCurrentItem(int id); 00042 00043 protected slots: 00044 void slotMenuActivated(int id); 00045 00046 signals: 00047 void activated(int id); 00048 00049 private: 00050 int currentItem; 00051 }; 00052 00053 00055 class KNFilterManager : public QObject 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 KNFilterManager( QObject * parent = 0 ); 00061 ~KNFilterManager(); 00062 00063 void readOptions(); 00064 void saveOptions(); 00065 00066 void prepareShutdown(); 00067 00068 KNArticleFilter* currentFilter() { return currFilter; } 00069 00070 void startConfig(KNode::FilterListWidget *fs); 00071 void endConfig(); 00072 void commitChanges(); 00073 void newFilter(); 00074 void editFilter(KNArticleFilter *f); 00075 void copyFilter(KNArticleFilter *f); 00076 void addFilter(KNArticleFilter *f); 00077 void deleteFilter(KNArticleFilter *f); 00078 bool newNameIsOK(KNArticleFilter *f, const QString &newName); 00079 00083 void setMenuAction(KNFilterSelectAction *a, QAction *keybA); 00084 00085 protected: 00086 void loadFilters(); 00087 void saveFilterLists(); 00088 KNArticleFilter* setFilter(const int id); 00089 KNArticleFilter* byID(int id); 00090 void updateMenu(); 00091 00092 QList<KNArticleFilter*> mFilterList; 00093 KNode::FilterListWidget *fset; 00094 KNArticleFilter *currFilter; 00095 KNFilterSelectAction *a_ctFilter; 00096 QList<int> menuOrder; 00097 bool commitNeeded; 00098 00099 protected slots: 00100 void slotMenuActivated(int id); 00101 void slotShowFilterChooser(); 00102 00103 signals: 00104 void filterChanged(KNArticleFilter *f); 00105 00106 }; 00107 00108 #endif 00109
KDE 4.2 API Reference