-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index 9576579..10bc611 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -1,367 +1,367 @@ | |||
1 | /* | 1 | /* |
2 | * TODO | 2 | * TODO |
3 | * make a font selection thing (size too) | 3 | * make a font selection thing (size too) |
4 | * make a cursor thing | 4 | * make a cursor thing |
5 | * add meta key support for german, etc | 5 | * add meta key support for german, etc |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <iostream.h> | 11 | #include <iostream.h> |
12 | 12 | ||
13 | #include <qpe/qpeapplication.h> | 13 | #include <qpe/qpeapplication.h> |
14 | #include <qpe/config.h> | 14 | #include <qpe/config.h> |
15 | 15 | ||
16 | #include <qwidget.h> | 16 | #include <qwidget.h> |
17 | #include <qdialog.h> | 17 | #include <qdialog.h> |
18 | #include <qtabwidget.h> | 18 | #include <qtabwidget.h> |
19 | #include <qvbox.h> | 19 | #include <qvbox.h> |
20 | #include <qgrid.h> | 20 | #include <qgrid.h> |
21 | #include <qgroupbox.h> | 21 | #include <qgroupbox.h> |
22 | #include <qlabel.h> | 22 | #include <qlabel.h> |
23 | #include <qcheckbox.h> | 23 | #include <qcheckbox.h> |
24 | #include <qsizepolicy.h> | 24 | #include <qsizepolicy.h> |
25 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
26 | #include <qlistbox.h> | 26 | #include <qlistbox.h> |
27 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
28 | #include <opie/ofiledialog.h> | 28 | #include <opie/ofiledialog.h> |
29 | #include <opie/colordialog.h> | 29 | #include <opie/colordialog.h> |
30 | #include <qdir.h> | 30 | #include <qdir.h> |
31 | #include <qfileinfo.h> | 31 | #include <qfileinfo.h> |
32 | #include "configdlg.h" | 32 | #include "configdlg.h" |
33 | #include "keyboard.h" | 33 | #include "keyboard.h" |
34 | 34 | ||
35 | // ConfigDlg::ConfigDlg() {{{1 | 35 | // ConfigDlg::ConfigDlg() {{{1 |
36 | ConfigDlg::ConfigDlg () : QTabWidget () | 36 | ConfigDlg::ConfigDlg () : QTabWidget () |
37 | { | 37 | { |
38 | setCaption( tr("Multikey Configuration") ); | 38 | setCaption( tr("Multikey Configuration") ); |
39 | Config config ("multikey"); | 39 | Config config ("multikey"); |
40 | config.setGroup("keymaps"); | 40 | config.setGroup("keymaps"); |
41 | QString current_map = config.readEntry("current", 0); | 41 | QString current_map = config.readEntry("current", 0); |
42 | 42 | ||
43 | /* | 43 | /* |
44 | * 'general config' tab | 44 | * 'general config' tab |
45 | */ | 45 | */ |
46 | 46 | ||
47 | QVBox *gen_box = new QVBox (this); | 47 | QVBox *gen_box = new QVBox (this); |
48 | gen_box->setMargin(3); | 48 | gen_box->setMargin(3); |
49 | addTab(gen_box, tr("General Settings")); | 49 | addTab(gen_box, tr("General Settings")); |
50 | 50 | ||
51 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); | 51 | QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); |
52 | 52 | ||
53 | keymaps = new QListBox (map_group); | 53 | keymaps = new QListBox (map_group); |
54 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 54 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
55 | 55 | ||
56 | QString cur(tr("Current Language")); | 56 | QString cur(tr("Current Language")); |
57 | keymaps->insertItem(cur); | 57 | keymaps->insertItem(cur); |
58 | keymaps->setSelected(0, true); | 58 | keymaps->setSelected(0, true); |
59 | 59 | ||
60 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); | 60 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); |
61 | default_maps = map_dir.entryList(); // so i can access it in other places | 61 | default_maps = map_dir.entryList(); // so i can access it in other places |
62 | 62 | ||
63 | for (uint i = 0; i <map_dir.count(); i++) { | 63 | for (uint i = 0; i <map_dir.count(); i++) { |
64 | 64 | ||
65 | keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); | 65 | keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); |
66 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { | 66 | if (map_dir.absPath() + "/" + map_dir[i] == current_map) { |
67 | 67 | ||
68 | keymaps->setSelected(i + 1, true); | 68 | keymaps->setSelected(i + 1, true); |
69 | } | 69 | } |
70 | 70 | ||
71 | } | 71 | } |
72 | 72 | ||
73 | custom_maps = config.readListEntry("maps", QChar('|')); | 73 | custom_maps = config.readListEntry("maps", QChar('|')); |
74 | 74 | ||
75 | for (uint i = 0; i < custom_maps.count(); i++) { | 75 | for (uint i = 0; i < custom_maps.count(); i++) { |
76 | 76 | ||
77 | if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false) | 77 | if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false) |
78 | || !QFile::exists(custom_maps[i])) { | 78 | || !QFile::exists(custom_maps[i])) { |
79 | 79 | ||
80 | custom_maps.remove(custom_maps.at(i)); | 80 | custom_maps.remove(custom_maps.at(i)); |
81 | 81 | ||
82 | // remove it from the list too | 82 | // remove it from the list too |
83 | config.writeEntry("maps", custom_maps.join("|")); | 83 | config.writeEntry("maps", custom_maps.join("|")); |
84 | 84 | ||
85 | 85 | ||
86 | } else { | 86 | } else { |
87 | 87 | ||
88 | keymaps->insertItem(custom_maps[i]); | 88 | keymaps->insertItem(custom_maps[i]); |
89 | if (custom_maps[i] == current_map) { | 89 | if (custom_maps[i] == current_map) { |
90 | 90 | ||
91 | keymaps->setSelected(map_dir.count() + i + 1, true); | 91 | keymaps->setSelected(map_dir.count() + i + 1, true); |
92 | } | 92 | } |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | // have to "+1" because the "current language" listItem... remember? | 96 | // have to "+1" because the "current language" listItem... remember? |
97 | 97 | ||
98 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); | 98 | connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); |
99 | 99 | ||
100 | 100 | ||
101 | QGrid *add_remove_grid = new QGrid(2, map_group); | 101 | QGrid *add_remove_grid = new QGrid(2, map_group); |
102 | add_remove_grid->setMargin(3); | 102 | add_remove_grid->setMargin(3); |
103 | add_remove_grid->setSpacing(3); | 103 | add_remove_grid->setSpacing(3); |
104 | 104 | ||
105 | add_button = new QPushButton(tr("Add"), add_remove_grid); | 105 | add_button = new QPushButton(tr("Add"), add_remove_grid); |
106 | add_button->setFlat((bool)1); | 106 | add_button->setFlat((bool)1); |
107 | connect(add_button, SIGNAL(clicked()), SLOT(addMap())); | 107 | connect(add_button, SIGNAL(clicked()), SLOT(addMap())); |
108 | 108 | ||
109 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); | 109 | remove_button = new QPushButton(tr("Remove"), add_remove_grid); |
110 | remove_button->setFlat((bool)1); | 110 | remove_button->setFlat((bool)1); |
111 | if ((int)map_dir.count() >= keymaps->currentItem()) | 111 | if ((int)map_dir.count() >= keymaps->currentItem()) |
112 | remove_button->setDisabled(true); | 112 | remove_button->setDisabled(true); |
113 | connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); | 113 | connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); |
114 | 114 | ||
115 | // make a box that will contain the buttons on the bottom | 115 | // make a box that will contain the buttons on the bottom |
116 | QGrid *other_grid = new QGrid(2, gen_box); | 116 | QGrid *other_grid = new QGrid(2, gen_box); |
117 | pick_button = new QCheckBox(tr("Pickboard"), other_grid); | 117 | pick_button = new QCheckBox(tr("Pickboard"), other_grid); |
118 | 118 | ||
119 | config.setGroup ("general"); | 119 | config.setGroup ("general"); |
120 | bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed | 120 | bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed |
121 | if (pick_open) { | 121 | if (pick_open) { |
122 | 122 | ||
123 | pick_button->setChecked(true); | 123 | pick_button->setChecked(true); |
124 | } | 124 | } |
125 | 125 | ||
126 | // by connecting it after checking it, the signal isn't emmited | 126 | // by connecting it after checking it, the signal isn't emmited |
127 | connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); | 127 | connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); |
128 | 128 | ||
129 | repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); | 129 | repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); |
130 | bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1); | 130 | bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1); |
131 | 131 | ||
132 | if (repeat_on) { | 132 | if (repeat_on) { |
133 | 133 | ||
134 | repeat_button->setChecked(true); | 134 | repeat_button->setChecked(true); |
135 | } | 135 | } |
136 | connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog())); | 136 | connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog())); |
137 | 137 | ||
138 | 138 | ||
139 | /* | 139 | /* |
140 | * 'color' tab | 140 | * 'color' tab |
141 | */ | 141 | */ |
142 | 142 | ||
143 | QGrid *color_box = new QGrid(2, this); | 143 | QGrid *color_box = new QGrid(2, this); |
144 | color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); | 144 | color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); |
145 | color_box->setMargin(3); | 145 | color_box->setMargin(3); |
146 | color_box->setSpacing(3); | 146 | color_box->setSpacing(3); |
147 | addTab(color_box, tr("Colors")); | 147 | addTab(color_box, tr("Colors")); |
148 | 148 | ||
149 | QLabel *label; | 149 | QLabel *label; |
150 | QStringList color; | 150 | QStringList color; |
151 | config.setGroup("colors"); | 151 | config.setGroup("colors"); |
152 | 152 | ||
153 | label = new QLabel(tr("Key Color"), color_box); | 153 | label = new QLabel(tr("Key Color"), color_box); |
154 | keycolor_button = new QPushButton(color_box); | 154 | keycolor_button = new QPushButton(color_box); |
155 | connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); | 155 | connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); |
156 | keycolor_button->setFlat((bool)1); | 156 | keycolor_button->setFlat((bool)1); |
157 | color = config.readListEntry("keycolor", QChar(',')); | 157 | color = config.readListEntry("keycolor", QChar(',')); |
158 | /* | 158 | /* |
159 | * hopefully not required | 159 | * hopefully not required |
160 | 160 | ||
161 | if (color.isEmpty()) { | 161 | if (color.isEmpty()) { |
162 | color = QStringList::split(",", "240,240,240"); | 162 | color = QStringList::split(",", "240,240,240"); |
163 | config.writeEntry("keycolor", color.join(",")); | 163 | config.writeEntry("keycolor", color.join(",")); |
164 | 164 | ||
165 | } | 165 | } |
166 | */ | 166 | */ |
167 | keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); | 167 | keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); |
168 | 168 | ||
169 | 169 | ||
170 | label = new QLabel(tr("Key Pressed Color"), color_box); | 170 | label = new QLabel(tr("Key Pressed Color"), color_box); |
171 | keycolor_pressed_button = new QPushButton(color_box); | 171 | keycolor_pressed_button = new QPushButton(color_box); |
172 | connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); | 172 | connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); |
173 | keycolor_pressed_button->setFlat((bool)1); | 173 | keycolor_pressed_button->setFlat((bool)1); |
174 | color = config.readListEntry("keycolor_pressed", QChar(',')); | 174 | color = config.readListEntry("keycolor_pressed", QChar(',')); |
175 | keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); | 175 | keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); |
176 | 176 | ||
177 | label = new QLabel(tr("Line Color"), color_box); | 177 | label = new QLabel(tr("Line Color"), color_box); |
178 | keycolor_lines_button = new QPushButton(color_box); | 178 | keycolor_lines_button = new QPushButton(color_box); |
179 | connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); | 179 | connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); |
180 | keycolor_lines_button->setFlat((bool)1); | 180 | keycolor_lines_button->setFlat((bool)1); |
181 | color = config.readListEntry("keycolor_lines", QChar(',')); | 181 | color = config.readListEntry("keycolor_lines", QChar(',')); |
182 | keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); | 182 | keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); |
183 | 183 | ||
184 | 184 | ||
185 | label = new QLabel(tr("Text Color"), color_box); | 185 | label = new QLabel(tr("Text Color"), color_box); |
186 | textcolor_button = new QPushButton(color_box); | 186 | textcolor_button = new QPushButton(color_box); |
187 | connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); | 187 | connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); |
188 | textcolor_button->setFlat((bool)1); | 188 | textcolor_button->setFlat((bool)1); |
189 | color = config.readListEntry("textcolor", QChar(',')); | 189 | color = config.readListEntry("textcolor", QChar(',')); |
190 | textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); | 190 | textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); |
191 | 191 | ||
192 | 192 | ||
193 | label = new QLabel("", color_box); // a spacer so the above buttons dont expand | 193 | label = new QLabel("", color_box); // a spacer so the above buttons dont expand |
194 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 194 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
195 | 195 | ||
196 | } | 196 | } |
197 | 197 | ||
198 | void ConfigDlg::pickTog() { | 198 | void ConfigDlg::pickTog() { |
199 | 199 | ||
200 | Config config ("multikey"); | 200 | Config config ("multikey"); |
201 | config.setGroup ("general"); | 201 | config.setGroup ("general"); |
202 | config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed | 202 | config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed |
203 | 203 | ||
204 | emit pickboardToggled(pick_button->isChecked()); | 204 | emit pickboardToggled(pick_button->isChecked()); |
205 | } | 205 | } |
206 | 206 | ||
207 | void ConfigDlg::repeatTog() { | 207 | void ConfigDlg::repeatTog() { |
208 | 208 | ||
209 | Config config ("multikey"); | 209 | Config config ("multikey"); |
210 | config.setGroup ("general"); | 210 | config.setGroup ("general"); |
211 | config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed | 211 | config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed |
212 | 212 | ||
213 | emit repeatToggled(repeat_button->isChecked()); | 213 | emit repeatToggled(repeat_button->isChecked()); |
214 | } | 214 | } |
215 | 215 | ||
216 | // ConfigDlg::setMap {{{1 | 216 | // ConfigDlg::setMap {{{1 |
217 | 217 | ||
218 | /* | 218 | /* |
219 | * the index is kinda screwy, because in the config file, index 0 is just the | 219 | * the index is kinda screwy, because in the config file, index 0 is just the |
220 | * first element in the QStringList, but here it's the "Current Language" | 220 | * first element in the QStringList, but here it's the "Current Language" |
221 | * listItem. therefor you have to minus one to the index before you access it. | 221 | * listItem. therefor you have to minus one to the index before you access it. |
222 | * | 222 | * |
223 | */ | 223 | */ |
224 | 224 | ||
225 | void ConfigDlg::setMap(int index) { | 225 | void ConfigDlg::setMap(int index) { |
226 | 226 | ||
227 | if (index == 0) { | 227 | if (index == 0) { |
228 | 228 | ||
229 | remove_button->setDisabled(true); | 229 | remove_button->setDisabled(true); |
230 | emit setMapToDefault(); | 230 | emit setMapToDefault(); |
231 | } | 231 | } |
232 | else if ((uint)index <= default_maps.count()) { | 232 | else if ((uint)index <= default_maps.count()) { |
233 | 233 | ||
234 | remove_button->setDisabled(true); | 234 | remove_button->setDisabled(true); |
235 | emit setMapToFile(keymaps->text(index)); | 235 | emit setMapToFile(keymaps->text(index)); |
236 | 236 | ||
237 | } else { | 237 | } else { |
238 | 238 | ||
239 | remove_button->setEnabled(true); | 239 | remove_button->setEnabled(true); |
240 | emit setMapToFile(keymaps->text(index)); | 240 | emit setMapToFile(keymaps->text(index)); |
241 | } | 241 | } |
242 | } | 242 | } |
243 | 243 | ||
244 | // ConfigDlg::addMap() {{{1 | 244 | // ConfigDlg::addMap() {{{1 |
245 | void ConfigDlg::addMap() { | 245 | void ConfigDlg::addMap() { |
246 | 246 | ||
247 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); | 247 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); |
248 | 248 | ||
249 | if (map.isNull()) return; | 249 | if (map.isNull()) return; |
250 | 250 | ||
251 | Config config ("multikey"); | 251 | Config config ("multikey"); |
252 | config.setGroup("keymaps"); | 252 | config.setGroup("keymaps"); |
253 | QStringList maps = config.readListEntry("maps", QChar('|')); | 253 | QStringList maps = config.readListEntry("maps", QChar('|')); |
254 | maps.append(map); | 254 | maps.append(map); |
255 | keymaps->insertItem(map); | 255 | keymaps->insertItem(map); |
256 | keymaps->setSelected(keymaps->count() - 1, true); | 256 | keymaps->setSelected(keymaps->count() - 1, true); |
257 | 257 | ||
258 | 258 | ||
259 | config.writeEntry("maps", maps, QChar('|')); | 259 | config.writeEntry("maps", maps, QChar('|')); |
260 | config.writeEntry("current", map); | 260 | config.writeEntry("current", map); |
261 | 261 | ||
262 | } | 262 | } |
263 | 263 | ||
264 | // ConfigDlg::removeMap() {{{1 | 264 | // ConfigDlg::removeMap() {{{1 |
265 | void ConfigDlg::removeMap() { | 265 | void ConfigDlg::removeMap() { |
266 | 266 | ||
267 | cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; | 267 | cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; |
268 | cout << "currentItem : " << keymaps->currentItem() << "\n"; | 268 | cout << "currentItem : " << keymaps->currentItem() << "\n"; |
269 | 269 | ||
270 | // move selection up one | 270 | // move selection up one |
271 | keymaps->setSelected(keymaps->currentItem() - 1, true); | 271 | keymaps->setSelected(keymaps->currentItem() - 1, true); |
272 | // delete the next selected item cus you just moved it up | 272 | // delete the next selected item cus you just moved it up |
273 | keymaps->removeItem(keymaps->currentItem() + 1); | 273 | keymaps->removeItem(keymaps->currentItem() + 1); |
274 | 274 | ||
275 | custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); | 275 | custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); |
276 | 276 | ||
277 | // write the changes | 277 | // write the changes |
278 | Config config ("multikey"); | 278 | Config config ("multikey"); |
279 | config.setGroup("keymaps"); | 279 | config.setGroup("keymaps"); |
280 | config.writeEntry("maps", custom_maps, QChar('|')); | 280 | config.writeEntry("maps", custom_maps, QChar('|')); |
281 | } | 281 | } |
282 | 282 | ||
283 | /* ConfigDlg::slots for the color buttons {{{1 | 283 | /* ConfigDlg::slots for the color buttons {{{1 |
284 | * | 284 | * |
285 | * these four slots are almost the same, except for the names. i was thinking | 285 | * these four slots are almost the same, except for the names. i was thinking |
286 | * of making a map with pointers to the buttons and names of the configEntry | 286 | * of making a map with pointers to the buttons and names of the configEntry |
287 | * so it could be one slot, but then there would be no way of telling which | 287 | * so it could be one slot, but then there would be no way of telling which |
288 | * of the buttons was clicked if they all connect to the same slot. | 288 | * of the buttons was clicked if they all connect to the same slot. |
289 | * | 289 | * |
290 | */ | 290 | */ |
291 | 291 | ||
292 | void ConfigDlg::keyColorClicked() { | 292 | void ConfigDlg::keyColorClicked() { |
293 | 293 | ||
294 | Config config ("multikey"); | 294 | Config config ("multikey"); |
295 | config.setGroup ("colors"); | 295 | config.setGroup ("colors"); |
296 | 296 | ||
297 | QStringList color = config.readListEntry("keycolor", QChar(',')); | 297 | QStringList color = config.readListEntry("keycolor", QChar(',')); |
298 | 298 | ||
299 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 299 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
300 | 300 | ||
301 | color[0].setNum(newcolor.red()); | 301 | color[0].setNum(newcolor.red()); |
302 | color[1].setNum(newcolor.green()); | 302 | color[1].setNum(newcolor.green()); |
303 | color[2].setNum(newcolor.blue()); | 303 | color[2].setNum(newcolor.blue()); |
304 | 304 | ||
305 | config.writeEntry("keycolor", color, QChar(',')); | 305 | config.writeEntry("keycolor", color, QChar(',')); |
306 | config.write(); | 306 | config.write(); |
307 | 307 | ||
308 | keycolor_button->setBackgroundColor(newcolor); | 308 | keycolor_button->setPalette(QPalette(newcolor)); |
309 | emit reloadKeyboard(); | 309 | emit reloadKeyboard(); |
310 | } | 310 | } |
311 | void ConfigDlg::keyColorPressedClicked() { | 311 | void ConfigDlg::keyColorPressedClicked() { |
312 | 312 | ||
313 | Config config ("multikey"); | 313 | Config config ("multikey"); |
314 | config.setGroup ("colors"); | 314 | config.setGroup ("colors"); |
315 | 315 | ||
316 | QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); | 316 | QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); |
317 | 317 | ||
318 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 318 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
319 | 319 | ||
320 | color[0].setNum(newcolor.red()); | 320 | color[0].setNum(newcolor.red()); |
321 | color[1].setNum(newcolor.green()); | 321 | color[1].setNum(newcolor.green()); |
322 | color[2].setNum(newcolor.blue()); | 322 | color[2].setNum(newcolor.blue()); |
323 | 323 | ||
324 | config.writeEntry("keycolor_pressed", color, QChar(',')); | 324 | config.writeEntry("keycolor_pressed", color, QChar(',')); |
325 | config.write(); | 325 | config.write(); |
326 | 326 | ||
327 | keycolor_pressed_button->setBackgroundColor(newcolor); | 327 | keycolor_pressed_button->setPalette(QPalette(newcolor)); |
328 | emit reloadKeyboard(); | 328 | emit reloadKeyboard(); |
329 | } | 329 | } |
330 | void ConfigDlg::keyColorLinesClicked() { | 330 | void ConfigDlg::keyColorLinesClicked() { |
331 | 331 | ||
332 | Config config ("multikey"); | 332 | Config config ("multikey"); |
333 | config.setGroup ("colors"); | 333 | config.setGroup ("colors"); |
334 | 334 | ||
335 | QStringList color = config.readListEntry("keycolor_lines", QChar(',')); | 335 | QStringList color = config.readListEntry("keycolor_lines", QChar(',')); |
336 | 336 | ||
337 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 337 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
338 | 338 | ||
339 | color[0].setNum(newcolor.red()); | 339 | color[0].setNum(newcolor.red()); |
340 | color[1].setNum(newcolor.green()); | 340 | color[1].setNum(newcolor.green()); |
341 | color[2].setNum(newcolor.blue()); | 341 | color[2].setNum(newcolor.blue()); |
342 | 342 | ||
343 | config.writeEntry("keycolor_lines", color, QChar(',')); | 343 | config.writeEntry("keycolor_lines", color, QChar(',')); |
344 | config.write(); | 344 | config.write(); |
345 | 345 | ||
346 | keycolor_lines_button->setBackgroundColor(newcolor); | 346 | keycolor_lines_button->setPalette(QPalette(newcolor)); |
347 | emit reloadKeyboard(); | 347 | emit reloadKeyboard(); |
348 | } | 348 | } |
349 | void ConfigDlg::textColorClicked() { | 349 | void ConfigDlg::textColorClicked() { |
350 | 350 | ||
351 | Config config ("multikey"); | 351 | Config config ("multikey"); |
352 | config.setGroup ("colors"); | 352 | config.setGroup ("colors"); |
353 | 353 | ||
354 | QStringList color = config.readListEntry("textcolor", QChar(',')); | 354 | QStringList color = config.readListEntry("textcolor", QChar(',')); |
355 | 355 | ||
356 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 356 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
357 | 357 | ||
358 | color[0].setNum(newcolor.red()); | 358 | color[0].setNum(newcolor.red()); |
359 | color[1].setNum(newcolor.green()); | 359 | color[1].setNum(newcolor.green()); |
360 | color[2].setNum(newcolor.blue()); | 360 | color[2].setNum(newcolor.blue()); |
361 | 361 | ||
362 | config.writeEntry("textcolor", color, QChar(',')); | 362 | config.writeEntry("textcolor", color, QChar(',')); |
363 | config.write(); | 363 | config.write(); |
364 | 364 | ||
365 | textcolor_button->setBackgroundColor(newcolor); | 365 | textcolor_button->setPalette(QPalette(newcolor)); |
366 | emit reloadKeyboard(); | 366 | emit reloadKeyboard(); |
367 | } | 367 | } |