-rw-r--r-- | noncore/apps/tableviewer/db/common.cpp | 40 | ||||
-rw-r--r-- | noncore/apps/tableviewer/main.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/tableviewer/tableviewer.cpp | 116 | ||||
-rw-r--r-- | noncore/apps/tableviewer/tableviewer.h | 4 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/commonwidgets.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/tableviewer/ui/tvbrowseview.cpp | 12 |
6 files changed, 89 insertions, 88 deletions
diff --git a/noncore/apps/tableviewer/db/common.cpp b/noncore/apps/tableviewer/db/common.cpp index 4c70e54..71844a5 100644 --- a/noncore/apps/tableviewer/db/common.cpp +++ b/noncore/apps/tableviewer/db/common.cpp @@ -19,13 +19,13 @@ **********************************************************************/ #include <stdlib.h> #include <qstring.h> #include <qheader.h> #include <qvector.h> #include <qdatetime.h> -#include <timestring.h> +#include <qpe/timestring.h> #include "common.h" #include "datacache.h" #include <assert.h> static const int del_flag = 0x1; static const int new_flag = 0x2; @@ -307,15 +307,15 @@ void TVVariant::load(QDataStream &s ) case Int: { int x; s >> x; d->value.i = x; } - break; + break; default: - qFatal("Unrecognized data type"); + qFatal("Unrecognized data type"); } } void TVVariant::save( QDataStream &s ) const { s << type(); @@ -387,13 +387,13 @@ const QString TVVariant::toString() const int TVVariant::toInt() const { if(d->typ == Int) return d->value.i; if(d->typ == String) { - QString tmpq(*(QString *)d->value.ptr); + QString tmpq(*(QString *)d->value.ptr); return parseNextNumber(&tmpq); } return 0; } @@ -681,15 +681,15 @@ Key::Key() : kname(), kexample(), kflags(0) { } Key::Key(QString name, TVVariant example, int flags = 0) : kname(name), kexample(example), kflags(flags) { } Key::Key(const Key &other) { - kname = other.kname; - kexample = other.kexample; - kflags = other.kflags; + kname = other.kname; + kexample = other.kexample; + kflags = other.kflags; } Key& Key::operator=(const Key& key) { kname = key.kname; kexample = key.kexample; @@ -775,16 +775,16 @@ KeyList::KeyList() : QIntDict<Key>(20) } /* Should be deep copy, but isn't */ KeyList::KeyList(const KeyList &k) : QIntDict<Key>(k) { KeyListIterator it(k); - while(it.current()) { - replace(it.currentKey(), new Key(*it.current())); - ++it; - } + while(it.current()) { + replace(it.currentKey(), new Key(*it.current())); + ++it; + } setAutoDelete(TRUE); } /*! Destroys a KeyList @@ -795,21 +795,21 @@ KeyList::~KeyList() { /* Do a comparision base on Keys */ bool KeyList::operator!=(const KeyList &other) { KeyListIterator it(*this); if (other.getNumFields() != getNumFields()) - return TRUE; + return TRUE; while(it.current()) { - //it.currentKey(), it.current(); - if (other.getKeyName(it.currentKey()) != getKeyName(it.currentKey())) - return TRUE; - if (other.getKeyType(it.currentKey()) != getKeyType(it.currentKey())) - return TRUE; - ++it; + //it.currentKey(), it.current(); + if (other.getKeyName(it.currentKey()) != getKeyName(it.currentKey())) + return TRUE; + if (other.getKeyType(it.currentKey()) != getKeyType(it.currentKey())) + return TRUE; + ++it; } return FALSE; } /*! Returns the number of keys stored in the KeyList @@ -1179,13 +1179,13 @@ void DataElem::setField(int i, QString q) TVVariant t = TVVariant(q); switch(kt) { case TVVariant::Int: { t.asInt(); setField(i, t); - return; + return; } case TVVariant::String: { t.asString(); setField(i, t); return; } @@ -1267,13 +1267,13 @@ QString DataElem::toQString() const int i; QString scratch = ""; QIntDictIterator<TVVariant> it(values); while (it.current()) { - i = it.currentKey(); + i = it.currentKey(); if(hasValidValue(i)) { scratch += "<B>" + contained->getKeyName(i) + ":</B> "; scratch += getField(i).toString(); scratch += "<br>"; } ++it; diff --git a/noncore/apps/tableviewer/main.cpp b/noncore/apps/tableviewer/main.cpp index 736e1cf..56c567f 100644 --- a/noncore/apps/tableviewer/main.cpp +++ b/noncore/apps/tableviewer/main.cpp @@ -15,13 +15,13 @@ ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #include "tableviewer.h" -#include <qpeapplication.h> +#include <qpe/qpeapplication.h> int main( int argc, char ** argv ) { QPEApplication a( argc, argv ); TableViewerWindow * mw = new TableViewerWindow; diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp index 0d4a412..0456b41 100644 --- a/noncore/apps/tableviewer/tableviewer.cpp +++ b/noncore/apps/tableviewer/tableviewer.cpp @@ -25,23 +25,23 @@ #include "ui/tvlistview.h" #include "ui/tveditview.h" #include "ui/tvkeyedit.h" #include "db/datacache.h" /* QPE includes */ -#include "fileselector.h" -#include "resource.h" +#include <qpe/fileselector.h> +#include <qpe/resource.h> +#include <qpe/qpetoolbar.h> /* QTE includes */ #include <qpe/qpemenubar.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. @@ -90,61 +90,61 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f QVBoxLayout *main_layout = new QVBoxLayout; /* Build tool bar */ navigation = new QPEToolBar(this, "navigation"); QToolButton *newItemButton = new QToolButton( - QIconSet(Resource::loadImage("new")), "New Item", QString::null, - this, SLOT(newItemSlot()), navigation, "New Item"); + QIconSet(Resource::loadPixmap("new")), "New Item", QString::null, + this, SLOT(newItemSlot()), navigation, "New Item"); QToolButton *editItemButton = new QToolButton( - QIconSet(Resource::loadImage("edit")), "Edit Item", QString::null, - this, SLOT(editItemSlot()), navigation, "Edit Item"); + QIconSet(Resource::loadPixmap("edit")), "Edit Item", QString::null, + this, SLOT(editItemSlot()), navigation, "Edit Item"); QToolButton *deleteItemButton = new QToolButton( - QIconSet(Resource::loadImage("trash")), "Delete Item", - QString::null, this, - SLOT(deleteItemSlot()), navigation, "Delete Item"); + QIconSet(Resource::loadPixmap("trash")), "Delete Item", + QString::null, this, + SLOT(deleteItemSlot()), navigation, "Delete Item"); navigation->addSeparator(); QToolButton *firstItemButton = new QToolButton( - QIconSet(Resource::loadImage("fastback")), "First Item", - QString::null, this, - SLOT(firstItem()), navigation, "First Item"); + QIconSet(Resource::loadPixmap("fastback")), "First Item", + QString::null, this, + SLOT(firstItem()), navigation, "First Item"); QToolButton *previousItemButton = new QToolButton( - QIconSet(Resource::loadImage("back")), "Previous Item", - QString::null, this, - SLOT(previousItem()), navigation, "Previous Item"); + QIconSet(Resource::loadPixmap("back")), "Previous Item", + QString::null, this, + SLOT(previousItem()), navigation, "Previous Item"); QToolButton *nextItemButton = new QToolButton( - QIconSet(Resource::loadImage("forward")), "Next Item", - QString::null, this, - SLOT(nextItem()), navigation, "Next Item"); + QIconSet(Resource::loadPixmap("forward")), "Next Item", + QString::null, this, + SLOT(nextItem()), navigation, "Next Item"); QToolButton *lastItemButton = new QToolButton( - QIconSet(Resource::loadImage("fastforward")), "Last Item", - QString::null, this, - SLOT(lastItem()), navigation, "Last Item"); + QIconSet(Resource::loadPixmap("fastforward")), "Last Item", + QString::null, this, + SLOT(lastItem()), navigation, "Last Item"); navigation->addSeparator(); QToolButton *browseButton = new QToolButton( - QIconSet(Resource::loadImage("day")), "View Single Item", - QString::null, this, - SLOT(browseViewSlot()), navigation, "View Single Item"); + QIconSet(Resource::loadPixmap("day")), "View Single Item", + QString::null, this, + SLOT(browseViewSlot()), navigation, "View Single Item"); QToolButton *listButton = new QToolButton( - QIconSet(Resource::loadImage("month")), "View Multiple Items", - QString::null, this, - SLOT(listViewSlot()), navigation, "View Multiple Items"); + QIconSet(Resource::loadPixmap("month")), "View Multiple Items", + QString::null, this, + SLOT(listViewSlot()), navigation, "View Multiple Items"); setToolBarsMovable(FALSE); setToolBarsMovable(FALSE); setToolBarsMovable(FALSE); /* Build widgets */ browseView = new TVBrowseView(&ts, this, 0); listView = new TVListView(&ts, this, 0); filterView = new TVFilterView(&ts, this, 0); fileSelector = new FileSelector("text/csv;text/x-xml-tableviewer", - this, "fileselector"); + this, "fileselector"); fileSelector->setNewVisible(FALSE); fileSelector->setCloseVisible(FALSE); cw = new QWidgetStack(this, 0); cw->addWidget(listView, ListState); cw->addWidget(browseView, BrowseState); @@ -159,13 +159,13 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f this, SLOT(searchOnKey(int, TVVariant))); connect(browseView, SIGNAL(sortChanged(int)), this, SLOT(setPrimaryKey(int))); connect(fileSelector, SIGNAL(closeMe()), this, SLOT(browseViewSlot())); connect(fileSelector, SIGNAL(fileSelected(const DocLnk &)), - this, SLOT(openDocument(const DocLnk &))); + this, SLOT(openDocument(const DocLnk &))); main_layout->addWidget(menu); main_layout->addWidget(cw); setCentralWidget(cw); @@ -174,38 +174,38 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f /*! Destroys the TableViewerWindow */ TableViewerWindow::~TableViewerWindow() { if(dirty) - saveDocument(); + saveDocument(); } /*! Opens a file dialog and loads the file specified by the dialog */ void TableViewerWindow::selectDocument() { if(dirty) - saveDocument(); + saveDocument(); current_view = FileState; cw->raiseWidget(current_view); fileSelector->reread(); } void TableViewerWindow::saveDocument() { if(!dirty) - return; + return; FileManager fm; QIODevice *dev = fm.saveFile(doc); if(!ds->saveSource(dev, doc.type())){ - qWarning("Save unsuccessful"); - return; + qWarning("Save unsuccessful"); + return; } dev->close(); dirty = FALSE; } void TableViewerWindow::newDocument() @@ -226,36 +226,36 @@ void TableViewerWindow::newDocument() doc = nf; dirty = FALSE; current_view = BrowseState; cw->raiseWidget(current_view); - /* now set up for editing the keys */ - ts.kRep->addKey("key", TVVariant::String); - editKeysSlot(); + /* now set up for editing the keys */ + ts.kRep->addKey("key", TVVariant::String); + editKeysSlot(); } void TableViewerWindow::openDocument(const DocLnk &f) { if (!f.isValid()) - return; + return; FileManager fm; QIODevice *dev = fm.openFile(f); doc = f; if(ds->openSource(dev, doc.type())) { DataElem *d; browseView->reset(); listView->reset(); filterView->reset(); - current_view = BrowseState; - cw->raiseWidget(current_view); + current_view = BrowseState; + cw->raiseWidget(current_view); /* set up new table state and ensure sub widgets have a reference */ ts.current_column = 0; ts.kRep = ds->getKeys(); browseView->rebuildKeys(); listView->rebuildKeys(); @@ -278,13 +278,13 @@ void TableViewerWindow::openDocument(const DocLnk &f) QString scratch = "Table Viewer";/* later take from constant */ scratch += " - "; scratch += ds->getName(); setCaption(tr(scratch)); - dirty = FALSE; + dirty = FALSE; } else { qWarning(tr("could not load Document")); } dev->close(); } @@ -326,13 +326,13 @@ void TableViewerWindow::applyFilter() listView->clearItems(); ds->first(); do { d = ds->getCurrentData(); if(d) if(filterView->passesFilter(d)) - listView->addItem(d); + listView->addItem(d); } while(ds->next()); listView->first(); listView->rebuildData(); } /*! @@ -362,42 +362,42 @@ void TableViewerWindow::filterViewSlot() void TableViewerWindow::editItemSlot() { if(TVEditView::openEditItemDialog(&ts, ts.current_elem, this)) { - listView->rebuildData(); - browseView->rebuildData(); - dirty = TRUE; + listView->rebuildData(); + browseView->rebuildData(); + dirty = TRUE; } } void TableViewerWindow::newItemSlot() { DataElem *d = new DataElem(ds); if (TVEditView::openEditItemDialog(&ts, d, this)) { - ds->addItem(d); - ts.current_elem = d; - applyFilter(); - listView->rebuildData(); - browseView->rebuildData(); - dirty = TRUE; + ds->addItem(d); + ts.current_elem = d; + applyFilter(); + listView->rebuildData(); + browseView->rebuildData(); + dirty = TRUE; } } void TableViewerWindow::deleteItemSlot() { - /* delete the actual item, then do a 'filter' */ - DataElem *to_remove = ts.current_elem; + /* delete the actual item, then do a 'filter' */ + DataElem *to_remove = ts.current_elem; - if(!to_remove) - return; + if(!to_remove) + return; listView->removeItem(); - ds->removeItem(to_remove); + ds->removeItem(to_remove); applyFilter(); listView->rebuildData(); browseView->rebuildData(); dirty = TRUE; } @@ -429,13 +429,13 @@ void TableViewerWindow::editKeysSlot() d = ds->getCurrentData(); if(d) listView->addItem(d); } while(ds->next()); /* Set up browse view, Will be based of structure of listView */ - dirty = TRUE; + dirty = TRUE; } } /*! A Slot that allows for widgets above to indicate a search should be done on a specified key index for a specified value diff --git a/noncore/apps/tableviewer/tableviewer.h b/noncore/apps/tableviewer/tableviewer.h index 2d4686a..0d3c39d 100644 --- a/noncore/apps/tableviewer/tableviewer.h +++ b/noncore/apps/tableviewer/tableviewer.h @@ -19,13 +19,13 @@ **********************************************************************/ #ifndef Tableviewer_H #define Tableviewer_H #include <qmainwindow.h> #include "db/common.h" -#include "fileselector.h" +#include <qpe/fileselector.h> /* Forward class declarations */ class QWidgetStack; class QDialog; class QMenuBar; @@ -95,13 +95,13 @@ private: enum UserState { BrowseState = 0, ListState, FilterState, EditState, - FileState, + FileState, }; UserState current_view; void applyFilter(); }; diff --git a/noncore/apps/tableviewer/ui/commonwidgets.cpp b/noncore/apps/tableviewer/ui/commonwidgets.cpp index 0b4f3c2..bf4c36f 100644 --- a/noncore/apps/tableviewer/ui/commonwidgets.cpp +++ b/noncore/apps/tableviewer/ui/commonwidgets.cpp @@ -19,13 +19,14 @@ **********************************************************************/ #include <qlineedit.h> #include <qlayout.h> #include <qlabel.h> #include <qcombobox.h> -#include <datebookmonth.h> + +#include <qpe/datebookmonth.h> #include <qpopupmenu.h> #include <qspinbox.h> #include "commonwidgets.h" DateEdit::DateEdit( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ) : QToolButton(parent, name) diff --git a/noncore/apps/tableviewer/ui/tvbrowseview.cpp b/noncore/apps/tableviewer/ui/tvbrowseview.cpp index f6da7b1..9bfc791 100644 --- a/noncore/apps/tableviewer/ui/tvbrowseview.cpp +++ b/noncore/apps/tableviewer/ui/tvbrowseview.cpp @@ -35,18 +35,18 @@ */ /*! Constructs a new TVBrowseView widget */ TVBrowseView::TVBrowseView(TableState *t, QWidget* parent = 0, const char *name = 0, - WFlags fl =0) + WFlags fl =0) { if (!name) - setName("BrowseView"); + setName("BrowseView"); - setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); +// setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); QVBoxLayout *vlayout = new QVBoxLayout(this); textViewDisplay = new QTextBrowser(this, "textViewDisplay"); vlayout->addWidget( textViewDisplay ); keyEntry = new TVBrowseKeyEntry(this, "keyEntry"); vlayout->addWidget( keyEntry ); @@ -71,16 +71,16 @@ TVBrowseView::~TVBrowseView() void TVBrowseView::rebuildData() { if(!ts) return; if(!ts->current_elem) { - /* also disable buttons */ - textViewDisplay->setText(""); + /* also disable buttons */ + textViewDisplay->setText(""); return; - } + } setDisplayText(ts->current_elem); } /* Reset to initial state */ void TVBrowseView::reset() |