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 | |||
@@ -13,25 +13,25 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 <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; |
32 | 32 | ||
33 | /* Helper function */ | 33 | /* Helper function */ |
34 | 34 | ||
35 | int parseNextNumber(QString *q) { | 35 | int parseNextNumber(QString *q) { |
36 | QChar c; | 36 | QChar c; |
37 | uint i; | 37 | uint i; |
@@ -301,27 +301,27 @@ void TVVariant::load(QDataStream &s ) | |||
301 | { | 301 | { |
302 | QDate *x = new QDate; | 302 | QDate *x = new QDate; |
303 | s >> *x; | 303 | s >> *x; |
304 | d->value.ptr = x; | 304 | d->value.ptr = x; |
305 | } | 305 | } |
306 | break; | 306 | break; |
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(); |
322 | 322 | ||
323 | switch( d->typ ) { | 323 | switch( d->typ ) { |
324 | case String: | 324 | case String: |
325 | s << *((QString *)d->value.ptr); | 325 | s << *((QString *)d->value.ptr); |
326 | break; | 326 | break; |
327 | case Date: | 327 | case Date: |
@@ -381,25 +381,25 @@ const QString TVVariant::toString() const | |||
381 | return QString::null; | 381 | return QString::null; |
382 | } | 382 | } |
383 | return QString::null; | 383 | return QString::null; |
384 | } | 384 | } |
385 | 385 | ||
386 | // TODO DO, this properly, */ | 386 | // TODO DO, this properly, */ |
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 | ||
400 | const QDate TVVariant::toDate() const | 400 | const QDate TVVariant::toDate() const |
401 | { | 401 | { |
402 | if(d->typ == Date) | 402 | if(d->typ == Date) |
403 | return *((QDate *)d->value.ptr); | 403 | return *((QDate *)d->value.ptr); |
404 | 404 | ||
405 | if(d->typ == String) { | 405 | if(d->typ == String) { |
@@ -675,27 +675,27 @@ bool TVVariant::close(TVVariant n) | |||
675 | \brief document me! | 675 | \brief document me! |
676 | 676 | ||
677 | document me! | 677 | document me! |
678 | */ | 678 | */ |
679 | 679 | ||
680 | Key::Key() : kname(), kexample(), kflags(0) { } | 680 | 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; |
696 | kflags = key.kflags; | 696 | kflags = key.kflags; |
697 | return *this; | 697 | return *this; |
698 | } | 698 | } |
699 | 699 | ||
700 | QString Key::name() const | 700 | QString Key::name() const |
701 | { | 701 | { |
@@ -769,53 +769,53 @@ void Key::setNewFlag(bool v) | |||
769 | /*! | 769 | /*! |
770 | Constructs a KeyList | 770 | Constructs a KeyList |
771 | */ | 771 | */ |
772 | KeyList::KeyList() : QIntDict<Key>(20) | 772 | KeyList::KeyList() : QIntDict<Key>(20) |
773 | { | 773 | { |
774 | setAutoDelete(TRUE); | 774 | setAutoDelete(TRUE); |
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 |
791 | */ | 791 | */ |
792 | KeyList::~KeyList() { | 792 | KeyList::~KeyList() { |
793 | } | 793 | } |
794 | 794 | ||
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 |
816 | */ | 816 | */ |
817 | int KeyList::getNumFields() const | 817 | int KeyList::getNumFields() const |
818 | { | 818 | { |
819 | return count(); | 819 | return count(); |
820 | } | 820 | } |
821 | 821 | ||
@@ -1173,25 +1173,25 @@ TVVariant DataElem::getField(QString qs) const | |||
1173 | */ | 1173 | */ |
1174 | void DataElem::setField(int i, QString q) | 1174 | void DataElem::setField(int i, QString q) |
1175 | { | 1175 | { |
1176 | /* from the type of the field, parse q and store */ | 1176 | /* from the type of the field, parse q and store */ |
1177 | TVVariant::KeyType kt = contained->getKeyType(i); | 1177 | TVVariant::KeyType kt = contained->getKeyType(i); |
1178 | 1178 | ||
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 | } |
1192 | case TVVariant::Date: { | 1192 | case TVVariant::Date: { |
1193 | t.asDate(); | 1193 | t.asDate(); |
1194 | setField(i, t); | 1194 | setField(i, t); |
1195 | return; | 1195 | return; |
1196 | } | 1196 | } |
1197 | case TVVariant::Time: { | 1197 | case TVVariant::Time: { |
@@ -1261,25 +1261,25 @@ void DataElem::unsetField(QString qs) | |||
1261 | /*! | 1261 | /*! |
1262 | Converts the data element to a Rich Text QString | 1262 | Converts the data element to a Rich Text QString |
1263 | */ | 1263 | */ |
1264 | QString DataElem::toQString() const | 1264 | QString DataElem::toQString() const |
1265 | { | 1265 | { |
1266 | /* lets make an attempt at this function */ | 1266 | /* lets make an attempt at this function */ |
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; |
1280 | } | 1280 | } |
1281 | return scratch; | 1281 | return scratch; |
1282 | } | 1282 | } |
1283 | 1283 | ||
1284 | /*! formats individual fields to strings so can be displayed */ | 1284 | /*! formats individual fields to strings so can be displayed */ |
1285 | QString DataElem::toQString(int i) const | 1285 | QString DataElem::toQString(int i) const |
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 | |||
@@ -9,24 +9,24 @@ | |||
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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; |
28 | mw->setCaption( TableViewerWindow::tr("Table Viewer") ); | 28 | mw->setCaption( TableViewerWindow::tr("Table Viewer") ); |
29 | a.showMainWidget(mw); | 29 | a.showMainWidget(mw); |
30 | 30 | ||
31 | return a.exec(); | 31 | return a.exec(); |
32 | } | 32 | } |
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 | |||
@@ -19,35 +19,35 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | /* local includes */ | 21 | /* local includes */ |
22 | #include "tableviewer.h" | 22 | #include "tableviewer.h" |
23 | #include "ui/tvbrowseview.h" | 23 | #include "ui/tvbrowseview.h" |
24 | #include "ui/tvfilterview.h" | 24 | #include "ui/tvfilterview.h" |
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. |
48 | */ | 48 | */ |
49 | 49 | ||
50 | /*! | 50 | /*! |
51 | Constructs a new TableViewerWindow | 51 | Constructs a new TableViewerWindow |
52 | */ | 52 | */ |
53 | TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) | 53 | TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f) |
@@ -84,134 +84,134 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f | |||
84 | menu->insertItem("Edit", edit_menu); | 84 | menu->insertItem("Edit", edit_menu); |
85 | 85 | ||
86 | QPopupMenu *view_menu = new QPopupMenu; | 86 | QPopupMenu *view_menu = new QPopupMenu; |
87 | view_menu->insertItem("Browse View", this, SLOT(browseViewSlot())); | 87 | view_menu->insertItem("Browse View", this, SLOT(browseViewSlot())); |
88 | view_menu->insertItem("List View", this, SLOT(listViewSlot())); | 88 | view_menu->insertItem("List View", this, SLOT(listViewSlot())); |
89 | menu->insertItem("View", view_menu); | 89 | menu->insertItem("View", view_menu); |
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); |
151 | cw->addWidget(filterView, FilterState); | 151 | cw->addWidget(filterView, FilterState); |
152 | cw->addWidget(fileSelector, FileState); | 152 | cw->addWidget(fileSelector, FileState); |
153 | 153 | ||
154 | current_view = FileState; | 154 | current_view = FileState; |
155 | cw->raiseWidget(current_view); | 155 | cw->raiseWidget(current_view); |
156 | fileSelector->reread(); | 156 | fileSelector->reread(); |
157 | 157 | ||
158 | connect(browseView, SIGNAL(searchOnKey(int, TVVariant)), | 158 | connect(browseView, SIGNAL(searchOnKey(int, TVVariant)), |
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 | ||
172 | } | 172 | } |
173 | 173 | ||
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() |
212 | { | 212 | { |
213 | DocLnk nf; | 213 | DocLnk nf; |
214 | nf.setType("text/x-xml-tableviewer"); | 214 | nf.setType("text/x-xml-tableviewer"); |
215 | nf.setName("table"); | 215 | nf.setName("table"); |
216 | 216 | ||
217 | delete ds; | 217 | delete ds; |
@@ -220,48 +220,48 @@ void TableViewerWindow::newDocument() | |||
220 | ts.current_column = 0; | 220 | ts.current_column = 0; |
221 | ts.kRep = ds->getKeys(); | 221 | ts.kRep = ds->getKeys(); |
222 | browseView->reset(); | 222 | browseView->reset(); |
223 | listView->reset(); | 223 | listView->reset(); |
224 | filterView->reset(); | 224 | filterView->reset(); |
225 | 225 | ||
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(); |
262 | filterView->rebuildKeys(); | 262 | filterView->rebuildKeys(); |
263 | 263 | ||
264 | ds->first(); | 264 | ds->first(); |
265 | /* set up the list view */ | 265 | /* set up the list view */ |
266 | listView->clearItems(); | 266 | listView->clearItems(); |
267 | do { | 267 | do { |
@@ -272,25 +272,25 @@ void TableViewerWindow::openDocument(const DocLnk &f) | |||
272 | 272 | ||
273 | /* Set up browse view, Will be based of structure of listView */ | 273 | /* Set up browse view, Will be based of structure of listView */ |
274 | listView->first(); | 274 | listView->first(); |
275 | ts.current_elem = listView->getCurrentData(); | 275 | ts.current_elem = listView->getCurrentData(); |
276 | browseView->rebuildData(); | 276 | browseView->rebuildData(); |
277 | listView->rebuildData(); | 277 | listView->rebuildData(); |
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 | ||
291 | /*! | 291 | /*! |
292 | Moves to the next item of the current table | 292 | Moves to the next item of the current table |
293 | */ | 293 | */ |
294 | void TableViewerWindow::nextItem() | 294 | void TableViewerWindow::nextItem() |
295 | { | 295 | { |
296 | listView->next(); | 296 | listView->next(); |
@@ -320,25 +320,25 @@ void TableViewerWindow::listViewSlot() | |||
320 | } | 320 | } |
321 | 321 | ||
322 | void TableViewerWindow::applyFilter() | 322 | void TableViewerWindow::applyFilter() |
323 | { | 323 | { |
324 | DataElem *d; | 324 | DataElem *d; |
325 | 325 | ||
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 | /*! |
339 | Raises the Browse View. This is a mode change for the application. | 339 | Raises the Browse View. This is a mode change for the application. |
340 | */ | 340 | */ |
341 | void TableViewerWindow::browseViewSlot() | 341 | void TableViewerWindow::browseViewSlot() |
342 | { | 342 | { |
343 | if(current_view == FilterState) | 343 | if(current_view == FilterState) |
344 | applyFilter(); | 344 | applyFilter(); |
@@ -356,54 +356,54 @@ void TableViewerWindow::browseViewSlot() | |||
356 | void TableViewerWindow::filterViewSlot() | 356 | void TableViewerWindow::filterViewSlot() |
357 | { | 357 | { |
358 | current_view = FilterState; | 358 | current_view = FilterState; |
359 | cw->raiseWidget(current_view); | 359 | cw->raiseWidget(current_view); |
360 | } | 360 | } |
361 | 361 | ||
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 | } |
404 | 404 | ||
405 | void TableViewerWindow::editKeysSlot() | 405 | void TableViewerWindow::editKeysSlot() |
406 | { | 406 | { |
407 | DataElem *d; | 407 | DataElem *d; |
408 | KeyList *k = TVKeyEdit::openEditKeysDialog(&ts, this); | 408 | KeyList *k = TVKeyEdit::openEditKeysDialog(&ts, this); |
409 | 409 | ||
@@ -423,25 +423,25 @@ void TableViewerWindow::editKeysSlot() | |||
423 | filterView->rebuildKeys(); | 423 | filterView->rebuildKeys(); |
424 | 424 | ||
425 | ds->first(); | 425 | ds->first(); |
426 | /* set up the list view */ | 426 | /* set up the list view */ |
427 | listView->clearItems(); | 427 | listView->clearItems(); |
428 | do { | 428 | do { |
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 |
442 | */ | 442 | */ |
443 | void TableViewerWindow::searchOnKey(int i, TVVariant v) | 443 | void TableViewerWindow::searchOnKey(int i, TVVariant v) |
444 | { | 444 | { |
445 | listView->findItem(i, v); | 445 | listView->findItem(i, v); |
446 | ts.current_elem = listView->getCurrentData(); | 446 | ts.current_elem = listView->getCurrentData(); |
447 | browseView->rebuildData(); | 447 | browseView->rebuildData(); |
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 | |||
@@ -13,25 +13,25 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 | #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 | ||
32 | class TVListView; | 32 | class TVListView; |
33 | class TVBrowseView; | 33 | class TVBrowseView; |
34 | class TVFilterView; | 34 | class TVFilterView; |
35 | class TVEditView; | 35 | class TVEditView; |
36 | 36 | ||
37 | class DBStore; | 37 | class DBStore; |
@@ -89,21 +89,21 @@ private: | |||
89 | 89 | ||
90 | DocLnk doc; | 90 | DocLnk doc; |
91 | 91 | ||
92 | QWidgetStack *cw; | 92 | QWidgetStack *cw; |
93 | DBStore *ds; | 93 | DBStore *ds; |
94 | TableState ts; /* not a pointer.. this class keeps the state */ | 94 | TableState ts; /* not a pointer.. this class keeps the state */ |
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 | }; |
108 | 108 | ||
109 | #endif | 109 | #endif |
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 | |||
@@ -13,25 +13,26 @@ | |||
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
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 | 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) |
32 | { | 33 | { |
33 | QPopupMenu *m1 = new QPopupMenu(this); | 34 | QPopupMenu *m1 = new QPopupMenu(this); |
34 | dateSelector = new DateBookMonth(m1, 0, TRUE); | 35 | dateSelector = new DateBookMonth(m1, 0, TRUE); |
35 | m1->insertItem(dateSelector); | 36 | m1->insertItem(dateSelector); |
36 | setPopup(m1); | 37 | setPopup(m1); |
37 | setPopupDelay(0); | 38 | setPopupDelay(0); |
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 | |||
@@ -29,30 +29,30 @@ | |||
29 | \brief The widget describing how to draw the browse view user interface | 29 | \brief The widget describing how to draw the browse view user interface |
30 | 30 | ||
31 | This widget allows for the user to browse through the table, one element | 31 | This widget allows for the user to browse through the table, one element |
32 | at a time, or search on a single key. Its main goal is to show a | 32 | at a time, or search on a single key. Its main goal is to show a |
33 | single element in a readable format and make it easy for the user to | 33 | single element in a readable format and make it easy for the user to |
34 | rapidly find specific elements in the table. | 34 | rapidly find specific elements in the table. |
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 ); |
53 | 53 | ||
54 | /* connect the signals down */ | 54 | /* connect the signals down */ |
55 | 55 | ||
56 | connect(keyEntry, SIGNAL(searchOnKey(int, TVVariant)), | 56 | connect(keyEntry, SIGNAL(searchOnKey(int, TVVariant)), |
57 | this, SIGNAL(searchOnKey(int, TVVariant))); | 57 | this, SIGNAL(searchOnKey(int, TVVariant))); |
58 | connect(keyEntry, SIGNAL(sortChanged(int)), | 58 | connect(keyEntry, SIGNAL(sortChanged(int)), |
@@ -65,28 +65,28 @@ TVBrowseView::TVBrowseView(TableState *t, QWidget* parent = 0, const char *name | |||
65 | /*! | 65 | /*! |
66 | Destroys the TVBrowseView widget | 66 | Destroys the TVBrowseView widget |
67 | */ | 67 | */ |
68 | TVBrowseView::~TVBrowseView() | 68 | TVBrowseView::~TVBrowseView() |
69 | { | 69 | { |
70 | } | 70 | } |
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() |
87 | { | 87 | { |
88 | textViewDisplay->setText(""); | 88 | textViewDisplay->setText(""); |
89 | keyEntry->reset(); | 89 | keyEntry->reset(); |
90 | } | 90 | } |
91 | 91 | ||
92 | /*! | 92 | /*! |