-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 26 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 59 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 23 |
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 | |||
@@ -40,16 +40,17 @@ | |||
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 | ||
48 | Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) | 49 | Checkbook::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; |
@@ -107,60 +108,74 @@ QWidget *Checkbook::initInfo() | |||
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 | ||
@@ -171,35 +186,40 @@ QWidget *Checkbook::initTransactions() | |||
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 | ||
@@ -220,16 +240,18 @@ QWidget *Checkbook::initCharts() | |||
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 | ||
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 | |||
@@ -38,15 +38,16 @@ | |||
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 | ||
45 | MainWindow::MainWindow() | 46 | MainWindow::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 |
@@ -56,42 +57,40 @@ MainWindow::MainWindow() | |||
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 | { |
@@ -110,13 +109,25 @@ MainWindow::MainWindow() | |||
110 | } | 109 | } |
111 | 110 | ||
112 | MainWindow::~MainWindow() | 111 | MainWindow::~MainWindow() |
113 | { | 112 | { |
114 | } | 113 | } |
115 | 114 | ||
116 | void MainWindow::slotOpen() | 115 | void 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 | |||
127 | void 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 | { |
@@ -133,32 +144,20 @@ void MainWindow::slotOpen() | |||
133 | } | 144 | } |
134 | } | 145 | } |
135 | delete currcb; | 146 | delete currcb; |
136 | } | 147 | } |
137 | } | 148 | } |
138 | 149 | ||
139 | void 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 | |||
151 | void MainWindow::slotDelete() | 150 | void 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 | |||
@@ -49,12 +49,12 @@ class MainWindow : public QMainWindow | |||
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 | |||
@@ -40,18 +40,17 @@ | |||
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 | ||
49 | Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, | 48 | Transaction::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 | ||
@@ -76,74 +75,92 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in | |||
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() ) |