summaryrefslogtreecommitdiff
authordrw <drw>2002-11-02 01:29:30 (UTC)
committer drw <drw>2002-11-02 01:29:30 (UTC)
commitbf9388acdebf6e55345dff3bd1cd652b45a2202a (patch) (side-by-side diff)
tree737ca55c9a30a1dde3aa289fd99cac7e4c30a3f7
parent6e9225388baa9dfac4ed09f22189cfa98a610d39 (diff)
downloadopie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.zip
opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.gz
opie-bf9388acdebf6e55345dff3bd1cd652b45a2202a.tar.bz2
Code updates/fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp59
-rw-r--r--noncore/apps/checkbook/checkbook.h5
-rw-r--r--noncore/apps/checkbook/checkbook.pro42
-rw-r--r--noncore/apps/checkbook/graph.cpp112
-rw-r--r--noncore/apps/checkbook/graph.h63
-rw-r--r--noncore/apps/checkbook/graphinfo.cpp84
-rw-r--r--noncore/apps/checkbook/graphinfo.h82
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp11
-rw-r--r--noncore/apps/checkbook/traninfo.cpp25
-rw-r--r--noncore/apps/checkbook/traninfo.h1
-rw-r--r--noncore/apps/checkbook/transaction.cpp4
11 files changed, 430 insertions, 58 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 4b81c6d..20b42b5 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -23,16 +23,18 @@
    --        :-=` Free Software Foundation, Inc.,
59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include "checkbook.h"
#include "transaction.h"
+#include "graph.h"
+#include "graphinfo.h"
#include <opie/otabwidget.h>
#include <qpe/config.h>
#include <qpe/qpeapplication.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qcombobox.h>
@@ -45,24 +47,29 @@
#include <qpushbutton.h>
#include <qwhatsthis.h>
#include <qwidget.h>
Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol )
: QDialog( parent, 0, TRUE, WStyle_ContextHelp )
{
name = n;
- filename = fd + name + ".qcb";
+ filename = fd;
+ filename.append( name );
+ filename.append( ".qcb" );
filedir = fd;
currencySymbol = symbol;
currBalance = 0.0;
if ( name != "" )
{
- setCaption( name + " - " + tr( "Checkbook" ) );
+ QString tempstr = name;
+ tempstr.append( " - " );
+ tempstr.append( tr( "Checkbook" ) );
+ setCaption( tempstr );
}
else
{
setCaption( tr( "New checkbook" ) );
}
// Setup layout to make everything pretty
QVBoxLayout *layout = new QVBoxLayout( this );
@@ -237,23 +244,24 @@ QWidget *Checkbook::initCharts()
layout->addWidget( label, 0, 0 );
graphList = new QComboBox( control );
graphList->insertItem( tr( "By category" ) );
graphList->insertItem( tr( "..." ) );
graphList->insertItem( tr( "..." ) );
layout->addWidget( graphList, 0, 1 );
*/
- QWidget *graphWidget = new QWidget( control );
- QWhatsThis::add( graphWidget, tr( "Graph not implemented yet." ) );
+ GraphInfo* info = new GraphInfo( GraphInfo::BarChart, 0x0, tr( "Graph Title" ),
+ tr( "X-Axis" ), tr( "Y-Axis" ) );
+ graphWidget = new Graph( control, info );
+ QWhatsThis::add( graphWidget, tr( "Charting is not implemented yet." ) );
layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 );
- graphWidget->setBackgroundMode( QWidget::PaletteBase );
QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control );
- QWhatsThis::add( btn, tr( "Click here to draw the graph." ) );
+ QWhatsThis::add( btn, tr( "Click here to draw the chart." ) );
connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) );
layout->addWidget( btn, 1, 1 );
return control;
}
void Checkbook::loadCheckbook()
{
@@ -271,18 +279,18 @@ void Checkbook::loadCheckbook()
i--;
typeList->setCurrentItem( i );
if ( typeList->currentText() == temptext )
{
break;
}
}
bankEdit->setText( config.readEntry( "Bank", "" ) );
- acctNumEdit->setText( config.readEntry( "Number", "" ) );
- pinNumEdit->setText( config.readEntry( "PINNumber", "" ) );
+ acctNumEdit->setText( config.readEntryCrypt( "Number", "" ) );
+ pinNumEdit->setText( config.readEntryCrypt( "PINNumber", "" ) );
balanceEdit->setText( config.readEntry( "Balance", "0.0" ) );
notesEdit->setText( config.readEntry( "Notes", "" ) );
bool ok;
currBalance = balanceEdit->text().toFloat( &ok );
startBalance = currBalance;
// Load transactions
@@ -304,21 +312,17 @@ void Checkbook::loadCheckbook()
}
currBalance += amount;
stramount.sprintf( "%c%.2f", currencySymbol, amount );
// Add to transaction list
transactions.append( tran );
// Add to transaction table
- QDate date = tran->date();
- QString datestr = QString::number( date.month() ) + "/" +
- QString::number( date.day() ) + "/" +
- QString::number( date.year() );
- ( void ) new QListViewItem( tranTable, QString::number( i ), datestr,
+ ( void ) new QListViewItem( tranTable, QString::number( i ), tran->datestr(),
trandesc, stramount );
}
else
{
delete tran;
}
}
balanceLabel->setText( tr( "Current balance: %1%2" ).arg( currencySymbol ).arg( currBalance, 0, 'f', 2 ) );
@@ -352,18 +356,18 @@ void Checkbook::accept()
}
Config *config = new Config(filename, Config::File);
// Save info
config->setGroup( "Account" );
config->writeEntry( "Type", typeList->currentText() );
config->writeEntry( "Bank", bankEdit->text() );
- config->writeEntry( "Number", acctNumEdit->text() );
- config->writeEntry( "PINNumber", pinNumEdit->text() );
+ config->writeEntryCrypt( "Number", acctNumEdit->text() );
+ config->writeEntryCrypt( "PINNumber", pinNumEdit->text() );
config->writeEntry( "Balance", balanceEdit->text() );
config->writeEntry( "Notes", notesEdit->text() );
// Save transactions
TranInfo *tran = transactions.first();
int i = 1;
while ( tran )
{
@@ -374,18 +378,23 @@ void Checkbook::accept()
config->write();
QDialog::accept();
}
void Checkbook::slotNameChanged( const QString &newname )
{
name = newname;
- filename = filedir + newname + ".qcb";
- setCaption( name + " - " + tr( "Checkbook" ) );
+ filename = filedir;
+ filename.append( newname );
+ filename.append( ".qcb" );
+ QString tempstr = name;
+ tempstr.append( " - " );
+ tempstr.append( tr( "Checkbook" ) );
+ setCaption( tempstr );
}
void Checkbook::slotStartingBalanceChanged( const QString &newbalance )
{
currBalance -= startBalance;
bool ok;
startBalance = newbalance.toFloat( &ok );
adjustBalance( startBalance );
@@ -409,23 +418,18 @@ void Checkbook::slotNewTran()
}
QString stramount;
stramount.sprintf( "%c%.2f", currencySymbol, amount );
// Add to transaction list
transactions.append( traninfo );
// Add to transaction table
-
- QDate date = traninfo->date();
- QString datestr = QString::number( date.month() ) + "/" +
- QString::number( date.day() ) + "/" +
- QString::number( date.year() );
- ( void ) new QListViewItem( tranTable, QString::number( highTranNum ), datestr,
- traninfo->desc(), stramount );
+ ( void ) new QListViewItem( tranTable, QString::number( highTranNum ),
+ traninfo->datestr(), traninfo->desc(), stramount );
adjustBalance( amount );
}
else
{
highTranNum--;
delete traninfo;
}
@@ -449,21 +453,17 @@ void Checkbook::slotEditTran()
}
Transaction *currtran = new Transaction( this, name,
traninfo,
currencySymbol );
currtran->showMaximized();
if ( currtran->exec() == QDialog::Accepted )
{
- QDate date = traninfo->date();
- QString datestr = QString::number( date.month() ) + "/" +
- QString::number( date.day() ) + "/" +
- QString::number( date.year() );
- curritem->setText( 1, datestr );
+ curritem->setText( 1, traninfo->datestr() );
curritem->setText( 2, traninfo->desc() );
float amount = traninfo->amount();
if ( traninfo->withdrawal() )
{
amount *= -1;
}
@@ -484,17 +484,16 @@ void Checkbook::slotDeleteTran()
QListViewItem *curritem = tranTable->currentItem();
if ( !curritem )
{
return;
}
bool ok;
int tranid = curritem->text( 0 ).toInt( &ok );
- //TranInfo *traninfo = transactions.at( tranid - 1 );
TranInfo *traninfo = findTranByID( tranid );
if ( QPEMessageBox::confirmDelete ( this, tr( "Delete transaction" ), traninfo->desc() ) )
{
float amount = traninfo->amount();
if ( traninfo->withdrawal() )
{
amount *= -1;
diff --git a/noncore/apps/checkbook/checkbook.h b/noncore/apps/checkbook/checkbook.h
index a86c0f9..01f1115 100644
--- a/noncore/apps/checkbook/checkbook.h
+++ b/noncore/apps/checkbook/checkbook.h
@@ -30,16 +30,17 @@
#define CHECKBOOK_H
#include "traninfo.h"
#include <qdialog.h>
class OTabWidget;
+class Graph;
class QComboBox;
class QLabel;
class QLineEdit;
class QListView;
class QMultiLineEdit;
class QString;
class Checkbook : public QDialog
@@ -78,19 +79,19 @@ class Checkbook : public QDialog
// Transactions tab
QWidget *initTransactions();
QListView *tranTable;
QLabel *balanceLabel;
float currBalance;
// Charts tab
- QWidget *initCharts();
+ QWidget *initCharts();
//QComboBox *graphList;
- QWidget *graphWidget;
+ Graph *graphWidget;
protected slots:
void accept();
private slots:
void slotNameChanged( const QString & );
void slotStartingBalanceChanged( const QString & );
void slotNewTran();
diff --git a/noncore/apps/checkbook/checkbook.pro b/noncore/apps/checkbook/checkbook.pro
index 07cc012..bd69939 100644
--- a/noncore/apps/checkbook/checkbook.pro
+++ b/noncore/apps/checkbook/checkbook.pro
@@ -1,32 +1,36 @@
TEMPLATE = app
CONFIG = qt warn_on release
HEADERS = mainwindow.h \
- traninfo.h \
- checkbook.h \
- transaction.h
-SOURCES = main.cpp \
- mainwindow.cpp \
- traninfo.cpp \
- checkbook.cpp \
- transaction.cpp
+ traninfo.h \
+ graphinfo.h \
+ checkbook.h \
+ transaction.h \
+ graph.h
+SOURCES = main.cpp \
+ mainwindow.cpp \
+ traninfo.cpp \
+ graphinfo.cpp \
+ checkbook.cpp \
+ transaction.cpp \
+ graph.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TARGET = checkbook
DESTDIR = $(OPIEDIR)/bin
TRANSLATIONS = ../../../i18n/de/checkbook.ts \
- ../../../i18n/en/checkbook.ts \
- ../../../i18n/es/checkbook.ts \
- ../../../i18n/fr/checkbook.ts \
- ../../../i18n/hu/checkbook.ts \
- ../../../i18n/ja/checkbook.ts \
- ../../../i18n/ko/checkbook.ts \
- ../../../i18n/no/checkbook.ts \
- ../../../i18n/pl/checkbook.ts \
- ../../../i18n/pt/checkbook.ts \
+ ../../../i18n/en/checkbook.ts \
+ ../../../i18n/es/checkbook.ts \
+ ../../../i18n/fr/checkbook.ts \
+ ../../../i18n/hu/checkbook.ts \
+ ../../../i18n/ja/checkbook.ts \
+ ../../../i18n/ko/checkbook.ts \
+ ../../../i18n/no/checkbook.ts \
+ ../../../i18n/pl/checkbook.ts \
+ ../../../i18n/pt/checkbook.ts \
../../../i18n/pt_BR/checkbook.ts \
- ../../../i18n/sl/checkbook.ts \
+ ../../../i18n/sl/checkbook.ts \
../../../i18n/zh_CN/checkbook.ts \
../../../i18n/zh_TW/checkbook.ts \
- ../../../i18n/it/checkbook.ts
+ ../../../i18n/it/checkbook.ts
diff --git a/noncore/apps/checkbook/graph.cpp b/noncore/apps/checkbook/graph.cpp
new file mode 100644
index 0000000..bae92da
--- a/dev/null
+++ b/noncore/apps/checkbook/graph.cpp
@@ -0,0 +1,112 @@
+/*
+                This file is part of the OPIE Project
+ =.
+             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include "graph.h"
+#include "graphinfo.h"
+
+#include <qpainter.h>
+
+Graph::Graph( QWidget *parent, GraphInfo *d, const QString &name, int flags )
+ : QWidget( parent, name, flags )
+{
+ setBackgroundMode( QWidget::PaletteBase );
+
+ data = d;
+
+ graph.setOptimization( QPixmap::BestOptim );
+}
+
+void Graph::setGraphInfo( GraphInfo *d )
+{
+ data = d;
+}
+
+void Graph::drawGraph( bool regen )
+{
+ if ( regen )
+ {
+ initGraph();
+ }
+ QPainter p( this );
+ p.drawPixmap( 0, 0, graph );
+}
+
+void Graph::paintEvent( QPaintEvent * )
+{
+ drawGraph( FALSE );
+}
+
+void Graph::resizeEvent( QResizeEvent * )
+{
+ drawGraph( TRUE );
+}
+
+void Graph::initGraph()
+{
+ graph.resize( width(), height() );
+ graph.fill( QColor( 255, 255, 255 ) );
+
+ if ( !data )
+ {
+ return;
+ }
+
+ // Any common stuff here (titles, ???)
+
+ switch ( data->graphType() )
+ {
+ case GraphInfo::BarChart :
+ {
+ drawBarChart();
+ }
+ break;
+ case GraphInfo::LineChart :
+ {
+ drawLineChart();
+ }
+ break;
+ case GraphInfo::PieChart :
+ {
+ drawPieChart();
+ }
+ };
+}
+
+void Graph::drawBarChart()
+{
+ //Find max value in GraphInfo->dataPoints() - make function in GraphInfo!!!
+}
+
+void Graph::drawLineChart()
+{
+}
+
+void Graph::drawPieChart()
+{
+}
+
diff --git a/noncore/apps/checkbook/graph.h b/noncore/apps/checkbook/graph.h
new file mode 100644
index 0000000..7379be7
--- a/dev/null
+++ b/noncore/apps/checkbook/graph.h
@@ -0,0 +1,63 @@
+/*
+                This file is part of the OPIE Project
+ =.
+             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef GRAPH_H
+#define GRAPH_H
+
+#include <qpixmap.h>
+#include <qwidget.h>
+
+class GraphInfo;
+
+class Graph : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ Graph( QWidget * = 0x0, GraphInfo * = 0x0, const QString & = 0x0, int = 0 );
+
+ void setGraphInfo( GraphInfo * );
+
+ void drawGraph( bool = FALSE );
+
+ protected:
+ void paintEvent( QPaintEvent * );
+ void resizeEvent( QResizeEvent * );
+
+ private:
+ GraphInfo *data;
+
+ QPixmap graph;
+
+ void initGraph();
+ void drawBarChart();
+ void drawLineChart();
+ void drawPieChart();
+};
+
+#endif
diff --git a/noncore/apps/checkbook/graphinfo.cpp b/noncore/apps/checkbook/graphinfo.cpp
new file mode 100644
index 0000000..7b06bdb
--- a/dev/null
+++ b/noncore/apps/checkbook/graphinfo.cpp
@@ -0,0 +1,84 @@
+/*
+                This file is part of the OPIE Project
+ =.
+             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include "graphinfo.h"
+
+GraphInfo::GraphInfo( GraphType type, DataPointList *data, const QString &title,
+ const QString &xtitle, const QString &ytitle )
+{
+ t = type;
+ d = data;
+ gt = title;
+ xt = xtitle;
+ yt = ytitle;
+}
+
+GraphInfo::GraphType GraphInfo::graphType()
+{
+ return t;
+}
+
+void GraphInfo::setGraphType( GraphType type )
+{
+ t = type;
+}
+
+DataPointList *GraphInfo::dataPoints()
+{
+ return d;
+}
+
+void GraphInfo::setDataPoints( DataPointList *data )
+{
+ d = data;
+}
+
+float GraphInfo::maxValue()
+{
+ float max;
+
+}
+
+float GraphInfo::minValue()
+{
+}
+
+void GraphInfo::setGraphTitle( const QString &title )
+{
+ gt = title;
+}
+
+void GraphInfo::setXAxisTitle( const QString &xtitle )
+{
+ xt = xtitle;
+}
+
+void GraphInfo::setYAxisTitle( const QString &ytitle )
+{
+ yt = ytitle;
+}
diff --git a/noncore/apps/checkbook/graphinfo.h b/noncore/apps/checkbook/graphinfo.h
new file mode 100644
index 0000000..4ad1dc9
--- a/dev/null
+++ b/noncore/apps/checkbook/graphinfo.h
@@ -0,0 +1,82 @@
+/*
+                This file is part of the OPIE Project
+ =.
+             .=l. Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef GRAPHINFO_H
+#define GRAPHINFO_H
+
+#include <qlist.h>
+#include <qstringlist.h>
+
+class DataPointInfo
+{
+ public:
+ DataPointInfo()
+ : l( 0x0 ), v( 0.0 ) {}
+ DataPointInfo( const QString &label, float value )
+ : l( label ), v( value ) {}
+
+ const QString &label() { return l; }
+ float value() { return v; }
+
+ private:
+ QString l;
+ float v;
+};
+
+typedef QList<DataPointInfo> DataPointList;
+
+class GraphInfo
+{
+ public:
+ enum GraphType { BarChart, LineChart, PieChart };
+
+ GraphInfo( GraphType = BarChart, DataPointList * = 0x0,
+ const QString & = 0x0, const QString & = 0x0, const QString & = 0x0 );
+
+ GraphInfo::GraphType graphType();
+ void setGraphType( GraphType );
+
+ DataPointList *dataPoints();
+ void setDataPoints( DataPointList * );
+
+ float maxValue();
+ float minValue();
+
+ void setGraphTitle( const QString & );
+ void setXAxisTitle( const QString & );
+ void setYAxisTitle( const QString & );
+
+ private:
+ GraphType t;
+ DataPointList *d;
+ QString gt;
+ QString xt;
+ QString yt;
+};
+
+#endif
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index ead17b4..2eb8396 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -132,32 +132,37 @@ void MainWindow::slotEdit()
if ( currcb->exec() == QDialog::Accepted )
{
QString newname = currcb->getName();
if ( currname != newname )
{
cbList->changeItem( newname, cbList->currentItem() );
cbList->sort();
- QFile f( cbDir + currname + ".qcb" );
+ QString tempstr = cbDir;
+ tempstr.append( currname );
+ tempstr.append( ".qcb" );
+ QFile f( tempstr );
if ( f.exists() )
{
f.remove();
}
}
delete currcb;
}
}
void MainWindow::slotDelete()
{
if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) )
{
- QString name = cbDir + cbList->currentText() + ".qcb";
- QFile f( name );
+ QString tempstr = cbDir;
+ tempstr.append( cbList->currentText() );
+ tempstr.append( ".qcb" );
+ QFile f( tempstr );
if ( f.exists() )
{
f.remove();
}
cbList->removeItem( cbList->currentItem() );
}
}
diff --git a/noncore/apps/checkbook/traninfo.cpp b/noncore/apps/checkbook/traninfo.cpp
index 5a770b0..460466c 100644
--- a/noncore/apps/checkbook/traninfo.cpp
+++ b/noncore/apps/checkbook/traninfo.cpp
@@ -25,16 +25,18 @@
Boston, MA 02111-1307, USA.
*/
#include "traninfo.h"
#include <qpe/config.h>
+QString tempstr;
+
TranInfo::TranInfo( int id, const QString &desc, const QDate &date, bool withdrawal,
const QString &type, const QString &category, float amount,
float fee, const QString &number, const QString &notes )
{
i = id;
d = desc;
td = date;
w = withdrawal;
@@ -112,25 +114,42 @@ TranInfo::TranInfo( Config config, int entry )
// Transaction number
cn = config.readEntry( "CheckNumber", "" );
// Notes
n = config.readEntry( "Comments", "" );
}
}
+const QString &TranInfo::datestr()
+{
+ tempstr = QString::number( td.year() );
+ tempstr.append( '/' );
+ int tempfield = td.month();
+ if ( tempfield < 10 ) tempstr.append( '0' );
+ tempstr.append( QString::number( tempfield ) );
+ tempstr.append( '/' );
+ tempfield = td.day();
+ if ( tempfield < 10 ) tempstr.append( '0' );
+ tempstr.append( QString::number( tempfield ) );
+
+ return( tempstr );
+}
+
void TranInfo::write( Config *config, int entry )
{
config->setGroup( QString::number( entry ) );
config->writeEntry( "Description", d );
- QString tempstr = QString::number( td.month() ) + "/" +
- QString::number( td.day() ) + "/" +
- QString::number( td.year() );
+ tempstr = QString::number( td.month() );
+ tempstr.append( '/' );
+ tempstr.append( QString::number( td.day() ) );
+ tempstr.append( '/' );
+ tempstr.append( QString::number( td.year() ) );
config->writeEntry( "Date", tempstr );
w ? tempstr = "true"
: tempstr = "false";
config->writeEntry( "Payment", tempstr );
if ( t == "Debit Charge" || t == "Written Check" )
tempstr = "0";
diff --git a/noncore/apps/checkbook/traninfo.h b/noncore/apps/checkbook/traninfo.h
index 1743ff7..e944c29 100644
--- a/noncore/apps/checkbook/traninfo.h
+++ b/noncore/apps/checkbook/traninfo.h
@@ -42,16 +42,17 @@ class TranInfo
bool = TRUE, const QString & = 0x0, const QString & = 0x0,
float = 0.0, float = 0.0,
const QString & = 0x0, const QString & = 0x0 );
TranInfo( Config, int );
int id() const { return i; }
const QString &desc() const { return d; }
const QDate &date() const { return td; }
+ const QString &datestr();
bool withdrawal() const { return w; }
const QString &type() const { return t; }
const QString &category() const { return c; }
float amount() const { return a; }
float fee() const { return f; }
const QString &number() const { return cn; }
const QString &notes() const { return n; }
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp
index 82baec9..a921491 100644
--- a/noncore/apps/checkbook/transaction.cpp
+++ b/noncore/apps/checkbook/transaction.cpp
@@ -44,17 +44,19 @@
#include <qscrollview.h>
#include <qstring.h>
#include <qwhatsthis.h>
Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info,
char symbol )
: QDialog( parent, 0, TRUE, WStyle_ContextHelp )
{
- setCaption( tr( "Transaction for " ) + acctname );
+ QString tempstr = tr( "Transaction for " );
+ tempstr.append( acctname );
+ setCaption( tempstr );
tran = info;
currencySymbol = symbol;
QVBoxLayout *vb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
vb->addWidget( sv, 0, 0 );