Diffstat (limited to 'noncore/apps/tableviewer/tableviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/tableviewer/tableviewer.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 | |||
@@ -25,24 +25,25 @@ | |||
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 | */ |
@@ -225,24 +226,29 @@ void TableViewerWindow::newDocument() | |||
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 | ||
238 | void TableViewerWindow::setDocument(const QString &f) | ||
239 | { | ||
240 | openDocument(DocLnk(f, TRUE)); | ||
241 | } | ||
242 | |||
237 | void TableViewerWindow::openDocument(const DocLnk &f) | 243 | void 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; |
@@ -280,24 +286,44 @@ void TableViewerWindow::openDocument(const DocLnk &f) | |||
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 | */ | ||
300 | void 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 | */ | ||
310 | void 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 | */ |
294 | void TableViewerWindow::nextItem() | 320 | void 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 | */ |