summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-03-11 13:35:07 (UTC)
committer llornkcor <llornkcor>2002-03-11 13:35:07 (UTC)
commitd9406acf405148290c11a49fc09f5ed6b1258843 (patch) (unidiff)
treefe3ca4c79917a1ff052ad63e65434b9b372c5d0b
parentaeb745907f05b7d0729d273f72b5641e890a4c27 (diff)
downloadopie-d9406acf405148290c11a49fc09f5ed6b1258843.zip
opie-d9406acf405148290c11a49fc09f5ed6b1258843.tar.gz
opie-d9406acf405148290c11a49fc09f5ed6b1258843.tar.bz2
adde patch for Pru'homme
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/main.cpp6
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp26
-rw-r--r--noncore/apps/tableviewer/tableviewer.h3
3 files changed, 32 insertions, 3 deletions
diff --git a/noncore/apps/tableviewer/main.cpp b/noncore/apps/tableviewer/main.cpp
index 56c567f..d17ee65 100644
--- a/noncore/apps/tableviewer/main.cpp
+++ b/noncore/apps/tableviewer/main.cpp
@@ -11,22 +11,22 @@
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 <qpe/qpeapplication.h> 21#include <qpe/qpeapplication.h>
22 22
23int main( int argc, char ** argv ) 23int 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;
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 0456b41..fbb5c24 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -21,32 +21,33 @@
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 <qpe/fileselector.h> 31#include <qpe/fileselector.h>
32#include <qpe/resource.h> 32#include <qpe/resource.h>
33#include <qpe/qpetoolbar.h> 33#include <qpe/qpetoolbar.h>
34 34
35/* QTE includes */ 35/* QTE includes */
36#include <qpe/qpemenubar.h> 36#include <qpe/qpemenubar.h>
37#include <qpe/qpetoolbar.h>
37#include <qpopupmenu.h> 38#include <qpopupmenu.h>
38#include <qapplication.h> 39#include <qapplication.h>
39#include <qwidgetstack.h> 40#include <qwidgetstack.h>
40#include <qlayout.h> 41#include <qlayout.h>
41#include <qbuffer.h> 42#include <qbuffer.h>
42/*! 43/*!
43 \class TableViewerWindow 44 \class TableViewerWindow
44 \brief The main window widget of the application 45 \brief The main window widget of the application
45 46
46 This is the main widget of the table viewer application. 47 This is the main widget of the table viewer application.
47 It is the co-ordination point. 48 It is the co-ordination point.
48*/ 49*/
49 50
50/*! 51/*!
51 Constructs a new TableViewerWindow 52 Constructs a new TableViewerWindow
52*/ 53*/
@@ -221,32 +222,37 @@ void TableViewerWindow::newDocument()
221 ts.kRep = ds->getKeys(); 222 ts.kRep = ds->getKeys();
222 browseView->reset(); 223 browseView->reset();
223 listView->reset(); 224 listView->reset();
224 filterView->reset(); 225 filterView->reset();
225 226
226 doc = nf; 227 doc = nf;
227 dirty = FALSE; 228 dirty = FALSE;
228 229
229 current_view = BrowseState; 230 current_view = BrowseState;
230 cw->raiseWidget(current_view); 231 cw->raiseWidget(current_view);
231 232
232 /* now set up for editing the keys */ 233 /* now set up for editing the keys */
233 ts.kRep->addKey("key", TVVariant::String); 234 ts.kRep->addKey("key", TVVariant::String);
234 editKeysSlot(); 235 editKeysSlot();
235} 236}
236 237
238void TableViewerWindow::setDocument(const QString &f)
239{
240 openDocument(DocLnk(f, TRUE));
241}
242
237void TableViewerWindow::openDocument(const DocLnk &f) 243void TableViewerWindow::openDocument(const DocLnk &f)
238{ 244{
239 245
240 if (!f.isValid()) 246 if (!f.isValid())
241 return; 247 return;
242 248
243 FileManager fm; 249 FileManager fm;
244 QIODevice *dev = fm.openFile(f); 250 QIODevice *dev = fm.openFile(f);
245 doc = f; 251 doc = f;
246 252
247 if(ds->openSource(dev, doc.type())) { 253 if(ds->openSource(dev, doc.type())) {
248 DataElem *d; 254 DataElem *d;
249 255
250 browseView->reset(); 256 browseView->reset();
251 listView->reset(); 257 listView->reset();
252 filterView->reset(); 258 filterView->reset();
@@ -276,32 +282,52 @@ void TableViewerWindow::openDocument(const DocLnk &f)
276 browseView->rebuildData(); 282 browseView->rebuildData();
277 listView->rebuildData(); 283 listView->rebuildData();
278 284
279 QString scratch = "Table Viewer";/* later take from constant */ 285 QString scratch = "Table Viewer";/* later take from constant */
280 scratch += " - "; 286 scratch += " - ";
281 scratch += ds->getName(); 287 scratch += ds->getName();
282 setCaption(tr(scratch)); 288 setCaption(tr(scratch));
283 289
284 dirty = FALSE; 290 dirty = FALSE;
285 } else { 291 } else {
286 qWarning(tr("could not load Document")); 292 qWarning(tr("could not load Document"));
287 } 293 }
288 dev->close(); 294 dev->close();
289} 295}
290 296
291/*! 297/*!
298 Moves to the first item of the current table
299*/
300void TableViewerWindow::firstItem()
301{
302 listView->first();
303 ts.current_elem = listView->getCurrentData();
304 browseView->rebuildData();
305}
306
307/*!
308 Moves to the lat item of the current table
309*/
310void TableViewerWindow::lastItem()
311{
312 listView->last();
313 ts.current_elem = listView->getCurrentData();
314 browseView->rebuildData();
315}
316
317/*!
292 Moves to the next item of the current table 318 Moves to the next item of the current table
293*/ 319*/
294void TableViewerWindow::nextItem() 320void TableViewerWindow::nextItem()
295{ 321{
296 listView->next(); 322 listView->next();
297 ts.current_elem = listView->getCurrentData(); 323 ts.current_elem = listView->getCurrentData();
298 browseView->rebuildData(); 324 browseView->rebuildData();
299} 325}
300 326
301/*! 327/*!
302 Moves to the previous item of the current table 328 Moves to the previous item of the current table
303*/ 329*/
304void TableViewerWindow::previousItem() 330void TableViewerWindow::previousItem()
305{ 331{
306 listView->previous(); 332 listView->previous();
307 ts.current_elem = listView->getCurrentData(); 333 ts.current_elem = listView->getCurrentData();
diff --git a/noncore/apps/tableviewer/tableviewer.h b/noncore/apps/tableviewer/tableviewer.h
index 0d3c39d..817db21 100644
--- a/noncore/apps/tableviewer/tableviewer.h
+++ b/noncore/apps/tableviewer/tableviewer.h
@@ -36,34 +36,37 @@ class TVEditView;
36 36
37class DBStore; 37class DBStore;
38 38
39class TableViewerWindow: public QMainWindow 39class TableViewerWindow: public QMainWindow
40{ 40{
41 Q_OBJECT 41 Q_OBJECT
42public: 42public:
43 TableViewerWindow( QWidget *parent = 0, 43 TableViewerWindow( QWidget *parent = 0,
44 const char *name = 0, WFlags f = 0 ); 44 const char *name = 0, WFlags f = 0 );
45 ~TableViewerWindow(); 45 ~TableViewerWindow();
46 46
47public slots: 47public slots:
48 void selectDocument(); 48 void selectDocument();
49 49
50 void newDocument(); 50 void newDocument();
51 void saveDocument(); 51 void saveDocument();
52 void setDocument(const QString &);
52 void openDocument(const DocLnk &); 53 void openDocument(const DocLnk &);
53 54
55 void firstItem();
56 void lastItem();
54 void nextItem(); 57 void nextItem();
55 void previousItem(); 58 void previousItem();
56 59
57 void listViewSlot(); 60 void listViewSlot();
58 void browseViewSlot(); 61 void browseViewSlot();
59 void filterViewSlot(); 62 void filterViewSlot();
60 63
61 void editItemSlot(); 64 void editItemSlot();
62 void newItemSlot(); 65 void newItemSlot();
63 void deleteItemSlot(); 66 void deleteItemSlot();
64 67
65 void editKeysSlot(); 68 void editKeysSlot();
66 69
67 /* reveiw the sig. for this function TODO */ 70 /* reveiw the sig. for this function TODO */
68 void searchOnKey(int, TVVariant); 71 void searchOnKey(int, TVVariant);
69 void setPrimaryKey(int); 72 void setPrimaryKey(int);