summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/checkbook.cpp
Unidiff
Diffstat (limited to 'noncore/apps/checkbook/checkbook.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 26b2533..1b933f2 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -1,340 +1,340 @@
1/* 1/*
2                This file is part of the OPIE Project 2                This file is part of the OPIE Project
3 =. 3 =.
4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> 4             .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org>
5           .>+-= 5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can 6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under 7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public 8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software 9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License, 10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version. 11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_. 12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that 13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of 15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General 17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details. 18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .: 19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU 20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file; 21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the 22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc., 23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330, 24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA. 25 Boston, MA 02111-1307, USA.
26 26
27*/ 27*/
28 28
29#include "checkbook.h" 29#include "checkbook.h"
30#include "cbinfo.h" 30#include "cbinfo.h"
31#include "transaction.h" 31#include "transaction.h"
32#include "traninfo.h" 32#include "traninfo.h"
33#include "graph.h" 33#include "graph.h"
34#include "graphinfo.h" 34#include "graphinfo.h"
35#include "password.h" 35#include "password.h"
36#include "cfg.h" 36#include "cfg.h"
37 37
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39#include <qpe/qpemessagebox.h> 39#include <qpe/qpemessagebox.h>
40#include <qpe/resource.h> 40#include <qpe/resource.h>
41 41
42#include <qcheckbox.h> 42#include <qcheckbox.h>
43#include <qcombobox.h> 43#include <qcombobox.h>
44#include <qlabel.h> 44#include <qlabel.h>
45#include <qlayout.h> 45#include <qlayout.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qmultilineedit.h> 47#include <qmultilineedit.h>
48#include <qpushbutton.h> 48#include <qpushbutton.h>
49#include <qwhatsthis.h> 49#include <qwhatsthis.h>
50#include <qpopupmenu.h> 50#include <qpopupmenu.h>
51 51
52#define COL_ID 0 52#define COL_ID 0
53#define COL_SORTDATE 1 53#define COL_SORTDATE 1
54#define COL_NUM 2 54#define COL_NUM 2
55#define COL_DATE 3 55#define COL_DATE 3
56#define COL_DESC 4 56#define COL_DESC 4
57#define COL_AMOUNT 5 57#define COL_AMOUNT 5
58#define COL_BAL 6 58#define COL_BAL 6
59 59
60// --- Checkbook -------------------------------------------------------------- 60// --- Checkbook --------------------------------------------------------------
61Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) 61Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg )
62 : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) 62 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
63{ 63{
64 info = i; 64 info = i;
65 _pCfg=cfg; 65 _pCfg=cfg;
66 66
67 // Title bar 67 // Title bar
68 if ( info->name() != "" ) 68 if ( info->name() != "" )
69 { 69 {
70 QString tempstr = info->name(); 70 QString tempstr = info->name();
71 tempstr.append( " - " ); 71 tempstr.append( " - " );
72 tempstr.append( tr( "Checkbook" ) ); 72 tempstr.append( tr( "Checkbook" ) );
73 setCaption( tempstr ); 73 setCaption( tempstr );
74 } 74 }
75 else 75 else
76 { 76 {
77 setCaption( tr( "New checkbook" ) ); 77 setCaption( tr( "New checkbook" ) );
78 } 78 }
79 79
80 80
81 // Setup layout to make everything pretty 81 // Setup layout to make everything pretty
82 QVBoxLayout *layout = new QVBoxLayout( this ); 82 QVBoxLayout *layout = new QVBoxLayout( this );
83 layout->setMargin( 2 ); 83 layout->setMargin( 2 );
84 layout->setSpacing( 4 ); 84 layout->setSpacing( 4 );
85 85
86 // Setup tabs for all info 86 // Setup tabs for all info
87 mainWidget = new OTabWidget( this ); 87 mainWidget = new OTabWidget( this );
88 layout->addWidget( mainWidget ); 88 layout->addWidget( mainWidget );
89 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) ); 89 mainWidget->addTab( initInfo(), "checkbook/infotab", tr( "Info" ) );
90 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) ); 90 mainWidget->addTab( initTransactions(), "checkbook/trantab", tr( "Transactions" ) );
91 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) ); 91 mainWidget->addTab( initCharts(), "checkbook/charttab", tr( "Charts" ) );
92 if( _pCfg->isShowLastTab() ) 92 if( _pCfg->isShowLastTab() )
93 mainWidget->setCurrentTab( info->getLastTab() ); 93 mainWidget->setCurrentTab( info->getLastTab() );
94 else 94 else
95 mainWidget->setCurrentTab( tr( "Info" ) ); 95 mainWidget->setCurrentTab( tr( "Info" ) );
96 connect( mainWidget, SIGNAL( currentChanged(QWidget *) ), this, SLOT( slotTab(QWidget *) ) ); 96 connect( mainWidget, SIGNAL( currentChanged(QWidget*) ), this, SLOT( slotTab(QWidget*) ) );
97 97
98 // Load checkbook information 98 // Load checkbook information
99 loadCheckbook(); 99 loadCheckbook();
100} 100}
101 101
102Checkbook::~Checkbook() 102Checkbook::~Checkbook()
103{ 103{
104} 104}
105 105
106// --- initInfo --------------------------------------------------------------- 106// --- initInfo ---------------------------------------------------------------
107QWidget *Checkbook::initInfo() 107QWidget *Checkbook::initInfo()
108{ 108{
109 QWidget *control = new QWidget( mainWidget, tr("Info") ); 109 QWidget *control = new QWidget( mainWidget, tr("Info") );
110 110
111 QVBoxLayout *vb = new QVBoxLayout( control ); 111 QVBoxLayout *vb = new QVBoxLayout( control );
112 112
113 QScrollView *sv = new QScrollView( control ); 113 QScrollView *sv = new QScrollView( control );
114 vb->addWidget( sv, 0, 0 ); 114 vb->addWidget( sv, 0, 0 );
115 sv->setResizePolicy( QScrollView::AutoOneFit ); 115 sv->setResizePolicy( QScrollView::AutoOneFit );
116 sv->setFrameStyle( QFrame::NoFrame ); 116 sv->setFrameStyle( QFrame::NoFrame );
117 117
118 QWidget *container = new QWidget( sv->viewport() ); 118 QWidget *container = new QWidget( sv->viewport() );
119 sv->addChild( container ); 119 sv->addChild( container );
120 120
121 QGridLayout *layout = new QGridLayout( container ); 121 QGridLayout *layout = new QGridLayout( container );
122 layout->setSpacing( 2 ); 122 layout->setSpacing( 2 );
123 layout->setMargin( 4 ); 123 layout->setMargin( 4 );
124 124
125 // Password protection 125 // Password protection
126 passwordCB = new QCheckBox( tr( "Password protect" ), container ); 126 passwordCB = new QCheckBox( tr( "Password protect" ), container );
127 QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) ); 127 QWhatsThis::add( passwordCB, tr( "Click here to enable/disable password protection of this checkbook." ) );
128 connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) ); 128 connect( passwordCB, SIGNAL( clicked() ), this, SLOT( slotPasswordClicked() ) );
129 layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 ); 129 layout->addMultiCellWidget( passwordCB, 0, 0, 0, 1 );
130 130
131 // Account name 131 // Account name
132 QLabel *label = new QLabel( tr( "Name:" ), container ); 132 QLabel *label = new QLabel( tr( "Name:" ), container );
133 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); 133 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) );
134 layout->addWidget( label, 1, 0 ); 134 layout->addWidget( label, 1, 0 );
135 nameEdit = new QLineEdit( container ); 135 nameEdit = new QLineEdit( container );
136 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); 136 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) );
137 connect( nameEdit, SIGNAL( textChanged( const QString & ) ), 137 connect( nameEdit, SIGNAL( textChanged(const QString&) ),
138 this, SLOT( slotNameChanged( const QString & ) ) ); 138 this, SLOT( slotNameChanged(const QString&) ) );
139 layout->addWidget( nameEdit, 1, 1 ); 139 layout->addWidget( nameEdit, 1, 1 );
140 140
141 // Type of account 141 // Type of account
142 label = new QLabel( tr( "Type:" ), container ); 142 label = new QLabel( tr( "Type:" ), container );
143 QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); 143 QWhatsThis::add( label, tr( "Select type of checkbook here." ) );
144 layout->addWidget( label, 2, 0 ); 144 layout->addWidget( label, 2, 0 );
145 typeList = new QComboBox( container ); 145 typeList = new QComboBox( container );
146 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); 146 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) );
147 typeList->insertStringList( _pCfg->getAccountTypes() ); 147 typeList->insertStringList( _pCfg->getAccountTypes() );
148 layout->addWidget( typeList, 2, 1 ); 148 layout->addWidget( typeList, 2, 1 );
149 149
150 // Bank/institution name 150 // Bank/institution name
151 label = new QLabel( tr( "Bank:" ), container ); 151 label = new QLabel( tr( "Bank:" ), container );
152 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); 152 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) );
153 layout->addWidget( label, 3, 0 ); 153 layout->addWidget( label, 3, 0 );
154 bankEdit = new QLineEdit( container ); 154 bankEdit = new QLineEdit( container );
155 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); 155 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) );
156 layout->addWidget( bankEdit, 3, 1 ); 156 layout->addWidget( bankEdit, 3, 1 );
157 157
158 // Account number 158 // Account number
159 label = new QLabel( tr( "Account number:" ), container ); 159 label = new QLabel( tr( "Account number:" ), container );
160 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); 160 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) );
161 layout->addWidget( label, 4, 0 ); 161 layout->addWidget( label, 4, 0 );
162 acctNumEdit = new QLineEdit( container ); 162 acctNumEdit = new QLineEdit( container );
163 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); 163 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) );
164 layout->addWidget( acctNumEdit, 4, 1 ); 164 layout->addWidget( acctNumEdit, 4, 1 );
165 165
166 // PIN number 166 // PIN number
167 label = new QLabel( tr( "PIN number:" ), container ); 167 label = new QLabel( tr( "PIN number:" ), container );
168 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); 168 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) );
169 layout->addWidget( label, 5, 0 ); 169 layout->addWidget( label, 5, 0 );
170 pinNumEdit = new QLineEdit( container ); 170 pinNumEdit = new QLineEdit( container );
171 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); 171 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) );
172 layout->addWidget( pinNumEdit, 5, 1 ); 172 layout->addWidget( pinNumEdit, 5, 1 );
173 173
174 // Starting balance 174 // Starting balance
175 label = new QLabel( tr( "Starting balance:" ), container ); 175 label = new QLabel( tr( "Starting balance:" ), container );
176 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); 176 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) );
177 layout->addWidget( label, 6, 0 ); 177 layout->addWidget( label, 6, 0 );
178 balanceEdit = new QLineEdit( container ); 178 balanceEdit = new QLineEdit( container );
179 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); 179 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) );
180 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), 180 connect( balanceEdit, SIGNAL( textChanged(const QString&) ),
181 this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); 181 this, SLOT( slotStartingBalanceChanged(const QString&) ) );
182 layout->addWidget( balanceEdit, 6, 1 ); 182 layout->addWidget( balanceEdit, 6, 1 );
183 183
184 // Notes 184 // Notes
185 label = new QLabel( tr( "Notes:" ), container ); 185 label = new QLabel( tr( "Notes:" ), container );
186 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); 186 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) );
187 layout->addWidget( label, 7, 0 ); 187 layout->addWidget( label, 7, 0 );
188 notesEdit = new QMultiLineEdit( container ); 188 notesEdit = new QMultiLineEdit( container );
189 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); 189 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) );
190 notesEdit->setMinimumHeight( 25 ); 190 notesEdit->setMinimumHeight( 25 );
191 notesEdit->setMaximumHeight( 65 ); 191 notesEdit->setMaximumHeight( 65 );
192 layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 ); 192 layout->addMultiCellWidget( notesEdit, 8, 8, 0, 1 );
193 193
194 return control; 194 return control;
195} 195}
196 196
197 197
198// --- initTransactions ------------------------------------------------------- 198// --- initTransactions -------------------------------------------------------
199QWidget *Checkbook::initTransactions() 199QWidget *Checkbook::initTransactions()
200{ 200{
201 QWidget *control = new QWidget( mainWidget, tr("Transactions") ); 201 QWidget *control = new QWidget( mainWidget, tr("Transactions") );
202 202
203 QGridLayout *layout = new QGridLayout( control ); 203 QGridLayout *layout = new QGridLayout( control );
204 layout->setSpacing( 2 ); 204 layout->setSpacing( 2 );
205 layout->setMargin( 4 ); 205 layout->setMargin( 4 );
206 206
207 // Sort selector 207 // Sort selector
208 QLabel *label = new QLabel( tr( "Sort by:" ), control ); 208 QLabel *label = new QLabel( tr( "Sort by:" ), control );
209 QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); 209 QWhatsThis::add( label, tr( "Select checkbook sorting here." ) );
210 layout->addMultiCellWidget( label, 0, 0, 0, 1 ); 210 layout->addMultiCellWidget( label, 0, 0, 0, 1 );
211 _cbSortType=new QComboBox( control ); 211 _cbSortType=new QComboBox( control );
212 _cbSortType->insertItem( tr("Entry Order") ); 212 _cbSortType->insertItem( tr("Entry Order") );
213 _cbSortType->insertItem( tr("Date") ); 213 _cbSortType->insertItem( tr("Date") );
214 _cbSortType->insertItem( tr("Number") ); 214 _cbSortType->insertItem( tr("Number") );
215 layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); 215 layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 );
216 connect( _cbSortType, SIGNAL( activated(const QString &) ), this, SLOT( slotSortChanged( const QString & ) ) ); 216 connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) );
217 217
218 // Table 218 // Table
219 tranTable = new QListView( control ); 219 tranTable = new QListView( control );
220 QFont fnt(QPEApplication::font()); 220 QFont fnt(QPEApplication::font());
221 fnt.setPointSize( fnt.pointSize()-1 ); 221 fnt.setPointSize( fnt.pointSize()-1 );
222 tranTable->setFont( fnt ); 222 tranTable->setFont( fnt );
223 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) ); 223 QWhatsThis::add( tranTable, tr( "This is a listing of all transactions entered for this checkbook.\n\nTo sort entries by a specific field, click on the column name." ) );
224 tranTable->addColumn( tr( "Id" ) ); 224 tranTable->addColumn( tr( "Id" ) );
225 tranTable->setColumnWidthMode( COL_ID, QListView::Manual ); 225 tranTable->setColumnWidthMode( COL_ID, QListView::Manual );
226 tranTable->setColumnWidth( COL_ID, 0); 226 tranTable->setColumnWidth( COL_ID, 0);
227 tranTable->addColumn( tr( "SortDate" ) ); 227 tranTable->addColumn( tr( "SortDate" ) );
228 tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); 228 tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual );
229 tranTable->setColumnWidth( COL_SORTDATE, 0); 229 tranTable->setColumnWidth( COL_SORTDATE, 0);
230 tranTable->addColumn( tr( "Num" ) ); 230 tranTable->addColumn( tr( "Num" ) );
231 tranTable->addColumn( tr( "Date" ) ); 231 tranTable->addColumn( tr( "Date" ) );
232 //tranTable->addColumn( tr( "Cleared" ) ); 232 //tranTable->addColumn( tr( "Cleared" ) );
233 tranTable->addColumn( tr( "Description" ) ); 233 tranTable->addColumn( tr( "Description" ) );
234 int column = tranTable->addColumn( tr( "Amount" ) ); 234 int column = tranTable->addColumn( tr( "Amount" ) );
235 tranTable->setColumnAlignment( column, Qt::AlignRight ); 235 tranTable->setColumnAlignment( column, Qt::AlignRight );
236 column=tranTable->addColumn( tr("Balance") ); 236 column=tranTable->addColumn( tr("Balance") );
237 tranTable->setColumnAlignment( column, Qt::AlignRight ); 237 tranTable->setColumnAlignment( column, Qt::AlignRight );
238 tranTable->setAllColumnsShowFocus( TRUE ); 238 tranTable->setAllColumnsShowFocus( TRUE );
239 tranTable->setSorting( -1 ); 239 tranTable->setSorting( -1 );
240 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); 240 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
241 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); 241 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
242 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 242 connect( tranTable, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
243 this, SLOT( slotMenuTran(QListViewItem *, const QPoint &) ) ); 243 this, SLOT( slotMenuTran(QListViewItem*,const QPoint&) ) );
244 connect( tranTable, SIGNAL( doubleClicked( QListViewItem * ) ), 244 connect( tranTable, SIGNAL( doubleClicked(QListViewItem*) ),
245 this, SLOT( slotEditTran() ) ); 245 this, SLOT( slotEditTran() ) );
246 _sortCol=COL_ID; 246 _sortCol=COL_ID;
247 247
248 // Buttons 248 // Buttons
249 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); 249 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control );
250 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); 250 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
251 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); 251 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) );
252 layout->addWidget( btn, 2, 0 ); 252 layout->addWidget( btn, 2, 0 );
253 253
254 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); 254 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control );
255 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); 255 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
256 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); 256 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) );
257 layout->addWidget( btn, 2, 1 ); 257 layout->addWidget( btn, 2, 1 );
258 258
259 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); 259 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control );
260 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); 260 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
261 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); 261 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) );
262 layout->addWidget( btn, 2, 2 ); 262 layout->addWidget( btn, 2, 2 );
263 263
264 return( control ); 264 return( control );
265} 265}
266 266
267 267
268// --- initCharts ------------------------------------------------------------- 268// --- initCharts -------------------------------------------------------------
269QWidget *Checkbook::initCharts() 269QWidget *Checkbook::initCharts()
270{ 270{
271 graphInfo = 0x0; 271 graphInfo = 0x0;
272 272
273 QWidget *control = new QWidget( mainWidget, tr("Charts") ); 273 QWidget *control = new QWidget( mainWidget, tr("Charts") );
274 274
275 QGridLayout *layout = new QGridLayout( control ); 275 QGridLayout *layout = new QGridLayout( control );
276 layout->setSpacing( 2 ); 276 layout->setSpacing( 2 );
277 layout->setMargin( 4 ); 277 layout->setMargin( 4 );
278 278
279 graphWidget = new Graph( control ); 279 graphWidget = new Graph( control );
280 QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) ); 280 QWhatsThis::add( graphWidget, tr( "Select the desired chart below and then click on the Draw button." ) );
281 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 ); 281 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 2 );
282 282
283 graphList = new QComboBox( control ); 283 graphList = new QComboBox( control );
284 QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) ); 284 QWhatsThis::add( graphList, tr( "Click here to select the desired chart type." ) );
285 graphList->insertItem( tr( "Account balance" ) ); 285 graphList->insertItem( tr( "Account balance" ) );
286 graphList->insertItem( tr( "Withdrawals by category" ) ); 286 graphList->insertItem( tr( "Withdrawals by category" ) );
287 graphList->insertItem( tr( "Deposits by category" ) ); 287 graphList->insertItem( tr( "Deposits by category" ) );
288 288
289 layout->addMultiCellWidget( graphList, 1, 1, 0, 1 ); 289 layout->addMultiCellWidget( graphList, 1, 1, 0, 1 );
290 290
291 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control ); 291 QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/drawbtn" ), tr( "Draw" ), control );
292 QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) ); 292 QWhatsThis::add( btn, tr( "Click here to draw the selected chart." ) );
293 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); 293 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) );
294 layout->addWidget( btn, 1, 2 ); 294 layout->addWidget( btn, 1, 2 );
295 295
296 return control; 296 return control;
297} 297}
298 298
299// --- loadCheckbook ---------------------------------------------------------- 299// --- loadCheckbook ----------------------------------------------------------
300void Checkbook::loadCheckbook() 300void Checkbook::loadCheckbook()
301{ 301{
302 if ( !info ) 302 if ( !info )
303 { 303 {
304 return; 304 return;
305 } 305 }
306 306
307 tranList = info->transactions(); 307 tranList = info->transactions();
308 308
309 passwordCB->setChecked( !info->password().isNull() ); 309 passwordCB->setChecked( !info->password().isNull() );
310 nameEdit->setText( info->name() ); 310 nameEdit->setText( info->name() );
311 QString temptext = info->type(); 311 QString temptext = info->type();
312 int i = typeList->count(); 312 int i = typeList->count();
313 while ( i > 0 ) 313 while ( i > 0 )
314 { 314 {
315 i--; 315 i--;
316 typeList->setCurrentItem( i ); 316 typeList->setCurrentItem( i );
317 if ( typeList->currentText() == temptext ) 317 if ( typeList->currentText() == temptext )
318 { 318 {
319 break; 319 break;
320 } 320 }
321 } 321 }
322 if( i<=0 ) { 322 if( i<=0 ) {
323 typeList->insertItem( temptext, 0 ); 323 typeList->insertItem( temptext, 0 );
324 typeList->setCurrentItem(0); 324 typeList->setCurrentItem(0);
325 } 325 }
326 bankEdit->setText( info->bank() ); 326 bankEdit->setText( info->bank() );
327 acctNumEdit->setText( info->account() ); 327 acctNumEdit->setText( info->account() );
328 pinNumEdit->setText( info->pin() ); 328 pinNumEdit->setText( info->pin() );
329 temptext.setNum( info->startingBalance(), 'f', 2 ); 329 temptext.setNum( info->startingBalance(), 'f', 2 );
330 balanceEdit->setText( temptext ); 330 balanceEdit->setText( temptext );
331 notesEdit->setText( info->notes() ); 331 notesEdit->setText( info->notes() );
332 332
333 // Load transactions 333 // Load transactions
334 float amount; 334 float amount;
335 QString stramount; 335 QString stramount;
336 for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() ) 336 for ( TranInfo *tran = tranList->first(); tran; tran = tranList->next() )
337 { 337 {
338 amount = tran->amount(); 338 amount = tran->amount();
339 if ( tran->withdrawal() ) 339 if ( tran->withdrawal() )
340 { 340 {