author | mickeyl <mickeyl> | 2003-10-30 13:18:08 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-10-30 13:18:08 (UTC) |
commit | 37414f207b147af4cf6778b323a0aa23127901bd (patch) (side-by-side diff) | |
tree | b08c10043ab689b0a40425d268cd72226799b0cf /noncore/apps/checkbook/cfg.cpp | |
parent | d53637f46cf217fc760d7aac58b4596843a73803 (diff) | |
download | opie-37414f207b147af4cf6778b323a0aa23127901bd.zip opie-37414f207b147af4cf6778b323a0aa23127901bd.tar.gz opie-37414f207b147af4cf6778b323a0aa23127901bd.tar.bz2 |
apply patch to HEAD
Diffstat (limited to 'noncore/apps/checkbook/cfg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/checkbook/cfg.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/noncore/apps/checkbook/cfg.cpp b/noncore/apps/checkbook/cfg.cpp index 1e0ec5c..0d5d9ed 100644 --- a/noncore/apps/checkbook/cfg.cpp +++ b/noncore/apps/checkbook/cfg.cpp @@ -34,35 +34,34 @@ #include <qpe/resource.h> #include <qpe/config.h> #include "cfg.h" // --- Cfg -------------------------------------------------------------------- Cfg::Cfg() { _currencySymbol="$"; _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) { -qDebug( "%s", sKey ); - QString sEntry; int iCount; // read count of elements sEntry.sprintf("%s_Count", sKey); iCount=cfg.readNumEntry(sEntry, 0); // read entries for(int i=1; i<=iCount; i++) { sEntry.sprintf("%s%d", sKey, i); QString sType=cfg.readEntry(sEntry); if( sType!=NULL ) @@ -77,38 +76,42 @@ qDebug( "%s", sKey ); void Cfg::readConfig(Config &config) { // set group config.setGroup( "Config" ); // read scalars _currencySymbol = config.readEntry( "CurrencySymbol", "$" ); _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"); writeStringList(config, "AccType", _AccountTypes); config.write(); } + // Payees + readStringList(config, "Payee", _Payees); + // Read Categories QStringList lst; readStringList(config, "Category", lst); if( lst.isEmpty() ) { QString type=QWidget::tr("Expense"); lst += QWidget::tr( "Automobile" )+";"+type; lst += QWidget::tr( "Bills" )+";"+type; lst += QWidget::tr( "CDs" )+";"+type; lst += QWidget::tr( "Clothing" )+";"+type; lst += QWidget::tr( "Computer" )+";"+type; lst += QWidget::tr( "DVDs" )+";"+type; lst += QWidget::tr( "Electronics" )+";"+type; @@ -122,24 +125,27 @@ void Cfg::readConfig(Config &config) type=QWidget::tr( "Income" ); lst += QWidget::tr( "Work" )+";"+type; lst += QWidget::tr( "Family Member" )+";"+type; lst += QWidget::tr( "Misc. Credit" )+";"+type; setCategories(lst); writeStringList(config, "Category", lst); config.write(); } else { setCategories(lst); } + + // not dirty + _bDirty=false; } // --- writeStringList -------------------------------------------------------- // Writes the entries in the control in a configuration file. It is assumed, // that the group is already set. Key is used to enumerate the entries void Cfg::writeStringList(Config &cfg, const char *sKey, QStringList &lst) { QString sEntry; int iCount=0; QStringList::Iterator itr; for(itr=lst.begin(); itr!=lst.end(); itr++) { @@ -157,34 +163,39 @@ void Cfg::writeStringList(Config &cfg, const char *sKey, QStringList &lst) void Cfg::writeConfig(Config &config) { // set the group config.setGroup( "Config" ); // write scalars config.writeEntry( "CurrencySymbol", _currencySymbol ); 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 ); // commit write config.write(); + _bDirty=false; } // --- getCategories ---------------------------------------------------------- QStringList Cfg::getCategories() { QStringList ret; for(Category *itr=_pCategories->first(); itr; itr=_pCategories->next() ) { QString sEntry; sEntry.sprintf("%s;%s", (const char *)itr->getName(), (const char *)(itr->isIncome() ? QWidget::tr("Income") : QWidget::tr("Expense")) ); ret.append(sEntry); } |