summaryrefslogtreecommitdiff
authordrw <drw>2002-10-26 18:23:34 (UTC)
committer drw <drw>2002-10-26 18:23:34 (UTC)
commit3dc25703dbf961f86bc25378113ffafb18ee192e (patch) (side-by-side diff)
tree75436ace2b4c524ea29de5cbd8ac6cbbbcf7ec4e
parentec58c37763a97306543a3f18052d37291b1cdf83 (diff)
downloadopie-3dc25703dbf961f86bc25378113ffafb18ee192e.zip
opie-3dc25703dbf961f86bc25378113ffafb18ee192e.tar.gz
opie-3dc25703dbf961f86bc25378113ffafb18ee192e.tar.bz2
Whats This and a couple fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/checkbook/checkbook.cpp26
-rw-r--r--noncore/apps/checkbook/mainwindow.cpp59
-rw-r--r--noncore/apps/checkbook/mainwindow.h2
-rw-r--r--noncore/apps/checkbook/transaction.cpp23
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
@@ -34,28 +34,29 @@
#include <qpe/qpeapplication.h>
#include <qpe/qpemessagebox.h>
#include <qpe/resource.h>
#include <qcombobox.h>
#include <qfile.h>
#include <qlabel.h>
#include <qlayout.h>
#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;
currencySymbol = symbol;
currBalance = 0.0;
if ( name != "" )
{
setCaption( name + " - " + tr( "Checkbook" ) );
}
else
@@ -101,111 +102,130 @@ QWidget *Checkbook::initInfo()
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
QWidget *container = new QWidget( sv->viewport() );
sv->addChild( container );
QGridLayout *layout = new QGridLayout( container );
layout->setSpacing( 2 );
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
typeList->insertItem( tr( "Mutual fund" ) ); // 4
typeList->insertItem( tr( "Other" ) ); // 5
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;
}
QWidget *Checkbook::initTransactions()
{
QWidget *control = new QWidget( mainWidget );
QGridLayout *layout = new QGridLayout( control );
layout->setSpacing( 2 );
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" ) );
tranTable->setColumnAlignment( colnum, Qt::AlignRight );
tranTable->setAllColumnsShowFocus( TRUE );
layout->addMultiCellWidget( tranTable, 1, 1, 0, 2 );
QPEApplication::setStylusOperation( tranTable->viewport(), QPEApplication::RightOnHold );
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 );
}
QWidget *Checkbook::initCharts()
{
QWidget *control = new QWidget( mainWidget );
QGridLayout *layout = new QGridLayout( control );
layout->setSpacing( 2 );
@@ -214,28 +234,30 @@ QWidget *Checkbook::initCharts()
/*
QLabel *label = new QLabel( control );
label->setText( tr( "Graph type:" ) );
layout->addWidget( label, 0, 0 );
graphList = new QComboBox( control );
graphList->insertItem( tr( "By category" ) );
graphList->insertItem( tr( "..." ) );
graphList->insertItem( tr( "..." ) );
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;
}
void Checkbook::loadCheckbook()
{
transactions.clear();
Config config(filename, Config::File);
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
@@ -32,133 +32,132 @@
#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>
+#include <qwhatsthis.h>
MainWindow::MainWindow()
- : QMainWindow()
+ : QMainWindow( 0x0, 0x0, WStyle_ContextHelp )
{
setCaption( tr( "Checkbook" ) );
cbDir = Global::applicationFileName( "checkbook", "" );
// Build menu and tool bars
setToolBarsMovable( FALSE );
QPEToolBar *bar = new QPEToolBar( this );
bar->setHorizontalStretchable( TRUE );
QPEMenuBar *mb = new QPEMenuBar( bar );
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 );
if (checkdir.exists() == true)
{
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 = '$';
}
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();
if ( currcb->exec() == QDialog::Accepted )
{
QString newname = currcb->getName();
if ( currname != newname )
{
cbList->changeItem( newname, cbList->currentItem() );
cbList->sort();
QFile f( cbDir + currname + ".qcb" );
if ( f.exists() )
{
f.remove();
}
}
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
@@ -43,18 +43,18 @@ class MainWindow : public QMainWindow
public:
MainWindow();
~MainWindow();
private:
QListBox *cbList;
QString cbDir;
QAction *actionOpen;
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
@@ -34,30 +34,29 @@
#include <qbuttongroup.h>
#include <qcombobox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qlineedit.h>
#include <qmultilineedit.h>
#include <qpopupmenu.h>
#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;
currencySymbol = symbol;
QVBoxLayout *vb = new QVBoxLayout( this );
QScrollView *sv = new QScrollView( this );
vb->addWidget( sv, 0, 0 );
sv->setResizePolicy( QScrollView::AutoOneFit );
sv->setFrameStyle( QFrame::NoFrame );
@@ -70,86 +69,104 @@ Transaction::Transaction( QWidget *parent, const QString &acctname, TranInfo *in
layout->setMargin( 4 );
// Withdrawal/Deposit
QButtonGroup *btngrp = new QButtonGroup( container );
btngrp->setColumnLayout(0, Qt::Vertical );
btngrp->layout()->setSpacing( 0 );
btngrp->layout()->setMargin( 0 );
btngrp->setMaximumWidth( 220 );
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 );
connect( datePicker, SIGNAL( dateClicked( int, int, int ) ),
this, SLOT( slotDateChanged( int, int, int ) ) );
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 )
{
if ( info->withdrawal() )
{
withBtn->setChecked( TRUE );
slotWithdrawalClicked();
}
else
{