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 | |||
@@ -332,68 +332,65 @@ void ConfigDlg::moveSelectedUp() | |||
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()); |