summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/tableviewer.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/tableviewer/tableviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/tableviewer.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/noncore/apps/tableviewer/tableviewer.cpp b/noncore/apps/tableviewer/tableviewer.cpp
index 102b94c..9538cb3 100644
--- a/noncore/apps/tableviewer/tableviewer.cpp
+++ b/noncore/apps/tableviewer/tableviewer.cpp
@@ -1,65 +1,67 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-/* local includes */
#include "tableviewer.h"
#include "ui/tvbrowseview.h"
#include "ui/tvfilterview.h"
#include "ui/tvlistview.h"
#include "ui/tveditview.h"
#include "ui/tvkeyedit.h"
#include "db/datacache.h"
-/* QPE includes */
+/* OPIE */
+#include <opie2/odebug.h>
#include <qpe/fileselector.h>
#include <qpe/resource.h>
-#include <qtoolbar.h>
+using namespace Opie::Core;
-/* QTE includes */
+/* QT */
#include <qmenubar.h>
+#include <qtoolbar.h>
#include <qpopupmenu.h>
#include <qapplication.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <qbuffer.h>
+
/*!
\class TableViewerWindow
\brief The main window widget of the application
This is the main widget of the table viewer application.
It is the co-ordination point.
*/
/*!
Constructs a new TableViewerWindow
*/
TableViewerWindow::TableViewerWindow(QWidget *parent, const char *name, WFlags f)
: QMainWindow(parent, name, f)
{
setCaption(tr("Table Viewer"));
/* Build data */
ds = new DBStore();
doc.setType("text/x-xml-tableviewer");
doc.setName("table");
dirty = FALSE;
ts.current_column = 0;
ts.kRep = ds->getKeys();
@@ -180,49 +182,49 @@ TableViewerWindow::~TableViewerWindow()
saveDocument();
}
/*!
Opens a file dialog and loads the file specified by the dialog
*/
void TableViewerWindow::selectDocument()
{
if(dirty)
saveDocument();
current_view = FileState;
cw->raiseWidget(current_view);
fileSelector->reread();
}
void TableViewerWindow::saveDocument()
{
if(!dirty)
return;
FileManager fm;
QIODevice *dev = fm.saveFile(doc);
if(!ds->saveSource(dev, doc.type())){
- qWarning("Save unsuccessful");
+ owarn << "Save unsuccessful" << oendl;
return;
}
dev->close();
dirty = FALSE;
}
void TableViewerWindow::newDocument()
{
DocLnk nf;
nf.setType("text/x-xml-tableviewer");
nf.setName("table");
delete ds;
ds = new DBStore();
ts.current_column = 0;
ts.kRep = ds->getKeys();
browseView->reset();
listView->reset();
filterView->reset();
doc = nf;
dirty = FALSE;
@@ -267,49 +269,49 @@ void TableViewerWindow::openDocument(const DocLnk &f)
filterView->rebuildKeys();
ds->first();
/* set up the list view */
listView->clearItems();
do {
d = ds->getCurrentData();
if(d)
listView->addItem(d);
} while(ds->next());
/* Set up browse view, Will be based of structure of listView */
listView->first();
ts.current_elem = listView->getCurrentData();
browseView->rebuildData();
listView->rebuildData();
QString scratch = "Table Viewer";/* later take from constant */
scratch += " - ";
scratch += ds->getName();
setCaption(tr(scratch));
dirty = FALSE;
} else {
- qWarning(tr("could not load Document"));
+ owarn << tr("could not load Document") << oendl;
}
dev->close();
}
/*!
Moves to the first item of the current table
*/
void TableViewerWindow::firstItem()
{
listView->first();
ts.current_elem = listView->getCurrentData();
browseView->rebuildData();
}
/*!
Moves to the lat item of the current table
*/
void TableViewerWindow::lastItem()
{
listView->last();
ts.current_elem = listView->getCurrentData();
browseView->rebuildData();
}