author | mouse <mouse> | 2004-01-05 14:10:39 (UTC) |
---|---|---|
committer | mouse <mouse> | 2004-01-05 14:10:39 (UTC) |
commit | 7fb9bc93eae8007a6eb298fc743bbf70dc50fbc5 (patch) (unidiff) | |
tree | 8f16b6c4e52eaca3d0d6c763f3cf938459653801 | |
parent | 4fca3779614c863443ff09295fd0af19b9d9310e (diff) | |
download | opie-7fb9bc93eae8007a6eb298fc743bbf70dc50fbc5.zip opie-7fb9bc93eae8007a6eb298fc743bbf70dc50fbc5.tar.gz opie-7fb9bc93eae8007a6eb298fc743bbf70dc50fbc5.tar.bz2 |
configdlg now based on QDialog, instead of QTabWidget
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index d29109a..3e39415 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -172,338 +172,335 @@ ConfigDlg::ConfigDlg () : QDialog () | |||
172 | 172 | ||
173 | gen_lay->addWidget(other_grid); | 173 | gen_lay->addWidget(other_grid); |
174 | tabs->addTab(gen_box, tr("General Settings")); | 174 | tabs->addTab(gen_box, tr("General Settings")); |
175 | 175 | ||
176 | /* | 176 | /* |
177 | * 'color' tab | 177 | * 'color' tab |
178 | */ | 178 | */ |
179 | 179 | ||
180 | QWidget *color_box = new QWidget(tabs, "color_tab"); | 180 | QWidget *color_box = new QWidget(tabs, "color_tab"); |
181 | 181 | ||
182 | QGridLayout *color_lay = new QGridLayout(color_box); | 182 | QGridLayout *color_lay = new QGridLayout(color_box); |
183 | QGrid *color_grid = new QGrid(2, color_box); | 183 | QGrid *color_grid = new QGrid(2, color_box); |
184 | color_lay->setAlignment(Qt::AlignTop); | 184 | color_lay->setAlignment(Qt::AlignTop); |
185 | color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); | 185 | color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); |
186 | color_grid->layout()->setAlignment(Qt::AlignTop); | 186 | color_grid->layout()->setAlignment(Qt::AlignTop); |
187 | color_grid->setMargin(3); | 187 | color_grid->setMargin(3); |
188 | color_grid->setSpacing(3); | 188 | color_grid->setSpacing(3); |
189 | 189 | ||
190 | QLabel *label; | 190 | QLabel *label; |
191 | QStringList color; | 191 | QStringList color; |
192 | config.setGroup("colors"); | 192 | config.setGroup("colors"); |
193 | 193 | ||
194 | label = new QLabel(tr("Key Color"), color_grid); | 194 | label = new QLabel(tr("Key Color"), color_grid); |
195 | keycolor_button = new QPushButton(color_grid); | 195 | keycolor_button = new QPushButton(color_grid); |
196 | connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); | 196 | connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); |
197 | keycolor_button->setFlat(TRUE); | 197 | keycolor_button->setFlat(TRUE); |
198 | color = config.readListEntry("keycolor", QChar(',')); | 198 | color = config.readListEntry("keycolor", QChar(',')); |
199 | /* | 199 | /* |
200 | * hopefully not required | 200 | * hopefully not required |
201 | 201 | ||
202 | if (color.isEmpty()) { | 202 | if (color.isEmpty()) { |
203 | color = QStringList::split(",", "240,240,240"); | 203 | color = QStringList::split(",", "240,240,240"); |
204 | config.writeEntry("keycolor", color.join(",")); | 204 | config.writeEntry("keycolor", color.join(",")); |
205 | 205 | ||
206 | } | 206 | } |
207 | */ | 207 | */ |
208 | keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); | 208 | keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); |
209 | 209 | ||
210 | 210 | ||
211 | label = new QLabel(tr("Key Pressed Color"), color_grid); | 211 | label = new QLabel(tr("Key Pressed Color"), color_grid); |
212 | keycolor_pressed_button = new QPushButton(color_grid); | 212 | keycolor_pressed_button = new QPushButton(color_grid); |
213 | connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); | 213 | connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); |
214 | keycolor_pressed_button->setFlat(TRUE); | 214 | keycolor_pressed_button->setFlat(TRUE); |
215 | color = config.readListEntry("keycolor_pressed", QChar(',')); | 215 | color = config.readListEntry("keycolor_pressed", QChar(',')); |
216 | keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); | 216 | keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); |
217 | 217 | ||
218 | label = new QLabel(tr("Line Color"), color_grid); | 218 | label = new QLabel(tr("Line Color"), color_grid); |
219 | keycolor_lines_button = new QPushButton(color_grid); | 219 | keycolor_lines_button = new QPushButton(color_grid); |
220 | connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); | 220 | connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); |
221 | keycolor_lines_button->setFlat(TRUE); | 221 | keycolor_lines_button->setFlat(TRUE); |
222 | color = config.readListEntry("keycolor_lines", QChar(',')); | 222 | color = config.readListEntry("keycolor_lines", QChar(',')); |
223 | keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); | 223 | keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); |
224 | 224 | ||
225 | 225 | ||
226 | label = new QLabel(tr("Text Color"), color_grid); | 226 | label = new QLabel(tr("Text Color"), color_grid); |
227 | textcolor_button = new QPushButton(color_grid); | 227 | textcolor_button = new QPushButton(color_grid); |
228 | connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); | 228 | connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); |
229 | textcolor_button->setFlat(TRUE); | 229 | textcolor_button->setFlat(TRUE); |
230 | color = config.readListEntry("textcolor", QChar(',')); | 230 | color = config.readListEntry("textcolor", QChar(',')); |
231 | textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); | 231 | textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); |
232 | 232 | ||
233 | label = new QLabel("", color_grid); // a spacer so the above buttons dont expand | 233 | label = new QLabel("", color_grid); // a spacer so the above buttons dont expand |
234 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 234 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
235 | /* FIXME: hacked spacer height */ | 235 | /* FIXME: hacked spacer height */ |
236 | QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum); | 236 | QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum); |
237 | 237 | ||
238 | color_lay->addWidget(color_grid, 0, 0); | 238 | color_lay->addWidget(color_grid, 0, 0); |
239 | color_lay->addItem(spacer); | 239 | color_lay->addItem(spacer); |
240 | 240 | ||
241 | tabs->addTab(color_box, tr("Colors")); | 241 | tabs->addTab(color_box, tr("Colors")); |
242 | base_lay->addWidget(tabs); | 242 | base_lay->addWidget(tabs); |
243 | } | 243 | } |
244 | 244 | ||
245 | QStringList ConfigDlg::loadSw() | 245 | QStringList ConfigDlg::loadSw() |
246 | { | 246 | { |
247 | Config *config = new Config("multikey"); | 247 | Config *config = new Config("multikey"); |
248 | config->setGroup("keymaps"); | 248 | config->setGroup("keymaps"); |
249 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); | 249 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); |
250 | QStringList d_maps = map_dir.entryList(); // so i can access it in other places | 250 | QStringList d_maps = map_dir.entryList(); // so i can access it in other places |
251 | QStringList c_maps = config->readListEntry("maps", QChar('|')); | 251 | QStringList c_maps = config->readListEntry("maps", QChar('|')); |
252 | QStringList s_maps = config->readListEntry("sw", QChar('|')); | 252 | QStringList s_maps = config->readListEntry("sw", QChar('|')); |
253 | delete config; | 253 | delete config; |
254 | 254 | ||
255 | if (!s_maps.count()) | 255 | if (!s_maps.count()) |
256 | { | 256 | { |
257 | s_maps = d_maps+c_maps; | 257 | s_maps = d_maps+c_maps; |
258 | } | 258 | } |
259 | else | 259 | else |
260 | { | 260 | { |
261 | /* Clear non existents entries */ | 261 | /* Clear non existents entries */ |
262 | QStringList s_copy(s_maps); | 262 | QStringList s_copy(s_maps); |
263 | for (uint i = 0; i < s_copy.count(); ++i) { | 263 | for (uint i = 0; i < s_copy.count(); ++i) { |
264 | if (d_maps.find(s_copy[i]) == d_maps.end() | 264 | if (d_maps.find(s_copy[i]) == d_maps.end() |
265 | && c_maps.find(s_copy[i]) == c_maps.end()) { | 265 | && c_maps.find(s_copy[i]) == c_maps.end()) { |
266 | s_maps.remove(s_copy[i]); | 266 | s_maps.remove(s_copy[i]); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | /* Update sw_maps from default_maps */ | 269 | /* Update sw_maps from default_maps */ |
270 | for (uint i = 0; i < d_maps.count(); ++i) { | 270 | for (uint i = 0; i < d_maps.count(); ++i) { |
271 | if (s_maps.find(d_maps[i]) == s_maps.end()) { | 271 | if (s_maps.find(d_maps[i]) == s_maps.end()) { |
272 | s_maps.append(d_maps[i]); | 272 | s_maps.append(d_maps[i]); |
273 | } | 273 | } |
274 | } | 274 | } |
275 | /* Update sw_maps from custom_maps */ | 275 | /* Update sw_maps from custom_maps */ |
276 | for (uint i = 0; i < c_maps.count(); ++i) { | 276 | for (uint i = 0; i < c_maps.count(); ++i) { |
277 | if (s_maps.find(c_maps[i]) == s_maps.end()) { | 277 | if (s_maps.find(c_maps[i]) == s_maps.end()) { |
278 | s_maps.append(c_maps[i]); | 278 | s_maps.append(c_maps[i]); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
283 | return s_maps; | 283 | return s_maps; |
284 | } | 284 | } |
285 | 285 | ||
286 | void ConfigDlg::accept() | 286 | void ConfigDlg::accept() |
287 | { | 287 | { |
288 | /* Writing all stuffs to config */ | 288 | /* Writing all stuffs to config */ |
289 | Config *config = new Config("multikey"); | 289 | Config *config = new Config("multikey"); |
290 | config->setGroup("general"); | 290 | config->setGroup("general"); |
291 | config->writeEntry("usePickboard", pick_button->isChecked()); // default closed | 291 | config->writeEntry("usePickboard", pick_button->isChecked()); // default closed |
292 | config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed | 292 | config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed |
293 | 293 | ||
294 | config->setGroup("keymaps"); | 294 | config->setGroup("keymaps"); |
295 | config->writeEntry("sw", sw_maps, QChar('|')); | 295 | config->writeEntry("sw", sw_maps, QChar('|')); |
296 | config->writeEntry("maps", custom_maps, QChar('|')); | 296 | config->writeEntry("maps", custom_maps, QChar('|')); |
297 | delete config; | 297 | delete config; |
298 | 298 | ||
299 | int index = keymaps->currentItem(); | 299 | int index = keymaps->currentItem(); |
300 | if (index == 0) { | 300 | if (index == 0) { |
301 | 301 | ||
302 | remove_button->setDisabled(true); | 302 | remove_button->setDisabled(true); |
303 | emit setMapToDefault(); | 303 | emit setMapToDefault(); |
304 | } | 304 | } |
305 | else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) { | 305 | else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) { |
306 | 306 | ||
307 | remove_button->setDisabled(true); | 307 | remove_button->setDisabled(true); |
308 | emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]); | 308 | emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]); |
309 | 309 | ||
310 | } else { | 310 | } else { |
311 | 311 | ||
312 | remove_button->setEnabled(true); | 312 | remove_button->setEnabled(true); |
313 | emit setMapToFile(sw_maps[index - 1]); | 313 | emit setMapToFile(sw_maps[index - 1]); |
314 | } | 314 | } |
315 | 315 | ||
316 | emit pickboardToggled(pick_button->isChecked()); | 316 | emit pickboardToggled(pick_button->isChecked()); |
317 | emit repeatToggled(repeat_button->isChecked()); | 317 | emit repeatToggled(repeat_button->isChecked()); |
318 | emit reloadSw(); | 318 | emit reloadSw(); |
319 | 319 | ||
320 | QDialog::accept(); | 320 | QDialog::accept(); |
321 | emit configDlgClosed(); | 321 | emit configDlgClosed(); |
322 | } | 322 | } |
323 | 323 | ||
324 | void ConfigDlg::moveSelectedUp() | 324 | void ConfigDlg::moveSelectedUp() |
325 | { | 325 | { |
326 | int i = keymaps->currentItem(); | 326 | int i = keymaps->currentItem(); |
327 | /* Ignore Current Language */ | 327 | /* Ignore Current Language */ |
328 | if (i > 1) { | 328 | if (i > 1) { |
329 | QString t = sw_maps[i-1]; | 329 | QString t = sw_maps[i-1]; |
330 | sw_maps[i-1] = sw_maps[i-2]; | 330 | sw_maps[i-1] = sw_maps[i-2]; |
331 | sw_maps[i-2] = t; | 331 | sw_maps[i-2] = t; |
332 | 332 | ||
333 | QString item = keymaps->currentText(); | 333 | QString item = keymaps->currentText(); |
334 | keymaps->removeItem(i); | 334 | keymaps->removeItem(i); |
335 | keymaps->insertItem(item, i-1); | 335 | keymaps->insertItem(item, i-1); |
336 | keymaps->setCurrentItem(i-1); | 336 | keymaps->setCurrentItem(i-1); |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | void ConfigDlg::moveSelectedDown() | 340 | void ConfigDlg::moveSelectedDown() |
341 | { | 341 | { |
342 | int i = keymaps->currentItem(); | 342 | int i = keymaps->currentItem(); |
343 | /* Ignore Current Language */ | 343 | /* Ignore Current Language */ |
344 | if (i > 0 && i < (int)keymaps->count() - 1) { | 344 | if (i > 0 && i < (int)keymaps->count() - 1) { |
345 | QString t = sw_maps[i-1]; | 345 | QString t = sw_maps[i-1]; |
346 | sw_maps[i-1] = sw_maps[i]; | 346 | sw_maps[i-1] = sw_maps[i]; |
347 | sw_maps[i] = t; | 347 | sw_maps[i] = t; |
348 | 348 | ||
349 | QString item = keymaps->currentText(); | 349 | QString item = keymaps->currentText(); |
350 | keymaps->removeItem(i); | 350 | keymaps->removeItem(i); |
351 | keymaps->insertItem(item, i+1); | 351 | keymaps->insertItem(item, i+1); |
352 | keymaps->setCurrentItem(i+1); | 352 | keymaps->setCurrentItem(i+1); |
353 | } | 353 | } |
354 | } | 354 | } |
355 | 355 | ||
356 | void ConfigDlg::closeEvent(QCloseEvent *) { | 356 | void ConfigDlg::closeEvent(QCloseEvent *) { |
357 | 357 | ||
358 | // tell the parent it was closed, so delete me | 358 | // tell the parent it was closed, so delete me |
359 | emit configDlgClosed(); | 359 | emit configDlgClosed(); |
360 | } | 360 | } |
361 | 361 | ||
362 | void ConfigDlg::setMap(int index) { | 362 | void ConfigDlg::setMap(int index) { |
363 | 363 | ||
364 | if (index == 0) { | 364 | if (index == 0 || default_maps.find(sw_maps[index-1]) != default_maps.end()) { |
365 | remove_button->setDisabled(true); | ||
366 | } | ||
367 | else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) { | ||
368 | remove_button->setDisabled(true); | 365 | remove_button->setDisabled(true); |
369 | } else { | 366 | } else { |
370 | remove_button->setEnabled(true); | 367 | remove_button->setEnabled(true); |
371 | } | 368 | } |
372 | } | 369 | } |
373 | 370 | ||
374 | // ConfigDlg::addMap() {{{1 | 371 | // ConfigDlg::addMap() {{{1 |
375 | void ConfigDlg::addMap() { | 372 | void ConfigDlg::addMap() { |
376 | 373 | ||
377 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); | 374 | QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); |
378 | 375 | ||
379 | if (map.isNull()) return; | 376 | if (map.isNull()) return; |
380 | 377 | ||
381 | Config config ("multikey"); | 378 | Config config ("multikey"); |
382 | config.setGroup("keymaps"); | 379 | config.setGroup("keymaps"); |
383 | QStringList maps = config.readListEntry("maps", QChar('|')); | 380 | QStringList maps = config.readListEntry("maps", QChar('|')); |
384 | maps.append(map); | 381 | maps.append(map); |
385 | custom_maps.append(map); | 382 | custom_maps.append(map); |
386 | if (sw_maps.find(map) == sw_maps.end()) | 383 | if (sw_maps.find(map) == sw_maps.end()) |
387 | sw_maps.append(map); | 384 | sw_maps.append(map); |
388 | 385 | ||
389 | QFile map_file (map); | 386 | QFile map_file (map); |
390 | if (map_file.open(IO_ReadOnly)) { | 387 | if (map_file.open(IO_ReadOnly)) { |
391 | 388 | ||
392 | QString line; bool found = 0; | 389 | QString line; bool found = 0; |
393 | 390 | ||
394 | map_file.readLine(line, 1024); | 391 | map_file.readLine(line, 1024); |
395 | while (!map_file.atEnd()) { | 392 | while (!map_file.atEnd()) { |
396 | 393 | ||
397 | if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { | 394 | if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { |
398 | 395 | ||
399 | keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); | 396 | keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); |
400 | found = 1; | 397 | found = 1; |
401 | break; | 398 | break; |
402 | } | 399 | } |
403 | map_file.readLine(line, 1024); | 400 | map_file.readLine(line, 1024); |
404 | } | 401 | } |
405 | if (!found) keymaps->insertItem(map); | 402 | if (!found) keymaps->insertItem(map); |
406 | 403 | ||
407 | map_file.close(); | 404 | map_file.close(); |
408 | } | 405 | } |
409 | 406 | ||
410 | keymaps->setSelected(keymaps->count() - 1, true); | 407 | keymaps->setSelected(keymaps->count() - 1, true); |
411 | } | 408 | } |
412 | 409 | ||
413 | // ConfigDlg::removeMap() {{{1 | 410 | // ConfigDlg::removeMap() {{{1 |
414 | void ConfigDlg::removeMap() { | 411 | void ConfigDlg::removeMap() { |
415 | 412 | ||
416 | // move selection up one | 413 | // move selection up one |
417 | keymaps->setSelected(keymaps->currentItem() - 1, true); | 414 | keymaps->setSelected(keymaps->currentItem() - 1, true); |
418 | // delete the next selected item cus you just moved it up | 415 | // delete the next selected item cus you just moved it up |
419 | keymaps->removeItem(keymaps->currentItem() + 1); | 416 | keymaps->removeItem(keymaps->currentItem() + 1); |
420 | 417 | ||
421 | custom_maps.remove(sw_maps[keymaps->currentItem()]); | 418 | custom_maps.remove(sw_maps[keymaps->currentItem()]); |
422 | sw_maps.remove(sw_maps.at(keymaps->currentItem())); | 419 | sw_maps.remove(sw_maps.at(keymaps->currentItem())); |
423 | } | 420 | } |
424 | 421 | ||
425 | /* ConfigDlg::slots for the color buttons {{{1 | 422 | /* ConfigDlg::slots for the color buttons {{{1 |
426 | * | 423 | * |
427 | * these four slots are almost the same, except for the names. i was thinking | 424 | * these four slots are almost the same, except for the names. i was thinking |
428 | * of making a map with pointers to the buttons and names of the configEntry | 425 | * of making a map with pointers to the buttons and names of the configEntry |
429 | * so it could be one slot, but then there would be no way of telling which | 426 | * so it could be one slot, but then there would be no way of telling which |
430 | * of the buttons was clicked if they all connect to the same slot. | 427 | * of the buttons was clicked if they all connect to the same slot. |
431 | * | 428 | * |
432 | */ | 429 | */ |
433 | 430 | ||
434 | void ConfigDlg::keyColorClicked() { | 431 | void ConfigDlg::keyColorClicked() { |
435 | 432 | ||
436 | Config config ("multikey"); | 433 | Config config ("multikey"); |
437 | config.setGroup ("colors"); | 434 | config.setGroup ("colors"); |
438 | 435 | ||
439 | QStringList color = config.readListEntry("keycolor", QChar(',')); | 436 | QStringList color = config.readListEntry("keycolor", QChar(',')); |
440 | 437 | ||
441 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 438 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
442 | 439 | ||
443 | color[0].setNum(newcolor.red()); | 440 | color[0].setNum(newcolor.red()); |
444 | color[1].setNum(newcolor.green()); | 441 | color[1].setNum(newcolor.green()); |
445 | color[2].setNum(newcolor.blue()); | 442 | color[2].setNum(newcolor.blue()); |
446 | 443 | ||
447 | config.writeEntry("keycolor", color, QChar(',')); | 444 | config.writeEntry("keycolor", color, QChar(',')); |
448 | config.write(); | 445 | config.write(); |
449 | 446 | ||
450 | keycolor_button->setPalette(QPalette(newcolor)); | 447 | keycolor_button->setPalette(QPalette(newcolor)); |
451 | emit reloadKeyboard(); | 448 | emit reloadKeyboard(); |
452 | } | 449 | } |
453 | void ConfigDlg::keyColorPressedClicked() { | 450 | void ConfigDlg::keyColorPressedClicked() { |
454 | 451 | ||
455 | Config config ("multikey"); | 452 | Config config ("multikey"); |
456 | config.setGroup ("colors"); | 453 | config.setGroup ("colors"); |
457 | 454 | ||
458 | QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); | 455 | QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); |
459 | 456 | ||
460 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 457 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
461 | 458 | ||
462 | color[0].setNum(newcolor.red()); | 459 | color[0].setNum(newcolor.red()); |
463 | color[1].setNum(newcolor.green()); | 460 | color[1].setNum(newcolor.green()); |
464 | color[2].setNum(newcolor.blue()); | 461 | color[2].setNum(newcolor.blue()); |
465 | 462 | ||
466 | config.writeEntry("keycolor_pressed", color, QChar(',')); | 463 | config.writeEntry("keycolor_pressed", color, QChar(',')); |
467 | config.write(); | 464 | config.write(); |
468 | 465 | ||
469 | keycolor_pressed_button->setPalette(QPalette(newcolor)); | 466 | keycolor_pressed_button->setPalette(QPalette(newcolor)); |
470 | emit reloadKeyboard(); | 467 | emit reloadKeyboard(); |
471 | } | 468 | } |
472 | void ConfigDlg::keyColorLinesClicked() { | 469 | void ConfigDlg::keyColorLinesClicked() { |
473 | 470 | ||
474 | Config config ("multikey"); | 471 | Config config ("multikey"); |
475 | config.setGroup ("colors"); | 472 | config.setGroup ("colors"); |
476 | 473 | ||
477 | QStringList color = config.readListEntry("keycolor_lines", QChar(',')); | 474 | QStringList color = config.readListEntry("keycolor_lines", QChar(',')); |
478 | 475 | ||
479 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 476 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
480 | 477 | ||
481 | color[0].setNum(newcolor.red()); | 478 | color[0].setNum(newcolor.red()); |
482 | color[1].setNum(newcolor.green()); | 479 | color[1].setNum(newcolor.green()); |
483 | color[2].setNum(newcolor.blue()); | 480 | color[2].setNum(newcolor.blue()); |
484 | 481 | ||
485 | config.writeEntry("keycolor_lines", color, QChar(',')); | 482 | config.writeEntry("keycolor_lines", color, QChar(',')); |
486 | config.write(); | 483 | config.write(); |
487 | 484 | ||
488 | keycolor_lines_button->setPalette(QPalette(newcolor)); | 485 | keycolor_lines_button->setPalette(QPalette(newcolor)); |
489 | emit reloadKeyboard(); | 486 | emit reloadKeyboard(); |
490 | } | 487 | } |
491 | void ConfigDlg::textColorClicked() { | 488 | void ConfigDlg::textColorClicked() { |
492 | 489 | ||
493 | Config config ("multikey"); | 490 | Config config ("multikey"); |
494 | config.setGroup ("colors"); | 491 | config.setGroup ("colors"); |
495 | 492 | ||
496 | QStringList color = config.readListEntry("textcolor", QChar(',')); | 493 | QStringList color = config.readListEntry("textcolor", QChar(',')); |
497 | 494 | ||
498 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); | 495 | QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); |
499 | 496 | ||
500 | color[0].setNum(newcolor.red()); | 497 | color[0].setNum(newcolor.red()); |
501 | color[1].setNum(newcolor.green()); | 498 | color[1].setNum(newcolor.green()); |
502 | color[2].setNum(newcolor.blue()); | 499 | color[2].setNum(newcolor.blue()); |
503 | 500 | ||
504 | config.writeEntry("textcolor", color, QChar(',')); | 501 | config.writeEntry("textcolor", color, QChar(',')); |
505 | config.write(); | 502 | config.write(); |
506 | 503 | ||
507 | textcolor_button->setPalette(QPalette(newcolor)); | 504 | textcolor_button->setPalette(QPalette(newcolor)); |
508 | emit reloadKeyboard(); | 505 | emit reloadKeyboard(); |
509 | } | 506 | } |