summaryrefslogtreecommitdiff
authordrw <drw>2002-10-26 18:23:34 (UTC)
committer drw <drw>2002-10-26 18:23:34 (UTC)
commit3dc25703dbf961f86bc25378113ffafb18ee192e (patch) (unidiff)
tree75436ace2b4c524ea29de5cbd8ac6cbbbcf7ec4e
parentec58c37763a97306543a3f18052d37291b1cdf83 (diff)
downloadopie-3dc25703dbf961f86bc25378113ffafb18ee192e.zip
opie-3dc25703dbf961f86bc25378113ffafb18ee192e.tar.gz
opie-3dc25703dbf961f86bc25378113ffafb18ee192e.tar.bz2
Whats This and a couple fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp26
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp59
-rw-r--r--noncore/apps/checkbook/mainwindow.h2
-rw-r--r--noncore/apps/checkbook/transaction.cpp23
4 files changed, 74 insertions, 36 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp
index 2919927..ee65784 100644
--- a/noncore/apps/checkbook/checkbook.cpp
+++ b/noncore/apps/checkbook/checkbook.cpp
@@ -34,28 +34,29 @@
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/qpemessagebox.h> 35#include <qpe/qpemessagebox.h>
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37 37
38#include <qcombobox.h> 38#include <qcombobox.h>
39#include <qfile.h> 39#include <qfile.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qlineedit.h> 42#include <qlineedit.h>
43#include <qlistview.h> 43#include <qlistview.h>
44#include <qmultilineedit.h> 44#include <qmultilineedit.h>
45#include <qpushbutton.h> 45#include <qpushbutton.h>
46#include <qwhatsthis.h>
46#include <qwidget.h> 47#include <qwidget.h>
47 48
48Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) 49Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol )
49 : QDialog( parent, 0, TRUE, 0 ) 50 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
50{ 51{
51 name = n; 52 name = n;
52 filename = fd + name + ".qcb"; 53 filename = fd + name + ".qcb";
53 filedir = fd; 54 filedir = fd;
54 currencySymbol = symbol; 55 currencySymbol = symbol;
55 currBalance = 0.0; 56 currBalance = 0.0;
56 57
57 if ( name != "" ) 58 if ( name != "" )
58 { 59 {
59 setCaption( name + " - " + tr( "Checkbook" ) ); 60 setCaption( name + " - " + tr( "Checkbook" ) );
60 } 61 }
61 else 62 else
@@ -101,111 +102,130 @@ QWidget *Checkbook::initInfo()
101 sv->setResizePolicy( QScrollView::AutoOneFit ); 102 sv->setResizePolicy( QScrollView::AutoOneFit );
102 sv->setFrameStyle( QFrame::NoFrame ); 103 sv->setFrameStyle( QFrame::NoFrame );
103 104
104 QWidget *container = new QWidget( sv->viewport() ); 105 QWidget *container = new QWidget( sv->viewport() );
105 sv->addChild( container ); 106 sv->addChild( container );
106 107
107 QGridLayout *layout = new QGridLayout( container ); 108 QGridLayout *layout = new QGridLayout( container );
108 layout->setSpacing( 2 ); 109 layout->setSpacing( 2 );
109 layout->setMargin( 4 ); 110 layout->setMargin( 4 );
110 111
111 // Account name 112 // Account name
112 QLabel *label = new QLabel( tr( "Name:" ), container ); 113 QLabel *label = new QLabel( tr( "Name:" ), container );
114 QWhatsThis::add( label, tr( "Enter name of checkbook here." ) );
113 layout->addWidget( label, 0, 0 ); 115 layout->addWidget( label, 0, 0 );
114 nameEdit = new QLineEdit( container ); 116 nameEdit = new QLineEdit( container );
117 QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) );
115 connect( nameEdit, SIGNAL( textChanged( const QString & ) ), 118 connect( nameEdit, SIGNAL( textChanged( const QString & ) ),
116 this, SLOT( slotNameChanged( const QString & ) ) ); 119 this, SLOT( slotNameChanged( const QString & ) ) );
117 layout->addWidget( nameEdit, 0, 1 ); 120 layout->addWidget( nameEdit, 0, 1 );
118 121
119 // Type of account 122 // Type of account
120 label = new QLabel( tr( "Type:" ), container ); 123 label = new QLabel( tr( "Type:" ), container );
124 QWhatsThis::add( label, tr( "Select type of checkbook here." ) );
121 layout->addWidget( label, 1, 0 ); 125 layout->addWidget( label, 1, 0 );
122 typeList = new QComboBox( container ); 126 typeList = new QComboBox( container );
127 QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) );
123 typeList->insertItem( tr( "Savings" ) ); // 0 128 typeList->insertItem( tr( "Savings" ) ); // 0
124 typeList->insertItem( tr( "Checking" ) ); // 1 129 typeList->insertItem( tr( "Checking" ) ); // 1
125 typeList->insertItem( tr( "CD" ) ); // 2 130 typeList->insertItem( tr( "CD" ) ); // 2
126 typeList->insertItem( tr( "Money market" ) );// 3 131 typeList->insertItem( tr( "Money market" ) );// 3
127 typeList->insertItem( tr( "Mutual fund" ) );// 4 132 typeList->insertItem( tr( "Mutual fund" ) );// 4
128 typeList->insertItem( tr( "Other" ) ); // 5 133 typeList->insertItem( tr( "Other" ) ); // 5
129 layout->addWidget( typeList, 1, 1 ); 134 layout->addWidget( typeList, 1, 1 );
130 135
131 // Bank/institution name 136 // Bank/institution name
132 label = new QLabel( tr( "Bank:" ), container ); 137 label = new QLabel( tr( "Bank:" ), container );
138 QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) );
133 layout->addWidget( label, 2, 0 ); 139 layout->addWidget( label, 2, 0 );
134 bankEdit = new QLineEdit( container ); 140 bankEdit = new QLineEdit( container );
141 QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) );
135 layout->addWidget( bankEdit, 2, 1 ); 142 layout->addWidget( bankEdit, 2, 1 );
136 143
137 // Account number 144 // Account number
138 label = new QLabel( tr( "Account number:" ), container ); 145 label = new QLabel( tr( "Account number:" ), container );
146 QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) );
139 layout->addWidget( label, 3, 0 ); 147 layout->addWidget( label, 3, 0 );
140 acctNumEdit = new QLineEdit( container ); 148 acctNumEdit = new QLineEdit( container );
149 QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) );
141 layout->addWidget( acctNumEdit, 3, 1 ); 150 layout->addWidget( acctNumEdit, 3, 1 );
142 151
143 // PIN number 152 // PIN number
144 label = new QLabel( tr( "PIN number:" ), container ); 153 label = new QLabel( tr( "PIN number:" ), container );
154 QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) );
145 layout->addWidget( label, 4, 0 ); 155 layout->addWidget( label, 4, 0 );
146 pinNumEdit = new QLineEdit( container ); 156 pinNumEdit = new QLineEdit( container );
157 QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) );
147 layout->addWidget( pinNumEdit, 4, 1 ); 158 layout->addWidget( pinNumEdit, 4, 1 );
148 159
149 // Starting balance 160 // Starting balance
150 label = new QLabel( tr( "Starting balance:" ), container ); 161 label = new QLabel( tr( "Starting balance:" ), container );
162 QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) );
151 layout->addWidget( label, 5, 0 ); 163 layout->addWidget( label, 5, 0 );
152 balanceEdit = new QLineEdit( container ); 164 balanceEdit = new QLineEdit( container );
165 QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) );
153 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), 166 connect( balanceEdit, SIGNAL( textChanged( const QString & ) ),
154 this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); 167 this, SLOT( slotStartingBalanceChanged( const QString & ) ) );
155 layout->addWidget( balanceEdit, 5, 1 ); 168 layout->addWidget( balanceEdit, 5, 1 );
156 169
157 // Notes 170 // Notes
158 label = new QLabel( tr( "Notes:" ), container ); 171 label = new QLabel( tr( "Notes:" ), container );
172 QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) );
159 layout->addWidget( label, 6, 0 ); 173 layout->addWidget( label, 6, 0 );
160 notesEdit = new QMultiLineEdit( container ); 174 notesEdit = new QMultiLineEdit( container );
175 QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) );
161 notesEdit->setMaximumHeight( 85 ); 176 notesEdit->setMaximumHeight( 85 );
162 layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 ); 177 layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 );
163 178
164 return control; 179 return control;
165} 180}
166 181
167QWidget *Checkbook::initTransactions() 182QWidget *Checkbook::initTransactions()
168{ 183{
169 QWidget *control = new QWidget( mainWidget ); 184 QWidget *control = new QWidget( mainWidget );
170 185
171 QGridLayout *layout = new QGridLayout( control ); 186 QGridLayout *layout = new QGridLayout( control );
172 layout->setSpacing( 2 ); 187 layout->setSpacing( 2 );
173 layout->setMargin( 4 ); 188 layout->setMargin( 4 );
174 189
175 balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), 190 balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ),
176 control ); 191 control );
192 QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) );
177 layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); 193 layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 );
178 194
179 tranTable = new QListView( control ); 195 tranTable = new QListView( control );
196 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." ) );
180 tranTable->addColumn( tr( "ID" ) ); 197 tranTable->addColumn( tr( "ID" ) );
181 tranTable->addColumn( tr( "Date" ) ); 198 tranTable->addColumn( tr( "Date" ) );
182 tranTable->addColumn( tr( "Description" ) ); 199 tranTable->addColumn( tr( "Description" ) );
183 int colnum = tranTable->addColumn( tr( "Amount" ) ); 200 int colnum = tranTable->addColumn( tr( "Amount" ) );
184 tranTable->setColumnAlignment( colnum, Qt::AlignRight ); 201 tranTable->setColumnAlignment( colnum, Qt::AlignRight );
185 tranTable->setAllColumnsShowFocus( TRUE ); 202 tranTable->setAllColumnsShowFocus( TRUE );
186 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 ); 203 layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
187 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold ); 204 QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
188 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 205 connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
189 this, SLOT( slotEditTran() ) ); 206 this, SLOT( slotEditTran() ) );
190 207
191 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); 208 QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control );
209 QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) );
192 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); 210 connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) );
193 layout->addWidget( btn, 2, 0 ); 211 layout->addWidget( btn, 2, 0 );
194 212
195 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); 213 btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control );
214 QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) );
196 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); 215 connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) );
197 layout->addWidget( btn, 2, 1 ); 216 layout->addWidget( btn, 2, 1 );
198 217
199 btn = new QPushButton( Resource::loadPixmap( "editdelete" ), tr( "Delete" ), control ); 218 btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control );
219 QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) );
200 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); 220 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) );
201 layout->addWidget( btn, 2, 2 ); 221 layout->addWidget( btn, 2, 2 );
202 222
203 return( control ); 223 return( control );
204} 224}
205 225
206QWidget *Checkbook::initCharts() 226QWidget *Checkbook::initCharts()
207{ 227{
208 QWidget *control = new QWidget( mainWidget ); 228 QWidget *control = new QWidget( mainWidget );
209 229
210 QGridLayout *layout = new QGridLayout( control ); 230 QGridLayout *layout = new QGridLayout( control );
211 layout->setSpacing( 2 ); 231 layout->setSpacing( 2 );
@@ -214,28 +234,30 @@ QWidget *Checkbook::initCharts()
214/* 234/*
215 QLabel *label = new QLabel( control ); 235 QLabel *label = new QLabel( control );
216 label->setText( tr( "Graph type:" ) ); 236 label->setText( tr( "Graph type:" ) );
217 layout->addWidget( label, 0, 0 ); 237 layout->addWidget( label, 0, 0 );
218 graphList = new QComboBox( control ); 238 graphList = new QComboBox( control );
219 graphList->insertItem( tr( "By category" ) ); 239 graphList->insertItem( tr( "By category" ) );
220 graphList->insertItem( tr( "..." ) ); 240 graphList->insertItem( tr( "..." ) );
221 graphList->insertItem( tr( "..." ) ); 241 graphList->insertItem( tr( "..." ) );
222 layout->addWidget( graphList, 0, 1 ); 242 layout->addWidget( graphList, 0, 1 );
223*/ 243*/
224 244
225 QWidget *graphWidget = new QWidget( control ); 245 QWidget *graphWidget = new QWidget( control );
246 QWhatsThis::add( graphWidget, tr( "Graph not implemented yet." ) );
226 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 ); 247 layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 );
227 graphWidget->setBackgroundMode( QWidget::PaletteBase ); 248 graphWidget->setBackgroundMode( QWidget::PaletteBase );
228 249
229 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Draw" ), control ); 250 QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Draw" ), control );
251 QWhatsThis::add( btn, tr( "Click here to draw the graph." ) );
230 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); 252 connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) );
231 layout->addWidget( btn, 1, 1 ); 253 layout->addWidget( btn, 1, 1 );
232 254
233 return control; 255 return control;
234} 256}
235 257
236void Checkbook::loadCheckbook() 258void Checkbook::loadCheckbook()
237{ 259{
238 transactions.clear(); 260 transactions.clear();
239 261
240 Config config(filename, Config::File); 262 Config config(filename, Config::File);
241 263
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp
index 9410536..ead17b4 100644
--- a/noncore/apps/checkbook/mainwindow.cpp
+++ b/noncore/apps/checkbook/mainwindow.cpp
@@ -32,133 +32,132 @@
32#include <qpe/global.h> 32#include <qpe/global.h>
33#include <qpe/qpeapplication.h> 33#include <qpe/qpeapplication.h>
34#include <qpe/qpemenubar.h> 34#include <qpe/qpemenubar.h>
35#include <qpe/qpemessagebox.h> 35#include <qpe/qpemessagebox.h>
36#include <qpe/qpetoolbar.h> 36#include <qpe/qpetoolbar.h>
37#include <qpe/resource.h> 37#include <qpe/resource.h>
38 38
39#include <qaction.h> 39#include <qaction.h>
40#include <qdir.h> 40#include <qdir.h>
41#include <qlistbox.h> 41#include <qlistbox.h>
42#include <qpopupmenu.h> 42#include <qpopupmenu.h>
43#include <qstring.h> 43#include <qstring.h>
44#include <qwhatsthis.h>
44 45
45MainWindow::MainWindow() 46MainWindow::MainWindow()
46 : QMainWindow() 47 : QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
47{ 48{
48 setCaption( tr( "Checkbook" ) ); 49 setCaption( tr( "Checkbook" ) );
49 50
50 cbDir = Global::applicationFileName( "checkbook", "" ); 51 cbDir = Global::applicationFileName( "checkbook", "" );
51 52
52 // Build menu and tool bars 53 // Build menu and tool bars
53 setToolBarsMovable( FALSE ); 54 setToolBarsMovable( FALSE );
54 55
55 QPEToolBar *bar = new QPEToolBar( this ); 56 QPEToolBar *bar = new QPEToolBar( this );
56 bar->setHorizontalStretchable( TRUE ); 57 bar->setHorizontalStretchable( TRUE );
57 QPEMenuBar *mb = new QPEMenuBar( bar ); 58 QPEMenuBar *mb = new QPEMenuBar( bar );
58 mb->setMargin( 0 ); 59 mb->setMargin( 0 );
59 QPopupMenu *popup = new QPopupMenu( this ); 60 QPopupMenu *popup = new QPopupMenu( this );
60 61
61 bar = new QPEToolBar( this ); 62 bar = new QPEToolBar( this );
62 actionOpen = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null,
63 0, this, 0 );
64 connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotOpen() ) );
65 actionOpen->addTo( popup );
66 actionOpen->addTo( bar );
67
68 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); 63 QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 );
64 a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) );
69 connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); 65 connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) );
70 a->addTo( popup ); 66 a->addTo( popup );
71 a->addTo( bar ); 67 a->addTo( bar );
72 68
73 actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "editdelete" ), QString::null, 69 actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null,
70 0, this, 0 );
71 actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) );
72 connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) );
73 actionOpen->addTo( popup );
74 actionOpen->addTo( bar );
75
76 actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null,
74 0, this, 0 ); 77 0, this, 0 );
78 actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) );
75 connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); 79 connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) );
76 actionDelete->addTo( popup ); 80 actionDelete->addTo( popup );
77 actionDelete->addTo( bar ); 81 actionDelete->addTo( bar );
78 82
79 popup->insertSeparator();
80
81 a = new QAction( tr( "Exit" ), QString::null, 0, this, 0 );
82 connect( a, SIGNAL( activated() ), this, SLOT( close() ) );
83 a->addTo( popup );
84
85 mb->insertItem( tr( "Checkbook" ), popup ); 83 mb->insertItem( tr( "Checkbook" ), popup );
86 84
87 // Build Checkbook selection list control 85 // Build Checkbook selection list control
88 cbList = new QListBox( this ); 86 cbList = new QListBox( this );
87 QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) );
89 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); 88 QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold );
90 connect( cbList, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint & ) ), 89 connect( cbList, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint & ) ),
91 this, SLOT( slotOpen() ) ); 90 this, SLOT( slotEdit() ) );
92 setCentralWidget( cbList ); 91 setCentralWidget( cbList );
93 92
94 // Load Checkbook selection list 93 // Load Checkbook selection list
95 QDir checkdir( cbDir ); 94 QDir checkdir( cbDir );
96 if (checkdir.exists() == true) 95 if (checkdir.exists() == true)
97 { 96 {
98 QStringList checkbooks = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, 97 QStringList checkbooks = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable,
99 QDir::Time ); 98 QDir::Time );
100 for ( QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++ ) 99 for ( QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++ )
101 { 100 {
102 (*it) = (*it).remove( (*it).find('.'), (*it).length() ); 101 (*it) = (*it).remove( (*it).find('.'), (*it).length() );
103 } 102 }
104 cbList->insertStringList( checkbooks ); 103 cbList->insertStringList( checkbooks );
105 } 104 }
106 cbList->sort(); 105 cbList->sort();
107 cbList->setSelected( 0, TRUE ); 106 cbList->setSelected( 0, TRUE );
108 107
109 currencySymbol = '$'; 108 currencySymbol = '$';
110} 109}
111 110
112MainWindow::~MainWindow() 111MainWindow::~MainWindow()
113{ 112{
114} 113}
115 114
116void MainWindow::slotOpen() 115void MainWindow::slotNew()
116{
117 Checkbook *currcb = new Checkbook( this, "", cbDir, currencySymbol );
118 currcb->showMaximized();
119 if ( currcb->exec() == QDialog::Accepted )
120 {
121 cbList->insertItem( currcb->getName() );
122 cbList->sort();
123 delete currcb;
124 }
125}
126
127void MainWindow::slotEdit()
117{ 128{
118 QString currname = cbList->currentText(); 129 QString currname = cbList->currentText();
119 Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol ); 130 Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol );
120 currcb->showMaximized(); 131 currcb->showMaximized();
121 if ( currcb->exec() == QDialog::Accepted ) 132 if ( currcb->exec() == QDialog::Accepted )
122 { 133 {
123 QString newname = currcb->getName(); 134 QString newname = currcb->getName();
124 if ( currname != newname ) 135 if ( currname != newname )
125 { 136 {
126 cbList->changeItem( newname, cbList->currentItem() ); 137 cbList->changeItem( newname, cbList->currentItem() );
127 cbList->sort(); 138 cbList->sort();
128 139
129 QFile f( cbDir + currname + ".qcb" ); 140 QFile f( cbDir + currname + ".qcb" );
130 if ( f.exists() ) 141 if ( f.exists() )
131 { 142 {
132 f.remove(); 143 f.remove();
133 } 144 }
134 } 145 }
135 delete currcb; 146 delete currcb;
136 } 147 }
137} 148}
138 149
139void MainWindow::slotNew()
140{
141 Checkbook *currcb = new Checkbook( this, "", cbDir, currencySymbol );
142 currcb->showMaximized();
143 if ( currcb->exec() == QDialog::Accepted )
144 {
145 cbList->insertItem( currcb->getName() );
146 cbList->sort();
147 delete currcb;
148 }
149}
150
151void MainWindow::slotDelete() 150void MainWindow::slotDelete()
152{ 151{
153 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) ) 152 if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) )
154 { 153 {
155 cbList->removeItem( cbList->currentItem() );
156
157 QString name = cbDir + cbList->currentText() + ".qcb"; 154 QString name = cbDir + cbList->currentText() + ".qcb";
158 QFile f( name ); 155 QFile f( name );
159 if ( f.exists() ) 156 if ( f.exists() )
160 { 157 {
161 f.remove(); 158 f.remove();
162 } 159 }
160
161 cbList->removeItem( cbList->currentItem() );
163 } 162 }
164} 163}
diff --git a/noncore/apps/checkbook/mainwindow.h b/noncore/apps/checkbook/mainwindow.h
index 54fbba6..2c5d93b 100644
--- a/noncore/apps/checkbook/mainwindow.h
+++ b/noncore/apps/checkbook/mainwindow.h
@@ -43,18 +43,18 @@ class MainWindow : public QMainWindow
43 public: 43 public:
44 MainWindow(); 44 MainWindow();
45 ~MainWindow(); 45 ~MainWindow();
46 46
47 private: 47 private:
48 QListBox *cbList; 48 QListBox *cbList;
49 QString cbDir; 49 QString cbDir;
50 QAction *actionOpen; 50 QAction *actionOpen;
51 QAction *actionDelete; 51 QAction *actionDelete;
52 char currencySymbol; 52 char currencySymbol;
53 53
54 private slots: 54 private slots:
55 void slotOpen();
56 void slotNew(); 55 void slotNew();
56 void slotEdit();
57 void slotDelete(); 57 void slotDelete();
58}; 58};
59 59
60#endif 60#endif
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp
index 7d1781b..82baec9 100644
--- a/noncore/apps/checkbook/transaction.cpp
+++ b/noncore/apps/checkbook/transaction.cpp
@@ -34,30 +34,29 @@
34 34
35#include <qbuttongroup.h> 35#include <qbuttongroup.h>
36#include <qcombobox.h> 36#include <qcombobox.h>
37#include <qlabel.h> 37#include <qlabel.h>
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qlineedit.h> 39#include <qlineedit.h>
40#include <qmultilineedit.h> 40#include <qmultilineedit.h>
41#include <qpopupmenu.h> 41#include <qpopupmenu.h>
42#include <qpushbutton.h> 42#include <qpushbutton.h>
43#include <qradiobutton.h> 43#include <qradiobutton.h>
44#include <qscrollview.h> 44#include <qscrollview.h>
45#include <qstring.h> 45#include <qstring.h>
46 46#include <qwhatsthis.h>
47#include <stdio.h>
48 47
49Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, 48Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info,
50 char symbol ) 49 char symbol )
51 : QDialog( parent, 0, TRUE, 0 ) 50 : QDialog( parent, 0, TRUE, WStyle_ContextHelp )
52{ 51{
53 setCaption( tr( "Transaction for " ) + acctname ); 52 setCaption( tr( "Transaction for " ) + acctname );
54 53
55 tran = info; 54 tran = info;
56 currencySymbol = symbol; 55 currencySymbol = symbol;
57 56
58 QVBoxLayout *vb = new QVBoxLayout( this ); 57 QVBoxLayout *vb = new QVBoxLayout( this );
59 58
60 QScrollView *sv = new QScrollView( this ); 59 QScrollView *sv = new QScrollView( this );
61 vb->addWidget( sv, 0, 0 ); 60 vb->addWidget( sv, 0, 0 );
62 sv->setResizePolicy( QScrollView::AutoOneFit ); 61 sv->setResizePolicy( QScrollView::AutoOneFit );
63 sv->setFrameStyle( QFrame::NoFrame ); 62 sv->setFrameStyle( QFrame::NoFrame );
@@ -70,86 +69,104 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in
70 layout->setMargin( 4 ); 69 layout->setMargin( 4 );
71 70
72 // Withdrawal/Deposit 71 // Withdrawal/Deposit
73 QButtonGroup *btngrp = new QButtonGroup( container ); 72 QButtonGroup *btngrp = new QButtonGroup( container );
74 btngrp->setColumnLayout(0, Qt::Vertical ); 73 btngrp->setColumnLayout(0, Qt::Vertical );
75 btngrp->layout()->setSpacing( 0 ); 74 btngrp->layout()->setSpacing( 0 );
76 btngrp->layout()->setMargin( 0 ); 75 btngrp->layout()->setMargin( 0 );
77 btngrp->setMaximumWidth( 220 ); 76 btngrp->setMaximumWidth( 220 );
78 QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); 77 QGridLayout *layout2 = new QGridLayout( btngrp->layout() );
79 layout2->setSpacing( 2 ); 78 layout2->setSpacing( 2 );
80 layout2->setMargin( 2 ); 79 layout2->setMargin( 2 );
81 withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp ); 80 withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp );
81 QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) );
82 layout2->addWidget( withBtn, 0, 0 ); 82 layout2->addWidget( withBtn, 0, 0 );
83 connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) ); 83 connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) );
84 depBtn = new QRadioButton( tr( "Deposit" ), btngrp ); 84 depBtn = new QRadioButton( tr( "Deposit" ), btngrp );
85 QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) );
85 layout2->addWidget( depBtn, 0, 1 ); 86 layout2->addWidget( depBtn, 0, 1 );
86 btngrp->setMaximumSize( 320, withBtn->height() ); 87 btngrp->setMaximumSize( 320, withBtn->height() );
87 connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); 88 connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) );
88 layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); 89 layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 );
89 90
90 // Date 91 // Date
91 QLabel *label = new QLabel( tr( "Date:" ), container ); 92 QLabel *label = new QLabel( tr( "Date:" ), container );
93 QWhatsThis::add( label, tr( "Select date of transaction here." ) );
92 layout->addWidget( label, 1, 0 ); 94 layout->addWidget( label, 1, 0 );
93 dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), 95 dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ),
94 container ); 96 container );
97 QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) );
95 QPopupMenu *m1 = new QPopupMenu( container ); 98 QPopupMenu *m1 = new QPopupMenu( container );
96 datePicker = new DateBookMonth( m1, 0, TRUE ); 99 datePicker = new DateBookMonth( m1, 0, TRUE );
97 m1->insertItem( datePicker ); 100 m1->insertItem( datePicker );
98 dateBtn->setPopup( m1 ); 101 dateBtn->setPopup( m1 );
99 connect( datePicker, SIGNAL( dateClicked( int, int, int ) ), 102 connect( datePicker, SIGNAL( dateClicked( int, int, int ) ),
100 this, SLOT( slotDateChanged( int, int, int ) ) ); 103 this, SLOT( slotDateChanged( int, int, int ) ) );
101 layout->addWidget( dateBtn, 1, 1 ); 104 layout->addWidget( dateBtn, 1, 1 );
102 105
103 // Check number 106 // Check number
104 label = new QLabel( tr( "Number:" ), container ); 107 label = new QLabel( tr( "Number:" ), container );
108 QWhatsThis::add( label, tr( "Enter check number here." ) );
105 layout->addWidget( label, 1, 2 ); 109 layout->addWidget( label, 1, 2 );
106 numEdit = new QLineEdit( container ); 110 numEdit = new QLineEdit( container );
111 QWhatsThis::add( numEdit, tr( "Enter check number here." ) );
107 numEdit->setMaximumWidth( 40 ); 112 numEdit->setMaximumWidth( 40 );
108 layout->addWidget( numEdit, 1, 3 ); 113 layout->addWidget( numEdit, 1, 3 );
109 114
110 // Description 115 // Description
111 label = new QLabel( tr( "Description:" ), container ); 116 label = new QLabel( tr( "Description:" ), container );
117 QWhatsThis::add( label, tr( "Enter description of transaction here." ) );
112 layout->addWidget( label, 2, 0 ); 118 layout->addWidget( label, 2, 0 );
113 descEdit = new QLineEdit( container ); 119 descEdit = new QLineEdit( container );
120 QWhatsThis::add( descEdit, tr( "Enter description of transaction here." ) );
114 layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 ); 121 layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 );
115 122
116 // Category 123 // Category
117 label = new QLabel( tr( "Category:" ), container ); 124 label = new QLabel( tr( "Category:" ), container );
125 QWhatsThis::add( label, tr( "Select transaction category here." ) );
118 layout->addWidget( label, 3, 0 ); 126 layout->addWidget( label, 3, 0 );
119 catList = new QComboBox( container ); 127 catList = new QComboBox( container );
128 QWhatsThis::add( catList, tr( "Select transaction category here." ) );
120 layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); 129 layout->addMultiCellWidget( catList, 3, 3, 1, 3 );
121 130
122 // Type 131 // Type
123 label = new QLabel( tr( "Type:" ), container ); 132 label = new QLabel( tr( "Type:" ), container );
133 QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) );
124 layout->addWidget( label, 4, 0 ); 134 layout->addWidget( label, 4, 0 );
125 typeList = new QComboBox( container ); 135 typeList = new QComboBox( container );
136 QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) );
126 layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); 137 layout->addMultiCellWidget( typeList, 4, 4, 1, 3 );
127 138
128 // Amount 139 // Amount
129 label = new QLabel( tr( "Amount:" ), container ); 140 label = new QLabel( tr( "Amount:" ), container );
141 QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) );
130 layout->addWidget( label, 5, 0 ); 142 layout->addWidget( label, 5, 0 );
131 amtEdit = new QLineEdit( container ); 143 amtEdit = new QLineEdit( container );
144 QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) );
132 layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); 145 layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 );
133 146
134 // Fee 147 // Fee
135 label = new QLabel( tr( "Fee:" ), container ); 148 label = new QLabel( tr( "Fee:" ), container );
149 QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) );
136 layout->addWidget( label, 6, 0 ); 150 layout->addWidget( label, 6, 0 );
137 feeEdit = new QLineEdit( container ); 151 feeEdit = new QLineEdit( container );
152 QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) );
138 layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); 153 layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 );
139 154
140 // Notes 155 // Notes
141 label = new QLabel( tr( "Notes:" ), container ); 156 label = new QLabel( tr( "Notes:" ), container );
157 QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) );
142 layout->addWidget( label, 7, 0 ); 158 layout->addWidget( label, 7, 0 );
143 noteEdit = new QMultiLineEdit( container ); 159 noteEdit = new QMultiLineEdit( container );
160 QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) );
144 layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); 161 layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 );
145 162
146 // Populate current values if provided 163 // Populate current values if provided
147 if ( info ) 164 if ( info )
148 { 165 {
149 if ( info->withdrawal() ) 166 if ( info->withdrawal() )
150 { 167 {
151 withBtn->setChecked( TRUE ); 168 withBtn->setChecked( TRUE );
152 slotWithdrawalClicked(); 169 slotWithdrawalClicked();
153 } 170 }
154 else 171 else
155 { 172 {