-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 26 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.cpp | 59 | ||||
-rw-r--r-- | noncore/apps/checkbook/mainwindow.h | 2 | ||||
-rw-r--r-- | noncore/apps/checkbook/transaction.cpp | 23 |
4 files changed, 74 insertions, 36 deletions
diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index 2919927..ee65784 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp @@ -44,8 +44,9 @@ #include <qmultilineedit.h> #include <qpushbutton.h> +#include <qwhatsthis.h> #include <qwidget.h> Checkbook::Checkbook( QWidget *parent, const QString &n, const QString &fd, char symbol ) - : QDialog( parent, 0, TRUE, 0 ) + : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { name = n; @@ -111,6 +112,8 @@ QWidget *Checkbook::initInfo() // Account name QLabel *label = new QLabel( tr( "Name:" ), container ); + QWhatsThis::add( label, tr( "Enter name of checkbook here." ) ); layout->addWidget( label, 0, 0 ); nameEdit = new QLineEdit( container ); + QWhatsThis::add( nameEdit, tr( "Enter name of checkbook here." ) ); connect( nameEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotNameChanged( const QString & ) ) ); @@ -119,6 +122,8 @@ QWidget *Checkbook::initInfo() // Type of account label = new QLabel( tr( "Type:" ), container ); + QWhatsThis::add( label, tr( "Select type of checkbook here." ) ); layout->addWidget( label, 1, 0 ); typeList = new QComboBox( container ); + QWhatsThis::add( typeList, tr( "Select type of checkbook here." ) ); typeList->insertItem( tr( "Savings" ) ); // 0 typeList->insertItem( tr( "Checking" ) ); // 1 @@ -131,24 +136,32 @@ QWidget *Checkbook::initInfo() // Bank/institution name label = new QLabel( tr( "Bank:" ), container ); + QWhatsThis::add( label, tr( "Enter name of the bank for this checkbook here." ) ); layout->addWidget( label, 2, 0 ); bankEdit = new QLineEdit( container ); + QWhatsThis::add( bankEdit, tr( "Enter name of the bank for this checkbook here." ) ); layout->addWidget( bankEdit, 2, 1 ); // Account number label = new QLabel( tr( "Account number:" ), container ); + QWhatsThis::add( label, tr( "Enter account number for this checkbook here." ) ); layout->addWidget( label, 3, 0 ); acctNumEdit = new QLineEdit( container ); + QWhatsThis::add( acctNumEdit, tr( "Enter account number for this checkbook here." ) ); layout->addWidget( acctNumEdit, 3, 1 ); // PIN number label = new QLabel( tr( "PIN number:" ), container ); + QWhatsThis::add( label, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( label, 4, 0 ); pinNumEdit = new QLineEdit( container ); + QWhatsThis::add( pinNumEdit, tr( "Enter PIN number for this checkbook here." ) ); layout->addWidget( pinNumEdit, 4, 1 ); // Starting balance label = new QLabel( tr( "Starting balance:" ), container ); + QWhatsThis::add( label, tr( "Enter the initial balance for this checkbook here." ) ); layout->addWidget( label, 5, 0 ); balanceEdit = new QLineEdit( container ); + QWhatsThis::add( balanceEdit, tr( "Enter the initial balance for this checkbook here." ) ); connect( balanceEdit, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotStartingBalanceChanged( const QString & ) ) ); @@ -157,6 +170,8 @@ QWidget *Checkbook::initInfo() // Notes label = new QLabel( tr( "Notes:" ), container ); + QWhatsThis::add( label, tr( "Enter any additional information for this checkbook here." ) ); layout->addWidget( label, 6, 0 ); notesEdit = new QMultiLineEdit( container ); + QWhatsThis::add( notesEdit, tr( "Enter any additional information for this checkbook here." ) ); notesEdit->setMaximumHeight( 85 ); layout->addMultiCellWidget( notesEdit, 7, 7, 0, 1 ); @@ -175,7 +190,9 @@ QWidget *Checkbook::initTransactions() balanceLabel = new QLabel( tr( "Current balance: %10.00" ).arg( currencySymbol ), control ); + QWhatsThis::add( balanceLabel, tr( "This area shows the current balance in this checkbook." ) ); layout->addMultiCellWidget( balanceLabel, 0, 0, 0, 2 ); tranTable = new QListView( control ); + 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." ) ); tranTable->addColumn( tr( "ID" ) ); tranTable->addColumn( tr( "Date" ) ); @@ -190,12 +207,15 @@ QWidget *Checkbook::initTransactions() QPushButton *btn = new QPushButton( Resource::loadPixmap( "new" ), tr( "New" ), control ); + QWhatsThis::add( btn, tr( "Click here to add a new transaction." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotNewTran() ) ); layout->addWidget( btn, 2, 0 ); btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Edit" ), control ); + QWhatsThis::add( btn, tr( "Select a transaction and then click here to edit it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotEditTran() ) ); layout->addWidget( btn, 2, 1 ); - btn = new QPushButton( Resource::loadPixmap( "editdelete" ), tr( "Delete" ), control ); + btn = new QPushButton( Resource::loadPixmap( "trash" ), tr( "Delete" ), control ); + QWhatsThis::add( btn, tr( "Select a checkbook and then click here to delete it." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDeleteTran() ) ); layout->addWidget( btn, 2, 2 ); @@ -224,8 +244,10 @@ QWidget *Checkbook::initCharts() QWidget *graphWidget = new QWidget( control ); + QWhatsThis::add( graphWidget, tr( "Graph not implemented yet." ) ); layout->addMultiCellWidget( graphWidget, 0, 0, 0, 1 ); graphWidget->setBackgroundMode( QWidget::PaletteBase ); QPushButton *btn = new QPushButton( Resource::loadPixmap( "edit" ), tr( "Draw" ), control ); + QWhatsThis::add( btn, tr( "Click here to draw the graph." ) ); connect( btn, SIGNAL( clicked() ), this, SLOT( slotDrawGraph() ) ); layout->addWidget( btn, 1, 1 ); diff --git a/noncore/apps/checkbook/mainwindow.cpp b/noncore/apps/checkbook/mainwindow.cpp index 9410536..ead17b4 100644 --- a/noncore/apps/checkbook/mainwindow.cpp +++ b/noncore/apps/checkbook/mainwindow.cpp @@ -42,7 +42,8 @@ #include <qpopupmenu.h> #include <qstring.h> +#include <qwhatsthis.h> MainWindow::MainWindow() - : QMainWindow() + : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { setCaption( tr( "Checkbook" ) ); @@ -60,34 +61,32 @@ MainWindow::MainWindow() bar = new QPEToolBar( this ); - actionOpen = new QAction( tr( "Open" ), Resource::loadPixmap( "fileopen" ), QString::null, - 0, this, 0 ); - connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotOpen() ) ); - actionOpen->addTo( popup ); - actionOpen->addTo( bar ); - QAction *a = new QAction( tr( "New" ), Resource::loadPixmap( "new" ), QString::null, 0, this, 0 ); + a->setWhatsThis( tr( "Click here to create a new checkbook.\n\nYou also can select New from the Checkbook menu." ) ); connect( a, SIGNAL( activated() ), this, SLOT( slotNew() ) ); a->addTo( popup ); a->addTo( bar ); - actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "editdelete" ), QString::null, + actionOpen = new QAction( tr( "Edit" ), Resource::loadPixmap( "edit" ), QString::null, + 0, this, 0 ); + actionOpen->setWhatsThis( tr( "Select a checkbook and then click here to edit it.\n\nYou also can select Edit from the Checkbook menu, or click and hold on a checkbook name." ) ); + connect( actionOpen, SIGNAL( activated() ), this, SLOT( slotEdit() ) ); + actionOpen->addTo( popup ); + actionOpen->addTo( bar ); + + actionDelete = new QAction( tr( "Delete" ), Resource::loadPixmap( "trash" ), QString::null, 0, this, 0 ); + actionDelete->setWhatsThis( tr( "Select a checkbook and then click here delete it.\n\nYou also can select Delete from the Checkbook menu." ) ); connect( actionDelete, SIGNAL( activated() ), this, SLOT( slotDelete() ) ); actionDelete->addTo( popup ); actionDelete->addTo( bar ); - popup->insertSeparator(); - - a = new QAction( tr( "Exit" ), QString::null, 0, this, 0 ); - connect( a, SIGNAL( activated() ), this, SLOT( close() ) ); - a->addTo( popup ); - mb->insertItem( tr( "Checkbook" ), popup ); // Build Checkbook selection list control cbList = new QListBox( this ); + QWhatsThis::add( cbList, tr( "This is a listing of all checkbooks currently available." ) ); QPEApplication::setStylusOperation( cbList->viewport(), QPEApplication::RightOnHold ); connect( cbList, SIGNAL( rightButtonPressed( QListBoxItem *, const QPoint & ) ), - this, SLOT( slotOpen() ) ); + this, SLOT( slotEdit() ) ); setCentralWidget( cbList ); @@ -114,5 +113,17 @@ MainWindow::~MainWindow() } -void MainWindow::slotOpen() +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(); @@ -137,22 +148,8 @@ void MainWindow::slotOpen() } -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::slotDelete() { if ( QPEMessageBox::confirmDelete ( this, tr( "Delete checkbook" ), cbList->currentText() ) ) { - cbList->removeItem( cbList->currentItem() ); - QString name = cbDir + cbList->currentText() + ".qcb"; QFile f( name ); @@ -161,4 +158,6 @@ void MainWindow::slotDelete() f.remove(); } + + cbList->removeItem( cbList->currentItem() ); } } diff --git a/noncore/apps/checkbook/mainwindow.h b/noncore/apps/checkbook/mainwindow.h index 54fbba6..2c5d93b 100644 --- a/noncore/apps/checkbook/mainwindow.h +++ b/noncore/apps/checkbook/mainwindow.h @@ -53,6 +53,6 @@ class MainWindow : public QMainWindow private slots: - void slotOpen(); void slotNew(); + void slotEdit(); void slotDelete(); }; diff --git a/noncore/apps/checkbook/transaction.cpp b/noncore/apps/checkbook/transaction.cpp index 7d1781b..82baec9 100644 --- a/noncore/apps/checkbook/transaction.cpp +++ b/noncore/apps/checkbook/transaction.cpp @@ -44,10 +44,9 @@ #include <qscrollview.h> #include <qstring.h> - -#include <stdio.h> +#include <qwhatsthis.h> Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *info, char symbol ) - : QDialog( parent, 0, TRUE, 0 ) + : QDialog( parent, 0, TRUE, WStyle_ContextHelp ) { setCaption( tr( "Transaction for " ) + acctname ); @@ -80,7 +79,9 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in layout2->setMargin( 2 ); withBtn = new QRadioButton( tr( "Withdrawal" ), btngrp ); + QWhatsThis::add( withBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); layout2->addWidget( withBtn, 0, 0 ); connect( withBtn, SIGNAL( clicked() ), this, SLOT( slotWithdrawalClicked() ) ); depBtn = new QRadioButton( tr( "Deposit" ), btngrp ); + QWhatsThis::add( depBtn, tr( "Select whether the transaction is a withdrawal or deposit here." ) ); layout2->addWidget( depBtn, 0, 1 ); btngrp->setMaximumSize( 320, withBtn->height() ); @@ -90,7 +91,9 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in // Date QLabel *label = new QLabel( tr( "Date:" ), container ); + QWhatsThis::add( label, tr( "Select date of transaction here." ) ); layout->addWidget( label, 1, 0 ); dateBtn = new QPushButton( TimeString::shortDate( QDate::currentDate() ), container ); + QWhatsThis::add( dateBtn, tr( "Select date of transaction here." ) ); QPopupMenu *m1 = new QPopupMenu( container ); datePicker = new DateBookMonth( m1, 0, TRUE ); @@ -103,6 +106,8 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in // Check number label = new QLabel( tr( "Number:" ), container ); + QWhatsThis::add( label, tr( "Enter check number here." ) ); layout->addWidget( label, 1, 2 ); numEdit = new QLineEdit( container ); + QWhatsThis::add( numEdit, tr( "Enter check number here." ) ); numEdit->setMaximumWidth( 40 ); layout->addWidget( numEdit, 1, 3 ); @@ -110,36 +115,48 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in // Description label = new QLabel( tr( "Description:" ), container ); + QWhatsThis::add( label, tr( "Enter description of transaction here." ) ); layout->addWidget( label, 2, 0 ); descEdit = new QLineEdit( container ); + QWhatsThis::add( descEdit, tr( "Enter description of transaction here." ) ); layout->addMultiCellWidget( descEdit, 2, 2, 1, 3 ); // Category label = new QLabel( tr( "Category:" ), container ); + QWhatsThis::add( label, tr( "Select transaction category here." ) ); layout->addWidget( label, 3, 0 ); catList = new QComboBox( container ); + QWhatsThis::add( catList, tr( "Select transaction category here." ) ); layout->addMultiCellWidget( catList, 3, 3, 1, 3 ); // Type label = new QLabel( tr( "Type:" ), container ); + QWhatsThis::add( label, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); layout->addWidget( label, 4, 0 ); typeList = new QComboBox( container ); + QWhatsThis::add( typeList, tr( "Select transaction type here.\n\nThe options available vary based on whether the transaction is a deposit or withdrawal." ) ); layout->addMultiCellWidget( typeList, 4, 4, 1, 3 ); // Amount label = new QLabel( tr( "Amount:" ), container ); + QWhatsThis::add( label, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); layout->addWidget( label, 5, 0 ); amtEdit = new QLineEdit( container ); + QWhatsThis::add( amtEdit, tr( "Enter the amount of transaction here.\n\nThe value entered should always be positive." ) ); layout->addMultiCellWidget( amtEdit, 5, 5, 1, 3 ); // Fee label = new QLabel( tr( "Fee:" ), container ); + QWhatsThis::add( label, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); layout->addWidget( label, 6, 0 ); feeEdit = new QLineEdit( container ); + QWhatsThis::add( feeEdit, tr( "Enter any fee amount assoiciated with this transaction.\n\nThe value entered should always be positive." ) ); layout->addMultiCellWidget( feeEdit, 6, 6, 1, 3 ); // Notes label = new QLabel( tr( "Notes:" ), container ); + QWhatsThis::add( label, tr( "Enter any additional information for this transaction here." ) ); layout->addWidget( label, 7, 0 ); noteEdit = new QMultiLineEdit( container ); + QWhatsThis::add( noteEdit, tr( "Enter any additional information for this transaction here." ) ); layout->addMultiCellWidget( noteEdit, 8, 8, 0, 3 ); |