summaryrefslogtreecommitdiff
path: root/inputmethods/multikey
Side-by-side diff
Diffstat (limited to 'inputmethods/multikey') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp1
-rw-r--r--inputmethods/multikey/keyboard.cpp2
2 files changed, 2 insertions, 1 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 1e104a6..59a290b 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -208,52 +208,53 @@ 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, QChar('|'));
config.writeEntry("current", map);
}
// ConfigDlg::removeMap() {{{1
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, QChar('|'));
}
// ConfigDlg::color {{{1
void ConfigDlg::keyColorButtonClicked() {
Config config ("multikey");
config.setGroup ("colors");
QStringList color = config.readListEntry("keycolor", QChar(','));
QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
color[0].setNum(newcolor.red());
color[1].setNum(newcolor.green());
color[2].setNum(newcolor.blue());
config.writeEntry("keycolor", color, QChar(','));
+ config.write();
key_color_button->setBackgroundColor(newcolor);
emit reloadKeyboard();
}
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 68918a6..8280297 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -503,97 +503,97 @@ void Keyboard::togglePickboard(bool on_off)
QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
}
/* Keyboard::setMapTo ... {{{1 */
void Keyboard::setMapToDefault() {
/* load current locale language map */
Config *config = new Config("locale");
config->setGroup( "Language" );
QString l = config->readEntry( "Language" , "en" );
delete config;
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", key_map); // default closed
delete config;
delete keys;
keys = new Keys(key_map);
// have to repaint the keyboard
repaint(FALSE);
}
void Keyboard::setMapToFile(QString map) {
/* save change to multikey config file */
Config *config = new Config("multikey");
config->setGroup ("keymaps");
config->writeEntry ("current", map); // default closed
delete config;
delete keys;
if (QFile(map).exists())
keys = new Keys(map);
else
keys = new Keys();
repaint(FALSE);
}
-/* Keybaord::setColor {{{1 */
+/* Keybaord::reloadKeyboard {{{1 */
void Keyboard::reloadKeyboard() {
// reload colors and redraw
loadKeyboardColors();
repaint();
}
void Keyboard::loadKeyboardColors() {
Config config ("multikey");
config.setGroup("colors");
QStringList color;
color = config.readListEntry("keycolor", QChar(','));
if (color.isEmpty()) {
color = QStringList::split(",", "240,240,240");
config.writeEntry("keycolor", color.join(","));
}
keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
color = config.readListEntry("keycolor_pressed", QChar(','));
if (color.isEmpty()) {
color = QStringList::split(",", "171,183,198");
config.writeEntry("keycolor_pressed", color.join(","));
}
keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
color = config.readListEntry("keycolor_lines", QChar(','));
if (color.isEmpty()) {
color = QStringList::split(",", "138,148,160");
config.writeEntry("keycolor_lines", color.join(","));
}
keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
color = config.readListEntry("textcolor", QChar(','));
if (color.isEmpty()) {
color = QStringList::split(",", "43,54,68");
config.writeEntry("textcolor", color.join(","));
}
textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
}