summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/db/common.cpp40
-rw-r--r--noncore/apps/tableviewer/main.cpp2
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp116
-rw-r--r--noncore/apps/tableviewer/tableviewer.h4
-rw-r--r--noncore/apps/tableviewer/ui/commonwidgets.cpp3
-rw-r--r--noncore/apps/tableviewer/ui/tvbrowseview.cpp12
6 files changed, 89 insertions, 88 deletions
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp
index 4c70e54..71844a5 100644
--- a/noncore/apps/tableviewer/db/common.cpp
+++ b/noncore/apps/tableviewer/db/common.cpp
@@ -17,17 +17,17 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <stdlib.h> 20#include <stdlib.h>
21#include <qstring.h> 21#include <qstring.h>
22#include <qheader.h> 22#include <qheader.h>
23#include <qvector.h> 23#include <qvector.h>
24#include <qdatetime.h> 24#include <qdatetime.h>
25#include <timestring.h> 25#include <qpe/timestring.h>
26#include "common.h" 26#include "common.h"
27#include "datacache.h" 27#include "datacache.h"
28#include <assert.h> 28#include <assert.h>
29 29
30static const int del_flag = 0x1; 30static const int del_flag = 0x1;
31static const int new_flag = 0x2; 31static const int new_flag = 0x2;
32 32
33/* Helper function */ 33/* Helper function */
@@ -305,19 +305,19 @@ void TVVariant::load(QDataStream &s )
305 } 305 }
306 break; 306 break;
307 case Int: 307 case Int:
308 { 308 {
309 int x; 309 int x;
310 s >> x; 310 s >> x;
311 d->value.i = x; 311 d->value.i = x;
312 } 312 }
313 break; 313 break;
314 default: 314 default:
315 qFatal("Unrecognized data type"); 315 qFatal("Unrecognized data type");
316 } 316 }
317} 317}
318 318
319void TVVariant::save( QDataStream &s ) const 319void TVVariant::save( QDataStream &s ) const
320{ 320{
321 s << type(); 321 s << type();
322 322
323 switch( d->typ ) { 323 switch( d->typ ) {
@@ -385,17 +385,17 @@ const QString TVVariant::toString() const
385 385
386// TODO DO, this properly, */ 386// TODO DO, this properly, */
387int TVVariant::toInt() const 387int TVVariant::toInt() const
388{ 388{
389 if(d->typ == Int) 389 if(d->typ == Int)
390 return d->value.i; 390 return d->value.i;
391 391
392 if(d->typ == String) { 392 if(d->typ == String) {
393 QString tmpq(*(QString *)d->value.ptr); 393 QString tmpq(*(QString *)d->value.ptr);
394 return parseNextNumber(&tmpq); 394 return parseNextNumber(&tmpq);
395 } 395 }
396 396
397 return 0; 397 return 0;
398} 398}
399 399
400const QDate TVVariant::toDate() const 400const QDate TVVariant::toDate() const
401{ 401{
@@ -679,19 +679,19 @@ bool TVVariant::close(TVVariant n)
679 679
680Key::Key() : kname(), kexample(), kflags(0) { } 680Key::Key() : kname(), kexample(), kflags(0) { }
681 681
682Key::Key(QString name, TVVariant example, int flags = 0) : 682Key::Key(QString name, TVVariant example, int flags = 0) :
683 kname(name), kexample(example), kflags(flags) { } 683 kname(name), kexample(example), kflags(flags) { }
684 684
685Key::Key(const Key &other) 685Key::Key(const Key &other)
686{ 686{
687 kname = other.kname; 687 kname = other.kname;
688 kexample = other.kexample; 688 kexample = other.kexample;
689 kflags = other.kflags; 689 kflags = other.kflags;
690} 690}
691 691
692Key& Key::operator=(const Key& key) 692Key& Key::operator=(const Key& key)
693{ 693{
694 kname = key.kname; 694 kname = key.kname;
695 kexample = key.kexample; 695 kexample = key.kexample;
696 kflags = key.kflags; 696 kflags = key.kflags;
697 return *this; 697 return *this;
@@ -773,45 +773,45 @@ KeyList::KeyList() : QIntDict<Key>(20)
773{ 773{
774 setAutoDelete(TRUE); 774 setAutoDelete(TRUE);
775} 775}
776 776
777/* Should be deep copy, but isn't */ 777/* Should be deep copy, but isn't */
778KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k) 778KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k)
779{ 779{
780 KeyListIterator it(k); 780 KeyListIterator it(k);
781 while(it.current()) { 781 while(it.current()) {
782 replace(it.currentKey(), new Key(*it.current())); 782 replace(it.currentKey(), new Key(*it.current()));
783 ++it; 783 ++it;
784 } 784 }
785 785
786 setAutoDelete(TRUE); 786 setAutoDelete(TRUE);
787} 787}
788 788
789/*! 789/*!
790 Destroys a KeyList 790 Destroys a KeyList
791*/ 791*/
792KeyList::~KeyList() { 792KeyList::~KeyList() {
793} 793}
794 794
795/* Do a comparision base on Keys */ 795/* Do a comparision base on Keys */
796bool KeyList::operator!=(const KeyList &other) 796bool KeyList::operator!=(const KeyList &other)
797{ 797{
798 KeyListIterator it(*this); 798 KeyListIterator it(*this);
799 799
800 if (other.getNumFields() != getNumFields()) 800 if (other.getNumFields() != getNumFields())
801 return TRUE; 801 return TRUE;
802 802
803 while(it.current()) { 803 while(it.current()) {
804 //it.currentKey(), it.current(); 804 //it.currentKey(), it.current();
805 if (other.getKeyName(it.currentKey()) != getKeyName(it.currentKey())) 805 if (other.getKeyName(it.currentKey()) != getKeyName(it.currentKey()))
806 return TRUE; 806 return TRUE;
807 if (other.getKeyType(it.currentKey()) != getKeyType(it.currentKey())) 807 if (other.getKeyType(it.currentKey()) != getKeyType(it.currentKey()))
808 return TRUE; 808 return TRUE;
809 ++it; 809 ++it;
810 } 810 }
811 return FALSE; 811 return FALSE;
812} 812}
813 813
814/*! 814/*!
815 Returns the number of keys stored in the KeyList 815 Returns the number of keys stored in the KeyList
816*/ 816*/
817int KeyList::getNumFields() const 817int KeyList::getNumFields() const
@@ -1177,17 +1177,17 @@ void DataElem::setField(int i, QString q)
1177 TVVariant::KeyType kt = contained->getKeyType(i); 1177 TVVariant::KeyType kt = contained->getKeyType(i);
1178 1178
1179 TVVariant t = TVVariant(q); 1179 TVVariant t = TVVariant(q);
1180 1180
1181 switch(kt) { 1181 switch(kt) {
1182 case TVVariant::Int: { 1182 case TVVariant::Int: {
1183 t.asInt(); 1183 t.asInt();
1184 setField(i, t); 1184 setField(i, t);
1185 return; 1185 return;
1186 } 1186 }
1187 case TVVariant::String: { 1187 case TVVariant::String: {
1188 t.asString(); 1188 t.asString();
1189 setField(i, t); 1189 setField(i, t);
1190 return; 1190 return;
1191 } 1191 }
1192 case TVVariant::Date: { 1192 case TVVariant::Date: {
1193 t.asDate(); 1193 t.asDate();
@@ -1265,17 +1265,17 @@ QString DataElem::toQString() const
1265{ 1265{
1266 /* lets make an attempt at this function */ 1266 /* lets make an attempt at this function */
1267 int i; 1267 int i;
1268 QString scratch = ""; 1268 QString scratch = "";
1269 1269
1270 QIntDictIterator<TVVariant> it(values); 1270 QIntDictIterator<TVVariant> it(values);
1271 1271
1272 while (it.current()) { 1272 while (it.current()) {
1273 i = it.currentKey(); 1273 i = it.currentKey();
1274 if(hasValidValue(i)) { 1274 if(hasValidValue(i)) {
1275 scratch += "<B>" + contained->getKeyName(i) + ":</B> "; 1275 scratch += "<B>" + contained->getKeyName(i) + ":</B> ";
1276 scratch += getField(i).toString(); 1276 scratch += getField(i).toString();
1277 scratch += "<br>"; 1277 scratch += "<br>";
1278 } 1278 }
1279 ++it; 1279 ++it;
1280 } 1280 }
1281 return scratch; 1281 return scratch;
diff --git a/noncore/apps/tableviewer/main.cpp b/noncore/apps/tableviewer/main.cpp
index 736e1cf..56c567f 100644
--- a/noncore/apps/tableviewer/main.cpp
+++ b/noncore/apps/tableviewer/main.cpp
@@ -13,17 +13,17 @@
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 "tableviewer.h" 20#include "tableviewer.h"
21#include <qpeapplication.h> 21#include <qpe/qpeapplication.h>
22 22
23int main( int argc, char ** argv ) 23int main( int argc, char ** argv )
24{ 24{
25 QPEApplication a( argc, argv ); 25 QPEApplication a( argc, argv );
26 26
27 TableViewerWindow * mw = new TableViewerWindow; 27 TableViewerWindow * mw = new TableViewerWindow;
28 mw->setCaption( TableViewerWindow::tr("Table Viewer") ); 28 mw->setCaption( TableViewerWindow::tr("Table Viewer") );
29 a.showMainWidget(mw); 29 a.showMainWidget(mw);
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index 0d4a412..0456b41 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -23,27 +23,27 @@
23#include "ui/tvbrowseview.h" 23#include "ui/tvbrowseview.h"
24#include "ui/tvfilterview.h" 24#include "ui/tvfilterview.h"
25#include "ui/tvlistview.h" 25#include "ui/tvlistview.h"
26#include "ui/tveditview.h" 26#include "ui/tveditview.h"
27#include "ui/tvkeyedit.h" 27#include "ui/tvkeyedit.h"
28#include "db/datacache.h" 28#include "db/datacache.h"
29 29
30/* QPE includes */ 30/* QPE includes */
31#include "fileselector.h" 31#include <qpe/fileselector.h>
32#include "resource.h" 32#include <qpe/resource.h>
33#include <qpe/qpetoolbar.h>
33 34
34/* QTE includes */ 35/* QTE includes */
35#include <qpe/qpemenubar.h> 36#include <qpe/qpemenubar.h>
36#include <qpopupmenu.h> 37#include <qpopupmenu.h>
37#include <qapplication.h> 38#include <qapplication.h>
38#include <qwidgetstack.h> 39#include <qwidgetstack.h>
39#include <qlayout.h> 40#include <qlayout.h>
40#include <qbuffer.h> 41#include <qbuffer.h>
41
42/*! 42/*!
43 \class TableViewerWindow 43 \class TableViewerWindow
44 \brief The main window widget of the application 44 \brief The main window widget of the application
45 45
46 This is the main widget of the table viewer application. 46 This is the main widget of the table viewer application.
47 It is the co-ordination point. 47 It is the co-ordination point.
48*/ 48*/
49 49
@@ -88,65 +88,65 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f
88 view_menu->insertItem("List View", this, SLOT(listViewSlot())); 88 view_menu->insertItem("List View", this, SLOT(listViewSlot()));
89 menu->insertItem("View", view_menu); 89 menu->insertItem("View", view_menu);
90 90
91 QVBoxLayout *main_layout = new QVBoxLayout; 91 QVBoxLayout *main_layout = new QVBoxLayout;
92 92
93 /* Build tool bar */ 93 /* Build tool bar */
94 navigation = new QPEToolBar(this, "navigation"); 94 navigation = new QPEToolBar(this, "navigation");
95 QToolButton *newItemButton = new QToolButton( 95 QToolButton *newItemButton = new QToolButton(
96 QIconSet(Resource::loadImage("new")), "New Item", QString::null, 96 QIconSet(Resource::loadPixmap("new")), "New Item", QString::null,
97 this, SLOT(newItemSlot()), navigation, "New Item"); 97 this, SLOT(newItemSlot()), navigation, "New Item");
98 QToolButton *editItemButton = new QToolButton( 98 QToolButton *editItemButton = new QToolButton(
99 QIconSet(Resource::loadImage("edit")), "Edit Item", QString::null, 99 QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null,
100 this, SLOT(editItemSlot()), navigation, "Edit Item"); 100 this, SLOT(editItemSlot()), navigation, "Edit Item");
101 QToolButton *deleteItemButton = new QToolButton( 101 QToolButton *deleteItemButton = new QToolButton(
102 QIconSet(Resource::loadImage("trash")), "Delete Item", 102 QIconSet(Resource::loadPixmap("trash")), "Delete Item",
103 QString::null, this, 103 QString::null, this,
104 SLOT(deleteItemSlot()), navigation, "Delete Item"); 104 SLOT(deleteItemSlot()), navigation, "Delete Item");
105 105
106 navigation->addSeparator(); 106 navigation->addSeparator();
107 107
108 QToolButton *firstItemButton = new QToolButton( 108 QToolButton *firstItemButton = new QToolButton(
109 QIconSet(Resource::loadImage("fastback")), "First Item", 109 QIconSet(Resource::loadPixmap("fastback")), "First Item",
110 QString::null, this, 110 QString::null, this,
111 SLOT(firstItem()), navigation, "First Item"); 111 SLOT(firstItem()), navigation, "First Item");
112 QToolButton *previousItemButton = new QToolButton( 112 QToolButton *previousItemButton = new QToolButton(
113 QIconSet(Resource::loadImage("back")), "Previous Item", 113 QIconSet(Resource::loadPixmap("back")), "Previous Item",
114 QString::null, this, 114 QString::null, this,
115 SLOT(previousItem()), navigation, "Previous Item"); 115 SLOT(previousItem()), navigation, "Previous Item");
116 QToolButton *nextItemButton = new QToolButton( 116 QToolButton *nextItemButton = new QToolButton(
117 QIconSet(Resource::loadImage("forward")), "Next Item", 117 QIconSet(Resource::loadPixmap("forward")), "Next Item",
118 QString::null, this, 118 QString::null, this,
119 SLOT(nextItem()), navigation, "Next Item"); 119 SLOT(nextItem()), navigation, "Next Item");
120 QToolButton *lastItemButton = new QToolButton( 120 QToolButton *lastItemButton = new QToolButton(
121 QIconSet(Resource::loadImage("fastforward")), "Last Item", 121 QIconSet(Resource::loadPixmap("fastforward")), "Last Item",
122 QString::null, this, 122 QString::null, this,
123 SLOT(lastItem()), navigation, "Last Item"); 123 SLOT(lastItem()), navigation, "Last Item");
124 124
125 navigation->addSeparator(); 125 navigation->addSeparator();
126 QToolButton *browseButton = new QToolButton( 126 QToolButton *browseButton = new QToolButton(
127 QIconSet(Resource::loadImage("day")), "View Single Item", 127 QIconSet(Resource::loadPixmap("day")), "View Single Item",
128 QString::null, this, 128 QString::null, this,
129 SLOT(browseViewSlot()), navigation, "View Single Item"); 129 SLOT(browseViewSlot()), navigation, "View Single Item");
130 QToolButton *listButton = new QToolButton( 130 QToolButton *listButton = new QToolButton(
131 QIconSet(Resource::loadImage("month")), "View Multiple Items", 131 QIconSet(Resource::loadPixmap("month")), "View Multiple Items",
132 QString::null, this, 132 QString::null, this,
133 SLOT(listViewSlot()), navigation, "View Multiple Items"); 133 SLOT(listViewSlot()), navigation, "View Multiple Items");
134 134
135 setToolBarsMovable(FALSE); 135 setToolBarsMovable(FALSE);
136 setToolBarsMovable(FALSE); 136 setToolBarsMovable(FALSE);
137 setToolBarsMovable(FALSE); 137 setToolBarsMovable(FALSE);
138 138
139/* Build widgets */ 139/* Build widgets */
140 browseView = new TVBrowseView(&ts, this, 0); 140 browseView = new TVBrowseView(&ts, this, 0);
141 listView = new TVListView(&ts, this, 0); 141 listView = new TVListView(&ts, this, 0);
142 filterView = new TVFilterView(&ts, this, 0); 142 filterView = new TVFilterView(&ts, this, 0);
143 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer", 143 fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer",
144 this, "fileselector"); 144 this, "fileselector");
145 fileSelector->setNewVisible(FALSE); 145 fileSelector->setNewVisible(FALSE);
146 fileSelector->setCloseVisible(FALSE); 146 fileSelector->setCloseVisible(FALSE);
147 147
148 cw = new QWidgetStack(this, 0); 148 cw = new QWidgetStack(this, 0);
149 cw->addWidget(listView, ListState); 149 cw->addWidget(listView, ListState);
150 cw->addWidget(browseView, BrowseState); 150 cw->addWidget(browseView, BrowseState);
151 cw->addWidget(filterView, FilterState); 151 cw->addWidget(filterView, FilterState);
152 cw->addWidget(fileSelector, FileState); 152 cw->addWidget(fileSelector, FileState);
@@ -157,57 +157,57 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f
157 157
158 connect(browseView, SIGNAL(searchOnKey(int, TVVariant)), 158 connect(browseView, SIGNAL(searchOnKey(int, TVVariant)),
159 this, SLOT(searchOnKey(int, TVVariant))); 159 this, SLOT(searchOnKey(int, TVVariant)));
160 connect(browseView, SIGNAL(sortChanged(int)), 160 connect(browseView, SIGNAL(sortChanged(int)),
161 this, SLOT(setPrimaryKey(int))); 161 this, SLOT(setPrimaryKey(int)));
162 162
163 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot())); 163 connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot()));
164 connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), 164 connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)),
165 this, SLOT(openDocument(const DocLnk &))); 165 this, SLOT(openDocument(const DocLnk &)));
166 166
167 main_layout->addWidget(menu); 167 main_layout->addWidget(menu);
168 main_layout->addWidget(cw); 168 main_layout->addWidget(cw);
169 169
170 setCentralWidget(cw); 170 setCentralWidget(cw);
171 171
172} 172}
173 173
174/*! 174/*!
175 Destroys the TableViewerWindow 175 Destroys the TableViewerWindow
176*/ 176*/
177TableViewerWindow::~TableViewerWindow() 177TableViewerWindow::~TableViewerWindow()
178{ 178{
179 if(dirty) 179 if(dirty)
180 saveDocument(); 180 saveDocument();
181} 181}
182 182
183/*! 183/*!
184 Opens a file dialog and loads the file specified by the dialog 184 Opens a file dialog and loads the file specified by the dialog
185*/ 185*/
186void TableViewerWindow::selectDocument() 186void TableViewerWindow::selectDocument()
187{ 187{
188 if(dirty) 188 if(dirty)
189 saveDocument(); 189 saveDocument();
190 current_view = FileState; 190 current_view = FileState;
191 cw->raiseWidget(current_view); 191 cw->raiseWidget(current_view);
192 fileSelector->reread(); 192 fileSelector->reread();
193} 193}
194 194
195void TableViewerWindow::saveDocument() 195void TableViewerWindow::saveDocument()
196{ 196{
197 if(!dirty) 197 if(!dirty)
198 return; 198 return;
199 199
200 FileManager fm; 200 FileManager fm;
201 QIODevice *dev = fm.saveFile(doc); 201 QIODevice *dev = fm.saveFile(doc);
202 202
203 if(!ds->saveSource(dev, doc.type())){ 203 if(!ds->saveSource(dev, doc.type())){
204 qWarning("Save unsuccessful"); 204 qWarning("Save unsuccessful");
205 return; 205 return;
206 } 206 }
207 dev->close(); 207 dev->close();
208 dirty = FALSE; 208 dirty = FALSE;
209} 209}
210 210
211void TableViewerWindow::newDocument() 211void TableViewerWindow::newDocument()
212{ 212{
213 DocLnk nf; 213 DocLnk nf;
@@ -224,40 +224,40 @@ void TableViewerWindow::newDocument()
224 filterView->reset(); 224 filterView->reset();
225 225
226 doc = nf; 226 doc = nf;
227 dirty = FALSE; 227 dirty = FALSE;
228 228
229 current_view = BrowseState; 229 current_view = BrowseState;
230 cw->raiseWidget(current_view); 230 cw->raiseWidget(current_view);
231 231
232 /* now set up for editing the keys */ 232 /* now set up for editing the keys */
233 ts.kRep->addKey("key", TVVariant::String); 233 ts.kRep->addKey("key", TVVariant::String);
234 editKeysSlot(); 234 editKeysSlot();
235} 235}
236 236
237void TableViewerWindow::openDocument(const DocLnk &f) 237void TableViewerWindow::openDocument(const DocLnk &f)
238{ 238{
239 239
240 if (!f.isValid()) 240 if (!f.isValid())
241 return; 241 return;
242 242
243 FileManager fm; 243 FileManager fm;
244 QIODevice *dev = fm.openFile(f); 244 QIODevice *dev = fm.openFile(f);
245 doc = f; 245 doc = f;
246 246
247 if(ds->openSource(dev, doc.type())) { 247 if(ds->openSource(dev, doc.type())) {
248 DataElem *d; 248 DataElem *d;
249 249
250 browseView->reset(); 250 browseView->reset();
251 listView->reset(); 251 listView->reset();
252 filterView->reset(); 252 filterView->reset();
253 253
254 current_view = BrowseState; 254 current_view = BrowseState;
255 cw->raiseWidget(current_view); 255 cw->raiseWidget(current_view);
256 256
257 /* set up new table state and ensure sub widgets have a reference */ 257 /* set up new table state and ensure sub widgets have a reference */
258 ts.current_column = 0; 258 ts.current_column = 0;
259 ts.kRep = ds->getKeys(); 259 ts.kRep = ds->getKeys();
260 browseView->rebuildKeys(); 260 browseView->rebuildKeys();
261 listView->rebuildKeys(); 261 listView->rebuildKeys();
262 filterView->rebuildKeys(); 262 filterView->rebuildKeys();
263 263
@@ -276,17 +276,17 @@ void TableViewerWindow::openDocument(const DocLnk &f)
276 browseView->rebuildData(); 276 browseView->rebuildData();
277 listView->rebuildData(); 277 listView->rebuildData();
278 278
279 QString scratch = "Table Viewer";/* later take from constant */ 279 QString scratch = "Table Viewer";/* later take from constant */
280 scratch += " - "; 280 scratch += " - ";
281 scratch += ds->getName(); 281 scratch += ds->getName();
282 setCaption(tr(scratch)); 282 setCaption(tr(scratch));
283 283
284 dirty = FALSE; 284 dirty = FALSE;
285 } else { 285 } else {
286 qWarning(tr("could not load Document")); 286 qWarning(tr("could not load Document"));
287 } 287 }
288 dev->close(); 288 dev->close();
289} 289}
290 290
291/*! 291/*!
292 Moves to the next item of the current table 292 Moves to the next item of the current table
@@ -324,17 +324,17 @@ void TableViewerWindow::applyFilter()
324 DataElem *d; 324 DataElem *d;
325 325
326 listView->clearItems(); 326 listView->clearItems();
327 ds->first(); 327 ds->first();
328 do { 328 do {
329 d = ds->getCurrentData(); 329 d = ds->getCurrentData();
330 if(d) 330 if(d)
331 if(filterView->passesFilter(d)) 331 if(filterView->passesFilter(d))
332 listView->addItem(d); 332 listView->addItem(d);
333 } while(ds->next()); 333 } while(ds->next());
334 listView->first(); 334 listView->first();
335 listView->rebuildData(); 335 listView->rebuildData();
336} 336}
337 337
338/*! 338/*!
339 Raises the Browse View. This is a mode change for the application. 339 Raises the Browse View. This is a mode change for the application.
340*/ 340*/
@@ -360,46 +360,46 @@ void TableViewerWindow::filterViewSlot()
360} 360}
361 361
362 362
363 363
364 364
365void TableViewerWindow::editItemSlot() 365void TableViewerWindow::editItemSlot()
366{ 366{
367 if(TVEditView::openEditItemDialog(&ts, ts.current_elem, this)) { 367 if(TVEditView::openEditItemDialog(&ts, ts.current_elem, this)) {
368 listView->rebuildData(); 368 listView->rebuildData();
369 browseView->rebuildData(); 369 browseView->rebuildData();
370 dirty = TRUE; 370 dirty = TRUE;
371 } 371 }
372} 372}
373 373
374void TableViewerWindow::newItemSlot() 374void TableViewerWindow::newItemSlot()
375{ 375{
376 DataElem *d = new DataElem(ds); 376 DataElem *d = new DataElem(ds);
377 if (TVEditView::openEditItemDialog(&ts, d, this)) { 377 if (TVEditView::openEditItemDialog(&ts, d, this)) {
378 378
379 ds->addItem(d); 379 ds->addItem(d);
380 ts.current_elem = d; 380 ts.current_elem = d;
381 applyFilter(); 381 applyFilter();
382 listView->rebuildData(); 382 listView->rebuildData();
383 browseView->rebuildData(); 383 browseView->rebuildData();
384 dirty = TRUE; 384 dirty = TRUE;
385 } 385 }
386} 386}
387 387
388void TableViewerWindow::deleteItemSlot() 388void TableViewerWindow::deleteItemSlot()
389{ 389{
390 /* delete the actual item, then do a 'filter' */ 390 /* delete the actual item, then do a 'filter' */
391 DataElem *to_remove = ts.current_elem; 391 DataElem *to_remove = ts.current_elem;
392 392
393 if(!to_remove) 393 if(!to_remove)
394 return; 394 return;
395 395
396 listView->removeItem(); 396 listView->removeItem();
397 ds->removeItem(to_remove); 397 ds->removeItem(to_remove);
398 398
399 applyFilter(); 399 applyFilter();
400 listView->rebuildData(); 400 listView->rebuildData();
401 browseView->rebuildData(); 401 browseView->rebuildData();
402 dirty = TRUE; 402 dirty = TRUE;
403} 403}
404 404
405void TableViewerWindow::editKeysSlot() 405void TableViewerWindow::editKeysSlot()
@@ -427,17 +427,17 @@ void TableViewerWindow::editKeysSlot()
427 listView->clearItems(); 427 listView->clearItems();
428 do { 428 do {
429 d = ds->getCurrentData(); 429 d = ds->getCurrentData();
430 if(d) 430 if(d)
431 listView->addItem(d); 431 listView->addItem(d);
432 } while(ds->next()); 432 } while(ds->next());
433 433
434 /* Set up browse view, Will be based of structure of listView */ 434 /* Set up browse view, Will be based of structure of listView */
435 dirty = TRUE; 435 dirty = TRUE;
436 } 436 }
437} 437}
438 438
439/*! 439/*!
440 A Slot that allows for widgets above to indicate a search should be 440 A Slot that allows for widgets above to indicate a search should be
441 done on a specified key index for a specified value 441 done on a specified key index for a specified value
442*/ 442*/
443void TableViewerWindow::searchOnKey(int i, TVVariant v) 443void TableViewerWindow::searchOnKey(int i, TVVariant v)
diff --git a/noncore/apps/tableviewer/tableviewer.h b/noncore/apps/tableviewer/tableviewer.h
index 2d4686a..0d3c39d 100644
--- a/noncore/apps/tableviewer/tableviewer.h
+++ b/noncore/apps/tableviewer/tableviewer.h
@@ -17,17 +17,17 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#ifndef Tableviewer_H 20#ifndef Tableviewer_H
21#define Tableviewer_H 21#define Tableviewer_H
22 22
23#include <qmainwindow.h> 23#include <qmainwindow.h>
24#include "db/common.h" 24#include "db/common.h"
25#include "fileselector.h" 25#include <qpe/fileselector.h>
26 26
27/* Forward class declarations */ 27/* Forward class declarations */
28class QWidgetStack; 28class QWidgetStack;
29class QDialog; 29class QDialog;
30class QMenuBar; 30class QMenuBar;
31 31
32class TVListView; 32class TVListView;
33class TVBrowseView; 33class TVBrowseView;
@@ -93,17 +93,17 @@ private:
93 DBStore *ds; 93 DBStore *ds;
94 TableState ts; /* not a pointer.. this class keeps the state */ 94 TableState ts; /* not a pointer.. this class keeps the state */
95 95
96 enum UserState { 96 enum UserState {
97 BrowseState = 0, 97 BrowseState = 0,
98 ListState, 98 ListState,
99 FilterState, 99 FilterState,
100 EditState, 100 EditState,
101 FileState, 101 FileState,
102 }; 102 };
103 103
104 UserState current_view; 104 UserState current_view;
105 105
106 void applyFilter(); 106 void applyFilter();
107}; 107};
108 108
109#endif 109#endif
diff --git a/noncore/apps/tableviewer/ui/commonwidgets.cpp b/noncore/apps/tableviewer/ui/commonwidgets.cpp
index 0b4f3c2..bf4c36f 100644
--- a/noncore/apps/tableviewer/ui/commonwidgets.cpp
+++ b/noncore/apps/tableviewer/ui/commonwidgets.cpp
@@ -17,17 +17,18 @@
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qlineedit.h> 21#include <qlineedit.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qlabel.h> 23#include <qlabel.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <datebookmonth.h> 25
26#include <qpe/datebookmonth.h>
26#include <qpopupmenu.h> 27#include <qpopupmenu.h>
27#include <qspinbox.h> 28#include <qspinbox.h>
28#include "commonwidgets.h" 29#include "commonwidgets.h"
29 30
30DateEdit::DateEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ) 31DateEdit::DateEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 )
31 : QToolButton(parent, name) 32 : QToolButton(parent, name)
32{ 33{
33 QPopupMenu *m1 = new QPopupMenu(this); 34 QPopupMenu *m1 = new QPopupMenu(this);
diff --git a/noncore/apps/tableviewer/ui/tvbrowseview.cpp b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
index f6da7b1..9bfc791 100644
--- a/noncore/apps/tableviewer/ui/tvbrowseview.cpp
+++ b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
@@ -33,22 +33,22 @@
33 single element in a readable format and make it easy for the user to 33 single element in a readable format and make it easy for the user to
34 rapidly find specific elements in the table. 34 rapidly find specific elements in the table.
35*/ 35*/
36 36
37/*! 37/*!
38 Constructs a new TVBrowseView widget 38 Constructs a new TVBrowseView widget
39*/ 39*/
40TVBrowseView::TVBrowseView(TableState *t, QWidget* parent = 0, const char *name = 0, 40TVBrowseView::TVBrowseView(TableState *t, QWidget* parent = 0, const char *name = 0,
41 WFlags fl =0) 41 WFlags fl =0)
42{ 42{
43 if (!name) 43 if (!name)
44 setName("BrowseView"); 44 setName("BrowseView");
45 45
46 setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); 46// setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) );
47 QVBoxLayout *vlayout = new QVBoxLayout(this); 47 QVBoxLayout *vlayout = new QVBoxLayout(this);
48 textViewDisplay = new QTextBrowser(this, "textViewDisplay"); 48 textViewDisplay = new QTextBrowser(this, "textViewDisplay");
49 vlayout->addWidget( textViewDisplay ); 49 vlayout->addWidget( textViewDisplay );
50 50
51 keyEntry = new TVBrowseKeyEntry(this, "keyEntry"); 51 keyEntry = new TVBrowseKeyEntry(this, "keyEntry");
52 vlayout->addWidget( keyEntry ); 52 vlayout->addWidget( keyEntry );
53 53
54 /* connect the signals down */ 54 /* connect the signals down */
@@ -69,20 +69,20 @@ TVBrowseView::~TVBrowseView()
69{ 69{
70} 70}
71 71
72void TVBrowseView::rebuildData() 72void TVBrowseView::rebuildData()
73{ 73{
74 if(!ts) 74 if(!ts)
75 return; 75 return;
76 if(!ts->current_elem) { 76 if(!ts->current_elem) {
77 /* also disable buttons */ 77 /* also disable buttons */
78 textViewDisplay->setText(""); 78 textViewDisplay->setText("");
79 return; 79 return;
80 } 80 }
81 81
82 setDisplayText(ts->current_elem); 82 setDisplayText(ts->current_elem);
83} 83}
84 84
85/* Reset to initial state */ 85/* Reset to initial state */
86void TVBrowseView::reset() 86void TVBrowseView::reset()
87{ 87{
88 textViewDisplay->setText(""); 88 textViewDisplay->setText("");