-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 @@ -81,2 +81,14 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p + 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 ) @@ -97,3 +109,4 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p layout->addWidget ( excludetransfers ); - layout->insertSpacing ( 2, 5 ); + layout->addWidget ( limittransactionsbox ); + layout->insertSpacing ( 3, 5 ); layout->addWidget ( defaults ); @@ -102,2 +115,3 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); + connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); } @@ -108,2 +122,7 @@ TransactionPreferences::~TransactionPreferences () +void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) + { + preferences->changePreference ( 7, pref ); + } + void TransactionPreferences::changeShowClearedPreference ( bool state ) @@ -128,3 +147,5 @@ void TransactionPreferences::setDefaultTransactionPreferences () preferences->changePreference ( 6, 0 ); + preferences->changePreference ( 7, 0 ); showclearedtransactions->setChecked ( FALSE ); + limittransactions->setCurrentItem ( 0 ); } 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 @@ -8,2 +8,4 @@ #include <qlayout.h> +#include <qlabel.h> +#include <qhbox.h> @@ -46,3 +48,4 @@ class TransactionPreferences : public QDialog QCheckBox *excludetransfers; - QString *limittransactionslabel; + QHBox *limittransactionsbox; + QLabel *limittransactionslabel; QComboBox *limittransactions; @@ -55,2 +58,3 @@ class TransactionPreferences : public QDialog void setDefaultTransactionPreferences (); + void changeLimitTransactionsPreference ( int ); }; 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 @@ -24,3 +24,3 @@ void Preferences::addPreferences () sqlite_get_table ( db, "select count() from preferences;", &results, 0, 0, 0 ); - if ( atoi ( results [ 1 ] ) != 6 ) + if ( atoi ( results [ 1 ] ) != 7 ) { @@ -61,2 +61,8 @@ void Preferences::addPreferences () 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 ); } |