summaryrefslogtreecommitdiff
path: root/noncore/unsupported/qashmoney/preferencedialogs.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/qashmoney/preferencedialogs.cpp') (more/less context) (ignore whitespace changes)
-rwxr-xr-xnoncore/unsupported/qashmoney/preferencedialogs.cpp216
1 files changed, 216 insertions, 0 deletions
diff --git a/noncore/unsupported/qashmoney/preferencedialogs.cpp b/noncore/unsupported/qashmoney/preferencedialogs.cpp
new file mode 100755
index 0000000..b83c957
--- a/dev/null
+++ b/noncore/unsupported/qashmoney/preferencedialogs.cpp
@@ -0,0 +1,216 @@
1#include "preferencedialogs.h"
2#include "preferences.h"
3
4extern Preferences *preferences;
5
6DatePreferences::DatePreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
7 {
8 setCaption( tr( "Date" ) );
9
10 QLabel *datelabel = new QLabel ( "Format", this );
11 dateformat = new QComboBox ( this );
12 dateformat->setEditable ( FALSE );
13 dateformat->insertItem ( "yyyymmdd" );
14 dateformat->insertItem ( "yymmdd" );
15 dateformat->insertItem ( "mmddyyyy" );
16 dateformat->insertItem ( "mmddyy" );
17 dateformat->insertItem ( "yyyyddmm" );
18 dateformat->insertItem ( "yyddmm" );
19 dateformat->insertItem ( "ddmmyyyy" );
20 dateformat->insertItem ( "ddmmyy" );
21 connect ( dateformat, SIGNAL ( activated(int) ), this, SLOT ( changeDateFormat(int) ) );
22
23 QLabel *dateseparatorlabel = new QLabel ( "Separator", this );
24 dateseparator = new QComboBox ( this );
25 dateseparator->insertItem ( "/" );
26 dateseparator->insertItem ( "-" );
27 dateseparator->insertItem ( "." );
28 connect ( dateseparator, SIGNAL ( activated(int) ), this, SLOT ( changeDateSeparator(int) ) );
29
30 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
31 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultDatePreferences() ) );
32
33 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
34 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
35
36 layout = new QVBoxLayout ( this, 2, 2 );
37 layout->addWidget ( datelabel );
38 layout->addWidget ( dateformat );
39 layout->addWidget ( dateseparatorlabel );
40 layout->addWidget ( dateseparator );
41 layout->insertSpacing ( 4, 5 );
42 layout->addWidget ( defaults );
43
44 }
45
46DatePreferences::~DatePreferences ()
47 {
48 }
49
50void DatePreferences::changeDateFormat ( int index )
51 {
52 index ++;
53 preferences->changePreference ( 1, index );
54 }
55
56void DatePreferences::changeDateSeparator ( int index )
57 {
58 index ++;
59 preferences->changePreference ( 2, index );
60 }
61
62void DatePreferences::setDefaultDatePreferences ()
63 {
64 preferences->setDefaultDatePreferences ();
65 dateformat->setCurrentItem ( ( preferences->getPreference ( 1 ) ) - 1 );
66 dateseparator->setCurrentItem ( ( preferences->getPreference ( 2 ) ) - 1 );
67 }
68
69// START TRANSACTION PREFERENCES
70
71TransactionPreferences::TransactionPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
72{
73 setCaption( tr ( "Transaction" ) );
74
75 showclearedtransactions = new QCheckBox ( this );
76 showclearedtransactions->setText ( "Show Cleared Transactions" );
77
78 limittransactionsbox = new QHBox ( this );
79 limittransactionsbox->setSpacing ( 2 );
80 limittransactionslabel = new QLabel ( "Show ", limittransactionsbox );
81 limittransactions = new QComboBox ( limittransactionsbox );
82 QLabel *limittransactionslabel2 = new QLabel ( "of cleared transactions. ", limittransactionsbox );
83 limittransactions->insertItem ( "14 days" );
84 limittransactions->insertItem ( "30 days" );
85 limittransactions->insertItem ( "90 days" );
86 limittransactions->insertItem ( "180 days" );
87 limittransactions->insertItem ( "365 days" );
88 limittransactions->insertItem ( "All" );
89 limittransactions->setCurrentItem ( preferences->getPreference ( 7 ) );
90
91 excludetransfers = new QCheckBox ( this );
92 excludetransfers->setText ( "Include Transfers In Limit View" );
93
94 if ( preferences->getPreference ( 3 ) == 1 )
95 showclearedtransactions->setChecked ( TRUE );
96 else
97 showclearedtransactions->setChecked ( FALSE );
98
99 if ( preferences->getPreference ( 6 ) == 1 )
100 excludetransfers->setChecked ( TRUE );
101 else
102 excludetransfers->setChecked ( FALSE );
103
104 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
105 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultTransactionPreferences() ) );
106
107 layout = new QVBoxLayout ( this, 2, 2 );
108 layout->addWidget ( showclearedtransactions );
109 layout->addWidget ( limittransactionsbox );
110 layout->addWidget ( excludetransfers );
111 layout->insertSpacing ( 3, 5 );
112 layout->addWidget ( defaults );
113
114 connect ( showclearedtransactions, SIGNAL ( toggled(bool) ), this, SLOT ( changeShowClearedPreference(bool) ) );
115 connect ( excludetransfers, SIGNAL ( toggled(bool) ), this, SLOT ( changeExcludeTranfersPreference(bool) ) );
116 connect ( limittransactions, SIGNAL ( activated(int) ), this, SLOT ( changeLimitTransactionsPreference(int) ) );
117}
118
119TransactionPreferences::~TransactionPreferences ()
120 {
121 }
122
123void TransactionPreferences::changeLimitTransactionsPreference ( int pref )
124 {
125 preferences->changePreference ( 7, pref );
126 }
127
128void TransactionPreferences::changeShowClearedPreference ( bool state )
129 {
130 if ( state == TRUE )
131 preferences->changePreference ( 3, 1 );
132 else
133 preferences->changePreference ( 3, 0 );
134 }
135
136void TransactionPreferences::changeExcludeTranfersPreference ( bool state )
137 {
138 if ( state == TRUE )
139 preferences->changePreference ( 6, 1 );
140 else
141 preferences->changePreference ( 6, 0 );
142 }
143
144void TransactionPreferences::setDefaultTransactionPreferences ()
145 {
146 preferences->changePreference ( 3, 0 );
147 preferences->changePreference ( 6, 0 );
148 preferences->changePreference ( 7, 0 );
149 showclearedtransactions->setChecked ( FALSE );
150 limittransactions->setCurrentItem ( 0 );
151 }
152
153// START ACCOUNT PREFERNCES
154
155AccountPreferences::AccountPreferences ( QWidget* parent ) : QDialog ( parent, 0, TRUE )
156{
157
158 setCaption( tr ( "Account" ) );
159
160 currencysupport = new QCheckBox ( this );
161 currencysupport->setText ( "Enable Currency Support" );
162
163 onetouch = new QCheckBox ( this );
164 onetouch->setText ( "One Touch Account Viewing" );
165
166 if ( preferences->getPreference ( 4 ) == 1 )
167 currencysupport->setChecked ( TRUE );
168 else
169 currencysupport->setChecked ( FALSE );
170
171 if ( preferences->getPreference ( 5 ) == 1 )
172 onetouch->setChecked ( TRUE );
173 else
174 onetouch->setChecked ( FALSE );
175
176 defaults = new QPushButton ( QPixmap ( "/opt/QtPalmtop/pics/defaults.png" ), "Defaults", this );
177 connect ( defaults, SIGNAL ( released() ), this, SLOT ( setDefaultAccountPreferences() ) );
178
179 layout = new QVBoxLayout ( this, 2, 2 );
180 layout->addWidget ( currencysupport );
181 layout->addWidget ( onetouch );
182 layout->insertSpacing ( 2, 5 );
183 layout->addWidget ( defaults );
184
185 connect ( currencysupport, SIGNAL ( toggled(bool) ), this, SLOT ( changeCurrencySupport(bool) ) );
186 connect ( onetouch, SIGNAL ( toggled(bool) ), this, SLOT ( changeOneTouchViewing(bool) ) );
187}
188
189AccountPreferences::~AccountPreferences ()
190 {
191 }
192
193void AccountPreferences::changeCurrencySupport ( bool state )
194 {
195 if ( state == TRUE )
196 preferences->changePreference ( 4, 1 );
197 else
198 preferences->changePreference ( 4, 0 );
199 }
200
201void AccountPreferences::changeOneTouchViewing ( bool state )
202 {
203 if ( state == TRUE )
204 preferences->changePreference ( 5, 1 );
205 else
206 preferences->changePreference ( 5, 0 );
207 }
208
209void AccountPreferences::setDefaultAccountPreferences ()
210 {
211 preferences->changePreference ( 4, 0 );
212 preferences->changePreference ( 5, 0 );
213 currencysupport->setChecked ( FALSE );
214 onetouch->setChecked ( FALSE );
215 }
216