00001 /********************************************************************** 00002 ** Copyright (C) 2000 Trolltech AS. All rights reserved. 00003 ** 00004 ** This file is part of Qtopia Environment. 00005 ** 00006 ** This file may be distributed and/or modified under the terms of the 00007 ** GNU General Public License version 2 as published by the Free Software 00008 ** Foundation and appearing in the file LICENSE.GPL included in the 00009 ** packaging of this file. 00010 ** 00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 ** 00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00015 ** 00016 ** Contact info@trolltech.com if any conditions of this licensing are 00017 ** not clear to you. 00018 ** 00019 **********************************************************************/ 00020 #ifndef Tvfilterview_H 00021 #define Tvfilterview_H 00022 00023 #include "filterkeyentry.h" 00024 #include "../db/common.h" 00025 #include <qlist.h> 00026 #include <qmap.h> 00027 #include <qdialog.h> 00028 00029 class QListViewItem; 00030 class QPushButton; 00031 class QListView; 00032 class TVFilterKeyEntry; 00033 00034 class TVFilterView : public QDialog 00035 { 00036 Q_OBJECT 00037 00038 signals: 00039 void editView(); 00040 void listView(); 00041 void browseView(); 00042 void loadFile(); 00043 00044 protected slots: 00045 void newTerm(); 00046 void deleteTerm(); 00047 void clearTerms(); 00048 void updateTerm(); 00049 void setTerm(QListViewItem *); 00050 00051 public: 00052 TVFilterView(TableState *t, QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 00053 ~TVFilterView(); 00054 00055 /* Access Methods */ 00056 void rebuildKeys(); 00057 void rebuildData(); 00058 void reset(); 00059 00060 bool passesFilter(DataElem *d); 00061 bool filterActive() const; /* return true if and only if filtering is on */ 00062 00063 QListView* display; 00064 QPushButton* newFilterButton; 00065 QPushButton* deleteFilterButton; 00066 QPushButton* clearFilterButton; 00067 QComboBox* keyNameCombo; 00068 00069 TVFilterKeyEntry* keyEntry; 00070 private: 00071 00072 typedef struct _FilterTerm { 00073 int keyIndex; 00074 CmpType ct; 00075 TVVariant value; 00076 QListViewItem *view; 00077 } FilterTerm; 00078 00079 QList<FilterTerm> terms; 00080 FilterTerm *current; 00081 bool do_filter; 00082 00083 TableState *ts; 00084 00085 QMap<int, int> keyIds; 00086 }; 00087 00088 #endif
1.4.2