author | allenforsythe <allenforsythe> | 2003-05-15 10:54:55 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-15 10:54:55 (UTC) |
commit | 2e756a3677b9d4ef426f06beab7ba595c9878f4a (patch) (side-by-side diff) | |
tree | 0776c1d88c1188bb0ee3e84fc5115980275b26df | |
parent | 19be94085643ce40e35a58eb419eb6b51a02b8d1 (diff) | |
download | opie-2e756a3677b9d4ef426f06beab7ba595c9878f4a.zip opie-2e756a3677b9d4ef426f06beab7ba595c9878f4a.tar.gz opie-2e756a3677b9d4ef426f06beab7ba595c9878f4a.tar.bz2 |
Added limit transaction combobox to transaction prefs
-rwxr-xr-x | noncore/apps/qashmoney/preferencedialogs.cpp | 23 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferencedialogs.h | 6 | ||||
-rwxr-xr-x | noncore/apps/qashmoney/preferences.cpp | 8 |
3 files changed, 34 insertions, 3 deletions
diff --git a/noncore/apps/qashmoney/preferencedialogs.cpp b/noncore/apps/qashmoney/preferencedialogs.cpp index 3c2fb97..00d52c6 100755 --- a/noncore/apps/qashmoney/preferencedialogs.cpp +++ b/noncore/apps/qashmoney/preferencedialogs.cpp @@ -76,12 +76,24 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p showclearedtransactions = new QCheckBox ( this ); showclearedtransactions->setText ( "Show Cleared Transactions" ); excludetransfers = new QCheckBox ( this ); excludetransfers->setText ( "Include Transfers In Limit View" ); + limittransactionsbox = new QHBox ( this ); + limittransactionsbox->setSpacing ( 2 ); + limittransactionslabel = new QLabel ( "Limit All Transactions To", limittransactionsbox ); + limittransactions = new QComboBox ( limittransactionsbox ); + limittransactions->insertItem ( "14 days" ); + limittransactions->insertItem ( "30 days" ); + limittransactions->insertItem ( "60 days" ); + limittransactions->insertItem ( "90 days" ); + limittransactions->insertItem ( "180 days" ); + limittransactions->insertItem ( "365 days" ); + limittransactions->insertItem ( "All" ); + if ( preferences->getPreference ( 3 ) == 1 ) showclearedtransactions->setChecked ( TRUE ); else showclearedtransactions->setChecked ( FALSE ); if ( preferences->getPreference ( 6 ) == 1 ) @@ -92,23 +104,30 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this ); connect ( defaults, SIGNAL ( released () ), this, SLOT ( setDefaultTransactionPreferences () ) ); layout = new QVBoxLayout ( this, 2, 2 ); layout->addWidget ( showclearedtransactions ); layout->addWidget ( excludetransfers ); - layout->insertSpacing ( 2, 5 ); + layout->addWidget ( limittransactionsbox ); + layout->insertSpacing ( 3, 5 ); layout->addWidget ( defaults ); connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); + connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); } TransactionPreferences::~TransactionPreferences () { } +void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) + { + preferences->changePreference ( 7, pref ); + } + void TransactionPreferences::changeShowClearedPreference ( bool state ) { if ( state == TRUE ) preferences->changePreference ( 3, 1 ); else preferences->changePreference ( 3, 0 ); @@ -123,13 +142,15 @@ void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) } void TransactionPreferences::setDefaultTransactionPreferences () { preferences->changePreference ( 3, 0 ); preferences->changePreference ( 6, 0 ); + preferences->changePreference ( 7, 0 ); showclearedtransactions->setChecked ( FALSE ); + limittransactions->setCurrentItem ( 0 ); } // START ACCOUNT PREFERNCES AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE ) { diff --git a/noncore/apps/qashmoney/preferencedialogs.h b/noncore/apps/qashmoney/preferencedialogs.h index 97b2dbb..88281b8 100755 --- a/noncore/apps/qashmoney/preferencedialogs.h +++ b/noncore/apps/qashmoney/preferencedialogs.h @@ -3,12 +3,14 @@ #include <qpushbutton.h> #include <qpixmap.h> #include <qgroupbox.h> #include <qhbuttongroup.h> #include <qcheckbox.h> #include <qlayout.h> +#include <qlabel.h> +#include <qhbox.h> #ifndef DATEPREFERENCES_H #define DATEPREFERENCES_H class DatePreferences : public QDialog { @@ -41,21 +43,23 @@ class TransactionPreferences : public QDialog public: TransactionPreferences ( QWidget * parent ); ~TransactionPreferences(); QCheckBox *showclearedtransactions; QCheckBox *excludetransfers; - QString *limittransactionslabel; + QHBox *limittransactionsbox; + QLabel *limittransactionslabel; QComboBox *limittransactions; QPushButton *defaults; QBoxLayout *layout; public slots: void changeShowClearedPreference ( bool ); void changeExcludeTranfersPreference ( bool ); void setDefaultTransactionPreferences (); + void changeLimitTransactionsPreference ( int ); }; #endif #ifndef ACCOUNTPREFERENCES_H #define ACCOUNTPREFERENCES_H diff --git a/noncore/apps/qashmoney/preferences.cpp b/noncore/apps/qashmoney/preferences.cpp index 8783a47..819d5cf 100755 --- a/noncore/apps/qashmoney/preferences.cpp +++ b/noncore/apps/qashmoney/preferences.cpp @@ -19,13 +19,13 @@ void Preferences::addPreferences () // added to the database, the result is zero if it hasn't int rows = 0; int columns = 0; char **results; sqlite_get_table ( db, "select count() from preferences;", &results, 0, 0, 0 ); - if ( atoi ( results [ 1 ] ) != 6 ) + if ( atoi ( results [ 1 ] ) != 7 ) { // dateformat preference 1 = yyyymmdd 2 = yymmdd 3 = mmddyyyy 4 = mmddyy // 5 = yyyyddmm 6 = yyddmm 7 = ddmmyyyy 8 = ddmmyy sqlite_get_table ( db, "select preference from preferences where id = 1;", &results, &rows, &columns, 0 ); if ( rows == 0 ) sqlite_exec ( db, "insert into preferences values ( 4, 'dateformat', 0, 0, 0, NULL );", 0, 0, 0 ); @@ -56,12 +56,18 @@ void Preferences::addPreferences () // exclude transfers from limit view 0 = no 1 = yes rows = 0; sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 ); if ( rows == 0 ) sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); + + // limit number of transactions to 0 = 14 days 1 = 30 days, 2 = 60 days, 3 = 90 days, 4 = 180 days, 5 = 365 days, 6 = all + rows = 0; + sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 ); + if ( rows == 0 ) + sqlite_exec ( db, "insert into preferences values ( 0, 'limittransactions', 0, 0, 0, NULL );", 0, 0, 0 ); } } void Preferences::initializeColumnPreferences () { int rows = 0; |