summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer
authoralwin <alwin>2004-03-02 12:21:11 (UTC)
committer alwin <alwin>2004-03-02 12:21:11 (UTC)
commitb6b1c97559c0ed9f2e33632272426bf98f289232 (patch) (unidiff)
treed3a9987704770cdf5eb14e1136f6e3ecb2f36a04 /noncore/apps/tableviewer
parent0d59c780513da78033f4d9040475dee9db0256d4 (diff)
downloadopie-b6b1c97559c0ed9f2e33632272426bf98f289232.zip
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.gz
opie-b6b1c97559c0ed9f2e33632272426bf98f289232.tar.bz2
applied the patch generated by the optimize_connect script from
TT.
Diffstat (limited to 'noncore/apps/tableviewer') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp8
-rw-r--r--noncore/apps/tableviewer/ui/commonwidgets.cpp2
-rw-r--r--noncore/apps/tableviewer/ui/tvbrowseview.cpp4
-rw-r--r--noncore/apps/tableviewer/ui/tvfilterview.cpp2
-rw-r--r--noncore/apps/tableviewer/ui/tvlistview.cpp4
5 files changed, 10 insertions, 10 deletions
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index f35dfcd..4c6d809 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -110,104 +110,104 @@ TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f
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::loadPixmap("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::loadPixmap("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::loadPixmap("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::loadPixmap("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::loadPixmap("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*/
177TableViewerWindow::~TableViewerWindow() 177TableViewerWindow::~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*/
186void TableViewerWindow::selectDocument() 186void 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
195void TableViewerWindow::saveDocument() 195void 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
211void TableViewerWindow::newDocument() 211void TableViewerWindow::newDocument()
212{ 212{
213 DocLnk nf; 213 DocLnk nf;
diff --git a/noncore/apps/tableviewer/ui/commonwidgets.cpp b/noncore/apps/tableviewer/ui/commonwidgets.cpp
index 4c47951..e82018c 100644
--- a/noncore/apps/tableviewer/ui/commonwidgets.cpp
+++ b/noncore/apps/tableviewer/ui/commonwidgets.cpp
@@ -1,88 +1,88 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
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 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 25
26#include <qpe/datebookmonth.h> 26#include <qpe/datebookmonth.h>
27#include <qpopupmenu.h> 27#include <qpopupmenu.h>
28#include <qspinbox.h> 28#include <qspinbox.h>
29#include "commonwidgets.h" 29#include "commonwidgets.h"
30 30
31DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f ) 31DateEdit::DateEdit( QWidget *parent, const char *name, WFlags f )
32 : QToolButton(parent, name) 32 : QToolButton(parent, name)
33{ 33{
34 QPopupMenu *m1 = new QPopupMenu(this); 34 QPopupMenu *m1 = new QPopupMenu(this);
35 dateSelector = new DateBookMonth(m1, 0, TRUE); 35 dateSelector = new DateBookMonth(m1, 0, TRUE);
36 m1->insertItem(dateSelector); 36 m1->insertItem(dateSelector);
37 setPopup(m1); 37 setPopup(m1);
38 setPopupDelay(0); 38 setPopupDelay(0);
39 39
40 connect(dateSelector, SIGNAL(dateClicked(int, int, int)), 40 connect(dateSelector, SIGNAL(dateClicked(int,int,int)),
41 this, SLOT(subValueChanged())); 41 this, SLOT(subValueChanged()));
42 42
43 setText(dateSelector->selectedDate().toString()); 43 setText(dateSelector->selectedDate().toString());
44} 44}
45 45
46 46
47DateEdit::~DateEdit() {} 47DateEdit::~DateEdit() {}
48 48
49QDate DateEdit::date() const 49QDate DateEdit::date() const
50{ 50{
51 return dateSelector->selectedDate(); 51 return dateSelector->selectedDate();
52} 52}
53 53
54void DateEdit::setDate(QDate d) 54void DateEdit::setDate(QDate d)
55{ 55{
56 dateSelector->setDate(d.year(), d.month(), d.day()); 56 dateSelector->setDate(d.year(), d.month(), d.day());
57 setText(d.toString()); 57 setText(d.toString());
58} 58}
59 59
60QSizePolicy DateEdit::sizePolicy() const 60QSizePolicy DateEdit::sizePolicy() const
61{ 61{
62 QSizePolicy sp; 62 QSizePolicy sp;
63 sp.setHorData(QToolButton::sizePolicy().horData()); 63 sp.setHorData(QToolButton::sizePolicy().horData());
64 sp.setVerData(QSizePolicy::Fixed); 64 sp.setVerData(QSizePolicy::Fixed);
65 65
66 return sp; 66 return sp;
67} 67}
68 68
69void DateEdit::clear() 69void DateEdit::clear()
70{ 70{
71 QDate today = QDate::currentDate(); 71 QDate today = QDate::currentDate();
72 72
73 dateSelector->setDate(today.year(), today.month(), today.day()); 73 dateSelector->setDate(today.year(), today.month(), today.day());
74 setText(today.toString()); 74 setText(today.toString());
75} 75}
76 76
77void DateEdit::subValueChanged() 77void DateEdit::subValueChanged()
78{ 78{
79 QDate current = dateSelector->selectedDate(); 79 QDate current = dateSelector->selectedDate();
80 80
81 setText(current.toString()); 81 setText(current.toString());
82 emit valueChanged(current); 82 emit valueChanged(current);
83} 83}
84 84
85TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f ) 85TimeEdit::TimeEdit( QWidget *parent, const char *name, WFlags f )
86 : QWidget(parent, name, f) 86 : QWidget(parent, name, f)
87{ 87{
88 QHBoxLayout *layout = new QHBoxLayout(this, 0); 88 QHBoxLayout *layout = new QHBoxLayout(this, 0);
diff --git a/noncore/apps/tableviewer/ui/tvbrowseview.cpp b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
index 22bac55..8a65ed1 100644
--- a/noncore/apps/tableviewer/ui/tvbrowseview.cpp
+++ b/noncore/apps/tableviewer/ui/tvbrowseview.cpp
@@ -9,98 +9,98 @@
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 "tvbrowseview.h" 20#include "tvbrowseview.h"
21#include "browsekeyentry.h" 21#include "browsekeyentry.h"
22#include <qtoolbutton.h> 22#include <qtoolbutton.h>
23#include <qtextview.h> 23#include <qtextview.h>
24#include <qtextbrowser.h> 24#include <qtextbrowser.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include "../xmlencodeattr.h" 26#include "../xmlencodeattr.h"
27 27
28/*! 28/*!
29 \class TVBrowseView 29 \class TVBrowseView
30 \brief The widget describing how to draw the browse view user interface 30 \brief The widget describing how to draw the browse view user interface
31 31
32 This widget allows for the user to browse through the table, one element 32 This widget allows for the user to browse through the table, one element
33 at a time, or search on a single key. Its main goal is to show a 33 at a time, or search on a single key. Its main goal is to show a
34 single element in a readable format and make it easy for the user to 34 single element in a readable format and make it easy for the user to
35 rapidly find specific elements in the table. 35 rapidly find specific elements in the table.
36*/ 36*/
37 37
38/*! 38/*!
39 Constructs a new TVBrowseView widget 39 Constructs a new TVBrowseView widget
40*/ 40*/
41TVBrowseView::TVBrowseView(TableState *t, QWidget* parent, const char *name, 41TVBrowseView::TVBrowseView(TableState *t, QWidget* parent, const char *name,
42 WFlags fl ) 42 WFlags fl )
43{ 43{
44 if (!name) 44 if (!name)
45 setName("BrowseView"); 45 setName("BrowseView");
46 46
47// setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) ); 47// setSizePolicy(QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding, 0, 0, sizePolicy().hasHeightForWidth() ) );
48 QVBoxLayout *vlayout = new QVBoxLayout(this); 48 QVBoxLayout *vlayout = new QVBoxLayout(this);
49 textViewDisplay = new QTextBrowser(this, "textViewDisplay"); 49 textViewDisplay = new QTextBrowser(this, "textViewDisplay");
50 vlayout->addWidget( textViewDisplay ); 50 vlayout->addWidget( textViewDisplay );
51 51
52 keyEntry = new TVBrowseKeyEntry(this, "keyEntry"); 52 keyEntry = new TVBrowseKeyEntry(this, "keyEntry");
53 vlayout->addWidget( keyEntry ); 53 vlayout->addWidget( keyEntry );
54 54
55 /* connect the signals down */ 55 /* connect the signals down */
56 56
57 connect(keyEntry, SIGNAL(searchOnKey(int, TVVariant)), 57 connect(keyEntry, SIGNAL(searchOnKey(int,TVVariant)),
58 this, SIGNAL(searchOnKey(int, TVVariant))); 58 this, SIGNAL(searchOnKey(int,TVVariant)));
59 connect(keyEntry, SIGNAL(sortChanged(int)), 59 connect(keyEntry, SIGNAL(sortChanged(int)),
60 this, SIGNAL(sortChanged(int))); 60 this, SIGNAL(sortChanged(int)));
61 61
62 ts = t; 62 ts = t;
63 keyEntry->setTableState(t); 63 keyEntry->setTableState(t);
64} 64}
65 65
66/*! 66/*!
67 Destroys the TVBrowseView widget 67 Destroys the TVBrowseView widget
68*/ 68*/
69TVBrowseView::~TVBrowseView() 69TVBrowseView::~TVBrowseView()
70{ 70{
71} 71}
72 72
73void TVBrowseView::rebuildData() 73void TVBrowseView::rebuildData()
74{ 74{
75 if(!ts) 75 if(!ts)
76 return; 76 return;
77 if(!ts->current_elem) { 77 if(!ts->current_elem) {
78 /* also disable buttons */ 78 /* also disable buttons */
79 textViewDisplay->setText(""); 79 textViewDisplay->setText("");
80 return; 80 return;
81 } 81 }
82 82
83 setDisplayText(ts->current_elem); 83 setDisplayText(ts->current_elem);
84} 84}
85 85
86/* Reset to initial state */ 86/* Reset to initial state */
87void TVBrowseView::reset() 87void TVBrowseView::reset()
88{ 88{
89 textViewDisplay->setText(""); 89 textViewDisplay->setText("");
90 keyEntry->reset(); 90 keyEntry->reset();
91} 91}
92 92
93/*! 93/*!
94 sets the data element to be displayed to element 94 sets the data element to be displayed to element
95*/ 95*/
96void TVBrowseView::setDisplayText(const DataElem *element) 96void TVBrowseView::setDisplayText(const DataElem *element)
97{ 97{
98 QString rep = ""; 98 QString rep = "";
99 99
100 KeyListIterator it(*ts->kRep); 100 KeyListIterator it(*ts->kRep);
101 101
102 while (it.current()) { 102 while (it.current()) {
103 if (element->hasValidValue(it.currentKey())) { 103 if (element->hasValidValue(it.currentKey())) {
104 if(it.currentKey() == ts->current_column) { 104 if(it.currentKey() == ts->current_column) {
105 rep += "<A name=\"ckey\"></A><B><FONT COLOR=#FF0000>" 105 rep += "<A name=\"ckey\"></A><B><FONT COLOR=#FF0000>"
106 + encodeAttr(it.current()->name()) 106 + encodeAttr(it.current()->name())
diff --git a/noncore/apps/tableviewer/ui/tvfilterview.cpp b/noncore/apps/tableviewer/ui/tvfilterview.cpp
index b03e846..22f1fb7 100644
--- a/noncore/apps/tableviewer/ui/tvfilterview.cpp
+++ b/noncore/apps/tableviewer/ui/tvfilterview.cpp
@@ -44,97 +44,97 @@ TVFilterView::TVFilterView(TableState *t, QWidget* parent,
44 display->header()->setResizeEnabled(FALSE); 44 display->header()->setResizeEnabled(FALSE);
45 45
46 vlayout->addWidget(display); 46 vlayout->addWidget(display);
47 47
48 QHBoxLayout *hlayout = new QHBoxLayout; 48 QHBoxLayout *hlayout = new QHBoxLayout;
49 hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum)); 49 hlayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum));
50 50
51 newFilterButton = new QPushButton(this, "new Filter"); 51 newFilterButton = new QPushButton(this, "new Filter");
52 newFilterButton->setMaximumSize(QSize(50, 32767)); 52 newFilterButton->setMaximumSize(QSize(50, 32767));
53 newFilterButton->setText("New"); 53 newFilterButton->setText("New");
54 hlayout->addWidget(newFilterButton); 54 hlayout->addWidget(newFilterButton);
55 55
56 deleteFilterButton = new QPushButton(this, "delete Filter"); 56 deleteFilterButton = new QPushButton(this, "delete Filter");
57 deleteFilterButton->setMaximumSize(QSize(50, 32767)); 57 deleteFilterButton->setMaximumSize(QSize(50, 32767));
58 deleteFilterButton->setText("Delete"); 58 deleteFilterButton->setText("Delete");
59 hlayout->addWidget(deleteFilterButton); 59 hlayout->addWidget(deleteFilterButton);
60 60
61 clearFilterButton = new QPushButton(this, "delete Filter"); 61 clearFilterButton = new QPushButton(this, "delete Filter");
62 clearFilterButton->setMaximumSize(QSize(60, 32767)); 62 clearFilterButton->setMaximumSize(QSize(60, 32767));
63 clearFilterButton->setText("Clear All"); 63 clearFilterButton->setText("Clear All");
64 hlayout->addWidget(clearFilterButton); 64 hlayout->addWidget(clearFilterButton);
65 65
66 vlayout->addLayout(hlayout); 66 vlayout->addLayout(hlayout);
67 67
68 QHBoxLayout *hlayout2 = new QHBoxLayout; 68 QHBoxLayout *hlayout2 = new QHBoxLayout;
69 69
70 keyNameCombo = new QComboBox(FALSE, this, "key name"); 70 keyNameCombo = new QComboBox(FALSE, this, "key name");
71 keyNameCombo->setEnabled(FALSE); 71 keyNameCombo->setEnabled(FALSE);
72 hlayout2->addWidget(keyNameCombo); 72 hlayout2->addWidget(keyNameCombo);
73 73
74 QLabel *label = new QLabel(this); 74 QLabel *label = new QLabel(this);
75 label->setText("has value"); 75 label->setText("has value");
76 hlayout2->addWidget(label); 76 hlayout2->addWidget(label);
77 77
78 keyEntry = new TVFilterKeyEntry(this, "key entry"); 78 keyEntry = new TVFilterKeyEntry(this, "key entry");
79 keyEntry->setEnabled(FALSE); 79 keyEntry->setEnabled(FALSE);
80 80
81 vlayout->addLayout(hlayout2); 81 vlayout->addLayout(hlayout2);
82 vlayout->addWidget(keyEntry); 82 vlayout->addWidget(keyEntry);
83 83
84 connect(newFilterButton, SIGNAL( clicked() ), this, SLOT( newTerm() )); 84 connect(newFilterButton, SIGNAL( clicked() ), this, SLOT( newTerm() ));
85 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm())); 85 connect(deleteFilterButton, SIGNAL( clicked() ), this, SLOT( deleteTerm()));
86 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms())); 86 connect(clearFilterButton, SIGNAL( clicked() ), this, SLOT( clearTerms()));
87 87
88 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() )); 88 connect(keyEntry, SIGNAL(valueChanged()), this, SLOT( updateTerm() ));
89 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() )); 89 connect(keyNameCombo, SIGNAL(activated(int)), this, SLOT( updateTerm() ));
90 90
91 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this, 91 connect(display, SIGNAL(selectionChanged(QListViewItem*)), this,
92 SLOT(setTerm(QListViewItem *))); 92 SLOT(setTerm(QListViewItem*)));
93 93
94 ts = t; 94 ts = t;
95 current = 0; 95 current = 0;
96 terms.setAutoDelete(true); 96 terms.setAutoDelete(true);
97 do_filter = false; 97 do_filter = false;
98 98
99#ifdef Q_WS_QWS 99#ifdef Q_WS_QWS
100 QPEApplication::showDialog( this ); 100 QPEApplication::showDialog( this );
101#endif 101#endif
102} 102}
103 103
104/*! 104/*!
105 Destroys the TVFilterView widget 105 Destroys the TVFilterView widget
106*/ 106*/
107TVFilterView::~TVFilterView() 107TVFilterView::~TVFilterView()
108{ 108{
109} 109}
110 110
111void TVFilterView::rebuildData() 111void TVFilterView::rebuildData()
112{ 112{
113} 113}
114 114
115void TVFilterView::reset() 115void TVFilterView::reset()
116{ 116{
117 keyNameCombo->clear(); 117 keyNameCombo->clear();
118 keyIds.clear(); 118 keyIds.clear();
119} 119}
120 120
121void TVFilterView::rebuildKeys() 121void TVFilterView::rebuildKeys()
122{ 122{
123 int i; 123 int i;
124 124
125 if (!ts) return; 125 if (!ts) return;
126 if(!ts->kRep) return; 126 if(!ts->kRep) return;
127 keyEntry->setTableState(ts); 127 keyEntry->setTableState(ts);
128 128
129 /* set up the list of keys that can be compared on */ 129 /* set up the list of keys that can be compared on */
130 keyNameCombo->clear(); 130 keyNameCombo->clear();
131 KeyListIterator it(*ts->kRep); 131 KeyListIterator it(*ts->kRep);
132 132
133 i = 0; 133 i = 0;
134 while(it.current()) { 134 while(it.current()) {
135 if(ts->kRep->validIndex(it.currentKey())) { 135 if(ts->kRep->validIndex(it.currentKey())) {
136 keyNameCombo->insertItem(it.current()->name()); 136 keyNameCombo->insertItem(it.current()->name());
137 keyIds.insert(i, it.currentKey()); 137 keyIds.insert(i, it.currentKey());
138 ++i; 138 ++i;
139 } 139 }
140 ++it; 140 ++it;
diff --git a/noncore/apps/tableviewer/ui/tvlistview.cpp b/noncore/apps/tableviewer/ui/tvlistview.cpp
index b25e813..b10ff1d 100644
--- a/noncore/apps/tableviewer/ui/tvlistview.cpp
+++ b/noncore/apps/tableviewer/ui/tvlistview.cpp
@@ -59,98 +59,98 @@ public:
59 } 59 }
60 QString key(int i, bool a) const 60 QString key(int i, bool a) const
61 { 61 {
62 return data_reference->toSortableQString(i); 62 return data_reference->toSortableQString(i);
63 } 63 }
64 64
65 void setDataElem(DataElem *d) 65 void setDataElem(DataElem *d)
66 { 66 {
67 data_reference = d; 67 data_reference = d;
68 } 68 }
69 69
70 DataElem *getDataElem() { 70 DataElem *getDataElem() {
71 return data_reference; 71 return data_reference;
72 } 72 }
73private: 73private:
74 DataElem *data_reference; 74 DataElem *data_reference;
75}; 75};
76 76
77TVListViewItem::TVListViewItem(QListView *parent, DataElem *d) 77TVListViewItem::TVListViewItem(QListView *parent, DataElem *d)
78 : QListViewItem(parent) 78 : QListViewItem(parent)
79{ 79{
80 data_reference = d; 80 data_reference = d;
81} 81}
82 82
83TVListViewItem::~TVListViewItem() 83TVListViewItem::~TVListViewItem()
84{ 84{
85 data_reference = 0; 85 data_reference = 0;
86} 86}
87 87
88TVListView::TVListView(TableState *t, QWidget* parent, 88TVListView::TVListView(TableState *t, QWidget* parent,
89 const char *name, WFlags fl ) : QWidget(parent, name, fl) 89 const char *name, WFlags fl ) : QWidget(parent, name, fl)
90{ 90{
91 if (!name) 91 if (!name)
92 setName("TVListView"); 92 setName("TVListView");
93 93
94 // the next two lines need to be rationalized. 94 // the next two lines need to be rationalized.
95 resize(318,457); 95 resize(318,457);
96 setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7, 96 setSizePolicy(QSizePolicy((QSizePolicy::SizeType)7,
97 (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth())); 97 (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth()));
98 setCaption(tr("List View")); 98 setCaption(tr("List View"));
99 99
100 QVBoxLayout *layout = new QVBoxLayout(this); 100 QVBoxLayout *layout = new QVBoxLayout(this);
101 layout->setSpacing(0); 101 layout->setSpacing(0);
102 layout->setMargin(0); 102 layout->setMargin(0);
103 103
104 listViewDisplay = new TVListViewPrivate(this, "listViewDisplay"); 104 listViewDisplay = new TVListViewPrivate(this, "listViewDisplay");
105 layout->addWidget(listViewDisplay); 105 layout->addWidget(listViewDisplay);
106 106
107 connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem *)), this, 107 connect(listViewDisplay, SIGNAL(currentChanged(QListViewItem*)), this,
108 SLOT(setCurrent(QListViewItem *))); 108 SLOT(setCurrent(QListViewItem*)));
109 connect(listViewDisplay, SIGNAL(sortChanged(int)), this, 109 connect(listViewDisplay, SIGNAL(sortChanged(int)), this,
110 SLOT(setSorting(int))); 110 SLOT(setSorting(int)));
111 111
112 listViewDisplay->setShowSortIndicator(true); 112 listViewDisplay->setShowSortIndicator(true);
113 113
114 it = new QListViewItemIterator(listViewDisplay); 114 it = new QListViewItemIterator(listViewDisplay);
115 ts = t; 115 ts = t;
116} 116}
117 117
118TVListView::~TVListView() 118TVListView::~TVListView()
119{ 119{
120} 120}
121 121
122void TVListView::addItem(DataElem *d) 122void TVListView::addItem(DataElem *d)
123{ 123{
124 TVListViewItem *i = new TVListViewItem(listViewDisplay, d); 124 TVListViewItem *i = new TVListViewItem(listViewDisplay, d);
125 125
126 delete it; 126 delete it;
127 it = new QListViewItemIterator(i); 127 it = new QListViewItemIterator(i);
128} 128}
129 129
130/* remove current (it) item */ 130/* remove current (it) item */
131void TVListView::removeItem() 131void TVListView::removeItem()
132{ 132{
133 QListViewItemIterator other(*it); 133 QListViewItemIterator other(*it);
134 134
135 QListViewItemIterator tmp = *it; 135 QListViewItemIterator tmp = *it;
136 (*it)++; 136 (*it)++;
137 if (!it->current()) { 137 if (!it->current()) {
138 *it = tmp; 138 *it = tmp;
139 (*it)--; 139 (*it)--;
140 if (!it->current()) { 140 if (!it->current()) {
141 delete it; 141 delete it;
142 it = 0; 142 it = 0;
143 } 143 }
144 } 144 }
145 145
146 delete other.current(); 146 delete other.current();
147} 147}
148 148
149void TVListView::clearItems() 149void TVListView::clearItems()
150{ 150{
151 /* This is ok since the destructor for TVListItem does not know about 151 /* This is ok since the destructor for TVListItem does not know about
152 the data_reference pointer.. and hence will leave it alone */ 152 the data_reference pointer.. and hence will leave it alone */
153 listViewDisplay->clear(); 153 listViewDisplay->clear();
154 delete it; 154 delete it;
155 it = new QListViewItemIterator(listViewDisplay); 155 it = new QListViewItemIterator(listViewDisplay);
156} 156}