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