summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer
Unidiff
Diffstat (limited to 'noncore/apps/tableviewer') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/browsekeyentry.cpp53
-rw-r--r--noncore/apps/tableviewer/db/common.cpp165
-rw-r--r--noncore/apps/tableviewer/db/datacache.cpp68
-rw-r--r--noncore/apps/tableviewer/db/datacache.h24
-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
7 files changed, 234 insertions, 222 deletions
diff --git a/noncore/apps/tableviewer/browsekeyentry.cpp b/noncore/apps/tableviewer/browsekeyentry.cpp
index 04e7902..bab9af6 100644
--- a/noncore/apps/tableviewer/browsekeyentry.cpp
+++ b/noncore/apps/tableviewer/browsekeyentry.cpp
@@ -18,5 +18,10 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "browsekeyentry.h" 20#include "browsekeyentry.h"
21 21
22/* OPIE */
23#include <opie2/odebug.h>
24using namespace Opie::Core;
25
26/* QT */
22#include <qtoolbutton.h> 27#include <qtoolbutton.h>
@@ -30,5 +35,2 @@
30 35
31//#include <iostream.h>
32#include <qheader.h>
33// For qWarning(const char *)
34 36
@@ -44,3 +46,3 @@
44/*! 46/*!
45 Constructs the widget 47 Constructs the widget
46*/ 48*/
@@ -82,26 +84,26 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
82 ws->raiseWidget(0); 84 ws->raiseWidget(0);
83 85
84 // TODO connect slots and signals.... 86 // TODO connect slots and signals....
85 connect(changeKeyButton, SIGNAL(clicked()), 87 connect(changeKeyButton, SIGNAL(clicked()),
86 this, SLOT(changeKeyMenuSlot())); 88 this, SLOT(changeKeyMenuSlot()));
87 connect(resetButton, SIGNAL(clicked()), 89 connect(resetButton, SIGNAL(clicked()),
88 this, SLOT(resetKeySlot())); 90 this, SLOT(resetKeySlot()));
89 91
90 connect(textKey, SIGNAL(textChanged(const QString&)), 92 connect(textKey, SIGNAL(textChanged(const QString&)),
91 this, SLOT(searchOnText())); 93 this, SLOT(searchOnText()));
92 94
93 connect(dayKey, SIGNAL(textChanged(const QString&)), 95 connect(dayKey, SIGNAL(textChanged(const QString&)),
94 this, SLOT(searchOnText())); 96 this, SLOT(searchOnText()));
95 connect(monthKey, SIGNAL(textChanged(const QString&)), 97 connect(monthKey, SIGNAL(textChanged(const QString&)),
96 this, SLOT(searchOnText())); 98 this, SLOT(searchOnText()));
97 connect(yearKey, SIGNAL(textChanged(const QString&)), 99 connect(yearKey, SIGNAL(textChanged(const QString&)),
98 this, SLOT(searchOnText())); 100 this, SLOT(searchOnText()));
99 101
100 connect(secondKey, SIGNAL(textChanged(const QString&)), 102 connect(secondKey, SIGNAL(textChanged(const QString&)),
101 this, SLOT(searchOnText())); 103 this, SLOT(searchOnText()));
102 connect(minuteKey, SIGNAL(textChanged(const QString&)), 104 connect(minuteKey, SIGNAL(textChanged(const QString&)),
103 this, SLOT(searchOnText())); 105 this, SLOT(searchOnText()));
104 connect(hourKey, SIGNAL(textChanged(const QString&)), 106 connect(hourKey, SIGNAL(textChanged(const QString&)),
105 this, SLOT(searchOnText())); 107 this, SLOT(searchOnText()));
106 108
107 h_layout->addWidget(ws); 109 h_layout->addWidget(ws);
@@ -112,3 +114,3 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
112/*! 114/*!
113 Destructs the widget 115 Destructs the widget
114*/ 116*/
@@ -138,4 +140,4 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param)
138 break; 140 break;
139 default: 141 default:
140 return; 142 return;
141 } 143 }
@@ -148,3 +150,3 @@ void TVBrowseKeyEntry::changeKeyMenuSlot()
148{ 150{
149 if(ts) 151 if(ts)
150 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); 152 keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0)));
@@ -167,3 +169,3 @@ void TVBrowseKeyEntry::setTableState(TableState *t) {
167 for (i = 0; i < t->kRep->getNumFields(); i++) { 169 for (i = 0; i < t->kRep->getNumFields(); i++) {
168 keyMenu->insertItem(ts->kRep->getKeyName(i), this, 170 keyMenu->insertItem(ts->kRep->getKeyName(i), this,
169 SLOT(changeKeySlot(int)), 0, i); 171 SLOT(changeKeySlot(int)), 0, i);
@@ -174,4 +176,4 @@ void TVBrowseKeyEntry::setTableState(TableState *t) {
174/*! 176/*!
175 Searches on the current value of the key entry provided that the 177 Searches on the current value of the key entry provided that the
176 current key is of type text WARNING, TODO fix memory leaks 178 current key is of type text WARNING, TODO fix memory leaks
177*/ 179*/
@@ -230,4 +232,3 @@ void TVBrowseKeyEntry::searchOnText()
230 default: 232 default:
231 qWarning("TVBrowseKeyEntry::searchOnText() " 233 owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl;
232 "cannot work out data type");
233 return; 234 return;
@@ -241,2 +242,2 @@ void TVBrowseKeyEntry::searchOnText()
241 done searching for the value v. 242 done searching for the value v.
242*/ 243*/
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp
index b58af85..c35dbea 100644
--- a/noncore/apps/tableviewer/db/common.cpp
+++ b/noncore/apps/tableviewer/db/common.cpp
@@ -18,4 +18,4 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "common.h" 20#include "common.h"
21#include "datacache.h" 21#include "datacache.h"
@@ -90,3 +90,3 @@ int QStringVector::compareItems(Item a, Item b)
90 QString *qb = (QString *)b; 90 QString *qb = (QString *)b;
91 91
92 return QString::compare(*qa, *qb); 92 return QString::compare(*qa, *qb);
@@ -96,3 +96,3 @@ int QStringVector::compareItems(Item a, Item b)
96 \class TVVariant 96 \class TVVariant
97 A way of abstracting void * and keeping information on 97 A way of abstracting void * and keeping information on
98 the keytypes and behaviours in one place 98 the keytypes and behaviours in one place
@@ -322,3 +322,3 @@ void TVVariant::load(QDataStream &s )
322 default: 322 default:
323 ofatal << "Unrecognized data type" << oendl; 323 ofatal << "Unrecognized data type" << oendl;
324 } 324 }
@@ -384,3 +384,3 @@ const QString TVVariant::toString() const
384 return ((QTime*)d->value.ptr)->toString(); 384 return ((QTime*)d->value.ptr)->toString();
385 case Int: 385 case Int:
386 return QString::number(d->value.i); 386 return QString::number(d->value.i);
@@ -426,3 +426,3 @@ const QDate TVVariant::toDate() const
426 } 426 }
427 427
428 428
@@ -435,3 +435,3 @@ const QTime TVVariant::toTime() const
435 return *((QTime *)d->value.ptr); 435 return *((QTime *)d->value.ptr);
436 436
437 if(d->typ == String) { 437 if(d->typ == String) {
@@ -456,3 +456,3 @@ const QTime TVVariant::toTime() const
456 return *((Q##f*)d->value.ptr); } 456 return *((Q##f*)d->value.ptr); }
457 457
458TV_VARIANT_AS(String) 458TV_VARIANT_AS(String)
@@ -562,3 +562,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
562 if(d->typ == Invalid) 562 if(d->typ == Invalid)
563 return FALSE; 563 return FALSE;
564 564
@@ -574,3 +574,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
574 case String: { 574 case String: {
575 /* case for strings is close is a substring.. closer is 575 /* case for strings is close is a substring.. closer is
576 * earlier alphabetically */ 576 * earlier alphabetically */
@@ -584,3 +584,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
584 /* contains sub-str, if later than is not closer */ 584 /* contains sub-str, if later than is not closer */
585 if(QString::compare(qs1, qs2) > 0) 585 if(QString::compare(qs1, qs2) > 0)
586 return FALSE; 586 return FALSE;
@@ -595,9 +595,9 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
595 int diff1 = (i1 - iv); 595 int diff1 = (i1 - iv);
596 if (diff1 < 0) 596 if (diff1 < 0)
597 diff1 = -diff1; 597 diff1 = -diff1;
598 int diff2 = (i2 - iv); 598 int diff2 = (i2 - iv);
599 if (diff2 < 0) 599 if (diff2 < 0)
600 diff2 = -diff2; 600 diff2 = -diff2;
601 601
602 if (diff1 < diff2) 602 if (diff1 < diff2)
603 return TRUE; 603 return TRUE;
@@ -612,6 +612,6 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
612 int diff1 = i1.daysTo(iv); 612 int diff1 = i1.daysTo(iv);
613 if (diff1 < 0) 613 if (diff1 < 0)
614 diff1 = -diff1; 614 diff1 = -diff1;
615 int diff2 = i2.daysTo(iv); 615 int diff2 = i2.daysTo(iv);
616 if (diff2 < 0) 616 if (diff2 < 0)
617 diff2 = -diff2; 617 diff2 = -diff2;
@@ -629,6 +629,6 @@ bool TVVariant::closer(TVVariant n, TVVariant o)
629 int diff1 = i1.msecsTo(iv); 629 int diff1 = i1.msecsTo(iv);
630 if (diff1 < 0) 630 if (diff1 < 0)
631 diff1 = -diff1; 631 diff1 = -diff1;
632 int diff2 = i2.msecsTo(iv); 632 int diff2 = i2.msecsTo(iv);
633 if (diff2 < 0) 633 if (diff2 < 0)
634 diff2 = -diff2; 634 diff2 = -diff2;
@@ -651,3 +651,3 @@ bool TVVariant::close(TVVariant n)
651 if(type() == Invalid) 651 if(type() == Invalid)
652 return FALSE; 652 return FALSE;
653 653
@@ -659,3 +659,3 @@ bool TVVariant::close(TVVariant n)
659 case String: { 659 case String: {
660 /* case for strings is close is a substring.. closer is 660 /* case for strings is close is a substring.. closer is
661 * earlier alphabetically */ 661 * earlier alphabetically */
@@ -668,3 +668,3 @@ bool TVVariant::close(TVVariant n)
668 } 668 }
669 case Int: 669 case Int:
670 case Date: 670 case Date:
@@ -683,3 +683,3 @@ bool TVVariant::close(TVVariant n)
683 \brief document me! 683 \brief document me!
684 684
685 document me! 685 document me!
@@ -690,3 +690,3 @@ Key::Key() : kname(), kexample(), kflags(0) { }
690Key::Key(QString name, TVVariant example, int flags) : 690Key::Key(QString name, TVVariant example, int flags) :
691 kname(name), kexample(example), kflags(flags) { } 691 kname(name), kexample(example), kflags(flags) { }
692 692
@@ -699,3 +699,3 @@ Key::Key(const Key &other)
699 699
700Key& Key::operator=(const Key& key) 700Key& Key::operator=(const Key& key)
701{ 701{
@@ -779,3 +779,3 @@ void Key::setNewFlag(bool v)
779*/ 779*/
780KeyList::KeyList() : QIntDict<Key>(20) 780KeyList::KeyList() : QIntDict<Key>(20)
781{ 781{
@@ -785,3 +785,3 @@ KeyList::KeyList() : QIntDict<Key>(20)
785/* Should be deep copy, but isn't */ 785/* Should be deep copy, but isn't */
786KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k) 786KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k)
787{ 787{
@@ -824,3 +824,3 @@ bool KeyList::operator!=(const KeyList &other)
824*/ 824*/
825int KeyList::getNumFields() const 825int KeyList::getNumFields() const
826{ 826{
@@ -849,12 +849,12 @@ int KeyList::addKey(QString name, TVVariant::KeyType type)
849 switch(type) { 849 switch(type) {
850 case TVVariant::String: 850 case TVVariant::String:
851 return addKey(name, TVVariant("<undefined>").asString()); 851 return addKey(name, TVVariant("<undefined>").asString());
852 break; 852 break;
853 case TVVariant::Date: 853 case TVVariant::Date:
854 return addKey(name, TVVariant(QDate::currentDate()).asDate()); 854 return addKey(name, TVVariant(QDate::currentDate()).asDate());
855 break; 855 break;
856 case TVVariant::Time: 856 case TVVariant::Time:
857 return addKey(name, TVVariant(QTime(0,0,0)).toTime()); 857 return addKey(name, TVVariant(QTime(0,0,0)).toTime());
858 break; 858 break;
859 case TVVariant::Int: 859 case TVVariant::Int:
860 return addKey(name, TVVariant(0).toInt()); 860 return addKey(name, TVVariant(0).toInt());
@@ -862,4 +862,3 @@ int KeyList::addKey(QString name, TVVariant::KeyType type)
862 default: 862 default:
863 qWarning(QObject::tr("KeyList::addKey() Cannot make default " 863 owarn << "KeyList::addKey() Cannot make default value for type " << type << ", Key not added." << oendl;
864 "value for type %1, Key not added.").arg(type));
865 break; 864 break;
@@ -869,3 +868,3 @@ int KeyList::addKey(QString name, TVVariant::KeyType type)
869 868
870void KeyList::setKeyFlags(int i, int flag) 869void KeyList::setKeyFlags(int i, int flag)
871{ 870{
@@ -882,3 +881,3 @@ int KeyList::getKeyFlags(int i) const
882 881
883bool KeyList::checkNewFlag(int i) const 882bool KeyList::checkNewFlag(int i) const
884{ 883{
@@ -889,3 +888,3 @@ bool KeyList::checkNewFlag(int i) const
889 888
890void KeyList::setNewFlag(int i, bool f) 889void KeyList::setNewFlag(int i, bool f)
891{ 890{
@@ -896,3 +895,3 @@ void KeyList::setNewFlag(int i, bool f)
896 895
897bool KeyList::checkDeleteFlag(int i) const 896bool KeyList::checkDeleteFlag(int i) const
898{ 897{
@@ -903,3 +902,3 @@ bool KeyList::checkDeleteFlag(int i) const
903 902
904void KeyList::setDeleteFlag(int i, bool f) 903void KeyList::setDeleteFlag(int i, bool f)
905{ 904{
@@ -920,3 +919,3 @@ QString KeyList::getKeyName(int i) const
920 919
921void KeyList::setKeyName(int i, const QString &n) 920void KeyList::setKeyName(int i, const QString &n)
922{ 921{
@@ -936,3 +935,3 @@ TVVariant::KeyType KeyList::getKeyType(int i) const
936 935
937void KeyList::setKeyType(int i, TVVariant::KeyType t) 936void KeyList::setKeyType(int i, TVVariant::KeyType t)
938{ 937{
@@ -1042,5 +1041,5 @@ QDataStream &operator>>( QDataStream &s, KeyList &k)
1042/*! 1041/*!
1043 Constructs a DataElem. This function needs a container because the 1042 Constructs a DataElem. This function needs a container because the
1044 size, types of keys and primary key are all defined by the containing 1043 size, types of keys and primary key are all defined by the containing
1045 database 1044 database
1046*/ 1045*/
@@ -1088,3 +1087,3 @@ QDataStream &operator>>( QDataStream &s, DataElem &d)
1088 if (size != d.getNumFields()) { 1087 if (size != d.getNumFields()) {
1089 owarn << "DataSize mis-match" << oendl; 1088 owarn << "DataSize mis-match" << oendl;
1090 return s; /* sanity check failed.. don't load */ 1089 return s; /* sanity check failed.. don't load */
@@ -1111,3 +1110,3 @@ KeyList DataElem::getKeys() const
1111 1110
1112/*! 1111/*!
1113 This function determines whether field index i of the element has been 1112 This function determines whether field index i of the element has been
@@ -1115,4 +1114,4 @@ KeyList DataElem::getKeys() const
1115 1114
1116 \return A boolean value that is TRUE if the specfied field of this 1115 \return A boolean value that is TRUE if the specfied field of this
1117 element has been set and FALSE if the field has not yet been set 1116 element has been set and FALSE if the field has not yet been set
1118*/ 1117*/
@@ -1122,3 +1121,3 @@ bool DataElem::hasValidValue(int i) const
1122 return FALSE; 1121 return FALSE;
1123 if(!contained->getKeys()->validIndex(i)) 1122 if(!contained->getKeys()->validIndex(i))
1124 return FALSE; 1123 return FALSE;
@@ -1127,3 +1126,3 @@ bool DataElem::hasValidValue(int i) const
1127 1126
1128/*! 1127/*!
1129 This function determines whether field name qs of the element has been 1128 This function determines whether field name qs of the element has been
@@ -1131,6 +1130,6 @@ bool DataElem::hasValidValue(int i) const
1131 1130
1132 \return A boolean value that is TRUE if the specfied field of this 1131 \return A boolean value that is TRUE if the specfied field of this
1133 element has been set and FALSE if the field has not yet been set 1132 element has been set and FALSE if the field has not yet been set
1134*/ 1133*/
1135bool DataElem::hasValidValue(QString qs) const 1134bool DataElem::hasValidValue(QString qs) const
1136{ 1135{
@@ -1141,3 +1140,3 @@ bool DataElem::hasValidValue(QString qs) const
1141/*! returns the type of the field specified by index i */ 1140/*! returns the type of the field specified by index i */
1142TVVariant::KeyType DataElem::getFieldType(int i) const 1141TVVariant::KeyType DataElem::getFieldType(int i) const
1143{ 1142{
@@ -1153,5 +1152,5 @@ TVVariant::KeyType DataElem::getFieldType(QString qs) const
1153 1152
1154/*! 1153/*!
1155 returns a pointer to the data stored in field index i for this 1154 returns a pointer to the data stored in field index i for this
1156 data element, (value may not be valid) 1155 data element, (value may not be valid)
1157*/ 1156*/
@@ -1164,5 +1163,5 @@ TVVariant DataElem::getField(int i) const
1164 1163
1165/*! 1164/*!
1166 returns a pointer to the data stored in field name qs for this 1165 returns a pointer to the data stored in field name qs for this
1167 data element, (value may not be valid) 1166 data element, (value may not be valid)
1168*/ 1167*/
@@ -1181,3 +1180,3 @@ TVVariant DataElem::getField(QString qs) const
1181*/ 1180*/
1182void DataElem::setField(int i, QString q) 1181void DataElem::setField(int i, QString q)
1183{ 1182{
@@ -1210,5 +1209,3 @@ void DataElem::setField(int i, QString q)
1210 default: 1209 default:
1211 qWarning( 1210 owarn << "DataElem::setField(" << i << ", " << q << ") No valid type found" << oendl;
1212 QObject::tr("DataElem::setField(%1, %2) No valid type found").arg(i).arg(q)
1213 );
1214 } 1211 }
@@ -1221,5 +1218,5 @@ void DataElem::setField(int i, QString q)
1221 \param i index of the field to set 1218 \param i index of the field to set
1222 \param value a pointer to the (already allocated) value to set 1219 \param value a pointer to the (already allocated) value to set
1223*/ 1220*/
1224void DataElem::setField(int i, TVVariant value) 1221void DataElem::setField(int i, TVVariant value)
1225{ 1222{
@@ -1238,3 +1235,3 @@ void DataElem::setField(int i, TVVariant value)
1238*/ 1235*/
1239void DataElem::setField(QString qs, QString q) 1236void DataElem::setField(QString qs, QString q)
1240{ 1237{
@@ -1250,3 +1247,3 @@ void DataElem::setField(QString qs, QString q)
1250 \param qs name of the field to set 1247 \param qs name of the field to set
1251 \param value a pointer to the (already allocated) value to set 1248 \param value a pointer to the (already allocated) value to set
1252*/ 1249*/
@@ -1269,3 +1266,3 @@ void DataElem::unsetField(QString qs)
1269/*! 1266/*!
1270 Converts the data element to a Rich Text QString 1267 Converts the data element to a Rich Text QString
1271*/ 1268*/
@@ -1292,3 +1289,3 @@ QString DataElem::toQString() const
1292/*! formats individual fields to strings so can be displayed */ 1289/*! formats individual fields to strings so can be displayed */
1293QString DataElem::toQString(int i) const 1290QString DataElem::toQString(int i) const
1294{ 1291{
@@ -1300,3 +1297,3 @@ QString DataElem::toQString(int i) const
1300/*! formats individual fields to strings so can be sorted by QListView */ 1297/*! formats individual fields to strings so can be sorted by QListView */
1301QString DataElem::toSortableQString(int i) const 1298QString DataElem::toSortableQString(int i) const
1302{ 1299{
@@ -1315,3 +1312,3 @@ QString DataElem::toSortableQString(int i) const
1315 static QDate epochD(1800, 1, 1); 1312 static QDate epochD(1800, 1, 1);
1316 scratch.sprintf("%08d", 1313 scratch.sprintf("%08d",
1317 epochD.daysTo(getField(i).toDate())); 1314 epochD.daysTo(getField(i).toDate()));
@@ -1321,3 +1318,3 @@ QString DataElem::toSortableQString(int i) const
1321 static QTime epochT(0, 0, 0); 1318 static QTime epochT(0, 0, 0);
1322 scratch.sprintf("%08d", 1319 scratch.sprintf("%08d",
1323 epochT.msecsTo(getField(i).toTime())); 1320 epochT.msecsTo(getField(i).toTime()));
@@ -1382,3 +1379,3 @@ bool DataElem::contains(int i, TVVariant v) const
1382 /* meaningless for dates */ 1379 /* meaningless for dates */
1383 case TVVariant::Int: 1380 case TVVariant::Int:
1384 case TVVariant::Time: 1381 case TVVariant::Time:
@@ -1387,3 +1384,3 @@ bool DataElem::contains(int i, TVVariant v) const
1387 default: 1384 default:
1388 owarn << "Tried to compare unknown data type" << oendl; 1385 owarn << "Tried to compare unknown data type" << oendl;
1389 } 1386 }
@@ -1408,3 +1405,3 @@ bool DataElem::startsWith(int i, TVVariant v) const
1408 /* meaningless for dates */ 1405 /* meaningless for dates */
1409 case TVVariant::Int: 1406 case TVVariant::Int:
1410 case TVVariant::Time: 1407 case TVVariant::Time:
@@ -1413,3 +1410,3 @@ bool DataElem::startsWith(int i, TVVariant v) const
1413 default: 1410 default:
1414 owarn << "Tried to compare unknown data type" << oendl; 1411 owarn << "Tried to compare unknown data type" << oendl;
1415 } 1412 }
@@ -1434,3 +1431,3 @@ bool DataElem::endsWith(int i, TVVariant v) const
1434 /* meaningless for dates */ 1431 /* meaningless for dates */
1435 case TVVariant::Int: 1432 case TVVariant::Int:
1436 case TVVariant::Time: 1433 case TVVariant::Time:
@@ -1439,3 +1436,3 @@ bool DataElem::endsWith(int i, TVVariant v) const
1439 default: 1436 default:
1440 owarn << "Tried to compare unknown data type" << oendl; 1437 owarn << "Tried to compare unknown data type" << oendl;
1441 } 1438 }
@@ -1448,5 +1445,5 @@ bool DataElem::endsWith(int i, TVVariant v) const
1448 1445
1449 \return 1446 \return
1450 <UL> 1447 <UL>
1451 <LI>TRUE if the first element is a closer match to the target than the 1448 <LI>TRUE if the first element is a closer match to the target than the
1452 second element</LI> 1449 second element</LI>
@@ -1458,3 +1455,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
1458{ 1455{
1459 int type; 1456 int type;
1460 1457
@@ -1471,3 +1468,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
1471 /* can't do compare */ 1468 /* can't do compare */
1472 owarn << "Tried to compare two incompatable types" << oendl; 1469 owarn << "Tried to compare two incompatable types" << oendl;
1473 return FALSE; 1470 return FALSE;
@@ -1475,3 +1472,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
1475 return target.closer(d1->getField(column), d2->getField(column)); 1472 return target.closer(d1->getField(column), d2->getField(column));
1476 } 1473 }
1477 return target.close(d1->getField(column)); 1474 return target.close(d1->getField(column));
diff --git a/noncore/apps/tableviewer/db/datacache.cpp b/noncore/apps/tableviewer/db/datacache.cpp
index 6380e1b..de57961 100644
--- a/noncore/apps/tableviewer/db/datacache.cpp
+++ b/noncore/apps/tableviewer/db/datacache.cpp
@@ -18,3 +18,3 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20/* 20/*
@@ -65,6 +65,6 @@ DBStore::DBStore()
65 65
66//TODO 66//TODO
67/*! 67/*!
68 Reinitializes the table to empty (include a resize of the master table, 68 Reinitializes the table to empty (include a resize of the master table,
69 which should free some memory) 69 which should free some memory)
70*/ 70*/
@@ -95,3 +95,3 @@ DBStore::~DBStore()
95/*! 95/*!
96 This function opens the given xml file, loads it and sets up the 96 This function opens the given xml file, loads it and sets up the
97 appropriate data structures. 97 appropriate data structures.
@@ -103,3 +103,3 @@ bool DBStore::openSource(QIODevice *inDev, const QString &source) {
103 103
104 /* first check if db is already open, if contains data.. then clear */ 104 /* first check if db is already open, if contains data.. then clear */
105 if(number_elems > 0) { 105 if(number_elems > 0) {
@@ -111,5 +111,5 @@ bool DBStore::openSource(QIODevice *inDev, const QString &source) {
111 } else if (source == "text/csv") { 111 } else if (source == "text/csv") {
112 archive = new DBCsv(this); 112 archive = new DBCsv(this);
113 } else 113 } else
114 return false; 114 return false;
115 115
@@ -118,3 +118,3 @@ bool DBStore::openSource(QIODevice *inDev, const QString &source) {
118 118
119bool DBStore::saveSource(QIODevice *outDev, const QString &source) 119bool DBStore::saveSource(QIODevice *outDev, const QString &source)
120{ 120{
@@ -124,6 +124,6 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source)
124 archive = new DBXml(this); 124 archive = new DBXml(this);
125 } else if (source == "text/x-xml-tableviewer") { 125 } else if (source == "text/x-xml-tableviewer") {
126 archive = new DBCsv(this); 126 archive = new DBCsv(this);
127 } else 127 } else
128 return false; 128 return false;
129 } 129 }
@@ -135,6 +135,6 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source)
135 archive = new DBXml(this); 135 archive = new DBXml(this);
136 } else if (source == "text/x-xml-tableviewer") { 136 } else if (source == "text/x-xml-tableviewer") {
137 archive = new DBCsv(this); 137 archive = new DBCsv(this);
138 } else 138 } else
139 return false; 139 return false;
140 } 140 }
@@ -144,3 +144,3 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source)
144 144
145/*! 145/*!
146 This function is used to add new elements to the database. If the database 146 This function is used to add new elements to the database. If the database
@@ -158,5 +158,5 @@ void DBStore::addItemInternal(DataElem *delem)
158{ 158{
159 /* if already full, don't over fill, do a qWarning though */ 159 /* if already full, don't over fill, do a owarn though */
160 if (full) { 160 if (full) {
161 owarn << "Attempted to add items to already full table" << oendl; 161 owarn << "Attempted to add items to already full table" << oendl;
162 return; 162 return;
@@ -187,9 +187,9 @@ void DBStore::removeItem(DataElem *r)
187 int position = master_table.findRef(r); 187 int position = master_table.findRef(r);
188 if(position != -1) { 188 if(position != -1) {
189 /* there is at least one item, this is it */ 189 /* there is at least one item, this is it */
190 /* replace this with the last element, decrease the element count */ 190 /* replace this with the last element, decrease the element count */
191 master_table.insert(position, master_table.at(--number_elems)); 191 master_table.insert(position, master_table.at(--number_elems));
192 master_table.remove(number_elems); 192 master_table.remove(number_elems);
193 delete r; 193 delete r;
194 } 194 }
195} 195}
@@ -203,3 +203,3 @@ void DBStore::setName(const QString &n)
203{ 203{
204 name = n; 204 name = n;
205} 205}
@@ -213,3 +213,3 @@ QString DBStore::getName()
213{ 213{
214 return name; 214 return name;
215} 215}
@@ -217,3 +217,3 @@ QString DBStore::getName()
217/*! 217/*!
218 Retrieves a pointer to the key representation of the database for 218 Retrieves a pointer to the key representation of the database for
219 other classes to use as reference. 219 other classes to use as reference.
@@ -237,3 +237,3 @@ void DBStore::setKeys(KeyList *k)
237/*! 237/*!
238 Sets the current element to the first element of the database 238 Sets the current element to the first element of the database
239*/ 239*/
@@ -245,3 +245,3 @@ void DBStore::first()
245/*! 245/*!
246 Sets the current element to the last element of the database 246 Sets the current element to the last element of the database
247*/ 247*/
@@ -259,3 +259,3 @@ bool DBStore::next()
259 unsigned int new_current_elem = current_elem + 1; 259 unsigned int new_current_elem = current_elem + 1;
260 if (current_elem < number_elems) 260 if (current_elem < number_elems)
261 /* was valid before inc (it is possible but unlikely that inc current 261 /* was valid before inc (it is possible but unlikely that inc current
@@ -280,3 +280,3 @@ bool DBStore::previous()
280 if (new_current_elem < number_elems) { 280 if (new_current_elem < number_elems) {
281 /* still is (if was 0, then now -1, but as is unsigned will wrap 281 /* still is (if was 0, then now -1, but as is unsigned will wrap
282 and hence be invalid */ 282 and hence be invalid */
@@ -290,3 +290,3 @@ bool DBStore::previous()
290 Returns the current data element in the database. Which element is current 290 Returns the current data element in the database. Which element is current
291 is affected by newly added items, findItem, next, previous, first and 291 is affected by newly added items, findItem, next, previous, first and
292 last functions 292 last functions
@@ -295,5 +295,5 @@ bool DBStore::previous()
295*/ 295*/
296DataElem *DBStore::getCurrentData() 296DataElem *DBStore::getCurrentData()
297{ 297{
298 if (current_elem >= number_elems) 298 if (current_elem >= number_elems)
299 return NULL; 299 return NULL;
diff --git a/noncore/apps/tableviewer/db/datacache.h b/noncore/apps/tableviewer/db/datacache.h
index c5dc637..e38050c 100644
--- a/noncore/apps/tableviewer/db/datacache.h
+++ b/noncore/apps/tableviewer/db/datacache.h
@@ -29,5 +29,11 @@
29 29
30#include "common.h"
31
32/* OPIE */
33#include <opie2/odebug.h>
34using namespace Opie::Core;
35
36/* QT */
30#include <qstring.h> 37#include <qstring.h>
31#include <qvector.h> 38#include <qvector.h>
32#include "common.h"
33 39
@@ -47,3 +53,3 @@ public:
47 virtual bool openSource(QIODevice *) { 53 virtual bool openSource(QIODevice *) {
48 qWarning("DBAccess::openSource not yet implemented"); 54 owarn << "DBAccess::openSource not yet implemented" << oendl;
49 return false; 55 return false;
@@ -52,3 +58,3 @@ public:
52 virtual bool saveSource(QIODevice *) { 58 virtual bool saveSource(QIODevice *) {
53 qWarning("DBAccess::saveSource(QString) not yet implemented"); 59 owarn << "DBAccess::saveSource(QString) not yet implemented" << oendl;
54 return false; 60 return false;
@@ -72,3 +78,3 @@ public:
72 void addItemInternal(DataElem *); 78 void addItemInternal(DataElem *);
73 void removeItem(DataElem *); 79 void removeItem(DataElem *);
74 80
@@ -108,6 +114,6 @@ public:
108 114
109 bool next(); 115 bool next();
110 bool previous(); 116 bool previous();
111 117
112 DataElem* getCurrentData(); 118 DataElem* getCurrentData();
113 119
@@ -116,3 +122,3 @@ private:
116 void freeTable(); 122 void freeTable();
117 QString name; 123 QString name;
118 124
@@ -125,3 +131,3 @@ private:
125 unsigned int table_size; /* should always be a power of 2 */ 131 unsigned int table_size; /* should always be a power of 2 */
126 bool full; /* since because we are using an int for indexing there is 132 bool full; /* since because we are using an int for indexing there is
127 an upper limit on the number of items we can store. */ 133 an upper limit on the number of items we can store. */
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
@@ -18,3 +18,3 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "browsekeyentry.h" 20#include "browsekeyentry.h"
@@ -22,2 +22,5 @@
22 22
23#include <opie2/odebug.h>
24using namespace Opie::Core;
25
23#include <qtoolbutton.h> 26#include <qtoolbutton.h>
@@ -31,5 +34,2 @@
31 34
32#include <qheader.h>
33// For qWarning(const char *)
34
35/*! 35/*!
@@ -44,3 +44,3 @@
44/*! 44/*!
45 Constructs the widget 45 Constructs the widget
46*/ 46*/
@@ -75,14 +75,14 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
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()));
@@ -93,9 +93,9 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
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()));
@@ -104,3 +104,3 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f)
104/*! 104/*!
105 Destructs the widget 105 Destructs the widget
106*/ 106*/
@@ -128,3 +128,3 @@ void 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)));
@@ -148,3 +148,3 @@ void TVBrowseKeyEntry::rebuildKeys() {
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);
@@ -165,4 +165,4 @@ void TVBrowseKeyEntry::reset()
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*/
@@ -191,7 +191,6 @@ void TVBrowseKeyEntry::searchOnText()
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;
@@ -205,2 +204,2 @@ void TVBrowseKeyEntry::searchOnText()
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
@@ -18,3 +18,3 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "filterkeyentry.h" 20#include "filterkeyentry.h"
@@ -22,2 +22,7 @@
22 22
23/* OPIE */
24#include <opie2/odebug.h>
25using namespace Opie::Core;
26
27/* QT */
23#include <qwidgetstack.h> 28#include <qwidgetstack.h>
@@ -100,9 +105,9 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
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()));
@@ -121,3 +126,3 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f)
121/*! 126/*!
122 Destructs the widget 127 Destructs the widget
123*/ 128*/
@@ -127,3 +132,3 @@ TVFilterKeyEntry::~TVFilterKeyEntry()
127 132
128void TVFilterKeyEntry::setKey(int i) 133void TVFilterKeyEntry::setKey(int i)
129{ 134{
@@ -185,16 +190,16 @@ TVVariant TVFilterKeyEntry::getCompareValue()
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 }
@@ -202,4 +207,3 @@ TVVariant TVFilterKeyEntry::getCompareValue()
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 }
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
@@ -20,2 +20,9 @@
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>
@@ -28,3 +35,2 @@
28 35
29#include <qpe/qpeapplication.h>
30 36
@@ -33,4 +39,4 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
33{ 39{
34 if ( !name ) 40 if ( !name )
35 setName( "Filter View" ); 41 setName( "Filter View" );
36 42
@@ -90,4 +96,4 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
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
@@ -104,3 +110,3 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
104/*! 110/*!
105 Destroys the TVFilterView widget 111 Destroys the TVFilterView widget
106*/ 112*/
@@ -120,3 +126,3 @@ void TVFilterView::reset()
120 126
121void TVFilterView::rebuildKeys() 127void TVFilterView::rebuildKeys()
122{ 128{
@@ -127,3 +133,3 @@ void TVFilterView::rebuildKeys()
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 */
@@ -134,8 +140,8 @@ void TVFilterView::rebuildKeys()
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 }
@@ -148,3 +154,3 @@ bool TVFilterView::passesFilter(DataElem *d) {
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() ) {
@@ -177,4 +183,3 @@ bool TVFilterView::passesFilter(DataElem *d) {
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;
@@ -196,3 +201,3 @@ bool TVFilterView::filterActive() const
196/* SLOTS */ 201/* SLOTS */
197void TVFilterView::newTerm() 202void TVFilterView::newTerm()
198{ 203{
@@ -214,3 +219,3 @@ void TVFilterView::newTerm()
214 219
215void TVFilterView::updateTerm() 220void TVFilterView::updateTerm()
216{ 221{
@@ -233,3 +238,3 @@ void TVFilterView::updateTerm()
233 term->value = keyEntry->getCompareValue(); 238 term->value = keyEntry->getCompareValue();
234 239
235 keyString = keyNameCombo->currentText(); 240 keyString = keyNameCombo->currentText();
@@ -262,3 +267,3 @@ void TVFilterView::updateTerm()
262 /* remove old view */ 267 /* remove old view */
263 if (term->view) 268 if (term->view)
264 delete(term->view); 269 delete(term->view);
@@ -269,3 +274,3 @@ void TVFilterView::updateTerm()
269/* deletes current term */ 274/* deletes current term */
270void TVFilterView::deleteTerm() 275void TVFilterView::deleteTerm()
271{ 276{
@@ -286,3 +291,3 @@ void TVFilterView::deleteTerm()
286/* clears all terminations */ 291/* clears all terminations */
287void TVFilterView::clearTerms() 292void TVFilterView::clearTerms()
288{ 293{
@@ -294,3 +299,3 @@ void 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 */
@@ -303,3 +308,3 @@ void TVFilterView::setTerm(QListViewItem *target)
303 if (!current) { 308 if (!current) {
304 current = term; 309 current = term;
305 } 310 }