-rw-r--r-- | inputmethods/multikey/configdlg.cpp | 4 | ||||
-rw-r--r-- | inputmethods/multikey/keyboard.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp index 1fba9bc..fe5051d 100644 --- a/inputmethods/multikey/configdlg.cpp +++ b/inputmethods/multikey/configdlg.cpp | |||
@@ -58,49 +58,49 @@ ConfigDlg::ConfigDlg () : QDialog () | |||
58 | 58 | ||
59 | QHBox *hbox1 = new QHBox(map_group); | 59 | QHBox *hbox1 = new QHBox(map_group); |
60 | keymaps = new QListBox(hbox1); | 60 | keymaps = new QListBox(hbox1); |
61 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 61 | keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
62 | QVBox *vbox1 = new QVBox(hbox1); | 62 | QVBox *vbox1 = new QVBox(hbox1); |
63 | 63 | ||
64 | QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up")); | 64 | QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up")); |
65 | tb1->setPixmap(Resource::loadPixmap("up")); | 65 | tb1->setPixmap(Resource::loadPixmap("up")); |
66 | tb1->setAutoRaise(TRUE); | 66 | tb1->setAutoRaise(TRUE); |
67 | tb1->setFocusPolicy(QWidget::NoFocus); | 67 | tb1->setFocusPolicy(QWidget::NoFocus); |
68 | tb1->setToggleButton(FALSE); | 68 | tb1->setToggleButton(FALSE); |
69 | connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp())); | 69 | connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp())); |
70 | 70 | ||
71 | QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down")); | 71 | QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down")); |
72 | tb2->setPixmap(Resource::loadPixmap("down")); | 72 | tb2->setPixmap(Resource::loadPixmap("down")); |
73 | tb2->setAutoRaise(TRUE); | 73 | tb2->setAutoRaise(TRUE); |
74 | tb2->setFocusPolicy(QWidget::NoFocus); | 74 | tb2->setFocusPolicy(QWidget::NoFocus); |
75 | tb2->setToggleButton(FALSE); | 75 | tb2->setToggleButton(FALSE); |
76 | connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown())); | 76 | connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown())); |
77 | 77 | ||
78 | QString cur(tr("Current Language")); | 78 | QString cur(tr("Current Language")); |
79 | keymaps->insertItem(cur); | 79 | keymaps->insertItem(cur); |
80 | keymaps->setSelected(0, true); | 80 | keymaps->setSelected(0, true); |
81 | 81 | ||
82 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); | 82 | QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); |
83 | default_maps = map_dir.entryList(); // so i can access it in other places | 83 | default_maps = map_dir.entryList(); // so i can access it in other places |
84 | custom_maps = config.readListEntry("maps", QChar('|')); | 84 | custom_maps = config.readListEntry("maps", QChar('|')); |
85 | sw_maps = ConfigDlg::loadSw(); | 85 | sw_maps = ConfigDlg::loadSw(); |
86 | 86 | ||
87 | QStringList sw_copy(sw_maps); | 87 | QStringList sw_copy(sw_maps); |
88 | for (uint i = 0; i < sw_copy.count(); i++) { | 88 | for (uint i = 0; i < sw_copy.count(); i++) { |
89 | 89 | ||
90 | QString keymap_map; | 90 | QString keymap_map; |
91 | if (sw_copy[i][0] != '/') { /* share/multikey */ | 91 | if (sw_copy[i][0] != '/') { /* share/multikey */ |
92 | 92 | ||
93 | keymap_map = map_dir.absPath() + "/" + sw_copy[i]; | 93 | keymap_map = map_dir.absPath() + "/" + sw_copy[i]; |
94 | } else { | 94 | } else { |
95 | 95 | ||
96 | if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false) | 96 | if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false) |
97 | || !QFile::exists(sw_copy[i])) { | 97 | || !QFile::exists(sw_copy[i])) { |
98 | 98 | ||
99 | custom_maps.remove(sw_copy[i]); | 99 | custom_maps.remove(sw_copy[i]); |
100 | sw_maps.remove(sw_copy[i]); | 100 | sw_maps.remove(sw_copy[i]); |
101 | 101 | ||
102 | // remove it from the list too | 102 | // remove it from the list too |
103 | config.writeEntry("maps", custom_maps.join("|")); | 103 | config.writeEntry("maps", custom_maps.join("|")); |
104 | 104 | ||
105 | continue; | 105 | continue; |
106 | } | 106 | } |
@@ -227,49 +227,49 @@ ConfigDlg::ConfigDlg () : QDialog () | |||
227 | 227 | ||
228 | label = new QLabel(tr("Text Color"), color_grid); | 228 | label = new QLabel(tr("Text Color"), color_grid); |
229 | textcolor_button = new QPushButton(color_grid); | 229 | textcolor_button = new QPushButton(color_grid); |
230 | connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); | 230 | connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); |
231 | textcolor_button->setFlat(TRUE); | 231 | textcolor_button->setFlat(TRUE); |
232 | color = config.readListEntry("textcolor", QChar(',')); | 232 | color = config.readListEntry("textcolor", QChar(',')); |
233 | textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); | 233 | textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); |
234 | 234 | ||
235 | label = new QLabel("", color_grid); // a spacer so the above buttons dont expand | 235 | label = new QLabel("", color_grid); // a spacer so the above buttons dont expand |
236 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); | 236 | label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); |
237 | /* FIXME: hacked spacer height */ | 237 | /* FIXME: hacked spacer height */ |
238 | QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum); | 238 | QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum); |
239 | 239 | ||
240 | color_lay->addWidget(color_grid, 0, 0); | 240 | color_lay->addWidget(color_grid, 0, 0); |
241 | color_lay->addItem(spacer); | 241 | color_lay->addItem(spacer); |
242 | 242 | ||
243 | tabs->addTab(color_box, tr("Colors")); | 243 | tabs->addTab(color_box, tr("Colors")); |
244 | base_lay->addWidget(tabs); | 244 | base_lay->addWidget(tabs); |
245 | } | 245 | } |
246 | 246 | ||
247 | QStringList ConfigDlg::loadSw() | 247 | QStringList ConfigDlg::loadSw() |
248 | { | 248 | { |
249 | Config *config = new Config("multikey"); | 249 | Config *config = new Config("multikey"); |
250 | config->setGroup("keymaps"); | 250 | config->setGroup("keymaps"); |
251 | QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); | 251 | QDir map_dir(QPEApplication::qpeDir() + "share/multikey", "*.keymap"); |
252 | QStringList d_maps = map_dir.entryList(); // so i can access it in other places | 252 | QStringList d_maps = map_dir.entryList(); // so i can access it in other places |
253 | QStringList c_maps = config->readListEntry("maps", QChar('|')); | 253 | QStringList c_maps = config->readListEntry("maps", QChar('|')); |
254 | QStringList s_maps = config->readListEntry("sw", QChar('|')); | 254 | QStringList s_maps = config->readListEntry("sw", QChar('|')); |
255 | delete config; | 255 | delete config; |
256 | 256 | ||
257 | if (!s_maps.count()) | 257 | if (!s_maps.count()) |
258 | { | 258 | { |
259 | s_maps = d_maps+c_maps; | 259 | s_maps = d_maps+c_maps; |
260 | } | 260 | } |
261 | else | 261 | else |
262 | { | 262 | { |
263 | /* Clear non existents entries */ | 263 | /* Clear non existents entries */ |
264 | QStringList s_copy(s_maps); | 264 | QStringList s_copy(s_maps); |
265 | for (uint i = 0; i < s_copy.count(); ++i) { | 265 | for (uint i = 0; i < s_copy.count(); ++i) { |
266 | if (d_maps.find(s_copy[i]) == d_maps.end() | 266 | if (d_maps.find(s_copy[i]) == d_maps.end() |
267 | && c_maps.find(s_copy[i]) == c_maps.end()) { | 267 | && c_maps.find(s_copy[i]) == c_maps.end()) { |
268 | s_maps.remove(s_copy[i]); | 268 | s_maps.remove(s_copy[i]); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | /* Update sw_maps from default_maps */ | 271 | /* Update sw_maps from default_maps */ |
272 | for (uint i = 0; i < d_maps.count(); ++i) { | 272 | for (uint i = 0; i < d_maps.count(); ++i) { |
273 | if (s_maps.find(d_maps[i]) == s_maps.end()) { | 273 | if (s_maps.find(d_maps[i]) == s_maps.end()) { |
274 | s_maps.append(d_maps[i]); | 274 | s_maps.append(d_maps[i]); |
275 | } | 275 | } |
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp index 7ddfd3e..f8cafd5 100644 --- a/inputmethods/multikey/keyboard.cpp +++ b/inputmethods/multikey/keyboard.cpp | |||
@@ -1356,54 +1356,54 @@ ushort Keyboard::constoe(const ushort c) { | |||
1356 | default: return 0; | 1356 | default: return 0; |
1357 | 1357 | ||
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | } | 1360 | } |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | 1363 | ||
1364 | // Keys::Keys {{{1 | 1364 | // Keys::Keys {{{1 |
1365 | 1365 | ||
1366 | Keys::Keys() { | 1366 | Keys::Keys() { |
1367 | 1367 | ||
1368 | Config *config = new Config ("multikey"); | 1368 | Config *config = new Config ("multikey"); |
1369 | config->setGroup( "keymaps" ); | 1369 | config->setGroup( "keymaps" ); |
1370 | QString map = config->readEntry( "current" ); | 1370 | QString map = config->readEntry( "current" ); |
1371 | delete config; | 1371 | delete config; |
1372 | 1372 | ||
1373 | if (map.isNull() || !(QFile(map).exists())) { | 1373 | if (map.isNull() || !(QFile(map).exists())) { |
1374 | 1374 | ||
1375 | Config *config = new Config("locale"); | 1375 | Config *config = new Config("locale"); |
1376 | config->setGroup( "Language" ); | 1376 | config->setGroup( "Language" ); |
1377 | QString l = config->readEntry( "Language" , "en" ); | 1377 | QString l = config->readEntry( "Language" , "en" ); |
1378 | delete config; | 1378 | delete config; |
1379 | 1379 | ||
1380 | map = QPEApplication::qpeDir() + "/share/multikey/" | 1380 | map = QPEApplication::qpeDir() + "share/multikey/" |
1381 | + l + ".keymap"; | 1381 | + l + ".keymap"; |
1382 | 1382 | ||
1383 | } | 1383 | } |
1384 | if (map.isNull() || !(QFile(map).exists())) { | 1384 | if (map.isNull() || !(QFile(map).exists())) { |
1385 | map = QPEApplication::qpeDir() + "/share/multikey/en.keymap"; | 1385 | map = QPEApplication::qpeDir() + "share/multikey/en.keymap"; |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | setKeysFromFile(map); | 1388 | setKeysFromFile(map); |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | Keys::Keys(const char * filename) { | 1391 | Keys::Keys(const char * filename) { |
1392 | 1392 | ||
1393 | setKeysFromFile(filename); | 1393 | setKeysFromFile(filename); |
1394 | } | 1394 | } |
1395 | 1395 | ||
1396 | // Keys::setKeysFromFile {{{2 | 1396 | // Keys::setKeysFromFile {{{2 |
1397 | void Keys::setKeysFromFile(const char * filename) { | 1397 | void Keys::setKeysFromFile(const char * filename) { |
1398 | 1398 | ||
1399 | QFile f(filename); | 1399 | QFile f(filename); |
1400 | 1400 | ||
1401 | if (f.open(IO_ReadOnly)) { | 1401 | if (f.open(IO_ReadOnly)) { |
1402 | 1402 | ||
1403 | QTextStream t(&f); | 1403 | QTextStream t(&f); |
1404 | int row; | 1404 | int row; |
1405 | int qcode; | 1405 | int qcode; |
1406 | ushort unicode; | 1406 | ushort unicode; |
1407 | int width; | 1407 | int width; |
1408 | QString buf; | 1408 | QString buf; |
1409 | QString comment; | 1409 | QString comment; |