-rw-r--r-- | noncore/apps/tableviewer/browsekeyentry.cpp | 53 | ||||
-rw-r--r-- | noncore/apps/tableviewer/db/common.cpp | 165 | ||||
-rw-r--r-- | noncore/apps/tableviewer/db/datacache.cpp | 68 | ||||
-rw-r--r-- | noncore/apps/tableviewer/db/datacache.h | 24 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/browsekeyentry.cpp | 49 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/filterkeyentry.cpp | 42 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/tvfilterview.cpp | 55 |
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 @@ ** -**********************************************************************/ +**********************************************************************/ #include "browsekeyentry.h" +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qtoolbutton.h> @@ -30,5 +35,2 @@ -//#include <iostream.h> -#include <qheader.h> -// For qWarning(const char *) @@ -44,3 +46,3 @@ /*! - Constructs the widget + Constructs the widget */ @@ -82,26 +84,26 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) ws->raiseWidget(0); - + // TODO connect slots and signals.... - connect(changeKeyButton, SIGNAL(clicked()), + connect(changeKeyButton, SIGNAL(clicked()), this, SLOT(changeKeyMenuSlot())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), this, SLOT(resetKeySlot())); - connect(textKey, SIGNAL(textChanged(const QString&)), + connect(textKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(dayKey, SIGNAL(textChanged(const QString&)), + connect(dayKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(monthKey, SIGNAL(textChanged(const QString&)), + connect(monthKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(yearKey, SIGNAL(textChanged(const QString&)), + connect(yearKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(secondKey, SIGNAL(textChanged(const QString&)), + connect(secondKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(minuteKey, SIGNAL(textChanged(const QString&)), + connect(minuteKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(hourKey, SIGNAL(textChanged(const QString&)), + connect(hourKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - + h_layout->addWidget(ws); @@ -112,3 +114,3 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) /*! - Destructs the widget + Destructs the widget */ @@ -138,4 +140,4 @@ void TVBrowseKeyEntry::changeKeySlot(int id_param) break; - default: - return; + default: + return; } @@ -148,3 +150,3 @@ void TVBrowseKeyEntry::changeKeyMenuSlot() { - if(ts) + if(ts) keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); @@ -167,3 +169,3 @@ void TVBrowseKeyEntry::setTableState(TableState *t) { for (i = 0; i < t->kRep->getNumFields(); i++) { - keyMenu->insertItem(ts->kRep->getKeyName(i), this, + keyMenu->insertItem(ts->kRep->getKeyName(i), this, SLOT(changeKeySlot(int)), 0, i); @@ -174,4 +176,4 @@ void TVBrowseKeyEntry::setTableState(TableState *t) { /*! - Searches on the current value of the key entry provided that the - current key is of type text WARNING, TODO fix memory leaks + Searches on the current value of the key entry provided that the + current key is of type text WARNING, TODO fix memory leaks */ @@ -230,4 +232,3 @@ void TVBrowseKeyEntry::searchOnText() default: - qWarning("TVBrowseKeyEntry::searchOnText() " - "cannot work out data type"); + owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl; return; @@ -241,2 +242,2 @@ void TVBrowseKeyEntry::searchOnText() done searching for the value v. -*/ +*/ 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 @@ ** -**********************************************************************/ -#include "common.h" +**********************************************************************/ +#include "common.h" #include "datacache.h" @@ -90,3 +90,3 @@ int QStringVector::compareItems(Item a, Item b) QString *qb = (QString *)b; - + return QString::compare(*qa, *qb); @@ -96,3 +96,3 @@ int QStringVector::compareItems(Item a, Item b) \class TVVariant - A way of abstracting void * and keeping information on + A way of abstracting void * and keeping information on the keytypes and behaviours in one place @@ -322,3 +322,3 @@ void TVVariant::load(QDataStream &s ) default: - ofatal << "Unrecognized data type" << oendl; + ofatal << "Unrecognized data type" << oendl; } @@ -384,3 +384,3 @@ const QString TVVariant::toString() const return ((QTime*)d->value.ptr)->toString(); - case Int: + case Int: return QString::number(d->value.i); @@ -426,3 +426,3 @@ const QDate TVVariant::toDate() const } - + @@ -435,3 +435,3 @@ const QTime TVVariant::toTime() const return *((QTime *)d->value.ptr); - + if(d->typ == String) { @@ -456,3 +456,3 @@ const QTime TVVariant::toTime() const return *((Q##f*)d->value.ptr); } - + TV_VARIANT_AS(String) @@ -562,3 +562,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o) if(d->typ == Invalid) - return FALSE; + return FALSE; @@ -574,3 +574,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o) case String: { - /* case for strings is close is a substring.. closer is + /* case for strings is close is a substring.. closer is * earlier alphabetically */ @@ -584,3 +584,3 @@ bool TVVariant::closer(TVVariant n, TVVariant o) /* contains sub-str, if later than is not closer */ - if(QString::compare(qs1, qs2) > 0) + if(QString::compare(qs1, qs2) > 0) return FALSE; @@ -595,9 +595,9 @@ bool TVVariant::closer(TVVariant n, TVVariant o) int diff1 = (i1 - iv); - if (diff1 < 0) + if (diff1 < 0) diff1 = -diff1; int diff2 = (i2 - iv); - if (diff2 < 0) + if (diff2 < 0) diff2 = -diff2; - if (diff1 < diff2) + if (diff1 < diff2) return TRUE; @@ -612,6 +612,6 @@ bool TVVariant::closer(TVVariant n, TVVariant o) int diff1 = i1.daysTo(iv); - if (diff1 < 0) + if (diff1 < 0) diff1 = -diff1; int diff2 = i2.daysTo(iv); - if (diff2 < 0) + if (diff2 < 0) diff2 = -diff2; @@ -629,6 +629,6 @@ bool TVVariant::closer(TVVariant n, TVVariant o) int diff1 = i1.msecsTo(iv); - if (diff1 < 0) + if (diff1 < 0) diff1 = -diff1; int diff2 = i2.msecsTo(iv); - if (diff2 < 0) + if (diff2 < 0) diff2 = -diff2; @@ -651,3 +651,3 @@ bool TVVariant::close(TVVariant n) if(type() == Invalid) - return FALSE; + return FALSE; @@ -659,3 +659,3 @@ bool TVVariant::close(TVVariant n) case String: { - /* case for strings is close is a substring.. closer is + /* case for strings is close is a substring.. closer is * earlier alphabetically */ @@ -668,3 +668,3 @@ bool TVVariant::close(TVVariant n) } - case Int: + case Int: case Date: @@ -683,3 +683,3 @@ bool TVVariant::close(TVVariant n) \brief document me! - + document me! @@ -690,3 +690,3 @@ Key::Key() : kname(), kexample(), kflags(0) { } Key::Key(QString name, TVVariant example, int flags) : - kname(name), kexample(example), kflags(flags) { } + kname(name), kexample(example), kflags(flags) { } @@ -699,3 +699,3 @@ Key::Key(const Key &other) -Key& Key::operator=(const Key& key) +Key& Key::operator=(const Key& key) { @@ -779,3 +779,3 @@ void Key::setNewFlag(bool v) */ -KeyList::KeyList() : QIntDict<Key>(20) +KeyList::KeyList() : QIntDict<Key>(20) { @@ -785,3 +785,3 @@ KeyList::KeyList() : QIntDict<Key>(20) /* Should be deep copy, but isn't */ -KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k) +KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k) { @@ -824,3 +824,3 @@ bool KeyList::operator!=(const KeyList &other) */ -int KeyList::getNumFields() const +int KeyList::getNumFields() const { @@ -849,12 +849,12 @@ int KeyList::addKey(QString name, TVVariant::KeyType type) switch(type) { - case TVVariant::String: + case TVVariant::String: return addKey(name, TVVariant("<undefined>").asString()); break; - case TVVariant::Date: + case TVVariant::Date: return addKey(name, TVVariant(QDate::currentDate()).asDate()); break; - case TVVariant::Time: + case TVVariant::Time: return addKey(name, TVVariant(QTime(0,0,0)).toTime()); break; - case TVVariant::Int: + case TVVariant::Int: return addKey(name, TVVariant(0).toInt()); @@ -862,4 +862,3 @@ int KeyList::addKey(QString name, TVVariant::KeyType type) default: - qWarning(QObject::tr("KeyList::addKey() Cannot make default " - "value for type %1, Key not added.").arg(type)); + owarn << "KeyList::addKey() Cannot make default value for type " << type << ", Key not added." << oendl; break; @@ -869,3 +868,3 @@ int KeyList::addKey(QString name, TVVariant::KeyType type) -void KeyList::setKeyFlags(int i, int flag) +void KeyList::setKeyFlags(int i, int flag) { @@ -882,3 +881,3 @@ int KeyList::getKeyFlags(int i) const -bool KeyList::checkNewFlag(int i) const +bool KeyList::checkNewFlag(int i) const { @@ -889,3 +888,3 @@ bool KeyList::checkNewFlag(int i) const -void KeyList::setNewFlag(int i, bool f) +void KeyList::setNewFlag(int i, bool f) { @@ -896,3 +895,3 @@ void KeyList::setNewFlag(int i, bool f) -bool KeyList::checkDeleteFlag(int i) const +bool KeyList::checkDeleteFlag(int i) const { @@ -903,3 +902,3 @@ bool KeyList::checkDeleteFlag(int i) const -void KeyList::setDeleteFlag(int i, bool f) +void KeyList::setDeleteFlag(int i, bool f) { @@ -920,3 +919,3 @@ QString KeyList::getKeyName(int i) const -void KeyList::setKeyName(int i, const QString &n) +void KeyList::setKeyName(int i, const QString &n) { @@ -936,3 +935,3 @@ TVVariant::KeyType KeyList::getKeyType(int i) const -void KeyList::setKeyType(int i, TVVariant::KeyType t) +void KeyList::setKeyType(int i, TVVariant::KeyType t) { @@ -1042,5 +1041,5 @@ QDataStream &operator>>( QDataStream &s, KeyList &k) /*! - Constructs a DataElem. This function needs a container because the - size, types of keys and primary key are all defined by the containing - database + Constructs a DataElem. This function needs a container because the + size, types of keys and primary key are all defined by the containing + database */ @@ -1088,3 +1087,3 @@ QDataStream &operator>>( QDataStream &s, DataElem &d) if (size != d.getNumFields()) { - owarn << "DataSize mis-match" << oendl; + owarn << "DataSize mis-match" << oendl; return s; /* sanity check failed.. don't load */ @@ -1111,3 +1110,3 @@ KeyList DataElem::getKeys() const -/*! +/*! This function determines whether field index i of the element has been @@ -1115,4 +1114,4 @@ KeyList DataElem::getKeys() const - \return A boolean value that is TRUE if the specfied field of this - element has been set and FALSE if the field has not yet been set + \return A boolean value that is TRUE if the specfied field of this + element has been set and FALSE if the field has not yet been set */ @@ -1122,3 +1121,3 @@ bool DataElem::hasValidValue(int i) const return FALSE; - if(!contained->getKeys()->validIndex(i)) + if(!contained->getKeys()->validIndex(i)) return FALSE; @@ -1127,3 +1126,3 @@ bool DataElem::hasValidValue(int i) const -/*! +/*! This function determines whether field name qs of the element has been @@ -1131,6 +1130,6 @@ bool DataElem::hasValidValue(int i) const - \return A boolean value that is TRUE if the specfied field of this - element has been set and FALSE if the field has not yet been set + \return A boolean value that is TRUE if the specfied field of this + element has been set and FALSE if the field has not yet been set */ -bool DataElem::hasValidValue(QString qs) const +bool DataElem::hasValidValue(QString qs) const { @@ -1141,3 +1140,3 @@ bool DataElem::hasValidValue(QString qs) const /*! returns the type of the field specified by index i */ -TVVariant::KeyType DataElem::getFieldType(int i) const +TVVariant::KeyType DataElem::getFieldType(int i) const { @@ -1153,5 +1152,5 @@ TVVariant::KeyType DataElem::getFieldType(QString qs) const -/*! - returns a pointer to the data stored in field index i for this - data element, (value may not be valid) +/*! + returns a pointer to the data stored in field index i for this + data element, (value may not be valid) */ @@ -1164,5 +1163,5 @@ TVVariant DataElem::getField(int i) const -/*! - returns a pointer to the data stored in field name qs for this - data element, (value may not be valid) +/*! + returns a pointer to the data stored in field name qs for this + data element, (value may not be valid) */ @@ -1181,3 +1180,3 @@ TVVariant DataElem::getField(QString qs) const */ -void DataElem::setField(int i, QString q) +void DataElem::setField(int i, QString q) { @@ -1210,5 +1209,3 @@ void DataElem::setField(int i, QString q) default: - qWarning( - QObject::tr("DataElem::setField(%1, %2) No valid type found").arg(i).arg(q) - ); + owarn << "DataElem::setField(" << i << ", " << q << ") No valid type found" << oendl; } @@ -1221,5 +1218,5 @@ void DataElem::setField(int i, QString q) \param i index of the field to set - \param value a pointer to the (already allocated) value to set + \param value a pointer to the (already allocated) value to set */ -void DataElem::setField(int i, TVVariant value) +void DataElem::setField(int i, TVVariant value) { @@ -1238,3 +1235,3 @@ void DataElem::setField(int i, TVVariant value) */ -void DataElem::setField(QString qs, QString q) +void DataElem::setField(QString qs, QString q) { @@ -1250,3 +1247,3 @@ void DataElem::setField(QString qs, QString q) \param qs name of the field to set - \param value a pointer to the (already allocated) value to set + \param value a pointer to the (already allocated) value to set */ @@ -1269,3 +1266,3 @@ void DataElem::unsetField(QString qs) /*! - Converts the data element to a Rich Text QString + Converts the data element to a Rich Text QString */ @@ -1292,3 +1289,3 @@ QString DataElem::toQString() const /*! formats individual fields to strings so can be displayed */ -QString DataElem::toQString(int i) const +QString DataElem::toQString(int i) const { @@ -1300,3 +1297,3 @@ QString DataElem::toQString(int i) const /*! formats individual fields to strings so can be sorted by QListView */ -QString DataElem::toSortableQString(int i) const +QString DataElem::toSortableQString(int i) const { @@ -1315,3 +1312,3 @@ QString DataElem::toSortableQString(int i) const static QDate epochD(1800, 1, 1); - scratch.sprintf("%08d", + scratch.sprintf("%08d", epochD.daysTo(getField(i).toDate())); @@ -1321,3 +1318,3 @@ QString DataElem::toSortableQString(int i) const static QTime epochT(0, 0, 0); - scratch.sprintf("%08d", + scratch.sprintf("%08d", epochT.msecsTo(getField(i).toTime())); @@ -1382,3 +1379,3 @@ bool DataElem::contains(int i, TVVariant v) const /* meaningless for dates */ - case TVVariant::Int: + case TVVariant::Int: case TVVariant::Time: @@ -1387,3 +1384,3 @@ bool DataElem::contains(int i, TVVariant v) const default: - owarn << "Tried to compare unknown data type" << oendl; + owarn << "Tried to compare unknown data type" << oendl; } @@ -1408,3 +1405,3 @@ bool DataElem::startsWith(int i, TVVariant v) const /* meaningless for dates */ - case TVVariant::Int: + case TVVariant::Int: case TVVariant::Time: @@ -1413,3 +1410,3 @@ bool DataElem::startsWith(int i, TVVariant v) const default: - owarn << "Tried to compare unknown data type" << oendl; + owarn << "Tried to compare unknown data type" << oendl; } @@ -1434,3 +1431,3 @@ bool DataElem::endsWith(int i, TVVariant v) const /* meaningless for dates */ - case TVVariant::Int: + case TVVariant::Int: case TVVariant::Time: @@ -1439,3 +1436,3 @@ bool DataElem::endsWith(int i, TVVariant v) const default: - owarn << "Tried to compare unknown data type" << oendl; + owarn << "Tried to compare unknown data type" << oendl; } @@ -1448,5 +1445,5 @@ bool DataElem::endsWith(int i, TVVariant v) const - \return + \return <UL> - <LI>TRUE if the first element is a closer match to the target than the + <LI>TRUE if the first element is a closer match to the target than the second element</LI> @@ -1458,3 +1455,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) { - int type; + int type; @@ -1471,3 +1468,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) /* can't do compare */ - owarn << "Tried to compare two incompatable types" << oendl; + owarn << "Tried to compare two incompatable types" << oendl; return FALSE; @@ -1475,3 +1472,3 @@ bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column) return target.closer(d1->getField(column), d2->getField(column)); - } + } 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 @@ ** -**********************************************************************/ +**********************************************************************/ /* @@ -65,6 +65,6 @@ DBStore::DBStore() -//TODO +//TODO /*! - Reinitializes the table to empty (include a resize of the master table, - which should free some memory) + Reinitializes the table to empty (include a resize of the master table, + which should free some memory) */ @@ -95,3 +95,3 @@ DBStore::~DBStore() /*! - This function opens the given xml file, loads it and sets up the + This function opens the given xml file, loads it and sets up the appropriate data structures. @@ -103,3 +103,3 @@ bool DBStore::openSource(QIODevice *inDev, const QString &source) { - /* first check if db is already open, if contains data.. then clear */ + /* first check if db is already open, if contains data.. then clear */ if(number_elems > 0) { @@ -111,5 +111,5 @@ bool DBStore::openSource(QIODevice *inDev, const QString &source) { } else if (source == "text/csv") { - archive = new DBCsv(this); + archive = new DBCsv(this); } else - return false; + return false; @@ -118,3 +118,3 @@ bool DBStore::openSource(QIODevice *inDev, const QString &source) { -bool DBStore::saveSource(QIODevice *outDev, const QString &source) +bool DBStore::saveSource(QIODevice *outDev, const QString &source) { @@ -124,6 +124,6 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source) archive = new DBXml(this); - } else if (source == "text/x-xml-tableviewer") { + } else if (source == "text/x-xml-tableviewer") { archive = new DBCsv(this); } else - return false; + return false; } @@ -135,6 +135,6 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source) archive = new DBXml(this); - } else if (source == "text/x-xml-tableviewer") { + } else if (source == "text/x-xml-tableviewer") { archive = new DBCsv(this); - } else - return false; + } else + return false; } @@ -144,3 +144,3 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source) -/*! +/*! This function is used to add new elements to the database. If the database @@ -158,5 +158,5 @@ void DBStore::addItemInternal(DataElem *delem) { - /* if already full, don't over fill, do a qWarning though */ + /* if already full, don't over fill, do a owarn though */ if (full) { - owarn << "Attempted to add items to already full table" << oendl; + owarn << "Attempted to add items to already full table" << oendl; return; @@ -187,9 +187,9 @@ void DBStore::removeItem(DataElem *r) int position = master_table.findRef(r); - if(position != -1) { - /* there is at least one item, this is it */ - /* replace this with the last element, decrease the element count */ - master_table.insert(position, master_table.at(--number_elems)); - master_table.remove(number_elems); - delete r; - } + if(position != -1) { + /* there is at least one item, this is it */ + /* replace this with the last element, decrease the element count */ + master_table.insert(position, master_table.at(--number_elems)); + master_table.remove(number_elems); + delete r; + } } @@ -203,3 +203,3 @@ void DBStore::setName(const QString &n) { - name = n; + name = n; } @@ -213,3 +213,3 @@ QString DBStore::getName() { - return name; + return name; } @@ -217,3 +217,3 @@ QString DBStore::getName() /*! - Retrieves a pointer to the key representation of the database for + Retrieves a pointer to the key representation of the database for other classes to use as reference. @@ -237,3 +237,3 @@ void DBStore::setKeys(KeyList *k) /*! - Sets the current element to the first element of the database + Sets the current element to the first element of the database */ @@ -245,3 +245,3 @@ void DBStore::first() /*! - Sets the current element to the last element of the database + Sets the current element to the last element of the database */ @@ -259,3 +259,3 @@ bool DBStore::next() unsigned int new_current_elem = current_elem + 1; - if (current_elem < number_elems) + if (current_elem < number_elems) /* was valid before inc (it is possible but unlikely that inc current @@ -280,3 +280,3 @@ bool DBStore::previous() if (new_current_elem < number_elems) { - /* still is (if was 0, then now -1, but as is unsigned will wrap + /* still is (if was 0, then now -1, but as is unsigned will wrap and hence be invalid */ @@ -290,3 +290,3 @@ bool DBStore::previous() Returns the current data element in the database. Which element is current - is affected by newly added items, findItem, next, previous, first and + is affected by newly added items, findItem, next, previous, first and last functions @@ -295,5 +295,5 @@ bool DBStore::previous() */ -DataElem *DBStore::getCurrentData() +DataElem *DBStore::getCurrentData() { - if (current_elem >= number_elems) + if (current_elem >= number_elems) 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 @@ +#include "common.h" + +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qstring.h> #include <qvector.h> -#include "common.h" @@ -47,3 +53,3 @@ public: virtual bool openSource(QIODevice *) { - qWarning("DBAccess::openSource not yet implemented"); + owarn << "DBAccess::openSource not yet implemented" << oendl; return false; @@ -52,3 +58,3 @@ public: virtual bool saveSource(QIODevice *) { - qWarning("DBAccess::saveSource(QString) not yet implemented"); + owarn << "DBAccess::saveSource(QString) not yet implemented" << oendl; return false; @@ -72,3 +78,3 @@ public: void addItemInternal(DataElem *); - void removeItem(DataElem *); + void removeItem(DataElem *); @@ -108,6 +114,6 @@ public: - bool next(); - bool previous(); + bool next(); + bool previous(); - DataElem* getCurrentData(); + DataElem* getCurrentData(); @@ -116,3 +122,3 @@ private: void freeTable(); - QString name; + QString name; @@ -125,3 +131,3 @@ private: unsigned int table_size; /* should always be a power of 2 */ - bool full; /* since because we are using an int for indexing there is + bool full; /* since because we are using an int for indexing there is 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 @@ ** -**********************************************************************/ +**********************************************************************/ #include "browsekeyentry.h" @@ -22,2 +22,5 @@ +#include <opie2/odebug.h> +using namespace Opie::Core; + #include <qtoolbutton.h> @@ -31,5 +34,2 @@ -#include <qheader.h> -// For qWarning(const char *) - /*! @@ -44,3 +44,3 @@ /*! - Constructs the widget + Constructs the widget */ @@ -75,14 +75,14 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) ws->raiseWidget(TVVariant::String); - + // TODO connect slots and signals.... - connect(changeKeyButton, SIGNAL(clicked()), + connect(changeKeyButton, SIGNAL(clicked()), this, SLOT(changeKeyMenuSlot())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), textKey, SLOT(clear())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), intKey, SLOT(clear())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), dateKey, SLOT(clear())); - connect(resetButton, SIGNAL(clicked()), + connect(resetButton, SIGNAL(clicked()), timeKey, SLOT(clear())); @@ -93,9 +93,9 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) - connect(textKey, SIGNAL(textChanged(const QString&)), + connect(textKey, SIGNAL(textChanged(const QString&)), this, SLOT(searchOnText())); - connect(intKey, SIGNAL(valueChanged(int)), + connect(intKey, SIGNAL(valueChanged(int)), this, SLOT(searchOnText())); - connect(dateKey, SIGNAL(valueChanged(const QDate&)), + connect(dateKey, SIGNAL(valueChanged(const QDate&)), this, SLOT(searchOnText())); - connect(timeKey, SIGNAL(valueChanged(const QTime&)), + connect(timeKey, SIGNAL(valueChanged(const QTime&)), this, SLOT(searchOnText())); @@ -104,3 +104,3 @@ TVBrowseKeyEntry::TVBrowseKeyEntry(QWidget *parent, const char *name, WFlags f) /*! - Destructs the widget + Destructs the widget */ @@ -128,3 +128,3 @@ void TVBrowseKeyEntry::changeKeyMenuSlot() { - if(ts) + if(ts) keyMenu->exec(changeKeyButton->mapToGlobal(QPoint(0,0))); @@ -148,3 +148,3 @@ void TVBrowseKeyEntry::rebuildKeys() { for (i = 0; i < ts->kRep->getNumFields(); i++) { - keyMenu->insertItem(it.current()->name(), this, + keyMenu->insertItem(it.current()->name(), this, SLOT(changeKeySlot(int)), 0, i); @@ -165,4 +165,4 @@ void TVBrowseKeyEntry::reset() /*! - Searches on the current value of the key entry provided that the - current key is of type text WARNING, TODO fix memory leaks + Searches on the current value of the key entry provided that the + current key is of type text WARNING, TODO fix memory leaks */ @@ -191,7 +191,6 @@ void TVBrowseKeyEntry::searchOnText() } - case TVVariant::Invalid: - break; + case TVVariant::Invalid: + break; default: - qWarning("TVBrowseKeyEntry::searchOnText() " - "cannot work out data type"); + owarn << "TVBrowseKeyEntry::searchOnText() cannot work out data type" << oendl; return; @@ -205,2 +204,2 @@ void TVBrowseKeyEntry::searchOnText() done searching for the value v. -*/ +*/ 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 @@ ** -**********************************************************************/ +**********************************************************************/ #include "filterkeyentry.h" @@ -22,2 +22,7 @@ +/* OPIE */ +#include <opie2/odebug.h> +using namespace Opie::Core; + +/* QT */ #include <qwidgetstack.h> @@ -100,9 +105,9 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f) /* connect the signals down */ - connect(textKey, SIGNAL(textChanged(const QString&)), + connect(textKey, SIGNAL(textChanged(const QString&)), this, SIGNAL(valueChanged())); - connect(intKey, SIGNAL(valueChanged(int)), + connect(intKey, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged())); - connect(dateKey, SIGNAL(valueChanged(const QDate&)), + connect(dateKey, SIGNAL(valueChanged(const QDate&)), this, SIGNAL(valueChanged())); - connect(timeKey, SIGNAL(valueChanged(const QTime&)), + connect(timeKey, SIGNAL(valueChanged(const QTime&)), this, SIGNAL(valueChanged())); @@ -121,3 +126,3 @@ TVFilterKeyEntry::TVFilterKeyEntry(QWidget *parent, const char *name, WFlags f) /*! - Destructs the widget + Destructs the widget */ @@ -127,3 +132,3 @@ TVFilterKeyEntry::~TVFilterKeyEntry() -void TVFilterKeyEntry::setKey(int i) +void TVFilterKeyEntry::setKey(int i) { @@ -185,16 +190,16 @@ TVVariant TVFilterKeyEntry::getCompareValue() switch(current_type) { - case TVVariant::String: - sendkey = TVVariant(QString(textKey->text())); - break; - case TVVariant::Int: { + case TVVariant::String: + sendkey = TVVariant(QString(textKey->text())); + break; + case TVVariant::Int: { sendkey = TVVariant(intKey->value()); - break; - } + break; + } case TVVariant::Time: { - sendkey = TVVariant(QTime(timeKey->time())); - break; + sendkey = TVVariant(QTime(timeKey->time())); + break; } case TVVariant::Date: { - sendkey = TVVariant(QDate(dateKey->date())); - break; + sendkey = TVVariant(QDate(dateKey->date())); + break; } @@ -202,4 +207,3 @@ TVVariant TVFilterKeyEntry::getCompareValue() sendkey = TVVariant(0); - qWarning("TVFilterKeyEntry::getCompareValue() " - "cannot work out data type"); + owarn << "TVFilterKeyEntry::getCompareValue() cannot work out data type" << oendl; } 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 @@ #include "tvfilterview.h" + +/* OPIE */ +#include <opie2/odebug.h> +#include <qpe/qpeapplication.h> +using namespace Opie::Core; + +/* QT */ #include <qtoolbutton.h> @@ -28,3 +35,2 @@ -#include <qpe/qpeapplication.h> @@ -33,4 +39,4 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent, { - if ( !name ) - setName( "Filter View" ); + if ( !name ) + setName( "Filter View" ); @@ -90,4 +96,4 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent, - connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, - SLOT(setTerm(QListViewItem*))); + connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, + SLOT(setTerm(QListViewItem*))); @@ -104,3 +110,3 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent, /*! - Destroys the TVFilterView widget + Destroys the TVFilterView widget */ @@ -120,3 +126,3 @@ void TVFilterView::reset() -void TVFilterView::rebuildKeys() +void TVFilterView::rebuildKeys() { @@ -127,3 +133,3 @@ void TVFilterView::rebuildKeys() keyEntry->setTableState(ts); - + /* set up the list of keys that can be compared on */ @@ -134,8 +140,8 @@ void TVFilterView::rebuildKeys() while(it.current()) { - if(ts->kRep->validIndex(it.currentKey())) { - keyNameCombo->insertItem(it.current()->name()); - keyIds.insert(i, it.currentKey()); - ++i; - } - ++it; + if(ts->kRep->validIndex(it.currentKey())) { + keyNameCombo->insertItem(it.current()->name()); + keyIds.insert(i, it.currentKey()); + ++i; + } + ++it; } @@ -148,3 +154,3 @@ bool TVFilterView::passesFilter(DataElem *d) { FilterTerm *t; - + for (t = terms.first(); t != 0; t = terms.next() ) { @@ -177,4 +183,3 @@ bool TVFilterView::passesFilter(DataElem *d) { default: - qWarning("TVFilterView::passesFilter() " - "unrecognized filter type"); + owarn << "TVFilterView::passesFilter() unrecognized filter type" << oendl; return false; @@ -196,3 +201,3 @@ bool TVFilterView::filterActive() const /* SLOTS */ -void TVFilterView::newTerm() +void TVFilterView::newTerm() { @@ -214,3 +219,3 @@ void TVFilterView::newTerm() -void TVFilterView::updateTerm() +void TVFilterView::updateTerm() { @@ -233,3 +238,3 @@ void TVFilterView::updateTerm() term->value = keyEntry->getCompareValue(); - + keyString = keyNameCombo->currentText(); @@ -262,3 +267,3 @@ void TVFilterView::updateTerm() /* remove old view */ - if (term->view) + if (term->view) delete(term->view); @@ -269,3 +274,3 @@ void TVFilterView::updateTerm() /* deletes current term */ -void TVFilterView::deleteTerm() +void TVFilterView::deleteTerm() { @@ -286,3 +291,3 @@ void TVFilterView::deleteTerm() /* clears all terminations */ -void TVFilterView::clearTerms() +void TVFilterView::clearTerms() { @@ -294,3 +299,3 @@ void TVFilterView::setTerm(QListViewItem *target) { - /* Iterate through the list to find item with view=target.. + /* Iterate through the list to find item with view=target.. * set as current, delete */ @@ -303,3 +308,3 @@ void TVFilterView::setTerm(QListViewItem *target) if (!current) { - current = term; + current = term; } |