summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index a9137b9..9ea59a4 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -216,64 +216,67 @@ void ConfigDlg::repeatTog() {
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
225void ConfigDlg::setMap(int index) { 225void 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
245void ConfigDlg::addMap() { 245void ConfigDlg::addMap() {
246 246
247 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); 247 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath());
248
249 if (map.isNull()) return;
250
248 Config config ("multikey"); 251 Config config ("multikey");
249 config.setGroup("keymaps"); 252 config.setGroup("keymaps");
250 QStringList maps = config.readListEntry("maps", QChar('|')); 253 QStringList maps = config.readListEntry("maps", QChar('|'));
251 maps.append(map); 254 maps.append(map);
252 keymaps->insertItem(map); 255 keymaps->insertItem(map);
253 keymaps->setSelected(keymaps->count() - 1, true); 256 keymaps->setSelected(keymaps->count() - 1, true);
254 257
255 258
256 config.writeEntry("maps", maps, QChar('|')); 259 config.writeEntry("maps", maps, QChar('|'));
257 config.writeEntry("current", map); 260 config.writeEntry("current", map);
258 261
259} 262}
260 263
261// ConfigDlg::removeMap() {{{1 264// ConfigDlg::removeMap() {{{1
262void ConfigDlg::removeMap() { 265void ConfigDlg::removeMap() {
263 266
264 cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n"; 267 cout << "removing : " << custom_maps[keymaps->currentItem() - default_maps.count() - 1] << "\n";
265 cout << "currentItem : " << keymaps->currentItem() << "\n"; 268 cout << "currentItem : " << keymaps->currentItem() << "\n";
266 269
267 // move selection up one 270 // move selection up one
268 keymaps->setSelected(keymaps->currentItem() - 1, true); 271 keymaps->setSelected(keymaps->currentItem() - 1, true);
269 // delete the next selected item cus you just moved it up 272 // delete the next selected item cus you just moved it up
270 keymaps->removeItem(keymaps->currentItem() + 1); 273 keymaps->removeItem(keymaps->currentItem() + 1);
271 274
272 custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]); 275 custom_maps.remove(custom_maps[keymaps->currentItem() - default_maps.count()]);
273 276
274 // write the changes 277 // write the changes
275 Config config ("multikey"); 278 Config config ("multikey");
276 config.setGroup("keymaps"); 279 config.setGroup("keymaps");
277 config.writeEntry("maps", custom_maps, QChar('|')); 280 config.writeEntry("maps", custom_maps, QChar('|'));
278} 281}
279 282