summaryrefslogtreecommitdiff
path: root/inputmethods/multikey/keyboard.cpp
Side-by-side diff
Diffstat (limited to 'inputmethods/multikey/keyboard.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/keyboard.cpp37
1 files changed, 13 insertions, 24 deletions
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index c53ae6c..ac3d9be 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -287,14 +287,14 @@ void Keyboard::mousePressEvent(QMouseEvent *e)
else {
configdlg = new ConfigDlg ();
connect(configdlg, SIGNAL(pickboardToggled(bool)),
this, SLOT(togglePickboard(bool)));
connect(configdlg, SIGNAL(setMapToDefault()),
this, SLOT(setMapToDefault()));
- connect(configdlg, SIGNAL(setMapToFile(int)),
- this, SLOT(setMapToFile(int)));
+ connect(configdlg, SIGNAL(setMapToFile(QString)),
+ this, SLOT(setMapToFile(QString)));
configdlg->showMaximized();
configdlg->show();
configdlg->raise();
}
} else if (qkeycode == Qt::Key_Control) {
@@ -516,39 +516,36 @@ void Keyboard::setMapToDefault() {
QString key_map = QPEApplication::qpeDir() + "/share/multikey/"
+ l + ".keymap";
/* save change to multikey config file */
config = new Config("multikey");
config->setGroup ("keymaps");
- config->writeEntry ("current", -1); // default closed
+ config->writeEntry ("current", key_map); // default closed
delete config;
delete keys;
keys = new Keys(key_map);
// have to repaint the keyboard
repaint(FALSE);
}
-void Keyboard::setMapToFile(int index) {
+void Keyboard::setMapToFile(QString map) {
/* save change to multikey config file */
Config *config = new Config("multikey");
config->setGroup ("keymaps");
- config->writeEntry ("current", index); // default closed
+ config->writeEntry ("current", map); // default closed
-
- /* now you have to retrieve the map */
- QStringList maps = config->readListEntry("maps", QChar('|'));
delete config;
delete keys;
- if (index < 0 || (int)maps.count() <= index)
- keys = new Keys();
+ if (QFile(map).exists())
+ keys = new Keys(map);
else
- keys = new Keys(maps[index]);
+ keys = new Keys();
repaint(FALSE);
}
/* korean input functions {{{1
@@ -856,36 +853,28 @@ ushort Keyboard::constoe(const ushort c) {
// Keys::Keys {{{1
Keys::Keys() {
Config *config = new Config ("multikey");
config->setGroup( "keymaps" );
- QStringList maps = config->readListEntry ("maps", QChar('|'));
-
- int index = config->readNumEntry( "current", -1 );
+ QString map = config->readEntry( "current" );
delete config;
- QString key_map;
-
- if (index < 0 || (int)maps.count() <= index) {
+ if (map.isNull() || !(QFile(map).exists())) {
Config *config = new Config("locale");
config->setGroup( "Language" );
QString l = config->readEntry( "Language" , "en" );
delete config;
- key_map = QPEApplication::qpeDir() + "/share/multikey/"
+ map = QPEApplication::qpeDir() + "/share/multikey/"
+ l + ".keymap";
- } else {
-
- key_map = maps[index];
- }
-
+ }
- setKeysFromFile(key_map);
+ setKeysFromFile(map);
}
Keys::Keys(const char * filename) {
setKeysFromFile(filename);
}