Diffstat (limited to 'inputmethods/multikey/configdlg.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index c5ebe3c..f6507b4 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp @@ -284,17 +284,38 @@ void ConfigDlg::addMap() { if (map.isNull()) return; Config config ("multikey"); config.setGroup("keymaps"); QStringList maps = config.readListEntry("maps", QChar('|')); maps.append(map); custom_maps.append(map); - keymaps->insertItem(map); + + QFile map_file (map); + if (map_file.open(IO_ReadOnly)) { + + QString line; bool found = 0; + + map_file.readLine(line, 1024); + while (!map_file.atEnd()) { + + if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { + + keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); + found = 1; + break; + } + map_file.readLine(line, 1024); + } + if (!found) keymaps->insertItem(map); + + map_file.close(); + } + keymaps->setSelected(keymaps->count() - 1, true); config.writeEntry("maps", maps, QChar('|')); config.writeEntry("current", map); } |