-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 18 | ||||
-rw-r--r-- | noncore/apps/checkbook/listedit.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/password.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 14 |
5 files changed, 21 insertions, 21 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 -------------------------------------------------------------- |
61 | Checkbook::Checkbook( QWidget *parent, CBInfo *i, Cfg *cfg ) | 61 | Checkbook::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 | ||
102 | Checkbook::~Checkbook() | 102 | Checkbook::~Checkbook() |
103 | { | 103 | { |
104 | } | 104 | } |
105 | 105 | ||
106 | // --- initInfo --------------------------------------------------------------- | 106 | // --- initInfo --------------------------------------------------------------- |
107 | QWidget *Checkbook::initInfo() | 107 | QWidget *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 ------------------------------------------------------- |
199 | QWidget *Checkbook::initTransactions() | 199 | QWidget *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 ------------------------------------------------------------- |
269 | QWidget *Checkbook::initCharts() | 269 | QWidget *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 ---------------------------------------------------------- |
300 | void Checkbook::loadCheckbook() | 300 | void 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 | { |
diff --git a/noncore/apps/checkbook/listedit.cpp b/noncore/apps/checkbook/listedit.cpp index 37f05f0..d00e305 100644 --- a/noncore/apps/checkbook/listedit.cpp +++ b/noncore/apps/checkbook/listedit.cpp | |||
@@ -1,168 +1,168 @@ | |||
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 "listedit.h" | 29 | #include "listedit.h" |
30 | #include <qlayout.h> | 30 | #include <qlayout.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qlistview.h> | 32 | #include <qlistview.h> |
33 | #include <qwidgetstack.h> | 33 | #include <qwidgetstack.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qpushbutton.h> | 35 | #include <qpushbutton.h> |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | 37 | ||
38 | 38 | ||
39 | // --- ListEdit --------------------------------------------------------------- | 39 | // --- ListEdit --------------------------------------------------------------- |
40 | ListEdit::ListEdit( QWidget *parent, const char *sName ) | 40 | ListEdit::ListEdit( QWidget *parent, const char *sName ) |
41 | : QWidget(parent, sName), TableDef(sName) | 41 | : QWidget(parent, sName), TableDef(sName) |
42 | { | 42 | { |
43 | // get font height | 43 | // get font height |
44 | int fh = fontMetrics().height(); | 44 | int fh = fontMetrics().height(); |
45 | 45 | ||
46 | // create layout | 46 | // create layout |
47 | QGridLayout *layout=new QGridLayout(this); | 47 | QGridLayout *layout=new QGridLayout(this); |
48 | layout->setSpacing( 2 ); | 48 | layout->setSpacing( 2 ); |
49 | layout->setMargin( 4 ); | 49 | layout->setMargin( 4 ); |
50 | 50 | ||
51 | // type table | 51 | // type table |
52 | _typeTable = new QListView( this ); | 52 | _typeTable = new QListView( this ); |
53 | ColumnDef *def=first(); | 53 | ColumnDef *def=first(); |
54 | while( def ) { | 54 | while( def ) { |
55 | _typeTable->addColumn( def->getName() ); | 55 | _typeTable->addColumn( def->getName() ); |
56 | def=next(); | 56 | def=next(); |
57 | } | 57 | } |
58 | connect( _typeTable, SIGNAL( clicked(QListViewItem *, const QPoint &, int) ), this, SLOT( slotClick(QListViewItem *, const QPoint &, int ) ) ); | 58 | connect( _typeTable, SIGNAL( clicked(QListViewItem*,const QPoint&,int) ), this, SLOT( slotClick(QListViewItem*,const QPoint&,int) ) ); |
59 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); | 59 | layout->addMultiCellWidget(_typeTable, 0,4,0,4); |
60 | _currentItem=NULL; | 60 | _currentItem=NULL; |
61 | 61 | ||
62 | // edit field | 62 | // edit field |
63 | _stack=new QWidgetStack( this ); | 63 | _stack=new QWidgetStack( this ); |
64 | _stack->setMaximumHeight(fh+5); | 64 | _stack->setMaximumHeight(fh+5); |
65 | layout->addMultiCellWidget(_stack, 5,5,0,2); | 65 | layout->addMultiCellWidget(_stack, 5,5,0,2); |
66 | _typeEdit = new QLineEdit( _stack ); | 66 | _typeEdit = new QLineEdit( _stack ); |
67 | _stack->raiseWidget(_typeEdit ); | 67 | _stack->raiseWidget(_typeEdit ); |
68 | connect( _typeEdit, SIGNAL( textChanged(const QString &) ), this, SLOT( slotEditChanged(const QString &) ) ); | 68 | connect( _typeEdit, SIGNAL( textChanged(const QString&) ), this, SLOT( slotEditChanged(const QString&) ) ); |
69 | 69 | ||
70 | // combo box | 70 | // combo box |
71 | _box=new QComboBox( _stack ); | 71 | _box=new QComboBox( _stack ); |
72 | connect( _box, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); | 72 | connect( _box, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); |
73 | 73 | ||
74 | 74 | ||
75 | // add button | 75 | // add button |
76 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); | 76 | QPushButton *btn = new QPushButton( Resource::loadPixmap( "checkbook/add" ), tr( "Add" ), this ); |
77 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); | 77 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotAdd() ) ); |
78 | layout->addWidget( btn, 5, 3 ); | 78 | layout->addWidget( btn, 5, 3 ); |
79 | 79 | ||
80 | // delete button | 80 | // delete button |
81 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); | 81 | btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), this ); |
82 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); | 82 | connect( btn, SIGNAL( clicked() ), this, SLOT( slotDel() ) ); |
83 | layout->addWidget( btn, 5, 4 ); | 83 | layout->addWidget( btn, 5, 4 ); |
84 | } | 84 | } |
85 | 85 | ||
86 | // --- ~ListEdit -------------------------------------------------------------- | 86 | // --- ~ListEdit -------------------------------------------------------------- |
87 | ListEdit::~ListEdit() | 87 | ListEdit::~ListEdit() |
88 | { | 88 | { |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | // --- slotEditTypeChanged ---------------------------------------------------- | 92 | // --- slotEditTypeChanged ---------------------------------------------------- |
93 | void ListEdit::slotEditChanged(const QString &str) | 93 | void ListEdit::slotEditChanged(const QString &str) |
94 | { | 94 | { |
95 | if( !_currentItem || _currentColumn<0 ) return; | 95 | if( !_currentItem || _currentColumn<0 ) return; |
96 | _currentItem->setText(_currentColumn, str); | 96 | _currentItem->setText(_currentColumn, str); |
97 | } | 97 | } |
98 | 98 | ||
99 | // --- slotAddType ------------------------------------------------------------ | 99 | // --- slotAddType ------------------------------------------------------------ |
100 | void ListEdit::slotAdd() | 100 | void ListEdit::slotAdd() |
101 | { | 101 | { |
102 | // construct new row | 102 | // construct new row |
103 | QString args[8]; | 103 | QString args[8]; |
104 | ColumnDef *pCol=this->first(); | 104 | ColumnDef *pCol=this->first(); |
105 | int i=0; | 105 | int i=0; |
106 | while( pCol && i<8 ) { | 106 | while( pCol && i<8 ) { |
107 | args[i++]=pCol->getNewValue(); | 107 | args[i++]=pCol->getNewValue(); |
108 | pCol=this->next(); | 108 | pCol=this->next(); |
109 | } | 109 | } |
110 | _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); | 110 | _currentItem=new QListViewItem(_typeTable, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7] ); |
111 | 111 | ||
112 | // fix uniques | 112 | // fix uniques |
113 | fixTypes(); | 113 | fixTypes(); |
114 | 114 | ||
115 | // display col 0 of new value | 115 | // display col 0 of new value |
116 | QPoint pnt; | 116 | QPoint pnt; |
117 | slotClick(_currentItem, pnt, 0); | 117 | slotClick(_currentItem, pnt, 0); |
118 | _typeTable->setSelected( _currentItem, true ); | 118 | _typeTable->setSelected( _currentItem, true ); |
119 | 119 | ||
120 | // make it selected | 120 | // make it selected |
121 | _typeEdit->setCursorPosition(0); | 121 | _typeEdit->setCursorPosition(0); |
122 | _typeEdit->setSelection(0, _typeEdit->text().length() ); | 122 | _typeEdit->setSelection(0, _typeEdit->text().length() ); |
123 | } | 123 | } |
124 | 124 | ||
125 | // --- slotDel ------------------------------------------------------------- | 125 | // --- slotDel ------------------------------------------------------------- |
126 | void ListEdit::slotDel() | 126 | void ListEdit::slotDel() |
127 | { | 127 | { |
128 | if( !_currentItem ) return; | 128 | if( !_currentItem ) return; |
129 | delete _currentItem; | 129 | delete _currentItem; |
130 | _currentItem=NULL; | 130 | _currentItem=NULL; |
131 | _typeEdit->setText(""); | 131 | _typeEdit->setText(""); |
132 | _stack->raiseWidget(_typeEdit); | 132 | _stack->raiseWidget(_typeEdit); |
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | // --- fixTypes ---------------------------------------------------------------- | 136 | // --- fixTypes ---------------------------------------------------------------- |
137 | // Makes sure all entries have a unique name and empty entries are replaced | 137 | // Makes sure all entries have a unique name and empty entries are replaced |
138 | // by a generic string. The first version performs the operation on a particular | 138 | // by a generic string. The first version performs the operation on a particular |
139 | // column, whereas the 2nd does it for all unique columns. | 139 | // column, whereas the 2nd does it for all unique columns. |
140 | class ColMap { | 140 | class ColMap { |
141 | public: | 141 | public: |
142 | ColMap(QString sValue, QListViewItem *pEntry) { | 142 | ColMap(QString sValue, QListViewItem *pEntry) { |
143 | _sValue=sValue; | 143 | _sValue=sValue; |
144 | _pEntry=pEntry; | 144 | _pEntry=pEntry; |
145 | } | 145 | } |
146 | QString &getValue() { return(_sValue); } | 146 | QString &getValue() { return(_sValue); } |
147 | QListViewItem *getItem() { return(_pEntry); } | 147 | QListViewItem *getItem() { return(_pEntry); } |
148 | 148 | ||
149 | protected: | 149 | protected: |
150 | QString _sValue; | 150 | QString _sValue; |
151 | QListViewItem *_pEntry; | 151 | QListViewItem *_pEntry; |
152 | }; | 152 | }; |
153 | 153 | ||
154 | class ColList : public QList<QString> | 154 | class ColList : public QList<QString> |
155 | { | 155 | { |
156 | public: | 156 | public: |
157 | ColList() : QList<QString>() { } | 157 | ColList() : QList<QString>() { } |
158 | 158 | ||
159 | protected: | 159 | protected: |
160 | int compareItems(QCollection::Item, QCollection::Item); | 160 | int compareItems(QCollection::Item, QCollection::Item); |
161 | }; | 161 | }; |
162 | 162 | ||
163 | int ColList::compareItems(QCollection::Item i1, QCollection::Item i2) { | 163 | int ColList::compareItems(QCollection::Item i1, QCollection::Item i2) { |
164 | return( ((QString *)i1)->compare(*(QString *)i2) ); | 164 | return( ((QString *)i1)->compare(*(QString *)i2) ); |
165 | } | 165 | } |
166 | 166 | ||
167 | void ListEdit::fixTypes(int iColumn) | 167 | void ListEdit::fixTypes(int iColumn) |
168 | { | 168 | { |
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index d0fac3b..254ce6a 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp | |||
@@ -79,193 +79,193 @@ MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ ) | |||
79 | connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); | 79 | connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); |
80 | actionOpen->addTo( popup ); | 80 | actionOpen->addTo( popup ); |
81 | actionOpen->addTo( bar ); | 81 | actionOpen->addTo( bar ); |
82 | 82 | ||
83 | actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, | 83 | actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, |
84 | 0, this, 0 ); | 84 | 0, this, 0 ); |
85 | actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); | 85 | actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); |
86 | connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); | 86 | connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); |
87 | actionDelete->addTo( popup ); | 87 | actionDelete->addTo( popup ); |
88 | actionDelete->addTo( bar ); | 88 | actionDelete->addTo( bar ); |
89 | 89 | ||
90 | popup->insertSeparator(); | 90 | popup->insertSeparator(); |
91 | 91 | ||
92 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); | 92 | a = new QAction( tr( "Configure" ), Resource::loadPixmap( "SettingsIcon" ), QString::null, 0, this, 0 ); |
93 | a->setWhatsThis( tr( "Click here to configure this app." ) ); | 93 | a->setWhatsThis( tr( "Click here to configure this app." ) ); |
94 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); | 94 | connect( a, SIGNAL( activated() ), this, SLOT( slotConfigure() ) ); |
95 | a->addTo( popup ); | 95 | a->addTo( popup ); |
96 | a->addTo( bar ); | 96 | a->addTo( bar ); |
97 | 97 | ||
98 | mb->insertItem( tr( "Checkbook" ), popup ); | 98 | mb->insertItem( tr( "Checkbook" ), popup ); |
99 | 99 | ||
100 | // Load Checkbook selection list | 100 | // Load Checkbook selection list |
101 | checkbooks = new CBInfoList(); | 101 | checkbooks = new CBInfoList(); |
102 | 102 | ||
103 | QDir checkdir( cbDir ); | 103 | QDir checkdir( cbDir ); |
104 | if (checkdir.exists() == true) | 104 | if (checkdir.exists() == true) |
105 | { | 105 | { |
106 | QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, | 106 | QStringList cblist = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, |
107 | QDir::Time ); | 107 | QDir::Time ); |
108 | CBInfo *cb = 0x0; | 108 | CBInfo *cb = 0x0; |
109 | QString filename; | 109 | QString filename; |
110 | 110 | ||
111 | for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) | 111 | for ( QStringList::Iterator it = cblist.begin(); it != cblist.end(); it++ ) |
112 | { | 112 | { |
113 | filename = cbDir; | 113 | filename = cbDir; |
114 | filename.append( (*it) ); | 114 | filename.append( (*it) ); |
115 | 115 | ||
116 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); | 116 | cb = new CBInfo( (*it).remove( (*it).find('.'), (*it).length() ), filename ); |
117 | checkbooks->inSort( cb ); | 117 | checkbooks->inSort( cb ); |
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | // Build Checkbook selection list control | 121 | // Build Checkbook selection list control |
122 | cbList = 0x0; | 122 | cbList = 0x0; |
123 | buildList(); | 123 | buildList(); |
124 | 124 | ||
125 | // open last book? | 125 | // open last book? |
126 | if( _cfg.isOpenLastBook() ) { | 126 | if( _cfg.isOpenLastBook() ) { |
127 | this->show(); | 127 | this->show(); |
128 | this->showMaximized(); | 128 | this->showMaximized(); |
129 | QListViewItem *itm=cbList->firstChild(); | 129 | QListViewItem *itm=cbList->firstChild(); |
130 | while( itm ) { | 130 | while( itm ) { |
131 | if( itm->text(posName)==_cfg.getLastBook() ) { | 131 | if( itm->text(posName)==_cfg.getLastBook() ) { |
132 | openBook( itm ); | 132 | openBook( itm ); |
133 | break; | 133 | break; |
134 | } | 134 | } |
135 | itm=itm->nextSibling(); | 135 | itm=itm->nextSibling(); |
136 | } | 136 | } |
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | // --- ~MainWindow ------------------------------------------------------------ | 141 | // --- ~MainWindow ------------------------------------------------------------ |
142 | MainWindow::~MainWindow() | 142 | MainWindow::~MainWindow() |
143 | { | 143 | { |
144 | writeConfig(); | 144 | writeConfig(); |
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | // --- buildList -------------------------------------------------------------- | 148 | // --- buildList -------------------------------------------------------------- |
149 | void MainWindow::buildList() | 149 | void MainWindow::buildList() |
150 | { | 150 | { |
151 | if ( cbList ) | 151 | if ( cbList ) |
152 | delete cbList; | 152 | delete cbList; |
153 | 153 | ||
154 | cbList = new QListView( this ); | 154 | cbList = new QListView( this ); |
155 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); | 155 | QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); |
156 | 156 | ||
157 | if ( _cfg.getShowLocks() ) | 157 | if ( _cfg.getShowLocks() ) |
158 | { | 158 | { |
159 | cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); | 159 | cbList->addColumn( Resource::loadIconSet( "locked" ), "", 24 ); |
160 | posName = 1; | 160 | posName = 1; |
161 | } | 161 | } |
162 | else | 162 | else |
163 | { | 163 | { |
164 | posName = 0; | 164 | posName = 0; |
165 | } | 165 | } |
166 | cbList->addColumn( tr( "Checkbook Name" ) ); | 166 | cbList->addColumn( tr( "Checkbook Name" ) ); |
167 | if ( _cfg.getShowBalances() ) | 167 | if ( _cfg.getShowBalances() ) |
168 | { | 168 | { |
169 | int colnum = cbList->addColumn( tr( "Balance" ) ); | 169 | int colnum = cbList->addColumn( tr( "Balance" ) ); |
170 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); | 170 | cbList->setColumnAlignment( colnum, Qt::AlignRight ); |
171 | } | 171 | } |
172 | cbList->setAllColumnsShowFocus( TRUE ); | 172 | cbList->setAllColumnsShowFocus( TRUE ); |
173 | cbList->setSorting( posName ); | 173 | cbList->setSorting( posName ); |
174 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); | 174 | QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); |
175 | connect( cbList, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), | 175 | connect( cbList, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ), |
176 | this, SLOT( slotEdit() ) ); | 176 | this, SLOT( slotEdit() ) ); |
177 | setCentralWidget( cbList ); | 177 | setCentralWidget( cbList ); |
178 | 178 | ||
179 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) | 179 | for ( CBInfo *cb = checkbooks->first(); cb; cb = checkbooks->next() ) |
180 | { | 180 | { |
181 | addCheckbook( cb ); | 181 | addCheckbook( cb ); |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void MainWindow::addCheckbook( CBInfo *cb ) | 185 | void MainWindow::addCheckbook( CBInfo *cb ) |
186 | { | 186 | { |
187 | QListViewItem *lvi = new QListViewItem( cbList ); | 187 | QListViewItem *lvi = new QListViewItem( cbList ); |
188 | if ( _cfg.getShowLocks() && !cb->password().isNull() ) | 188 | if ( _cfg.getShowLocks() && !cb->password().isNull() ) |
189 | { | 189 | { |
190 | lvi->setPixmap( 0, lockIcon ); | 190 | lvi->setPixmap( 0, lockIcon ); |
191 | } | 191 | } |
192 | lvi->setText( posName, cb->name() ); | 192 | lvi->setText( posName, cb->name() ); |
193 | if ( _cfg.getShowBalances() ) | 193 | if ( _cfg.getShowBalances() ) |
194 | { | 194 | { |
195 | QString balance; | 195 | QString balance; |
196 | balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); | 196 | balance.sprintf( "%s%.2f", _cfg.getCurrencySymbol().latin1(), cb->balance() ); |
197 | lvi->setText( posName + 1, balance ); | 197 | lvi->setText( posName + 1, balance ); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | void MainWindow::buildFilename( const QString &name ) | 201 | void MainWindow::buildFilename( const QString &name ) |
202 | { | 202 | { |
203 | tempFilename = cbDir; | 203 | tempFilename = cbDir; |
204 | tempFilename.append( name ); | 204 | tempFilename.append( name ); |
205 | tempFilename.append( ".qcb" ); | 205 | tempFilename.append( ".qcb" ); |
206 | } | 206 | } |
207 | 207 | ||
208 | void MainWindow::slotNew() | 208 | void MainWindow::slotNew() |
209 | { | 209 | { |
210 | CBInfo *cb = new CBInfo(); | 210 | CBInfo *cb = new CBInfo(); |
211 | 211 | ||
212 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 212 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
213 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) | 213 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) |
214 | { | 214 | { |
215 | // Save new checkbook | 215 | // Save new checkbook |
216 | buildFilename( cb->name() ); | 216 | buildFilename( cb->name() ); |
217 | _cfg.setLastBook( cb->name() ); | 217 | _cfg.setLastBook( cb->name() ); |
218 | cb->setFilename( tempFilename ); | 218 | cb->setFilename( tempFilename ); |
219 | cb->write(); | 219 | cb->write(); |
220 | 220 | ||
221 | // Add to listbox | 221 | // Add to listbox |
222 | checkbooks->inSort( cb ); | 222 | checkbooks->inSort( cb ); |
223 | addCheckbook( cb ); | 223 | addCheckbook( cb ); |
224 | } | 224 | } |
225 | delete currcb; | 225 | delete currcb; |
226 | } | 226 | } |
227 | 227 | ||
228 | // --- slotEdit --------------------------------------------------------------- | 228 | // --- slotEdit --------------------------------------------------------------- |
229 | void MainWindow::slotEdit() | 229 | void MainWindow::slotEdit() |
230 | { | 230 | { |
231 | // get name and open it | 231 | // get name and open it |
232 | QListViewItem *curritem = cbList->currentItem(); | 232 | QListViewItem *curritem = cbList->currentItem(); |
233 | if ( !curritem ) | 233 | if ( !curritem ) |
234 | return; | 234 | return; |
235 | openBook( curritem ); | 235 | openBook( curritem ); |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | // --- openBook --------------------------------------------------------------- | 239 | // --- openBook --------------------------------------------------------------- |
240 | void MainWindow::openBook(QListViewItem *curritem) | 240 | void MainWindow::openBook(QListViewItem *curritem) |
241 | { | 241 | { |
242 | // find book in List | 242 | // find book in List |
243 | QString currname=curritem->text(posName); | 243 | QString currname=curritem->text(posName); |
244 | CBInfo *cb = checkbooks->first(); | 244 | CBInfo *cb = checkbooks->first(); |
245 | while ( cb ) { | 245 | while ( cb ) { |
246 | if ( cb->name() == currname ) | 246 | if ( cb->name() == currname ) |
247 | break; | 247 | break; |
248 | cb = checkbooks->next(); | 248 | cb = checkbooks->next(); |
249 | } | 249 | } |
250 | if ( !cb ) return; | 250 | if ( !cb ) return; |
251 | 251 | ||
252 | // | 252 | // |
253 | buildFilename( currname ); | 253 | buildFilename( currname ); |
254 | float currbalance = cb->balance(); | 254 | float currbalance = cb->balance(); |
255 | bool currlock = !cb->password().isNull(); | 255 | bool currlock = !cb->password().isNull(); |
256 | 256 | ||
257 | if ( currlock ) | 257 | if ( currlock ) |
258 | { | 258 | { |
259 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | 259 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); |
260 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) | 260 | if ( pw->exec() != QDialog::Accepted || pw->password != cb->password() ) |
261 | { | 261 | { |
262 | delete pw; | 262 | delete pw; |
263 | return; | 263 | return; |
264 | } | 264 | } |
265 | delete pw; | 265 | delete pw; |
266 | } | 266 | } |
267 | 267 | ||
268 | _cfg.setLastBook( currname ); | 268 | _cfg.setLastBook( currname ); |
269 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); | 269 | Checkbook *currcb = new Checkbook( this, cb, &_cfg ); |
270 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) | 270 | if ( QPEApplication::execDialog( currcb ) == QDialog::Accepted ) |
271 | { | 271 | { |
diff --git a/noncore/apps/checkbook/password.cpp b/noncore/apps/checkbook/password.cpp index f381271..89a6bc6 100644 --- a/noncore/apps/checkbook/password.cpp +++ b/noncore/apps/checkbook/password.cpp | |||
@@ -1,97 +1,97 @@ | |||
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 "password.h" | 29 | #include "password.h" |
30 | 30 | ||
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qlayout.h> | 32 | #include <qlayout.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
35 | 35 | ||
36 | static const char* const showhideimage_data[] = { | 36 | static const char* const showhideimage_data[] = { |
37 | "16 16 2 1", | 37 | "16 16 2 1", |
38 | ". c None", | 38 | ". c None", |
39 | "# c #000000", | 39 | "# c #000000", |
40 | "................", | 40 | "................", |
41 | "...#...###...##.", | 41 | "...#...###...##.", |
42 | "..#.#..#..#.##..", | 42 | "..#.#..#..#.##..", |
43 | "..###..###.##...", | 43 | "..###..###.##...", |
44 | ".#...#.#..##....", | 44 | ".#...#.#..##....", |
45 | ".#...#.#.##.....", | 45 | ".#...#.#.##.....", |
46 | "........##.#..#.", | 46 | "........##.#..#.", |
47 | "..##...##...##..", | 47 | "..##...##...##..", |
48 | ".#..#.###...##..", | 48 | ".#..#.###...##..", |
49 | ".#...##..#.#..#.", | 49 | ".#...##..#.#..#.", |
50 | ".#..##..........", | 50 | ".#..##..........", |
51 | ".#.##.#..#.#..#.", | 51 | ".#.##.#..#.#..#.", |
52 | "..##...##...##..", | 52 | "..##...##...##..", |
53 | ".##....##...##..", | 53 | ".##....##...##..", |
54 | ".#....#..#.#..#.", | 54 | ".#....#..#.#..#.", |
55 | "................"}; | 55 | "................"}; |
56 | 56 | ||
57 | Password::Password( QWidget *parent, const char *caption, const char *prompt ) | 57 | Password::Password( QWidget *parent, const char *caption, const char *prompt ) |
58 | : QDialog( parent, 0x0, TRUE, 0x0 ) | 58 | : QDialog( parent, 0x0, TRUE, 0x0 ) |
59 | { | 59 | { |
60 | setCaption( caption ); | 60 | setCaption( caption ); |
61 | 61 | ||
62 | QGridLayout *layout = new QGridLayout( this ); | 62 | QGridLayout *layout = new QGridLayout( this ); |
63 | layout->setSpacing( 2 ); | 63 | layout->setSpacing( 2 ); |
64 | layout->setMargin( 4 ); | 64 | layout->setMargin( 4 ); |
65 | 65 | ||
66 | QLabel *label = new QLabel( prompt, this ); | 66 | QLabel *label = new QLabel( prompt, this ); |
67 | label->setAlignment( AlignLeft | AlignTop | WordBreak ); | 67 | label->setAlignment( AlignLeft | AlignTop | WordBreak ); |
68 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); | 68 | layout->addMultiCellWidget( label, 0, 0, 0, 1 ); |
69 | 69 | ||
70 | pw = new QLineEdit( this ); | 70 | pw = new QLineEdit( this ); |
71 | pw->setEchoMode( QLineEdit::Password ); | 71 | pw->setEchoMode( QLineEdit::Password ); |
72 | layout->addWidget( pw, 1, 0 ); | 72 | layout->addWidget( pw, 1, 0 ); |
73 | 73 | ||
74 | QPixmap *pic = new QPixmap( ( const char** ) showhideimage_data ); | 74 | QPixmap *pic = new QPixmap( ( const char** ) showhideimage_data ); |
75 | QPushButton *btn = new QPushButton( ( QIconSet ) *pic, QString::null, this ); | 75 | QPushButton *btn = new QPushButton( ( QIconSet ) *pic, QString::null, this ); |
76 | btn->setMaximumSize( pic->width() + 10, pic->height() + 10 ); | 76 | btn->setMaximumSize( pic->width() + 10, pic->height() + 10 ); |
77 | btn->setToggleButton( TRUE ); | 77 | btn->setToggleButton( TRUE ); |
78 | connect( btn, SIGNAL( toggled( bool ) ), this, SLOT( slotTogglePassword( bool ) ) ); | 78 | connect( btn, SIGNAL( toggled(bool) ), this, SLOT( slotTogglePassword(bool) ) ); |
79 | layout->addWidget( btn, 1, 1 ); | 79 | layout->addWidget( btn, 1, 1 ); |
80 | 80 | ||
81 | password == ""; | 81 | password == ""; |
82 | } | 82 | } |
83 | 83 | ||
84 | Password::~Password() | 84 | Password::~Password() |
85 | { | 85 | { |
86 | } | 86 | } |
87 | 87 | ||
88 | void Password::accept() | 88 | void Password::accept() |
89 | { | 89 | { |
90 | password = pw->text(); | 90 | password = pw->text(); |
91 | QDialog::accept(); | 91 | QDialog::accept(); |
92 | } | 92 | } |
93 | 93 | ||
94 | void Password::slotTogglePassword( bool showPW ) | 94 | void Password::slotTogglePassword( bool showPW ) |
95 | { | 95 | { |
96 | showPW ? pw->setEchoMode( QLineEdit::Normal ) : pw->setEchoMode( QLineEdit::Password ); | 96 | showPW ? pw->setEchoMode( QLineEdit::Normal ) : pw->setEchoMode( QLineEdit::Password ); |
97 | } | 97 | } |
diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index a72a48b..1b08b24 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp | |||
@@ -6,267 +6,267 @@ | |||
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 "transaction.h" | 29 | #include "transaction.h" |
30 | #include "traninfo.h" | 30 | #include "traninfo.h" |
31 | #include "cfg.h" | 31 | #include "cfg.h" |
32 | #include "checkbook.h" | 32 | #include "checkbook.h" |
33 | 33 | ||
34 | #include <qpe/datebookmonth.h> | 34 | #include <qpe/datebookmonth.h> |
35 | 35 | ||
36 | #include <qbuttongroup.h> | 36 | #include <qbuttongroup.h> |
37 | #include <qcombobox.h> | 37 | #include <qcombobox.h> |
38 | #include <qlabel.h> | 38 | #include <qlabel.h> |
39 | #include <qlayout.h> | 39 | #include <qlayout.h> |
40 | #include <qlineedit.h> | 40 | #include <qlineedit.h> |
41 | #include <qmultilineedit.h> | 41 | #include <qmultilineedit.h> |
42 | #include <qradiobutton.h> | 42 | #include <qradiobutton.h> |
43 | #include <qwhatsthis.h> | 43 | #include <qwhatsthis.h> |
44 | 44 | ||
45 | Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, | 45 | Transaction::Transaction( QWidget *parent, bool bNew, const QString &acctname, |
46 | TranInfo *info, Cfg *pCfg ) | 46 | TranInfo *info, Cfg *pCfg ) |
47 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) | 47 | : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) |
48 | { | 48 | { |
49 | QString tempstr = tr( "Transaction for " ); | 49 | QString tempstr = tr( "Transaction for " ); |
50 | tempstr.append( acctname ); | 50 | tempstr.append( acctname ); |
51 | setCaption( tempstr ); | 51 | setCaption( tempstr ); |
52 | 52 | ||
53 | _bNew=bNew; | 53 | _bNew=bNew; |
54 | tran = info; | 54 | tran = info; |
55 | _pCfg=pCfg; | 55 | _pCfg=pCfg; |
56 | 56 | ||
57 | QVBoxLayout *vb = new QVBoxLayout( this ); | 57 | QVBoxLayout *vb = new QVBoxLayout( this ); |
58 | 58 | ||
59 | QScrollView *sv = new QScrollView( this ); | 59 | QScrollView *sv = new QScrollView( this ); |
60 | vb->addWidget( sv, 0, 0 ); | 60 | vb->addWidget( sv, 0, 0 ); |
61 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 61 | sv->setResizePolicy( QScrollView::AutoOneFit ); |
62 | sv->setFrameStyle( QFrame::NoFrame ); | 62 | sv->setFrameStyle( QFrame::NoFrame ); |
63 | 63 | ||
64 | QWidget *container = new QWidget( sv->viewport() ); | 64 | QWidget *container = new QWidget( sv->viewport() ); |
65 | sv->addChild( container ); | 65 | sv->addChild( container ); |
66 | 66 | ||
67 | QGridLayout *layout = new QGridLayout( container ); | 67 | QGridLayout *layout = new QGridLayout( container ); |
68 | layout->setSpacing( 2 ); | 68 | layout->setSpacing( 2 ); |
69 | layout->setMargin( 4 ); | 69 | layout->setMargin( 4 ); |
70 | 70 | ||
71 | // Withdrawal/Deposit | 71 | // Withdrawal/Deposit |
72 | QButtonGroup *btngrp = new QButtonGroup( container ); | 72 | QButtonGroup *btngrp = new QButtonGroup( container ); |
73 | btngrp->setColumnLayout(0, Qt::Vertical ); | 73 | btngrp->setColumnLayout(0, Qt::Vertical ); |
74 | btngrp->layout()->setSpacing( 0 ); | 74 | btngrp->layout()->setSpacing( 0 ); |
75 | btngrp->layout()->setMargin( 0 ); | 75 | btngrp->layout()->setMargin( 0 ); |
76 | btngrp->setMaximumWidth( 220 ); | 76 | btngrp->setMaximumWidth( 220 ); |
77 | QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); | 77 | QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); |
78 | layout2->setSpacing( 2 ); | 78 | layout2->setSpacing( 2 ); |
79 | layout2->setMargin( 2 ); | 79 | layout2->setMargin( 2 ); |
80 | 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." ) ); | 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 | QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); |
86 | layout2->addWidget( depBtn, 0, 1 ); | 86 | layout2->addWidget( depBtn, 0, 1 ); |
87 | btngrp->setMaximumSize( 320, withBtn->height() ); | 87 | btngrp->setMaximumSize( 320, withBtn->height() ); |
88 | connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); | 88 | connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); |
89 | layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); | 89 | layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); |
90 | 90 | ||
91 | // Date | 91 | // Date |
92 | 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." ) ); | 93 | QWhatsThis::add( label, tr( "Select date of transaction here." ) ); |
94 | layout->addWidget( label, 1, 0 ); | 94 | layout->addWidget( label, 1, 0 ); |
95 | dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), | 95 | dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), |
96 | container ); | 96 | container ); |
97 | QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) ); | 97 | QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) ); |
98 | QPopupMenu *m1 = new QPopupMenu( container ); | 98 | QPopupMenu *m1 = new QPopupMenu( container ); |
99 | datePicker = new DateBookMonth( m1, 0, TRUE ); | 99 | datePicker = new DateBookMonth( m1, 0, TRUE ); |
100 | m1->insertItem( datePicker ); | 100 | m1->insertItem( datePicker ); |
101 | dateBtn->setPopup( m1 ); | 101 | dateBtn->setPopup( m1 ); |
102 | connect( datePicker, SIGNAL( dateClicked( int, int, int ) ), | 102 | connect( datePicker, SIGNAL( dateClicked(int,int,int) ), |
103 | this, SLOT( slotDateChanged( int, int, int ) ) ); | 103 | this, SLOT( slotDateChanged(int,int,int) ) ); |
104 | layout->addWidget( dateBtn, 1, 1 ); | 104 | layout->addWidget( dateBtn, 1, 1 ); |
105 | 105 | ||
106 | // Check number | 106 | // Check number |
107 | label = new QLabel( tr( "Number:" ), container ); | 107 | label = new QLabel( tr( "Number:" ), container ); |
108 | QWhatsThis::add( label, tr( "Enter check number here." ) ); | 108 | QWhatsThis::add( label, tr( "Enter check number here." ) ); |
109 | layout->addWidget( label, 1, 2 ); | 109 | layout->addWidget( label, 1, 2 ); |
110 | numEdit = new QLineEdit( container ); | 110 | numEdit = new QLineEdit( container ); |
111 | QWhatsThis::add( numEdit, tr( "Enter check number here." ) ); | 111 | QWhatsThis::add( numEdit, tr( "Enter check number here." ) ); |
112 | numEdit->setMaximumWidth( 40 ); | 112 | numEdit->setMaximumWidth( 40 ); |
113 | layout->addWidget( numEdit, 1, 3 ); | 113 | layout->addWidget( numEdit, 1, 3 ); |
114 | 114 | ||
115 | // Description | 115 | // Description |
116 | label = new QLabel( tr( "Description:" ), container ); | 116 | label = new QLabel( tr( "Description:" ), container ); |
117 | QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); | 117 | QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); |
118 | layout->addWidget( label, 2, 0 ); | 118 | layout->addWidget( label, 2, 0 ); |
119 | _cbDesc=new QComboBox( true, container ); | 119 | _cbDesc=new QComboBox( true, container ); |
120 | _cbDesc->insertStringList( _pCfg->getPayees() ); | 120 | _cbDesc->insertStringList( _pCfg->getPayees() ); |
121 | QWhatsThis::add( _cbDesc, tr( "Enter description of transaction here." ) ); | 121 | QWhatsThis::add( _cbDesc, tr( "Enter description of transaction here." ) ); |
122 | layout->addMultiCellWidget( _cbDesc, 2, 2, 1, 3 ); | 122 | layout->addMultiCellWidget( _cbDesc, 2, 2, 1, 3 ); |
123 | connect( _cbDesc, SIGNAL( activated(const QString &) ), this, SLOT( slotActivated(const QString &) ) ); | 123 | connect( _cbDesc, SIGNAL( activated(const QString&) ), this, SLOT( slotActivated(const QString&) ) ); |
124 | 124 | ||
125 | 125 | ||
126 | // Category | 126 | // Category |
127 | label = new QLabel( tr( "Category:" ), container ); | 127 | label = new QLabel( tr( "Category:" ), container ); |
128 | QWhatsThis::add( label, tr( "Select transaction category here." ) ); | 128 | QWhatsThis::add( label, tr( "Select transaction category here." ) ); |
129 | layout->addWidget( label, 3, 0 ); | 129 | layout->addWidget( label, 3, 0 ); |
130 | catList = new QComboBox( container ); | 130 | catList = new QComboBox( container ); |
131 | QWhatsThis::add( catList, tr( "Select transaction category here." ) ); | 131 | QWhatsThis::add( catList, tr( "Select transaction category here." ) ); |
132 | layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); | 132 | layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); |
133 | 133 | ||
134 | // Type | 134 | // Type |
135 | label = new QLabel( tr( "Type:" ), container ); | 135 | label = new QLabel( tr( "Type:" ), container ); |
136 | QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); | 136 | QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); |
137 | layout->addWidget( label, 4, 0 ); | 137 | layout->addWidget( label, 4, 0 ); |
138 | typeList = new QComboBox( container ); | 138 | typeList = new QComboBox( container ); |
139 | QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); | 139 | QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); |
140 | layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); | 140 | layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); |
141 | 141 | ||
142 | 142 | ||
143 | // Amount | 143 | // Amount |
144 | label = new QLabel( tr( "Amount:" ), container ); | 144 | label = new QLabel( tr( "Amount:" ), container ); |
145 | QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); | 145 | QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); |
146 | layout->addWidget( label, 5, 0 ); | 146 | layout->addWidget( label, 5, 0 ); |
147 | amtEdit = new QLineEdit( container ); | 147 | amtEdit = new QLineEdit( container ); |
148 | QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); | 148 | QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); |
149 | layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); | 149 | layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); |
150 | 150 | ||
151 | // Fee | 151 | // Fee |
152 | label = new QLabel( tr( "Fee:" ), container ); | 152 | label = new QLabel( tr( "Fee:" ), container ); |
153 | QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); | 153 | QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); |
154 | layout->addWidget( label, 6, 0 ); | 154 | layout->addWidget( label, 6, 0 ); |
155 | feeEdit = new QLineEdit( container ); | 155 | feeEdit = new QLineEdit( container ); |
156 | QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); | 156 | QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); |
157 | layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); | 157 | layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); |
158 | 158 | ||
159 | // Notes | 159 | // Notes |
160 | label = new QLabel( tr( "Notes:" ), container ); | 160 | label = new QLabel( tr( "Notes:" ), container ); |
161 | QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); | 161 | QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); |
162 | layout->addWidget( label, 7, 0 ); | 162 | layout->addWidget( label, 7, 0 ); |
163 | noteEdit = new QMultiLineEdit( container ); | 163 | noteEdit = new QMultiLineEdit( container ); |
164 | QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); | 164 | QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); |
165 | layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); | 165 | layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); |
166 | 166 | ||
167 | // init date | 167 | // init date |
168 | initFromInfo( info ); | 168 | initFromInfo( info ); |
169 | 169 | ||
170 | // not new handlers | 170 | // not new handlers |
171 | connect( withBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); | 171 | connect( withBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); |
172 | connect( depBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); | 172 | connect( depBtn, SIGNAL( toggled(bool) ), this, SLOT( slotNotNew() ) ); |
173 | connect( catList, SIGNAL(activated(const QString &)), this, SLOT( slotNotNew() ) ); | 173 | connect( catList, SIGNAL(activated(const QString&)), this, SLOT( slotNotNew() ) ); |
174 | connect( typeList, SIGNAL(activated(const QString &)), this, SLOT( slotNotNew() ) ); | 174 | connect( typeList, SIGNAL(activated(const QString&)), this, SLOT( slotNotNew() ) ); |
175 | connect( amtEdit, SIGNAL(textChanged(const QString &)), this, SLOT( slotNotNew() ) ); | 175 | connect( amtEdit, SIGNAL(textChanged(const QString&)), this, SLOT( slotNotNew() ) ); |
176 | connect( feeEdit, SIGNAL(textChanged(const QString &)), this, SLOT( slotNotNew() ) ); | 176 | connect( feeEdit, SIGNAL(textChanged(const QString&)), this, SLOT( slotNotNew() ) ); |
177 | connect( noteEdit, SIGNAL(textChanged()), this, SLOT( slotNotNew() ) ); | 177 | connect( noteEdit, SIGNAL(textChanged()), this, SLOT( slotNotNew() ) ); |
178 | } | 178 | } |
179 | 179 | ||
180 | // --- initFromInfo ----------------------------------------------------------- | 180 | // --- initFromInfo ----------------------------------------------------------- |
181 | void Transaction::initFromInfo(TranInfo *info, bool bPopulateOld) | 181 | void Transaction::initFromInfo(TranInfo *info, bool bPopulateOld) |
182 | { | 182 | { |
183 | // Populate current values if provided | 183 | // Populate current values if provided |
184 | if ( info ) | 184 | if ( info ) |
185 | { | 185 | { |
186 | if ( info->withdrawal() ) | 186 | if ( info->withdrawal() ) |
187 | { | 187 | { |
188 | withBtn->setChecked( TRUE ); | 188 | withBtn->setChecked( TRUE ); |
189 | slotWithdrawalClicked(); | 189 | slotWithdrawalClicked(); |
190 | } | 190 | } |
191 | else | 191 | else |
192 | { | 192 | { |
193 | depBtn->setChecked( TRUE ); | 193 | depBtn->setChecked( TRUE ); |
194 | slotDepositClicked(); | 194 | slotDepositClicked(); |
195 | } | 195 | } |
196 | 196 | ||
197 | if( !bPopulateOld ) { | 197 | if( !bPopulateOld ) { |
198 | QDate dt = info->date(); | 198 | QDate dt = info->date(); |
199 | slotDateChanged( dt.year(), dt.month(), dt.day() ); | 199 | slotDateChanged( dt.year(), dt.month(), dt.day() ); |
200 | datePicker->setDate( dt ); | 200 | datePicker->setDate( dt ); |
201 | numEdit->setText( info->number() ); | 201 | numEdit->setText( info->number() ); |
202 | } | 202 | } |
203 | QString temptext = info->category(); | 203 | QString temptext = info->category(); |
204 | 204 | ||
205 | // set description field | 205 | // set description field |
206 | int i; | 206 | int i; |
207 | for(i=_cbDesc->count()-1; i>=0; i--) { | 207 | for(i=_cbDesc->count()-1; i>=0; i--) { |
208 | if( _cbDesc->text(i)==info->desc() ) { | 208 | if( _cbDesc->text(i)==info->desc() ) { |
209 | _cbDesc->setCurrentItem(i); | 209 | _cbDesc->setCurrentItem(i); |
210 | break; | 210 | break; |
211 | } | 211 | } |
212 | } | 212 | } |
213 | if( i<=0 ) | 213 | if( i<=0 ) |
214 | _cbDesc->setEditText( info->desc() ); | 214 | _cbDesc->setEditText( info->desc() ); |
215 | 215 | ||
216 | i = catList->count(); | 216 | i = catList->count(); |
217 | while ( i > 0 ) | 217 | while ( i > 0 ) |
218 | { | 218 | { |
219 | i--; | 219 | i--; |
220 | catList->setCurrentItem( i ); | 220 | catList->setCurrentItem( i ); |
221 | if ( catList->currentText() == temptext ) | 221 | if ( catList->currentText() == temptext ) |
222 | { | 222 | { |
223 | break; | 223 | break; |
224 | } | 224 | } |
225 | } | 225 | } |
226 | temptext = info->type(); | 226 | temptext = info->type(); |
227 | i = typeList->count(); | 227 | i = typeList->count(); |
228 | while ( i > 0 ) | 228 | while ( i > 0 ) |
229 | { | 229 | { |
230 | i--; | 230 | i--; |
231 | typeList->setCurrentItem( i ); | 231 | typeList->setCurrentItem( i ); |
232 | if ( typeList->currentText() == temptext ) | 232 | if ( typeList->currentText() == temptext ) |
233 | { | 233 | { |
234 | break; | 234 | break; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) ); | 237 | amtEdit->setText( QString( "%1" ).arg( info->amount(), 0, 'f', 2 ) ); |
238 | feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) ); | 238 | feeEdit->setText( QString( "%1" ).arg( info->fee(), 0, 'f', 2 ) ); |
239 | noteEdit->setText( info->notes() ); | 239 | noteEdit->setText( info->notes() ); |
240 | } | 240 | } |
241 | else | 241 | else |
242 | { | 242 | { |
243 | withBtn->setChecked( TRUE ); | 243 | withBtn->setChecked( TRUE ); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | // --- ~Transaction ----------------------------------------------------------- | 248 | // --- ~Transaction ----------------------------------------------------------- |
249 | Transaction::~Transaction() | 249 | Transaction::~Transaction() |
250 | { | 250 | { |
251 | } | 251 | } |
252 | 252 | ||
253 | // --- accept ----------------------------------------------------------------- | 253 | // --- accept ----------------------------------------------------------------- |
254 | void Transaction::accept() | 254 | void Transaction::accept() |
255 | { | 255 | { |
256 | tran->setDesc( _cbDesc->currentText() ); | 256 | tran->setDesc( _cbDesc->currentText() ); |
257 | tran->setDate( datePicker->selectedDate() ); | 257 | tran->setDate( datePicker->selectedDate() ); |
258 | tran->setWithdrawal( withBtn->isChecked() ); | 258 | tran->setWithdrawal( withBtn->isChecked() ); |
259 | tran->setType( typeList->currentText() ); | 259 | tran->setType( typeList->currentText() ); |
260 | tran->setCategory( catList->currentText() ); | 260 | tran->setCategory( catList->currentText() ); |
261 | bool ok; | 261 | bool ok; |
262 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); | 262 | tran->setAmount( amtEdit->text().toFloat( &ok ) ); |
263 | tran->setFee( feeEdit->text().toFloat( &ok ) ); | 263 | tran->setFee( feeEdit->text().toFloat( &ok ) ); |
264 | tran->setNumber( numEdit->text() ); | 264 | tran->setNumber( numEdit->text() ); |
265 | tran->setNotes( noteEdit->text() ); | 265 | tran->setNotes( noteEdit->text() ); |
266 | 266 | ||
267 | QDialog::accept(); | 267 | QDialog::accept(); |
268 | } | 268 | } |
269 | 269 | ||
270 | void Transaction::slotWithdrawalClicked() | 270 | void Transaction::slotWithdrawalClicked() |
271 | { | 271 | { |
272 | catList->clear(); | 272 | catList->clear(); |