Diffstat (limited to 'noncore/apps/checkbook/mainwindow.cpp') (more/less context) (ignore 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 @@ -18,26 +18,28 @@ ..}^=.= = ; Public License for more details. ++= -. .` .: : = ...= . :.=- You should have received a copy of the GNU -. .:....=;==+<; General Public License along with this file; -_. . . )=. = see the file COPYING. If not, write to the -- :-=` Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "mainwindow.h" +#include "password.h" #include "checkbook.h" +#include <qpe/config.h> #include <qpe/global.h> #include <qpe/qpeapplication.h> #include <qpe/qpemenubar.h> #include <qpe/qpemessagebox.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qaction.h> #include <qdir.h> #include <qlistbox.h> #include <qpopupmenu.h> #include <qstring.h> @@ -96,59 +98,75 @@ MainWindow::MainWindow() { QStringList checkbooks = checkdir.entryList( "*.qcb", QDir::Files|QDir::Readable|QDir::Writable, QDir::Time ); for ( QStringList::Iterator it = checkbooks.begin(); it != checkbooks.end(); it++ ) { (*it) = (*it).remove( (*it).find('.'), (*it).length() ); } cbList->insertStringList( checkbooks ); } cbList->sort(); cbList->setSelected( 0, TRUE ); - currencySymbol = '$'; + currencySymbol = "$"; } MainWindow::~MainWindow() { } void MainWindow::slotNew() { Checkbook *currcb = new Checkbook( this, "", cbDir, currencySymbol ); currcb->showMaximized(); if ( currcb->exec() == QDialog::Accepted ) { cbList->insertItem( currcb->getName() ); cbList->sort(); delete currcb; } } void MainWindow::slotEdit() { QString currname = cbList->currentText(); + + QString tempstr = cbDir; + tempstr.append( currname ); + tempstr.append( ".qcb" ); + + Config config( tempstr, Config::File ); + config.setGroup( "Account" ); + QString password = config.readEntryCrypt( "Password", "" ); + if ( password != "" ) + { + Password *pw = new Password( this, tr( "Enter password" ), tr( "Please enter your password:" ) ); + if ( pw->exec() != QDialog::Accepted || pw->password != password ) + { + delete pw; + return; + } + delete pw; + } + Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol ); currcb->showMaximized(); if ( currcb->exec() == QDialog::Accepted ) { QString newname = currcb->getName(); if ( currname != newname ) { cbList->changeItem( newname, cbList->currentItem() ); cbList->sort(); - QString tempstr = cbDir; - tempstr.append( currname ); - tempstr.append( ".qcb" ); QFile f( tempstr ); if ( f.exists() ) { f.remove(); } } delete currcb; } } void MainWindow::slotDelete() { |