author | drw <drw> | 2002-10-26 18:23:34 (UTC) |
---|---|---|
committer | drw <drw> | 2002-10-26 18:23:34 (UTC) |
commit | 3dc25703dbf961f86bc25378113ffafb18ee192e (patch) (side-by-side diff) | |
tree | 75436ace2b4c524ea29de5cbd8ac6cbbbcf7ec4e /noncore/apps/checkbook | |
parent | ec58c37763a97306543a3f18052d37291b1cdf83 (diff) | |
download | opie-3dc25703dbf961f86bc25378113ffafb18ee192e.zip opie-3dc25703dbf961f86bc25378113ffafb18ee192e.tar.gz opie-3dc25703dbf961f86bc25378113ffafb18ee192e.tar.bz2 |
Whats This and a couple fixes
-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 @@ -42,12 +42,13 @@ #include <qlineedit.h> #include <qlistview.h> #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; filename = fd + name + ".qcb"; filedir = fd; @@ -109,18 +110,22 @@ QWidget *Checkbook::initInfo() layout->setMargin( 4 ); // 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 & ) ) ); layout->addWidget( nameEdit, 0, 1 ); // 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 typeList->insertItem( tr( "CD" ) ); // 2 typeList->insertItem( tr( "Money market" ) ); // 3 @@ -129,36 +134,46 @@ QWidget *Checkbook::initInfo() layout->addWidget( typeList, 1, 1 ); // 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 & ) ) ); layout->addWidget( balanceEdit, 5, 1 ); // 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 ); return control; @@ -173,11 +188,13 @@ QWidget *Checkbook::initTransactions() layout->setMargin( 4 ); 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" ) ); tranTable->addColumn( tr( "Description" ) ); int colnum = tranTable->addColumn( tr( "Amount" ) ); @@ -188,16 +205,19 @@ QWidget *Checkbook::initTransactions() connect( tranTable, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), this, SLOT( slotEditTran() ) ); 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 ); return( control ); @@ -222,12 +242,14 @@ QWidget *Checkbook::initCharts() layout->addWidget( graphList, 0, 1 ); */ 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 ); return control; 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 @@ -40,11 +40,12 @@ #include <qdir.h> #include <qlistbox.h> #include <qpopupmenu.h> #include <qstring.h> +#include <qwhatsthis.h> MainWindow::MainWindow() - : QMainWindow() + : QMainWindow( 0x0, 0x0, WStyle_ContextHelp ) { setCaption( tr( "Checkbook" ) ); cbDir = Global::applicationFileName( "checkbook", "" ); @@ -58,38 +59,36 @@ MainWindow::MainWindow() mb->setMargin( 0 ); QPopupMenu *popup = new QPopupMenu( this ); 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 ); // Load Checkbook selection list QDir checkdir( cbDir ); @@ -112,9 +111,21 @@ MainWindow::MainWindow() 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(); Checkbook *currcb = new Checkbook( this, currname, cbDir, currencySymbol ); currcb->showMaximized(); @@ -135,30 +146,18 @@ void MainWindow::slotOpen() delete currcb; } } -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 ); if ( f.exists() ) { 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 @@ -51,10 +51,10 @@ class MainWindow : public QMainWindow QAction *actionDelete; char currencySymbol; private slots: - void slotOpen(); void slotNew(); + void slotEdit(); void slotDelete(); }; #endif 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 @@ -42,14 +42,13 @@ #include <qpushbutton.h> #include <qradiobutton.h> #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 ); tran = info; @@ -78,21 +77,25 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in QGridLayout *layout2 = new QGridLayout( btngrp->layout() ); layout2->setSpacing( 2 ); 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() ); connect( depBtn, SIGNAL( clicked() ), this, SLOT( slotDepositClicked() ) ); layout->addMultiCellWidget( btngrp, 0, 0, 0, 3 ); // 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 ); m1->insertItem( datePicker ); dateBtn->setPopup( m1 ); @@ -101,47 +104,61 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in layout->addWidget( dateBtn, 1, 1 ); // 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 ); // 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 ); // Populate current values if provided if ( info ) |