summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/ui/browsekeyentry.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tableviewer/ui/browsekeyentry.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/ui/browsekeyentry.cpp49
1 files changed, 24 insertions, 25 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*/