diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 (patch) | |
tree | 67208f7c145782a7e90b123b982ca78d88cc2c87 /knode/knrangefilter.h | |
download | tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.tar.gz tdepim-460c52653ab0dcca6f19a4f492ed2c5e4e963ab0.zip |
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'knode/knrangefilter.h')
-rw-r--r-- | knode/knrangefilter.h | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/knode/knrangefilter.h b/knode/knrangefilter.h new file mode 100644 index 000000000..702a2ca55 --- /dev/null +++ b/knode/knrangefilter.h @@ -0,0 +1,88 @@ +/* + knrangefilter.h + + KNode, the KDE newsreader + Copyright (c) 1999-2001 the KNode authors. + See file AUTHORS for details + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, US +*/ + +#ifndef KNRANGEFILTER_H +#define KNRANGEFILTER_H + +#include <qgroupbox.h> + +class QLabel; +class KIntSpinBox; +class QComboBox; +class QCheckBox; + +class KSimpleConfig; + + +class KNRangeFilter { + + friend class KNRangeFilterWidget; + + public: + KNRangeFilter() { op1=eq; op2=dis; val1=0; val2=0; enabled=false; } + ~KNRangeFilter() {} + + KNRangeFilter& operator=(const KNRangeFilter &nr) + { val1=nr.val1; val2=nr.val2; + op1=nr.op1; op2=nr.op2; + enabled=nr.enabled; + return (*this); } + + void load(KSimpleConfig *conf); + void save(KSimpleConfig *conf); + + bool doFilter(int a); + + protected: + enum Op { gt=0, gtoeq=1, eq=2, ltoeq=3, lt=4, dis=5 }; + bool matchesOp(int v1, Op o, int v2); + + int val1, val2; + Op op1, op2; + bool enabled; + +}; + + +//================================================================================== + + +class KNRangeFilterWidget : public QGroupBox { + + Q_OBJECT + + public: + KNRangeFilterWidget(const QString& value, int min, int max, QWidget* parent, const QString &unit=QString::null); + ~KNRangeFilterWidget(); + + KNRangeFilter filter(); + void setFilter(KNRangeFilter &f); + void clear(); + + protected: + QCheckBox *enabled; + QLabel *des; + KIntSpinBox *val1, *val2; + QComboBox *op1, *op2; + + protected slots: + void slotEnabled(bool e); + void slotOp1Changed(int id); + void slotOp2Changed(int id); + +}; + +#endif |