--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/chartwindow.cpp Thu May 18 23:05:01 2006 +0200
@@ -0,0 +1,69 @@
+#include <qmainwindow.h>
+#include <qlistview.h>
+#include <qstatusbar.h>
+#include "chartwindow.h"
+#include "mainpanel.h"
+
+
+ChartWindow::ChartWindow(QWidget *parent, const char *name)
+ : QMainWindow(parent, name, WDestructiveClose)
+{
+ //QVBoxLayout *mainlayout = new QVBoxLayout(this, 0);
+
+ // Only the listview in the window
+ accountsList = new QListView(this);
+
+ accountsList->addColumn( tr("Number") );
+ accountsList->addColumn( tr("Name") );
+ accountsList->addColumn( tr("Description") );
+ accountsList->addColumn( tr("General") );
+ accountsList->addColumn( tr("Is Account") );
+ accountsList->addColumn( tr("Enabled") );
+ accountsList->addColumn( tr("Type") );
+ accountsList->addColumn( tr("Links") );
+
+ accountsList->setAllColumnsShowFocus( true );
+
+
+ // We get the data to be shown
+ QSqlQuery q;
+
+ q.prepare("SELECT account_num, name, description, general, account, "
+ "enabled, type, links FROM chart");
+ if(q.exec())
+ {
+ while(q.next()) {
+ new QListViewItem( accountsList,
+ q.value(0).toString(), // account_num
+ q.value(1).toString(), // name
+ q.value(2).toString(), // description
+ q.value(3).toBool()?"True":"False", // general
+ q.value(4).toBool()?"True":"False", // account
+ q.value(5).toBool()?"True":"False", // enabled
+ q.value(6).toString(), // type
+ q.value(7).toString()); // links
+ }
+ }
+ else
+ qDebug("Query failed when trying to get Chart of accounts");
+
+
+ // Prepare this main window
+ setFocusProxy( accountsList );
+ setCentralWidget( accountsList );
+
+ setCaption( tr("Accounts Chart") );
+
+ // Show Status Bar
+
+ // Needed?
+ statusBar()->clear();
+
+ statusBar()->message( tr("Click with right button over any accout to"
+ " perform any action") );
+
+}
+
+ChartWindow::~ChartWindow()
+{
+}