author | allenforsythe <allenforsythe> | 2003-05-15 10:54:55 (UTC) |
---|---|---|
committer | allenforsythe <allenforsythe> | 2003-05-15 10:54:55 (UTC) |
commit | 2e756a3677b9d4ef426f06beab7ba595c9878f4a (patch) (unidiff) | |
tree | 0776c1d88c1188bb0ee3e84fc5115980275b26df /noncore/apps/qashmoney | |
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 | |||
@@ -78,8 +78,20 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p | |||
78 | 78 | ||
79 | excludetransfers = new QCheckBox ( this ); | 79 | excludetransfers = new QCheckBox ( this ); |
80 | excludetransfers->setText ( "Include Transfers In Limit View" ); | 80 | excludetransfers->setText ( "Include Transfers In Limit View" ); |
81 | 81 | ||
82 | limittransactionsbox = new QHBox ( this ); | ||
83 | limittransactionsbox->setSpacing ( 2 ); | ||
84 | limittransactionslabel = new QLabel ( "Limit All Transactions To", limittransactionsbox ); | ||
85 | limittransactions = new QComboBox ( limittransactionsbox ); | ||
86 | limittransactions->insertItem ( "14 days" ); | ||
87 | limittransactions->insertItem ( "30 days" ); | ||
88 | limittransactions->insertItem ( "60 days" ); | ||
89 | limittransactions->insertItem ( "90 days" ); | ||
90 | limittransactions->insertItem ( "180 days" ); | ||
91 | limittransactions->insertItem ( "365 days" ); | ||
92 | limittransactions->insertItem ( "All" ); | ||
93 | |||
82 | if ( preferences->getPreference ( 3 ) == 1 ) | 94 | if ( preferences->getPreference ( 3 ) == 1 ) |
83 | showclearedtransactions->setChecked ( TRUE ); | 95 | showclearedtransactions->setChecked ( TRUE ); |
84 | else | 96 | else |
85 | showclearedtransactions->setChecked ( FALSE ); | 97 | showclearedtransactions->setChecked ( FALSE ); |
@@ -94,19 +106,26 @@ TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( p | |||
94 | 106 | ||
95 | layout = new QVBoxLayout ( this, 2, 2 ); | 107 | layout = new QVBoxLayout ( this, 2, 2 ); |
96 | layout->addWidget ( showclearedtransactions ); | 108 | layout->addWidget ( showclearedtransactions ); |
97 | layout->addWidget ( excludetransfers ); | 109 | layout->addWidget ( excludetransfers ); |
98 | layout->insertSpacing ( 2, 5 ); | 110 | layout->addWidget ( limittransactionsbox ); |
111 | layout->insertSpacing ( 3, 5 ); | ||
99 | layout->addWidget ( defaults ); | 112 | layout->addWidget ( defaults ); |
100 | 113 | ||
101 | connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); | 114 | connect ( showclearedtransactions, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeShowClearedPreference ( bool ) ) ); |
102 | connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); | 115 | connect ( excludetransfers, SIGNAL ( toggled ( bool ) ), this, SLOT ( changeExcludeTranfersPreference ( bool ) ) ); |
116 | connect ( limittransactions, SIGNAL ( activated ( int ) ), this, SLOT ( changeLimitTransactionsPreference ( int ) ) ); | ||
103 | } | 117 | } |
104 | 118 | ||
105 | TransactionPreferences::~TransactionPreferences () | 119 | TransactionPreferences::~TransactionPreferences () |
106 | { | 120 | { |
107 | } | 121 | } |
108 | 122 | ||
123 | void TransactionPreferences::changeLimitTransactionsPreference ( int pref ) | ||
124 | { | ||
125 | preferences->changePreference ( 7, pref ); | ||
126 | } | ||
127 | |||
109 | void TransactionPreferences::changeShowClearedPreference ( bool state ) | 128 | void TransactionPreferences::changeShowClearedPreference ( bool state ) |
110 | { | 129 | { |
111 | if ( state == TRUE ) | 130 | if ( state == TRUE ) |
112 | preferences->changePreference ( 3, 1 ); | 131 | preferences->changePreference ( 3, 1 ); |
@@ -125,9 +144,11 @@ void TransactionPreferences::changeExcludeTranfersPreference ( bool state ) | |||
125 | void TransactionPreferences::setDefaultTransactionPreferences () | 144 | void TransactionPreferences::setDefaultTransactionPreferences () |
126 | { | 145 | { |
127 | preferences->changePreference ( 3, 0 ); | 146 | preferences->changePreference ( 3, 0 ); |
128 | preferences->changePreference ( 6, 0 ); | 147 | preferences->changePreference ( 6, 0 ); |
148 | preferences->changePreference ( 7, 0 ); | ||
129 | showclearedtransactions->setChecked ( FALSE ); | 149 | showclearedtransactions->setChecked ( FALSE ); |
150 | limittransactions->setCurrentItem ( 0 ); | ||
130 | } | 151 | } |
131 | 152 | ||
132 | // START ACCOUNT PREFERNCES | 153 | // START ACCOUNT PREFERNCES |
133 | 154 | ||
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 | |||
@@ -5,8 +5,10 @@ | |||
5 | #include <qgroupbox.h> | 5 | #include <qgroupbox.h> |
6 | #include <qhbuttongroup.h> | 6 | #include <qhbuttongroup.h> |
7 | #include <qcheckbox.h> | 7 | #include <qcheckbox.h> |
8 | #include <qlayout.h> | 8 | #include <qlayout.h> |
9 | #include <qlabel.h> | ||
10 | #include <qhbox.h> | ||
9 | 11 | ||
10 | #ifndef DATEPREFERENCES_H | 12 | #ifndef DATEPREFERENCES_H |
11 | #define DATEPREFERENCES_H | 13 | #define DATEPREFERENCES_H |
12 | 14 | ||
@@ -43,17 +45,19 @@ class TransactionPreferences : public QDialog | |||
43 | ~TransactionPreferences(); | 45 | ~TransactionPreferences(); |
44 | 46 | ||
45 | QCheckBox *showclearedtransactions; | 47 | QCheckBox *showclearedtransactions; |
46 | QCheckBox *excludetransfers; | 48 | QCheckBox *excludetransfers; |
47 | QString *limittransactionslabel; | 49 | QHBox *limittransactionsbox; |
50 | QLabel *limittransactionslabel; | ||
48 | QComboBox *limittransactions; | 51 | QComboBox *limittransactions; |
49 | QPushButton *defaults; | 52 | QPushButton *defaults; |
50 | QBoxLayout *layout; | 53 | QBoxLayout *layout; |
51 | 54 | ||
52 | public slots: | 55 | public slots: |
53 | void changeShowClearedPreference ( bool ); | 56 | void changeShowClearedPreference ( bool ); |
54 | void changeExcludeTranfersPreference ( bool ); | 57 | void changeExcludeTranfersPreference ( bool ); |
55 | void setDefaultTransactionPreferences (); | 58 | void setDefaultTransactionPreferences (); |
59 | void changeLimitTransactionsPreference ( int ); | ||
56 | }; | 60 | }; |
57 | 61 | ||
58 | #endif | 62 | #endif |
59 | 63 | ||
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 | |||
@@ -21,9 +21,9 @@ void Preferences::addPreferences () | |||
21 | int columns = 0; | 21 | int columns = 0; |
22 | char **results; | 22 | char **results; |
23 | 23 | ||
24 | sqlite_get_table ( db, "select count() from preferences;", &results, 0, 0, 0 ); | 24 | sqlite_get_table ( db, "select count() from preferences;", &results, 0, 0, 0 ); |
25 | if ( atoi ( results [ 1 ] ) != 6 ) | 25 | if ( atoi ( results [ 1 ] ) != 7 ) |
26 | { | 26 | { |
27 | // dateformat preference 1 = yyyymmdd 2 = yymmdd 3 = mmddyyyy 4 = mmddyy | 27 | // dateformat preference 1 = yyyymmdd 2 = yymmdd 3 = mmddyyyy 4 = mmddyy |
28 | // 5 = yyyyddmm 6 = yyddmm 7 = ddmmyyyy 8 = ddmmyy | 28 | // 5 = yyyyddmm 6 = yyddmm 7 = ddmmyyyy 8 = ddmmyy |
29 | sqlite_get_table ( db, "select preference from preferences where id = 1;", &results, &rows, &columns, 0 ); | 29 | sqlite_get_table ( db, "select preference from preferences where id = 1;", &results, &rows, &columns, 0 ); |
@@ -58,8 +58,14 @@ void Preferences::addPreferences () | |||
58 | rows = 0; | 58 | rows = 0; |
59 | sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 ); | 59 | sqlite_get_table ( db, "select preference from preferences where id = 6;", &results, &rows, &columns, 0 ); |
60 | if ( rows == 0 ) | 60 | if ( rows == 0 ) |
61 | sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); | 61 | sqlite_exec ( db, "insert into preferences values ( 0, 'excludetransfersfromlimit', 0, 0, 0, NULL );", 0, 0, 0 ); |
62 | |||
63 | // 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 | ||
64 | rows = 0; | ||
65 | sqlite_get_table ( db, "select preference from preferences where id = 7;", &results, &rows, &columns, 0 ); | ||
66 | if ( rows == 0 ) | ||
67 | sqlite_exec ( db, "insert into preferences values ( 0, 'limittransactions', 0, 0, 0, NULL );", 0, 0, 0 ); | ||
62 | } | 68 | } |
63 | } | 69 | } |
64 | 70 | ||
65 | void Preferences::initializeColumnPreferences () | 71 | void Preferences::initializeColumnPreferences () |