summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer
authormickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
committer mickeyl <mickeyl>2004-04-04 13:54:40 (UTC)
commit16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (side-by-side diff)
tree0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/apps/tableviewer
parent8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff)
downloadopie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz
opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/apps/tableviewer') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/db/common.cpp28
-rw-r--r--noncore/apps/tableviewer/db/datacache.cpp12
-rw-r--r--noncore/apps/tableviewer/db/xmlsource.cpp30
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp14
-rw-r--r--noncore/apps/tableviewer/tableviewer.pro8
-rw-r--r--noncore/apps/tableviewer/ui/tvlistview.cpp9
6 files changed, 66 insertions, 35 deletions
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp
index dbf9370..6e544ba 100644
--- a/noncore/apps/tableviewer/db/common.cpp
+++ b/noncore/apps/tableviewer/db/common.cpp
@@ -1,52 +1,60 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <stdlib.h>
+#include "common.h"
+#include "datacache.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/timestring.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qstring.h>
#include <qheader.h>
#include <qvector.h>
#include <qdatetime.h>
-#include <qpe/timestring.h>
-#include "common.h"
-#include "datacache.h"
+
+/* STD */
#include <assert.h>
+#include <stdlib.h>
static const int del_flag = 0x1;
static const int new_flag = 0x2;
/* Helper function */
int parseNextNumber(QString *q) {
QChar c;
uint i;
int result = 0;
bool found_digits = FALSE;
for(i = 0; i < q->length(); i++) {
c = q->at(i);
if (c.isDigit()) {
if (found_digits)
result *= 10;
found_digits = TRUE;
result += c.digitValue();
} else {
if (found_digits)
break;
/* just skip this char */
}
@@ -291,49 +299,49 @@ void TVVariant::load(QDataStream &s )
}
break;
case Time:
{
QTime *x = new QTime;
s >> *x;
d->value.ptr = x;
}
break;
case Date:
{
QDate *x = new QDate;
s >> *x;
d->value.ptr = x;
}
break;
case Int:
{
int x;
s >> x;
d->value.i = x;
}
break;
default:
- qFatal("Unrecognized data type");
+ ofatal << "Unrecognized data type" << oendl;
}
}
void TVVariant::save( QDataStream &s ) const
{
s << type();
switch( d->typ ) {
case String:
s << *((QString *)d->value.ptr);
break;
case Date:
s << *((QDate *)d->value.ptr);
break;
case Time:
s << *((QTime *)d->value.ptr);
break;
case Int:
s << d->value.i;
break;
case Invalid:
break;
}
}
@@ -1057,49 +1065,49 @@ QDataStream &operator<<( QDataStream &s, const DataElem &d)
int size = d.getNumFields();
s << size; /* redundent data but makes streaming easier */
KeyList k = d.getKeys();
KeyListIterator it(k);
while(it.current()) {
s << (Q_UINT16)it.currentKey();
s << d.getField(it.currentKey());
++it;
}
return s;
}
QDataStream &operator>>( QDataStream &s, DataElem &d)
{
int i;
int size;
TVVariant t;
int index = 0;
s >> size; /* redundent data but makes streaming easier */
if (size != d.getNumFields()) {
- qWarning("DataSize mis-match");
+ owarn << "DataSize mis-match" << oendl;
return s; /* sanity check failed.. don't load */
}
for(i = 0; i < size; i++) {
s >> (Q_UINT16)index;
s >> t;
d.setField(index, t);
}
return s;
}
/*! Returns the number of possible (not valid) fields in the data element */
int DataElem::getNumFields() const
{
return contained->getNumFields();
}
KeyList DataElem::getKeys() const
{
return *(contained->getKeys());
}
/*!
This function determines whether field index i of the element has been
@@ -1356,115 +1364,115 @@ bool DataElem::equalTo(int i, TVVariant v) const
}
bool DataElem::contains(int i, TVVariant v) const
{
if (!hasValidValue(i)) return FALSE;
if (getField(i).type() != v.type())
return FALSE;
switch(getField(i).type()) {
case TVVariant::String: {
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
if (qs1.contains(qs2) > 0) return TRUE;
break;
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
break;
default:
- qWarning("Tried to compare unknown data type");
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
bool DataElem::startsWith(int i, TVVariant v) const
{
if (!hasValidValue(i)) return FALSE;
if (getField(i).type() != v.type())
return FALSE;
switch(getField(i).type()) {
case TVVariant::String: {
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
return qs1.startsWith(qs2);
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
return FALSE;
default:
- qWarning("Tried to compare unknown data type");
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
bool DataElem::endsWith(int i, TVVariant v) const
{
if (!hasValidValue(i)) return FALSE;
if (getField(i).type() != v.type())
return FALSE;
switch(getField(i).type()) {
case TVVariant::String: {
QString qs1 = getField(i).toString().lower();
QString qs2 = v.toString().lower();
return qs1.startsWith(qs2);
}
/* meaningless for ints */
/* meaningless for time */
/* meaningless for dates */
case TVVariant::Int:
case TVVariant::Time:
case TVVariant::Date:
return FALSE;
default:
- qWarning("Tried to compare unknown data type");
+ owarn << "Tried to compare unknown data type" << oendl;
}
return FALSE;
}
/*!
Determins which of the first to parameters are closer to the third, target
parameter.
\return
<UL>
<LI>TRUE if the first element is a closer match to the target than the
second element</LI>
<LI>FALSE if the first element is not a closer match to the target than
the second element</LI>
</UL>
*/
bool DataElem::closer(DataElem*d1, DataElem *d2, TVVariant target, int column)
{
int type;
if(!d1) return FALSE;
if (!d1->hasValidValue(column)) return FALSE;
if(!target.isValid()) return FALSE;
type = d1->getField(column).type();
if(d2) {
if (type != d2->getField(column).type()) {
/* can't do compare */
- qWarning("Tried to compare two incompatable types");
+ owarn << "Tried to compare two incompatable types" << oendl;
return FALSE;
}
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 7c14eef..6380e1b 100644
--- a/noncore/apps/tableviewer/db/datacache.cpp
+++ b/noncore/apps/tableviewer/db/datacache.cpp
@@ -5,51 +5,59 @@
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
/*
* This file is used to load the xml files that represent the database.
* The main requirment for said file is each data entry must contain a key,
* otherwise any other data headings are allowed.
*/
#include "datacache.h"
#include "xmlsource.h"
#include "csvsource.h"
-#include <stdlib.h>
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qheader.h>
+/* STD */
+#include <stdlib.h>
+
#define INIT_TABLE_SIZE 128
/*!
\class DBStore datastore.h
\brief The DBStore class is the class responsible for storing, sorting and
searching the data loaded by the application
*/
/*!
Constructs a DBStore item
*/
DBStore::DBStore()
{
name = "";
number_elems = 0;
full = false;
kRep = new KeyList();
master_table.resize(INIT_TABLE_SIZE);
table_size = INIT_TABLE_SIZE;
current_elem = 0;
archive = 0;
@@ -129,49 +137,49 @@ bool DBStore::saveSource(QIODevice *outDev, const QString &source)
archive = new DBCsv(this);
} else
return false;
}
return (archive->saveSource(outDev));
}
/*!
This function is used to add new elements to the database. If the database
has already reached the maximum allowable size this function does not alter
the database.
\param delm An already allocated and initialized data element to be added
*/
void DBStore::addItem(DataElem *delem)
{
addItemInternal(delem);
}
void DBStore::addItemInternal(DataElem *delem)
{
/* if already full, don't over fill, do a qWarning though */
if (full) {
- qWarning("Attempted to add items to already full table");
+ owarn << "Attempted to add items to already full table" << oendl;
return;
}
master_table.insert(number_elems, delem);
current_elem = number_elems;
number_elems++;
if(number_elems >= table_size) {
/* filled current table, double if we can */
table_size = table_size << 1;
/* check that the new table size is still valid, i.e. that we didn't
just shift the 1 bit of the end of the int. */
if (!table_size) {
full = true;
/* no point in doing antying else. */
return;
}
master_table.resize(table_size);
}
}
void DBStore::removeItem(DataElem *r)
diff --git a/noncore/apps/tableviewer/db/xmlsource.cpp b/noncore/apps/tableviewer/db/xmlsource.cpp
index 94fec36..4ca6aee 100644
--- a/noncore/apps/tableviewer/db/xmlsource.cpp
+++ b/noncore/apps/tableviewer/db/xmlsource.cpp
@@ -1,50 +1,56 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "xmlsource.h"
-#include <qdict.h>
-#include <stdlib.h>
-#include <qtextstream.h>
#include "../xmlencodeattr.h"
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+/* QT */
+#include <qdict.h>
+#include <qtextstream.h>
+
+/* STD */
+#include <stdlib.h>
DBXml::DBXml(DBStore *d)
{
dstore = d;
}
QString DBXml::type()
{
return "xml";
}
bool DBXml::openSource(QIODevice *inDev)
{
bool ok;
DBXmlHandler h(dstore);
QTextStream tsIn(inDev);
QXmlInputSource source(tsIn);
QXmlSimpleReader reader;
reader.setContentHandler(&h);
reader.setErrorHandler(&h);
ok = reader.parse(source);
@@ -119,179 +125,179 @@ DBXml::~DBXml() {}
The format of the xml files can be found at the front of the file
dataparser.h
*/
/*!
Constructs a new DBXmlHandler, and sets that the table should be
constructed in the DBStore pointed to by ds.
*/
DBXmlHandler::DBXmlHandler(DBStore *ds)
{
data_store = ds;
current_keyrep = 0;
}
/*!
Destroys the DBXmlHandler
*/
DBXmlHandler::~DBXmlHandler()
{
}
QString DBXmlHandler::errorProtocol()
{
- qWarning("Error reading file");
+ owarn << "Error reading file" << oendl;
return errorProt;
}
bool DBXmlHandler::startDocument()
{
errorProt = "";
state = StateInit;
return TRUE;
}
bool DBXmlHandler::startElement(const QString&, const QString&,
const QString& qName, const QXmlAttributes& atts)
{
if (state == StateInit && qName == "database") {
// First thing it expects is a <document name="..."> tag
state = StateDocument;
data_store->setName(atts.value("name"));
return TRUE;
}
if (state == StateDocument && qName == "header") {
state = StateHeader;
if (current_keyrep) delete current_keyrep;
current_keyrep = new KeyList();
return TRUE;
}
if (state == StateHeader && qName == "key") {
/* Ok, adding a new key to our KeyList TODO */
state = StateKey;
last_key_type = TVVariant::String;
key = atts.value("name");
if (key.isEmpty()) {
- qWarning("empty key name");
+ owarn << "empty key name" << oendl;
return FALSE;
}
if(!atts.value("type").isEmpty())
last_key_type = TVVariant::nameToType(atts.value("type"));
return TRUE;
}
if (state == StateDocument && qName == "record") {
state = StateRecord;
current_data = new DataElem(data_store);
// Now expecting a <record> tag
return TRUE;
}
if (state == StateRecord) {
state = StateField;
/* the qName is the name of a key */
if (!keyIndexList[qName]) {
/* invalid key, we failed */
- qWarning("Invalid key in record");
+ owarn << "Invalid key in record" << oendl;
return FALSE;
}
keyIndex = *keyIndexList[qName];
return TRUE;
}
- qWarning("Unable to determine tag type");
+ owarn << "Unable to determine tag type" << oendl;
return FALSE;
}
bool DBXmlHandler::endElement(const QString&, const QString&,
const QString& qName)
{
switch(state) {
case StateField:
// TODO checks 'could' be done of the popped value
state = StateRecord;
break;
case StateKey:
// TODO checks 'could' be done of the popped value
state = StateHeader;
break;
case StateHeader:
data_store->setKeys(current_keyrep);
state = StateDocument;
break;
case StateRecord:
data_store->addItem(current_data);
state = StateDocument;
break;
case StateDocument:
// we are done...
break;
default:
// should only get a 'endElement' from one of the above states.
- qWarning("Invalid end tag");
+ owarn << "Invalid end tag" << oendl;
return FALSE;
break;
}
return TRUE;
}
bool DBXmlHandler::characters(const QString& ch)
{
// this is where the 'between tag' stuff happens.
// e.g. the stuff between tags.
QString ch_simplified = ch.simplifyWhiteSpace();
if (ch_simplified.isEmpty())
return TRUE;
if (state == StateKey) {
int *tmp_val = new int;
/* We just grabbed the display name of a key */
*tmp_val = current_keyrep->addKey(ch_simplified, last_key_type);
keyIndexList.insert(key, tmp_val);
return TRUE;
}
if (state == StateField) {
/* Ok, need to add data here */
current_data->setField(keyIndex, ch_simplified);
return TRUE;
}
- qWarning("Junk characters found... ignored");
+ owarn << "Junk characters found... ignored" << oendl;
return TRUE;
}
QString DBXmlHandler::errorString()
{
return "the document is not in the expected file format";
}
bool DBXmlHandler::warning(const QXmlParseException& exception)
{
errorProt += QString("warning parsing error: %1 in line %2, column %3\n" )
.arg(exception.message())
.arg(exception.lineNumber())
.arg(exception.columnNumber());
- qWarning(errorProt);
+ owarn << errorProt << oendl;
return QXmlDefaultHandler::fatalError(exception);
}
bool DBXmlHandler::error(const QXmlParseException& exception)
{
errorProt += QString("error parsing error: %1 in line %2, column %3\n" )
.arg(exception.message())
.arg(exception.lineNumber())
.arg(exception.columnNumber());
- qWarning(errorProt);
+ owarn << errorProt << oendl;
return QXmlDefaultHandler::fatalError(exception);
}
bool DBXmlHandler::fatalError(const QXmlParseException& exception)
{
errorProt += QString("fatal parsing error: %1 in line %2, column %3\n" )
.arg(exception.message())
.arg(exception.lineNumber())
.arg(exception.columnNumber());
- qWarning(errorProt);
+ owarn << errorProt << oendl;
return QXmlDefaultHandler::fatalError(exception);
}
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index 102b94c..9538cb3 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -1,65 +1,67 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-/* local includes */
#include "tableviewer.h"
#include "ui/tvbrowseview.h"
#include "ui/tvfilterview.h"
#include "ui/tvlistview.h"
#include "ui/tveditview.h"
#include "ui/tvkeyedit.h"
#include "db/datacache.h"
-/* QPE includes */
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/fileselector.h>
#include <qpe/resource.h>
-#include <qtoolbar.h>
+using namespace Opie::Core;
-/* QTE includes */
+/* QT */
#include <qmenubar.h>
+#include <qtoolbar.h>
#include <qpopupmenu.h>
#include <qapplication.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qbuffer.h>
+
/*!
\class TableViewerWindow
\brief The main window widget of the application
This is the main widget of the table viewer application.
It is the co-ordination point.
*/
/*!
Constructs a new TableViewerWindow
*/
TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f)
: QMainWindow(parent, name, f)
{
setCaption(tr("Table Viewer"));
/* Build data */
ds = new DBStore();
doc.setType("text/x-xml-tableviewer");
doc.setName("table");
dirty = FALSE;
ts.current_column = 0;
ts.kRep = ds->getKeys();
@@ -180,49 +182,49 @@ TableViewerWindow::~TableViewerWindow()
saveDocument();
}
/*!
Opens a file dialog and loads the file specified by the dialog
*/
void TableViewerWindow::selectDocument()
{
if(dirty)
saveDocument();
current_view = FileState;
cw->raiseWidget(current_view);
fileSelector->reread();
}
void TableViewerWindow::saveDocument()
{
if(!dirty)
return;
FileManager fm;
QIODevice *dev = fm.saveFile(doc);
if(!ds->saveSource(dev, doc.type())){
- qWarning("Save unsuccessful");
+ owarn << "Save unsuccessful" << oendl;
return;
}
dev->close();
dirty = FALSE;
}
void TableViewerWindow::newDocument()
{
DocLnk nf;
nf.setType("text/x-xml-tableviewer");
nf.setName("table");
delete ds;
ds = new DBStore();
ts.current_column = 0;
ts.kRep = ds->getKeys();
browseView->reset();
listView->reset();
filterView->reset();
doc = nf;
dirty = FALSE;
@@ -267,49 +269,49 @@ void TableViewerWindow::openDocument(const DocLnk &f)
filterView->rebuildKeys();
ds->first();
/* set up the list view */
listView->clearItems();
do {
d = ds->getCurrentData();
if(d)
listView->addItem(d);
} while(ds->next());
/* Set up browse view, Will be based of structure of listView */
listView->first();
ts.current_elem = listView->getCurrentData();
browseView->rebuildData();
listView->rebuildData();
QString scratch = "Table Viewer";/* later take from constant */
scratch += " - ";
scratch += ds->getName();
setCaption(tr(scratch));
dirty = FALSE;
} else {
- qWarning(tr("could not load Document"));
+ owarn << tr("could not load Document") << oendl;
}
dev->close();
}
/*!
Moves to the first item of the current table
*/
void TableViewerWindow::firstItem()
{
listView->first();
ts.current_elem = listView->getCurrentData();
browseView->rebuildData();
}
/*!
Moves to the lat item of the current table
*/
void TableViewerWindow::lastItem()
{
listView->last();
ts.current_elem = listView->getCurrentData();
browseView->rebuildData();
}
diff --git a/noncore/apps/tableviewer/tableviewer.pro b/noncore/apps/tableviewer/tableviewer.pro
index 1de23bb..564f50f 100644
--- a/noncore/apps/tableviewer/tableviewer.pro
+++ b/noncore/apps/tableviewer/tableviewer.pro
@@ -1,38 +1,38 @@
-CONFIG = qt warn_on quick-app
+CONFIG = qt warn_on quick-app
SUBDIRS = db ui
HEADERS = tableviewer.h \
xmlencodeattr.h \
ui/commonwidgets.h \
ui/tvbrowseview.h \
ui/tvlistview.h \
ui/tvfilterview.h \
ui/tveditview.h \
ui/browsekeyentry.h \
ui/filterkeyentry.h \
ui/tvkeyedit.h \
db/datacache.h \
db/common.h \
db/xmlsource.h \
db/csvsource.h
SOURCES = main.cpp \
tableviewer.cpp \
xmlencodeattr.cpp \
ui/commonwidgets.cpp \
ui/tvbrowseview.cpp \
ui/tvfilterview.cpp \
ui/browsekeyentry.cpp \
ui/filterkeyentry.cpp \
ui/tvlistview.cpp \
ui/tveditview.cpp \
ui/tvkeyedit.cpp \
db/datacache.cpp \
db/xmlsource.cpp \
db/csvsource.cpp \
db/common.cpp
INTERFACES = ui/tvkeyedit_gen.ui
TARGET = tableviewer
-INCLUDEPATH += $(OPIEDIR)/include
-DEPENDPATH += $(OPIEDIR)/include
-LIBS += -lqpe -lopiecore2
+INCLUDEPATH += $(OPIEDIR)/include
+DEPENDPATH += $(OPIEDIR)/include
+LIBS += -lqpe -lopiecore2
include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/apps/tableviewer/ui/tvlistview.cpp b/noncore/apps/tableviewer/ui/tvlistview.cpp
index b10ff1d..c3e6432 100644
--- a/noncore/apps/tableviewer/ui/tvlistview.cpp
+++ b/noncore/apps/tableviewer/ui/tvlistview.cpp
@@ -1,45 +1,52 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
+
#include "tvlistview.h"
#include "../db/common.h"
+
+/* OPIE */
+#include <opie2/odebug.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qtoolbutton.h>
#include <qlistview.h>
#include <qlayout.h>
void TVListViewPrivate::setColumnWidth(int column, int width)
{
if(width > 70) width = 70;
QListView::setColumnWidth(column, width);
}
void TVListViewPrivate::setSorting(int column, bool increasing)
{
emit sortChanged(column);
QListView::setSorting(column, increasing);
}
TVListViewPrivate::TVListViewPrivate(QWidget *parent, const char* name,
WFlags fl) : QListView(parent, name, fl) {
;
}
class TVListViewItem : public QListViewItem
{
public:
@@ -142,49 +149,49 @@ void TVListView::removeItem()
it = 0;
}
}
delete other.current();
}
void TVListView::clearItems()
{
/* This is ok since the destructor for TVListItem does not know about
the data_reference pointer.. and hence will leave it alone */
listViewDisplay->clear();
delete it;
it = new QListViewItemIterator(listViewDisplay);
}
void TVListView::first()
{
delete it;
it = new QListViewItemIterator(listViewDisplay);
}
void TVListView::last()
{
- qWarning("TVListView::last not yet implemented");
+ owarn << "TVListView::last not yet implemented" << oendl;
}
void TVListView::next()
{
QListViewItemIterator tmp = *it;
(*it)++;
if (!it->current()) {
*it = tmp;
}
}
void TVListView::previous()
{
QListViewItemIterator tmp = *it;
(*it)--;
if (!it->current()) {
*it = tmp;
}
}
DataElem *TVListView::getCurrentData() {
if (it->current()) {
return ((TVListViewItem *)it->current())->getDataElem();
}