author | hash <hash> | 2002-08-19 07:21:51 (UTC) |
---|---|---|
committer | hash <hash> | 2002-08-19 07:21:51 (UTC) |
commit | 9cc94030d7f6a04b79da8db83e6c609c1580a3d3 (patch) (side-by-side diff) | |
tree | b7c0fbc543d633ec9bd0f9d2ef762ebb92b2da55 /inputmethods/multikey/configdlg.cpp | |
parent | 64a00421be85d223072e087d4d3c9ecdad464095 (diff) | |
download | opie-9cc94030d7f6a04b79da8db83e6c609c1580a3d3.zip opie-9cc94030d7f6a04b79da8db83e6c609c1580a3d3.tar.gz opie-9cc94030d7f6a04b79da8db83e6c609c1580a3d3.tar.bz2 |
parses dir and also lets you add/remove maps located in other places
Diffstat (limited to 'inputmethods/multikey/configdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index a6e4dad..ac132d3 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp @@ -131,89 +131,91 @@ ConfigDlg::ConfigDlg () : QTabWidget () QLabel *label; label = new QLabel(tr("Key Color"), color_box); QPushButton *button = new QPushButton(color_box); button->setFlat((bool)1); label = new QLabel(tr("Key Pressed Color"), color_box); button = new QPushButton(color_box); button->setFlat((bool)1); label = new QLabel(tr("Line Color"), color_box); button = new QPushButton(color_box); button->setFlat((bool)1); label = new QLabel(tr("Text Color"), color_box); button = new QPushButton(color_box); button->setFlat((bool)1); label = new QLabel("", color_box); // a spacer so the above buttons dont expand label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); } void ConfigDlg::pickTog() { Config config ("multikey"); config.setGroup ("pickboard"); config.writeEntry ("open", pick_button->isChecked()); // default closed emit pickboardToggled(pick_button->isChecked()); } /* * the index is kinda screwy, because in the config file, index 0 is just the * first element in the QStringList, but here it's the "Current Language" * listItem. therefor you have to minus one to the index before you access it. * */ void ConfigDlg::setMap(int index) { if (index == 0) { remove_button->setDisabled(true); emit setMapToDefault(); } else if ((uint)index <= default_maps.count()) { remove_button->setDisabled(true); + emit setMapToFile(keymaps->text(index)); + } else { remove_button->setEnabled(true); emit setMapToFile(keymaps->text(index)); } } void ConfigDlg::addMap() { QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); Config config ("multikey"); config.setGroup("keymaps"); QStringList maps = config.readListEntry("maps", QChar('|')); maps.append(map); keymaps->insertItem(map); keymaps->setSelected(keymaps->count() - 1, true); config.writeEntry("maps", maps.join("|")); config.writeEntry("current", map); } void ConfigDlg::removeMap() { cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; cout << "currentItem : " << keymaps->currentItem() << "\n"; // move selection up one keymaps->setSelected(keymaps->currentItem() - 1, true); // delete the next selected item cus you just moved it up keymaps->removeItem(keymaps->currentItem() + 1); custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); // write the changes Config config ("multikey"); config.setGroup("keymaps"); config.writeEntry("maps", custom_maps.join("|")); } |