-rw-r--r-- | noncore/apps/checkbook/cfg.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/checkbook/cfg.h | 45 | ||||
-rw-r--r-- | noncore/apps/checkbook/checkbook.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/checkbook/configuration.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/checkbook/configuration.h | 1 |
5 files changed, 37 insertions, 21 deletions
diff --git a/noncore/apps/checkbook/cfg.cpp b/noncore/apps/checkbook/cfg.cpp index 24fa4cb..4f70593 100644 --- a/noncore/apps/checkbook/cfg.cpp +++ b/noncore/apps/checkbook/cfg.cpp @@ -24,32 +24,33 @@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include <stdio.h> #include <qwidget.h> #include <qpe/config.h> #include "cfg.h" // --- Cfg -------------------------------------------------------------------- Cfg::Cfg() { _currencySymbol="$"; + _useSmallFont=TRUE; _showLocks=FALSE; _showBalances=FALSE; _pCategories=new CategoryList(); _bDirty=false; } // --- readStringList --------------------------------------------------------- // Reads the entries for the control from a configuration file and returns // them in a StringList. Later this list can be used to create the control. It // is assumed, that the group is already set. Key is used to enumerate the // entries. void Cfg::readStringList(Config &cfg, const char *sKey, QStringList &lst) { QString sEntry; int iCount; @@ -64,32 +65,33 @@ void Cfg::readStringList(Config &cfg, const char *sKey, QStringList &lst) if( sType!=NULL ) lst.append(sType); } } // --- readConfig ------------------------------------------------------------- // Reads the member data from the given config file. It will also set the group // "Config" void Cfg::readConfig(Config &config) { // set group config.setGroup( "Config" ); // read scalars _currencySymbol = config.readEntry( "CurrencySymbol", "$" ); + _useSmallFont = config.readBoolEntry( "UseSmallFont", TRUE ); _showLocks = config.readBoolEntry( "ShowLocks", FALSE ); _showBalances = config.readBoolEntry( "ShowBalances", FALSE ); _openLastBook = config.readBoolEntry( "OpenLastBook", FALSE ); _sLastBook = config.readEntry("LastBook", ""); _showLastTab = config.readBoolEntry( "ShowLastTab", FALSE ); _bSavePayees = config.readBoolEntry( "SavePayees", FALSE ); // Account types readStringList(config, "AccType", _AccountTypes); if( _AccountTypes.isEmpty() ) { _AccountTypes+= (const char *)QWidget::tr("Savings"); _AccountTypes+= (const char *)QWidget::tr("Checking"); _AccountTypes+= (const char *)QWidget::tr("CD"); _AccountTypes+= (const char *)QWidget::tr("Money market"); _AccountTypes+= (const char *)QWidget::tr("Mutual fund"); _AccountTypes+= (const char *)QWidget::tr("Other"); @@ -151,32 +153,33 @@ void Cfg::writeStringList(Config &cfg, const char *sKey, QStringList &lst) } sEntry.sprintf("%s_Count", sKey); cfg.writeEntry(sEntry, iCount); } // --- writeConfig ----------------------------------------------------------- // Writes all config data back to the config file. The group will be set to // "Config" and the write be commited void Cfg::writeConfig(Config &config) { // set the group config.setGroup( "Config" ); // write scalars config.writeEntry( "CurrencySymbol", _currencySymbol ); + config.writeEntry( "UseSmallFont", _useSmallFont ); config.writeEntry( "ShowLocks", _showLocks ); config.writeEntry( "ShowBalances", _showBalances ); config.writeEntry( "OpenLastBook", _openLastBook ); config.writeEntry( "LastBook", _sLastBook ); config.writeEntry( "ShowLastTab", _showLastTab ); config.writeEntry( "SavePayees", _bSavePayees ); // write account types writeStringList(config, "AccType", _AccountTypes); // write payees writeStringList(config, "Payee", _Payees); // write categories QStringList lst=getCategories(); writeStringList(config, "Category", lst ); diff --git a/noncore/apps/checkbook/cfg.h b/noncore/apps/checkbook/cfg.h index 20692b4..418bd93 100644 --- a/noncore/apps/checkbook/cfg.h +++ b/noncore/apps/checkbook/cfg.h @@ -1,39 +1,39 @@ /* - This file is part of the OPIE Project + This file is part of the OPIE Project =. - .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> - .>+-= - _;:, .> :=|. This file is free software; you can -.> <`_, > . <= redistribute it and/or modify it under -:`=1 )Y*s>-.-- : the terms of the GNU General Public -.="- .-=="i, .._ License as published by the Free Software - - . .-<_> .<> Foundation; either version 2 of the License, - ._= =} : or (at your option) any later version. - .%`+i> _;_. - .i_,=:_. -<s. This file is distributed in the hope that - + . -:. = it will be useful, but WITHOUT ANY WARRANTY; - : .. .:, . . . without even the implied warranty of - =_ + =;=|` MERCHANTABILITY or FITNESS FOR A - _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General -..}^=.= = ; 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., + .=l. Copyright (c) 2002 Dan Williams <drw@handhelds.org> + .>+-= +_;:, .> :=|. This file is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software +- . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This file is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General +..}^=.= = ; 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. */ #ifndef CFG_H #define CFG_H #include <qstring.h> #include <qlist.h> #include <qstringlist.h> class Config; // --- Category --------------------------------------------------------------- class Category { @@ -55,32 +55,34 @@ class Category class CategoryList : public QList<Category> { public: // --- Constructor CategoryList(); }; // --- Cfg -------------------------------------------------------------------- class Cfg { public: // --- Constructor Cfg(); // --- members + bool getUseSmallFont() { return(_useSmallFont); } + void setUseSmallFont(bool n) { _useSmallFont=n; } bool getShowLocks() { return(_showLocks); } void setShowLocks(bool n) { _showLocks=n; } bool getShowBalances() { return(_showBalances); } void setShowBalances(bool n) { _showBalances=n; } QString &getCurrencySymbol() { return(_currencySymbol); } void setCurrencySymbol(QString n) {_currencySymbol= n; } void setCurrencySymbol(const char *n) { _currencySymbol=n; } QStringList &getAccountTypes() { return(_AccountTypes); } // --- Payees QStringList &getPayees() { return(_Payees); } bool getSavePayees() { return(_bSavePayees); } void setSavePayees(bool bSave) { _bSavePayees=bSave; } // --- Categories QStringList getCategories(); @@ -103,30 +105,31 @@ class Cfg // --- writes data to config file void writeConfig(Config &cfg); // --- dirty flag bool isDirty() { return(_bDirty); } void setDirty(bool bDirty) { _bDirty=bDirty; } protected: // --- reads list from config file static void readStringList(Config &cfg, const char *sKey, QStringList &lst); // --- writes list in configuration file static void writeStringList(Config &cfg, const char *sKey, QStringList &lst); private: QString _currencySymbol; + bool _useSmallFont; bool _showLocks; bool _showBalances; bool _openLastBook; bool _showLastTab; bool _bDirty; bool _bSavePayees; QString _sLastBook; QStringList _AccountTypes; CategoryList *_pCategories; QStringList _Payees; }; #endif diff --git a/noncore/apps/checkbook/checkbook.cpp b/noncore/apps/checkbook/checkbook.cpp index b325f45..1231f42 100644 --- a/noncore/apps/checkbook/checkbook.cpp +++ b/noncore/apps/checkbook/checkbook.cpp @@ -208,33 +208,36 @@ QWidget *Checkbook::initTransactions() layout->setMargin( 4 ); // Sort selector QLabel *label = new QLabel( tr( "Sort by:" ), control ); QWhatsThis::add( label, tr( "Select checkbook sorting here." ) ); layout->addMultiCellWidget( label, 0, 0, 0, 1 ); _cbSortType=new QComboBox( control ); _cbSortType->insertItem( tr("Entry Order") ); _cbSortType->insertItem( tr("Date") ); _cbSortType->insertItem( tr("Number") ); layout->addMultiCellWidget( _cbSortType, 0, 0, 1, 2 ); connect( _cbSortType, SIGNAL( activated(const QString&) ), this, SLOT( slotSortChanged(const QString&) ) ); // Table tranTable = new QListView( control ); QFont fnt(QPEApplication::font()); + if( _pCfg->getUseSmallFont() ) + { fnt.setPointSize( fnt.pointSize()-1 ); + } tranTable->setFont( fnt ); 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->setColumnWidthMode( COL_ID, QListView::Manual ); tranTable->setColumnWidth( COL_ID, 0); tranTable->addColumn( tr( "SortDate" ) ); tranTable->setColumnWidthMode( COL_SORTDATE, QListView::Manual ); tranTable->setColumnWidth( COL_SORTDATE, 0); tranTable->addColumn( tr( "Num" ) ); tranTable->addColumn( tr( "Date" ) ); //tranTable->addColumn( tr( "Cleared" ) ); tranTable->addColumn( tr( "Description" ) ); int column = tranTable->addColumn( tr( "Amount" ) ); tranTable->setColumnAlignment( column, Qt::AlignRight ); column=tranTable->addColumn( tr("Balance") ); tranTable->setColumnAlignment( column, Qt::AlignRight ); diff --git a/noncore/apps/checkbook/configuration.cpp b/noncore/apps/checkbook/configuration.cpp index 872d9b2..929c7c0 100644 --- a/noncore/apps/checkbook/configuration.cpp +++ b/noncore/apps/checkbook/configuration.cpp @@ -133,40 +133,46 @@ QWidget *Configuration::initSettings(Cfg &cfg) openLastBookCB->setMaximumHeight(fh+5); openLastBookCB->setChecked( cfg.isOpenLastBook() ); layout->addMultiCellWidget( openLastBookCB, 3, 3, 0, 1 ); lastTabCB = new QCheckBox( tr("Show last checkbook tab" ), container ); QWhatsThis::add( lastTabCB, tr("Click here to select whether the last tab in a checkbook should be displayed.") ); lastTabCB->setMaximumHeight(fh+5); lastTabCB->setChecked( cfg.isShowLastTab() ); layout->addMultiCellWidget( lastTabCB, 4, 4, 0, 1 ); savePayees = new QCheckBox( tr("Save new description as payee"), container ); QWhatsThis::add( savePayees, tr("Click here to save new descriptions in the list of payess.") ); savePayees->setMaximumHeight(fh+5); savePayees->setChecked( cfg.getSavePayees() ); layout->addMultiCellWidget( savePayees, 5, 5, 0, 1 ); + smallFontCB = new QCheckBox( tr( "Use smaller font for list" ), container ); + QWhatsThis::add( smallFontCB, tr( "Click here to select smaller font for transactions." ) ); + smallFontCB->setChecked( cfg.getUseSmallFont() ); + layout->addMultiCellWidget( smallFontCB, 6, 6, 0, 1 ); + return(control); } // --- saveConfig ------------------------------------------------------------- void Configuration::saveConfig(Cfg &cfg) { // Settings cfg.setCurrencySymbol( symbolEdit->text() ); + cfg.setUseSmallFont( smallFontCB->isChecked() ); cfg.setShowLocks( lockCB->isChecked() ); cfg.setShowBalances( balCB->isChecked() ); cfg.setOpenLastBook( openLastBookCB->isChecked() ); cfg.setShowLastTab( lastTabCB->isChecked() ); cfg.setSavePayees( savePayees->isChecked() ); // Typelist _listEditTypes->storeInList( cfg.getAccountTypes() ); // Category list QStringList lst; _listEditCategories->storeInList( lst ); cfg.setCategories( lst ); // Payees _listEditPayees->storeInList( cfg.getPayees() ); diff --git a/noncore/apps/checkbook/configuration.h b/noncore/apps/checkbook/configuration.h index 663514d..44c9717 100644 --- a/noncore/apps/checkbook/configuration.h +++ b/noncore/apps/checkbook/configuration.h @@ -35,32 +35,33 @@ class QCheckBox; class QLineEdit; class QString; class QTabWidget; class ListEdit; class Configuration : public QDialog { Q_OBJECT public: // Constructor Configuration( QWidget *, Cfg &cfg); ~Configuration(); QLineEdit *symbolEdit; + QCheckBox *smallFontCB; QCheckBox *lockCB; QCheckBox *balCB; QCheckBox *openLastBookCB; QCheckBox *lastTabCB; QCheckBox *savePayees; QTabWidget *_mainWidget; ListEdit *_listEditTypes; ListEdit *_listEditCategories; ListEdit *_listEditPayees; // saves settings in config struct void saveConfig(Cfg &cfg); protected: // creates settings tap from configuration QWidget *initSettings(Cfg &cfg); |