summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/ui
Unidiff
Diffstat (limited to 'noncore/apps/tableviewer/ui') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/ui/browsekeyentry.cpp49
-rw-r--r--noncore/apps/tableviewer/ui/filterkeyentry.cpp42
-rw-r--r--noncore/apps/tableviewer/ui/tvfilterview.cpp55
3 files changed, 77 insertions, 69 deletions
diff --git a/noncore/apps/tableviewer/ui/browsekeyentry.cpp b/noncore/apps/tableviewer/ui/browsekeyentry.cpp
index 42e24dd..6b78437 100644
--- a/noncore/apps/tableviewer/ui/browsekeyentry.cpp
+++ b/noncore/apps/tableviewer/ui/browsekeyentry.cpp
@@ -13,39 +13,39 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "browsekeyentry.h" 20#include "browsekeyentry.h"
21#include "commonwidgets.h" 21#include "commonwidgets.h"
22 22
23#include <opie2/odebug.h>
24using namespace Opie::Core;
25
23#include <qtoolbutton.h> 26#include <qtoolbutton.h>
24#include <qwidgetstack.h> 27#include <qwidgetstack.h>
25#include <qlayout.h> 28#include <qlayout.h>
26#include <qlineedit.h> 29#include <qlineedit.h>
27#include <qpushbutton.h> 30#include <qpushbutton.h>
28#include <qpopupmenu.h> 31#include <qpopupmenu.h>
29#include <qhbox.h> 32#include <qhbox.h>
30#include <qdatetime.h> 33#include <qdatetime.h>
31 34
32#include <qheader.h>
33// For qWarning(const char *)
34
35/*! 35/*!
36 \class TVBrowseKeyEntry 36 \class TVBrowseKeyEntry
37 \brief a Widget used enter keys into the TVBrowseViewWidget 37 \brief a Widget used enter keys into the TVBrowseViewWidget
38 38
39 The TVBrowseKeyEntry Widget provides the facility to enter 39 The TVBrowseKeyEntry Widget provides the facility to enter
40 various key types to be search on in the table. The key can be changed 40 various key types to be search on in the table. The key can be changed
41 and the entry field will update to the correct sort of widget appropriately 41 and the entry field will update to the correct sort of widget appropriately
42*/ 42*/
43 43
44/*! 44/*!
45 Constructs the widget 45 Constructs the widget
46*/ 46*/
47TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) 47TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
48 : QWidget(parent, name, f) 48 : QWidget(parent, name, f)
49{ 49{
50 QHBoxLayout *h_layout = new QHBoxLayout(this); 50 QHBoxLayout *h_layout = new QHBoxLayout(this);
51 51
@@ -70,42 +70,42 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
70 ws->addWidget(textKey, TVVariant::String); 70 ws->addWidget(textKey, TVVariant::String);
71 ws->addWidget(intKey, TVVariant::Int); 71 ws->addWidget(intKey, TVVariant::Int);
72 ws->addWidget(timeKey, TVVariant::Time); 72 ws->addWidget(timeKey, TVVariant::Time);
73 ws->addWidget(dateKey, TVVariant::Date); 73 ws->addWidget(dateKey, TVVariant::Date);
74 74
75 ws->raiseWidget(TVVariant::String); 75 ws->raiseWidget(TVVariant::String);
76 76
77 // TODO connect slots and signals.... 77 // TODO connect slots and signals....
78 connect(changeKeyButton, SIGNAL(clicked()), 78 connect(changeKeyButton, SIGNAL(clicked()),
79 this, SLOT(changeKeyMenuSlot())); 79 this, SLOT(changeKeyMenuSlot()));
80 80
81 connect(resetButton, SIGNAL(clicked()), 81 connect(resetButton, SIGNAL(clicked()),
82 textKey, SLOT(clear())); 82 textKey, SLOT(clear()));
83 connect(resetButton, SIGNAL(clicked()), 83 connect(resetButton, SIGNAL(clicked()),
84 intKey, SLOT(clear())); 84 intKey, SLOT(clear()));
85 connect(resetButton, SIGNAL(clicked()), 85 connect(resetButton, SIGNAL(clicked()),
86 dateKey, SLOT(clear())); 86 dateKey, SLOT(clear()));
87 connect(resetButton, SIGNAL(clicked()), 87 connect(resetButton, SIGNAL(clicked()),
88 timeKey, SLOT(clear())); 88 timeKey, SLOT(clear()));
89 89
90 h_layout->addWidget(ws); 90 h_layout->addWidget(ws);
91 h_layout->addWidget(resetButton); 91 h_layout->addWidget(resetButton);
92 h_layout->addWidget(changeKeyButton); 92 h_layout->addWidget(changeKeyButton);
93 93
94 connect(textKey, SIGNAL(textChanged(const QString&)), 94 connect(textKey, SIGNAL(textChanged(const QString&)),
95 this, SLOT(searchOnText())); 95 this, SLOT(searchOnText()));
96 connect(intKey, SIGNAL(valueChanged(int)), 96 connect(intKey, SIGNAL(valueChanged(int)),
97 this, SLOT(searchOnText())); 97 this, SLOT(searchOnText()));
98 connect(dateKey, SIGNAL(valueChanged(const QDate&)), 98 connect(dateKey, SIGNAL(valueChanged(const QDate&)),
99 this, SLOT(searchOnText())); 99 this, SLOT(searchOnText()));
100 connect(timeKey, SIGNAL(valueChanged(const QTime&)), 100 connect(timeKey, SIGNAL(valueChanged(const QTime&)),
101 this, SLOT(searchOnText())); 101 this, SLOT(searchOnText()));
102} 102}
103 103
104/*! 104/*!
105 Destructs the widget 105 Destructs the widget
106*/ 106*/
107TVBrowseKeyEntry::~TVBrowseKeyEntry() 107TVBrowseKeyEntry::~TVBrowseKeyEntry()
108{ 108{
109} 109}
110 110
111/*! 111/*!
@@ -123,13 +123,13 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param)
123 123
124/*! 124/*!
125 Opens the change key menu 125 Opens the change key menu
126*/ 126*/
127void TVBrowseKeyEntry::changeKeyMenuSlot() 127void TVBrowseKeyEntry::changeKeyMenuSlot()
128{ 128{
129 if(ts) 129 if(ts)
130 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); 130 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0)));
131} 131}
132 132
133 133
134void TVBrowseKeyEntry::setTableState(TableState *t) { 134void TVBrowseKeyEntry::setTableState(TableState *t) {
135 ts = t; 135 ts = t;
@@ -143,13 +143,13 @@ void TVBrowseKeyEntry::rebuildKeys() {
143 /* clear the old */ 143 /* clear the old */
144 keyMenu->clear(); 144 keyMenu->clear();
145 145
146 KeyListIterator it(*ts->kRep); 146 KeyListIterator it(*ts->kRep);
147 147
148 for (i = 0; i < ts->kRep->getNumFields(); i++) { 148 for (i = 0; i < ts->kRep->getNumFields(); i++) {
149 keyMenu->insertItem(it.current()->name(), this, 149 keyMenu->insertItem(it.current()->name(), this,
150 SLOT(changeKeySlot(int)), 0, i); 150 SLOT(changeKeySlot(int)), 0, i);
151 keyMenu->setItemParameter(i, it.currentKey()); 151 keyMenu->setItemParameter(i, it.currentKey());
152 ++it; 152 ++it;
153 } 153 }
154} 154}
155 155
@@ -160,14 +160,14 @@ void TVBrowseKeyEntry::reset()
160 dateKey->clear(); 160 dateKey->clear();
161 timeKey->clear(); 161 timeKey->clear();
162 162
163 keyMenu->clear(); 163 keyMenu->clear();
164} 164}
165/*! 165/*!
166 Searches on the current value of the key entry provided that the 166 Searches on the current value of the key entry provided that the
167 current key is of type text WARNING, TODO fix memory leaks 167 current key is of type text WARNING, TODO fix memory leaks
168*/ 168*/
169void TVBrowseKeyEntry::searchOnText() 169void TVBrowseKeyEntry::searchOnText()
170{ 170{
171 TVVariant sendkey; 171 TVVariant sendkey;
172 172
173 if (!ts) 173 if (!ts)
@@ -186,21 +186,20 @@ void TVBrowseKeyEntry::searchOnText()
186 break; 186 break;
187 } 187 }
188 case TVVariant::Date: { 188 case TVVariant::Date: {
189 sendkey = TVVariant(QDate(dateKey->date())); 189 sendkey = TVVariant(QDate(dateKey->date()));
190 break; 190 break;
191 } 191 }
192 case TVVariant::Invalid: 192 case TVVariant::Invalid:
193 break; 193 break;
194 default: 194 default:
195 qWarning("TVBrowseKeyEntry::searchOnText() " 195 owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl;
196 "cannot work out data type");
197 return; 196 return;
198 } 197 }
199 emit searchOnKey(ts->current_column, sendkey); 198 emit searchOnKey(ts->current_column, sendkey);
200} 199}
201 200
202/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, TVVariant) 201/*! \fn void TVBrowseKeyEntry::searchOnKey(int currentKeyId, TVVariant)
203 202
204 This signal indicates that a search on key index currentKeyId should be 203 This signal indicates that a search on key index currentKeyId should be
205 done searching for the value v. 204 done searching for the value v.
206*/ 205*/
diff --git a/noncore/apps/tableviewer/ui/filterkeyentry.cpp b/noncore/apps/tableviewer/ui/filterkeyentry.cpp
index d108fbd..4d74d6b 100644
--- a/noncore/apps/tableviewer/ui/filterkeyentry.cpp
+++ b/noncore/apps/tableviewer/ui/filterkeyentry.cpp
@@ -13,16 +13,21 @@
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "filterkeyentry.h" 20#include "filterkeyentry.h"
21#include "commonwidgets.h" 21#include "commonwidgets.h"
22 22
23/* OPIE */
24#include <opie2/odebug.h>
25using namespace Opie::Core;
26
27/* QT */
23#include <qwidgetstack.h> 28#include <qwidgetstack.h>
24#include <qcombobox.h> 29#include <qcombobox.h>
25#include <qlayout.h> 30#include <qlayout.h>
26#include <qlineedit.h> 31#include <qlineedit.h>
27#include <qsizepolicy.h> 32#include <qsizepolicy.h>
28#include <qdatetime.h> 33#include <qdatetime.h>
@@ -95,19 +100,19 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
95 ws->addWidget(textEntry, TVVariant::String); 100 ws->addWidget(textEntry, TVVariant::String);
96 ws->addWidget(intEntry, TVVariant::Int); 101 ws->addWidget(intEntry, TVVariant::Int);
97 ws->addWidget(timeEntry, TVVariant::Time); 102 ws->addWidget(timeEntry, TVVariant::Time);
98 ws->addWidget(dateEntry, TVVariant::Date); 103 ws->addWidget(dateEntry, TVVariant::Date);
99 104
100 /* connect the signals down */ 105 /* connect the signals down */
101 connect(textKey, SIGNAL(textChanged(const QString&)), 106 connect(textKey, SIGNAL(textChanged(const QString&)),
102 this, SIGNAL(valueChanged())); 107 this, SIGNAL(valueChanged()));
103 connect(intKey, SIGNAL(valueChanged(int)), 108 connect(intKey, SIGNAL(valueChanged(int)),
104 this, SIGNAL(valueChanged())); 109 this, SIGNAL(valueChanged()));
105 connect(dateKey, SIGNAL(valueChanged(const QDate&)), 110 connect(dateKey, SIGNAL(valueChanged(const QDate&)),
106 this, SIGNAL(valueChanged())); 111 this, SIGNAL(valueChanged()));
107 connect(timeKey, SIGNAL(valueChanged(const QTime&)), 112 connect(timeKey, SIGNAL(valueChanged(const QTime&)),
108 this, SIGNAL(valueChanged())); 113 this, SIGNAL(valueChanged()));
109 114
110 connect(intCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 115 connect(intCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
111 connect(textCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 116 connect(textCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
112 connect(timeCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 117 connect(timeCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
113 connect(dateCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged())); 118 connect(dateCombo, SIGNAL(activated(int)), this, SIGNAL(valueChanged()));
@@ -116,19 +121,19 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
116 layout->addWidget(ws); 121 layout->addWidget(ws);
117 122
118 current_type = TVVariant::String; 123 current_type = TVVariant::String;
119} 124}
120 125
121/*! 126/*!
122 Destructs the widget 127 Destructs the widget
123*/ 128*/
124TVFilterKeyEntry::~TVFilterKeyEntry() 129TVFilterKeyEntry::~TVFilterKeyEntry()
125{ 130{
126} 131}
127 132
128void TVFilterKeyEntry::setKey(int i) 133void TVFilterKeyEntry::setKey(int i)
129{ 134{
130 135
131 if (!ts) return; 136 if (!ts) return;
132 if (!ts->kRep) return; 137 if (!ts->kRep) return;
133 138
134 /* set up to raise appropriate widget set */ 139 /* set up to raise appropriate widget set */
@@ -180,29 +185,28 @@ CmpType TVFilterKeyEntry::getCompareType()
180TVVariant TVFilterKeyEntry::getCompareValue() 185TVVariant TVFilterKeyEntry::getCompareValue()
181{ 186{
182 TVVariant sendkey; 187 TVVariant sendkey;
183 int tmp; 188 int tmp;
184 189
185 switch(current_type) { 190 switch(current_type) {
186 case TVVariant::String: 191 case TVVariant::String:
187 sendkey = TVVariant(QString(textKey->text())); 192 sendkey = TVVariant(QString(textKey->text()));
188 break; 193 break;
189 case TVVariant::Int: { 194 case TVVariant::Int: {
190 sendkey = TVVariant(intKey->value()); 195 sendkey = TVVariant(intKey->value());
191 break; 196 break;
192 } 197 }
193 case TVVariant::Time: { 198 case TVVariant::Time: {
194 sendkey = TVVariant(QTime(timeKey->time())); 199 sendkey = TVVariant(QTime(timeKey->time()));
195 break; 200 break;
196 } 201 }
197 case TVVariant::Date: { 202 case TVVariant::Date: {
198 sendkey = TVVariant(QDate(dateKey->date())); 203 sendkey = TVVariant(QDate(dateKey->date()));
199 break; 204 break;
200 } 205 }
201 default: { 206 default: {
202 sendkey = TVVariant(0); 207 sendkey = TVVariant(0);
203 qWarning("TVFilterKeyEntry::getCompareValue() " 208 owarn << "TVFilterKeyEntry::getCompareValue() cannot work out data type" << oendl;
204 "cannot work out data type");
205 } 209 }
206 } 210 }
207 return sendkey; 211 return sendkey;
208} 212}
diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp
index 22f1fb7..198c8b5 100644
--- a/noncore/apps/tableviewer/ui/tvfilterview.cpp
+++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp
@@ -15,27 +15,33 @@
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "tvfilterview.h" 20#include "tvfilterview.h"
21
22/* OPIE */
23#include <opie2/odebug.h>
24#include <qpe/qpeapplication.h>
25using namespace Opie::Core;
26
27/* QT */
21#include <qtoolbutton.h> 28#include <qtoolbutton.h>
22#include <qcombobox.h> 29#include <qcombobox.h>
23#include <qlistview.h> 30#include <qlistview.h>
24#include <qlayout.h> 31#include <qlayout.h>
25#include <qheader.h> 32#include <qheader.h>
26#include <qpushbutton.h> 33#include <qpushbutton.h>
27#include <qlabel.h> 34#include <qlabel.h>
28 35
29#include <qpe/qpeapplication.h>
30 36
31TVFilterView::TVFilterView(TableState *t, QWidget* parent, 37TVFilterView::TVFilterView(TableState *t, QWidget* parent,
32 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl) 38 const char *name, WFlags fl ) : QDialog(parent, name, TRUE, fl)
33{ 39{
34 if ( !name ) 40 if ( !name )
35 setName( "Filter View" ); 41 setName( "Filter View" );
36 42
37 QVBoxLayout *vlayout = new QVBoxLayout(this); 43 QVBoxLayout *vlayout = new QVBoxLayout(this);
38 44
39 display = new QListView(this, "display"); 45 display = new QListView(this, "display");
40 display->addColumn("Key"); 46 display->addColumn("Key");
41 display->addColumn("Constraint"); 47 display->addColumn("Constraint");
@@ -85,27 +91,27 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
85 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm())); 91 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm()));
86 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms())); 92 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms()));
87 93
88 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() )); 94 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() ));
89 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() )); 95 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() ));
90 96
91 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, 97 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
92 SLOT(setTerm(QListViewItem*))); 98 SLOT(setTerm(QListViewItem*)));
93 99
94 ts = t; 100 ts = t;
95 current = 0; 101 current = 0;
96 terms.setAutoDelete(true); 102 terms.setAutoDelete(true);
97 do_filter = false; 103 do_filter = false;
98 104
99#ifdef Q_WS_QWS 105#ifdef Q_WS_QWS
100 QPEApplication::showDialog( this ); 106 QPEApplication::showDialog( this );
101#endif 107#endif
102} 108}
103 109
104/*! 110/*!
105 Destroys the TVFilterView widget 111 Destroys the TVFilterView widget
106*/ 112*/
107TVFilterView::~TVFilterView() 113TVFilterView::~TVFilterView()
108{ 114{
109} 115}
110 116
111void TVFilterView::rebuildData() 117void TVFilterView::rebuildData()
@@ -115,41 +121,41 @@ void TVFilterView::rebuildData()
115void TVFilterView::reset() 121void TVFilterView::reset()
116{ 122{
117 keyNameCombo->clear(); 123 keyNameCombo->clear();
118 keyIds.clear(); 124 keyIds.clear();
119} 125}
120 126
121void TVFilterView::rebuildKeys() 127void TVFilterView::rebuildKeys()
122{ 128{
123 int i; 129 int i;
124 130
125 if (!ts) return; 131 if (!ts) return;
126 if(!ts->kRep) return; 132 if(!ts->kRep) return;
127 keyEntry->setTableState(ts); 133 keyEntry->setTableState(ts);
128 134
129 /* set up the list of keys that can be compared on */ 135 /* set up the list of keys that can be compared on */
130 keyNameCombo->clear(); 136 keyNameCombo->clear();
131 KeyListIterator it(*ts->kRep); 137 KeyListIterator it(*ts->kRep);
132 138
133 i = 0; 139 i = 0;
134 while(it.current()) { 140 while(it.current()) {
135 if(ts->kRep->validIndex(it.currentKey())) { 141 if(ts->kRep->validIndex(it.currentKey())) {
136 keyNameCombo->insertItem(it.current()->name()); 142 keyNameCombo->insertItem(it.current()->name());
137 keyIds.insert(i, it.currentKey()); 143 keyIds.insert(i, it.currentKey());
138 ++i; 144 ++i;
139 } 145 }
140 ++it; 146 ++it;
141 } 147 }
142} 148}
143 149
144bool TVFilterView::passesFilter(DataElem *d) { 150bool TVFilterView::passesFilter(DataElem *d) {
145 if (!filterActive()) return true; 151 if (!filterActive()) return true;
146 152
147 153
148 FilterTerm *t; 154 FilterTerm *t;
149 155
150 for (t = terms.first(); t != 0; t = terms.next() ) { 156 for (t = terms.first(); t != 0; t = terms.next() ) {
151 /* check against filter */ 157 /* check against filter */
152 switch(t->ct) { 158 switch(t->ct) {
153 case ct_less: 159 case ct_less:
154 if (!d->lessThan(t->keyIndex, t->value)) 160 if (!d->lessThan(t->keyIndex, t->value))
155 return false; 161 return false;
@@ -172,14 +178,13 @@ bool TVFilterView::passesFilter(DataElem *d) {
172 break; 178 break;
173 case ct_endswith: 179 case ct_endswith:
174 if (!d->endsWith(t->keyIndex, t->value)) 180 if (!d->endsWith(t->keyIndex, t->value))
175 return false; 181 return false;
176 break; 182 break;
177 default: 183 default:
178 qWarning("TVFilterView::passesFilter() " 184 owarn << "TVFilterView::passesFilter() unrecognized filter type" << oendl;
179 "unrecognized filter type");
180 return false; 185 return false;
181 } 186 }
182 } 187 }
183 return true; 188 return true;
184} 189}
185 190
@@ -191,13 +196,13 @@ bool TVFilterView::filterActive() const
191 if (terms.isEmpty()) 196 if (terms.isEmpty())
192 return false; 197 return false;
193 return true; 198 return true;
194} 199}
195 200
196/* SLOTS */ 201/* SLOTS */
197void TVFilterView::newTerm() 202void TVFilterView::newTerm()
198{ 203{
199 if (!ts) return; 204 if (!ts) return;
200 205
201 FilterTerm *term = new FilterTerm; 206 FilterTerm *term = new FilterTerm;
202 current = term; 207 current = term;
203 208
@@ -209,13 +214,13 @@ void TVFilterView::newTerm()
209 terms.append(term); 214 terms.append(term);
210 215
211 keyEntry->setEnabled(true); 216 keyEntry->setEnabled(true);
212 keyNameCombo->setEnabled(true); 217 keyNameCombo->setEnabled(true);
213} 218}
214 219
215void TVFilterView::updateTerm() 220void TVFilterView::updateTerm()
216{ 221{
217 FilterTerm *term; 222 FilterTerm *term;
218 /* Read the widget values (keyname, compare type, value) 223 /* Read the widget values (keyname, compare type, value)
219 * and build the lists */ 224 * and build the lists */
220 if (!ts) return; 225 if (!ts) return;
221 if (!current) return; 226 if (!current) return;
@@ -228,13 +233,13 @@ void TVFilterView::updateTerm()
228 233
229 /* create new list item, set initial values, enable widgets */ 234 /* create new list item, set initial values, enable widgets */
230 term->keyIndex = keyIds[keyNameCombo->currentItem()]; 235 term->keyIndex = keyIds[keyNameCombo->currentItem()];
231 keyEntry->setKey(term->keyIndex); /* so the next two items make sense */ 236 keyEntry->setKey(term->keyIndex); /* so the next two items make sense */
232 term->ct = keyEntry->getCompareType(), 237 term->ct = keyEntry->getCompareType(),
233 term->value = keyEntry->getCompareValue(); 238 term->value = keyEntry->getCompareValue();
234 239
235 keyString = keyNameCombo->currentText(); 240 keyString = keyNameCombo->currentText();
236 241
237 switch(term->ct) { 242 switch(term->ct) {
238 case ct_less: 243 case ct_less:
239 cmpString = " less than "; 244 cmpString = " less than ";
240 break; 245 break;
@@ -257,20 +262,20 @@ void TVFilterView::updateTerm()
257 cmpString = " ERROR "; 262 cmpString = " ERROR ";
258 } 263 }
259 264
260 vString = term->value.toString(); 265 vString = term->value.toString();
261 266
262 /* remove old view */ 267 /* remove old view */
263 if (term->view) 268 if (term->view)
264 delete(term->view); 269 delete(term->view);
265 term->view = new QListViewItem(display, 0, keyString, cmpString, vString); 270 term->view = new QListViewItem(display, 0, keyString, cmpString, vString);
266 display->setSelected(term->view, true); 271 display->setSelected(term->view, true);
267} 272}
268 273
269/* deletes current term */ 274/* deletes current term */
270void TVFilterView::deleteTerm() 275void TVFilterView::deleteTerm()
271{ 276{
272 if(!current) return; 277 if(!current) return;
273 if (current->view) 278 if (current->view)
274 delete(current->view); 279 delete(current->view);
275 280
276 terms.removeRef(current); 281 terms.removeRef(current);
@@ -281,26 +286,26 @@ void TVFilterView::deleteTerm()
281 keyEntry->setEnabled(false); 286 keyEntry->setEnabled(false);
282 keyNameCombo->setEnabled(false); 287 keyNameCombo->setEnabled(false);
283 } 288 }
284} 289}
285 290
286/* clears all terminations */ 291/* clears all terminations */
287void TVFilterView::clearTerms() 292void TVFilterView::clearTerms()
288{ 293{
289 while(current) 294 while(current)
290 deleteTerm(); 295 deleteTerm();
291} 296}
292 297
293void TVFilterView::setTerm(QListViewItem *target) 298void TVFilterView::setTerm(QListViewItem *target)
294{ 299{
295 /* Iterate through the list to find item with view=target.. 300 /* Iterate through the list to find item with view=target..
296 * set as current, delete */ 301 * set as current, delete */
297 FilterTerm *term = current; 302 FilterTerm *term = current;
298 303
299 for (current = terms.first(); current != 0; current = terms.next() ) 304 for (current = terms.first(); current != 0; current = terms.next() )
300 if (current->view == target) 305 if (current->view == target)
301 break; 306 break;
302 307
303 if (!current) { 308 if (!current) {
304 current = term; 309 current = term;
305 } 310 }
306} 311}