Diffstat (limited to 'noncore/apps/checkbook/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index 567b8ad..2c0abf1 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp | |||
@@ -24,14 +24,16 @@ | |||
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 "mainwindow.h" | 29 | #include "mainwindow.h" |
30 | #include "password.h" | ||
30 | #include "checkbook.h" | 31 | #include "checkbook.h" |
31 | 32 | ||
33 | #include <qpe/config.h> | ||
32 | #include <qpe/global.h> | 34 | #include <qpe/global.h> |
33 | #include <qpe/qpeapplication.h> | 35 | #include <qpe/qpeapplication.h> |
34 | #include <qpe/qpemenubar.h> | 36 | #include <qpe/qpemenubar.h> |
35 | #include <qpe/qpemessagebox.h> | 37 | #include <qpe/qpemessagebox.h> |
36 | #include <qpe/qpetoolbar.h> | 38 | #include <qpe/qpetoolbar.h> |
37 | #include <qpe/resource.h> | 39 | #include <qpe/resource.h> |
@@ -102,13 +104,13 @@ MainWindow::MainWindow() | |||
102 | } | 104 | } |
103 | cbList->insertStringList( checkbooks ); | 105 | cbList->insertStringList( checkbooks ); |
104 | } | 106 | } |
105 | cbList->sort(); | 107 | cbList->sort(); |
106 | cbList->setSelected( 0, TRUE ); | 108 | cbList->setSelected( 0, TRUE ); |
107 | 109 | ||
108 | currencySymbol = '$'; | 110 | currencySymbol = "$"; |
109 | } | 111 | } |
110 | 112 | ||
111 | MainWindow::~MainWindow() | 113 | MainWindow::~MainWindow() |
112 | { | 114 | { |
113 | } | 115 | } |
114 | 116 | ||
@@ -124,25 +126,41 @@ void MainWindow::slotNew() | |||
124 | } | 126 | } |
125 | } | 127 | } |
126 | 128 | ||
127 | void MainWindow::slotEdit() | 129 | void MainWindow::slotEdit() |
128 | { | 130 | { |
129 | QString currname = cbList->currentText(); | 131 | QString currname = cbList->currentText(); |
132 | |||
133 | QString tempstr = cbDir; | ||
134 | tempstr.append( currname ); | ||
135 | tempstr.append( ".qcb" ); | ||
136 | |||
137 | Config config( tempstr, Config::File ); | ||
138 | config.setGroup( "Account" ); | ||
139 | QString password = config.readEntryCrypt( "Password", "" ); | ||
140 | if ( password != "" ) | ||
141 | { | ||
142 | Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); | ||
143 | if ( pw->exec() != QDialog::Accepted || pw->password != password ) | ||
144 | { | ||
145 | delete pw; | ||
146 | return; | ||
147 | } | ||
148 | delete pw; | ||
149 | } | ||
150 | |||
130 | Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol ); | 151 | Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol ); |
131 | currcb->showMaximized(); | 152 | currcb->showMaximized(); |
132 | if ( currcb->exec() == QDialog::Accepted ) | 153 | if ( currcb->exec() == QDialog::Accepted ) |
133 | { | 154 | { |
134 | QString newname = currcb->getName(); | 155 | QString newname = currcb->getName(); |
135 | if ( currname != newname ) | 156 | if ( currname != newname ) |
136 | { | 157 | { |
137 | cbList->changeItem( newname, cbList->currentItem() ); | 158 | cbList->changeItem( newname, cbList->currentItem() ); |
138 | cbList->sort(); | 159 | cbList->sort(); |
139 | 160 | ||
140 | QString tempstr = cbDir; | ||
141 | tempstr.append( currname ); | ||
142 | tempstr.append( ".qcb" ); | ||
143 | QFile f( tempstr ); | 161 | QFile f( tempstr ); |
144 | if ( f.exists() ) | 162 | if ( f.exists() ) |
145 | { | 163 | { |
146 | f.remove(); | 164 | f.remove(); |
147 | } | 165 | } |
148 | } | 166 | } |