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