summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/checkbook/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp2
1 files changed, 1 insertions, 1 deletions
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
@@ -127,97 +127,97 @@ MainWindow::MainWindow( QWidget* parent, const char* name, WFlags /*fl*/ )
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 ------------------------------------------------------------
142MainWindow::~MainWindow() 142MainWindow::~MainWindow()
143{ 143{
144 writeConfig(); 144 writeConfig();
145} 145}
146 146
147 147
148// --- buildList -------------------------------------------------------------- 148// --- buildList --------------------------------------------------------------
149void MainWindow::buildList() 149void 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
185void MainWindow::addCheckbook( CBInfo *cb ) 185void 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
201void MainWindow::buildFilename( const QString &name ) 201void 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
208void MainWindow::slotNew() 208void 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 );