summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-04 14:22:59 (UTC)
committer mickeyl <mickeyl>2004-01-04 14:22:59 (UTC)
commit5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057 (patch) (unidiff)
treec2e1b4a090ca53efd3b3e0c20d12a633e01470d4
parent84f039ef3799c5310a4f94057b9d76d4ee55f499 (diff)
downloadopie-5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057.zip
opie-5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057.tar.gz
opie-5c4c2a789c19e727bb9ca323ea1fec1b7d1bd057.tar.bz2
more patches to multikey+applet courtesy Anton Kachalov <mouse@altlinux.ru>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/multikeyapplet/multikey.cpp22
-rw-r--r--core/applets/multikeyapplet/multikey.h2
-rw-r--r--inputmethods/multikey/configdlg.cpp161
-rw-r--r--inputmethods/multikey/configdlg.h12
-rw-r--r--share/multikey/ru.keymap255
5 files changed, 359 insertions, 93 deletions
diff --git a/core/applets/multikeyapplet/multikey.cpp b/core/applets/multikeyapplet/multikey.cpp
index 0a056b0..f1227ef 100644
--- a/core/applets/multikeyapplet/multikey.cpp
+++ b/core/applets/multikeyapplet/multikey.cpp
@@ -1,106 +1,122 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru 2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14 14
15#include "multikey.h" 15#include "multikey.h"
16 16
17#include <qpe/global.h> 17#include <qpe/global.h>
18#include <qpe/config.h> 18#include <qpe/config.h>
19#include <qpe/qcopenvelope_qws.h> 19#include <qpe/qcopenvelope_qws.h>
20#include <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21 21
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qdir.h> 23#include <qdir.h>
24#include <qfileinfo.h> 24#include <qfileinfo.h>
25#include <qcopchannel_qws.h> 25#include <qcopchannel_qws.h>
26 26
27Multikey::Multikey( QWidget *parent ) : QLabel( parent ), current("EN") 27Multikey::Multikey(QWidget *parent) : QLabel(parent), popupMenu(this), current("EN")
28{ 28{
29 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this); 29 QCopChannel* swChannel = new QCopChannel("MultiKey/Switcher", this);
30 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)), 30 connect( swChannel, SIGNAL(received(const QCString &, const QByteArray &)),
31 this, SLOT(message(const QCString &, const QByteArray &))); 31 this, SLOT(message(const QCString &, const QByteArray &)));
32 32
33 setFont( QFont( "Helvetica", 10, QFont::Normal ) ); 33 setFont( QFont( "Helvetica", 10, QFont::Normal ) );
34 lang = 0; 34 lang = 0;
35 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()"); 35 QCopEnvelope e("MultiKey/Keyboard", "getmultikey()");
36 setText("EN"); 36 setText("EN");
37 popupMenu.insertItem("EN", -1);
37 show(); 38 show();
38} 39}
39 40
40void Multikey::mousePressEvent( QMouseEvent * ) 41void Multikey::mousePressEvent(QMouseEvent *ev)
41{ 42{
43 if (ev->button() == RightButton) {
44
45 QPoint p = mapToGlobal(QPoint(0, 0));
46 QSize s = popupMenu.sizeHint();
47 int opt = popupMenu.exec(QPoint(p.x() + (width() / 2) - (s.width() / 2),
48 p.y() - s.height()), 0);
49
50 if (opt == -1)
51 return;
52 lang = opt;
53 } else {
54 lang = lang < sw_maps.count()-1 ? lang+1 : 0;
55 }
56
42 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)"); 57 QCopEnvelope e("MultiKey/Keyboard", "setmultikey(QString)");
43 lang = lang < sw_maps.count()-1 ? lang+1 : 0;
44 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii()); 58 //qDebug("Lang=%d, count=%d, lab=%s", lang, sw_maps.count(), labels[lang].ascii());
45 e << sw_maps[lang]; 59 e << sw_maps[lang];
46 setText(labels[lang]); 60 setText(labels[lang]);
47} 61}
48 62
49void Multikey::message(const QCString &message, const QByteArray &data) 63void Multikey::message(const QCString &message, const QByteArray &data)
50{ 64{
51 if ( message == "setsw(QString,QString)" ) { 65 if ( message == "setsw(QString,QString)" ) {
52 66
53 QDataStream stream(data, IO_ReadOnly); 67 QDataStream stream(data, IO_ReadOnly);
54 QString maps, current_map; 68 QString maps, current_map;
55 stream >> maps >> current_map; 69 stream >> maps >> current_map;
56 QStringList sw = QStringList::split(QChar('|'), maps); 70 QStringList sw = QStringList::split(QChar('|'), maps);
57 sw.append(current_map); 71 sw.append(current_map);
58 72
59 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap"); 73 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey/", "*.keymap");
60 lang = 0; 74 lang = 0;
61 labels.clear(); 75 labels.clear();
62 sw_maps.clear(); 76 sw_maps.clear();
77 popupMenu.clear();
63 78
64 for (uint i = 0; i < sw.count(); ++i) { 79 for (uint i = 0; i < sw.count(); ++i) {
65 QString keymap_map; 80 QString keymap_map;
66 if (sw[i][0] != '/') { 81 if (sw[i][0] != '/') {
67 82
68 keymap_map = map_dir.absPath() + "/" + sw[i]; 83 keymap_map = map_dir.absPath() + "/" + sw[i];
69 } else { 84 } else {
70 85
71 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false) 86 if ((map_dir.exists(QFileInfo(sw[i]).fileName(), false)
72 && i != sw.count()-1) || !QFile::exists(sw[i])) { 87 && i != sw.count()-1) || !QFile::exists(sw[i])) {
73 continue; 88 continue;
74 } 89 }
75 keymap_map = sw[i]; 90 keymap_map = sw[i];
76 } 91 }
77 92
78 QFile map(keymap_map); 93 QFile map(keymap_map);
79 if (map.open(IO_ReadOnly)) { 94 if (map.open(IO_ReadOnly)) {
80 QString line; 95 QString line;
81 96
82 map.readLine(line, 1024); 97 map.readLine(line, 1024);
83 while (!map.atEnd()) { 98 while (!map.atEnd()) {
84 99
85 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) { 100 if (line.find(QRegExp("^sw\\s*=\\s*")) != -1) {
86 101
87 if (i != sw.count()-1) { 102 if (i != sw.count()-1) {
88 if (keymap_map == current_map) { 103 if (keymap_map == current_map) {
89 lang = i; 104 lang = i;
90 } 105 }
91 sw_maps.append(keymap_map); 106 sw_maps.append(keymap_map);
92 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 107 labels.append(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
108 popupMenu.insertItem(labels[labels.count()-1], labels.count()-1);
93 } else { 109 } else {
94 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace(); 110 current = line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace();
95 } 111 }
96 break; 112 break;
97 } 113 }
98 map.readLine(line, 1024); 114 map.readLine(line, 1024);
99 } 115 }
100 map.close(); 116 map.close();
101 } 117 }
102 } 118 }
103 119
104 setText(current); 120 setText(current);
105 } 121 }
106} 122}
diff --git a/core/applets/multikeyapplet/multikey.h b/core/applets/multikeyapplet/multikey.h
index 2cb7b29..b525074 100644
--- a/core/applets/multikeyapplet/multikey.h
+++ b/core/applets/multikeyapplet/multikey.h
@@ -1,38 +1,40 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru 2** Copyright (C) 2004 Anton Kachalov mouse@altlinux.ru
3** All rights reserved. 3** All rights reserved.
4** 4**
5** This file may be distributed and/or modified under the terms of the 5** This file may be distributed and/or modified under the terms of the
6** GNU General Public License version 2 as published by the Free Software 6** GNU General Public License version 2 as published by the Free Software
7** Foundation and appearing in the file LICENSE.GPL included in the 7** Foundation and appearing in the file LICENSE.GPL included in the
8** packaging of this file. 8** packaging of this file.
9** 9**
10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 10** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 11** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
12** 12**
13**********************************************************************/ 13**********************************************************************/
14#ifndef __MULTIKEY_H__ 14#ifndef __MULTIKEY_H__
15#define __MULTIKEY_H__ 15#define __MULTIKEY_H__
16 16
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qstringlist.h> 18#include <qstringlist.h>
19#include <qpopupmenu.h>
19#include <qcopchannel_qws.h> 20#include <qcopchannel_qws.h>
20 21
21class Multikey : public QLabel 22class Multikey : public QLabel
22{ 23{
23 Q_OBJECT 24 Q_OBJECT
24public: 25public:
25 Multikey( QWidget *parent ); 26 Multikey( QWidget *parent );
26 27
27public slots: 28public slots:
28 void message(const QCString &message, const QByteArray &data); 29 void message(const QCString &message, const QByteArray &data);
29 30
30protected: 31protected:
31 void mousePressEvent( QMouseEvent * ); 32 void mousePressEvent( QMouseEvent * );
32 QStringList sw_maps; 33 QStringList sw_maps;
33 QStringList labels; 34 QStringList labels;
35 QPopupMenu popupMenu;
34 QString current; 36 QString current;
35 uint lang; 37 uint lang;
36}; 38};
37 39
38#endif /* __MULTIKEY_H__ */ 40#endif /* __MULTIKEY_H__ */
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index f127d0e..d29109a 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -1,514 +1,509 @@
1/* 1/*
2 * TODO 2 * TODO
3 * make a font selection thing (size too) 3 * make a font selection thing (size too)
4 * make a keymap editor 4 * make a keymap editor
5 * make keys translucent 5 * make keys translucent
6 * make vertical keys possible 6 * make vertical keys possible
7 * 7 *
8 * 8 *
9 */ 9 */
10 10
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include <qpe/resource.h> 13#include <qpe/resource.h>
14 14
15#include <qlayout.h>
15#include <qwidget.h> 16#include <qwidget.h>
16#include <qdialog.h> 17#include <qdialog.h>
17#include <qtabwidget.h> 18#include <qtabwidget.h>
18#include <qvbox.h> 19#include <qvbox.h>
19#include <qgrid.h> 20#include <qgrid.h>
20#include <qgroupbox.h> 21#include <qgroupbox.h>
21#include <qlabel.h> 22#include <qlabel.h>
22#include <qcheckbox.h> 23#include <qcheckbox.h>
23#include <qsizepolicy.h> 24#include <qsizepolicy.h>
24#include <qpushbutton.h> 25#include <qpushbutton.h>
25#include <qlistbox.h> 26#include <qlistbox.h>
26#include <qstringlist.h> 27#include <qstringlist.h>
27#include <qtoolbutton.h> 28#include <qtoolbutton.h>
28#include <opie/ofiledialog.h> 29#include <opie/ofiledialog.h>
29#include <opie/colordialog.h> 30#include <opie/colordialog.h>
30#include <qdir.h> 31#include <qdir.h>
31#include <qfileinfo.h> 32#include <qfileinfo.h>
32#include "configdlg.h" 33#include "configdlg.h"
33#include "keyboard.h" 34#include "keyboard.h"
34 35
35// ConfigDlg::ConfigDlg() {{{1 36// ConfigDlg::ConfigDlg() {{{1
36ConfigDlg::ConfigDlg () : QTabWidget () 37ConfigDlg::ConfigDlg () : QDialog ()
37{ 38{
38 setCaption( tr("Multikey Configuration") ); 39 setCaption( tr("Multikey Configuration") );
39 Config config ("multikey"); 40 Config config ("multikey");
40 config.setGroup("keymaps"); 41 config.setGroup("keymaps");
41 QString current_map = config.readEntry("current", 0); 42 QString current_map = config.readEntry("current", 0);
42 43
43 /* 44 /*
44 * 'general config' tab 45 * 'general config' tab
45 */ 46 */
46 47
47 QVBox *gen_box = new QVBox (this); 48 QVBoxLayout *base_lay = new QVBoxLayout(this);
48 gen_box->setMargin(3); 49
49 addTab(gen_box, tr("General Settings")); 50 QTabWidget *tabs = new QTabWidget(this, "tabs");
50 51
52 QWidget *gen_box = new QWidget(tabs, "gen_tab");
53 QVBoxLayout *gen_lay = new QVBoxLayout(gen_box);
54 gen_lay->setMargin(3);
51 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); 55 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box);
52 56
53 QHBox *hbox1 = new QHBox(map_group); 57 QHBox *hbox1 = new QHBox(map_group);
54 keymaps = new QListBox(hbox1); 58 keymaps = new QListBox(hbox1);
55 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 59 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
56 QVBox *vbox1 = new QVBox(hbox1); 60 QVBox *vbox1 = new QVBox(hbox1);
57 61
58 QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up")); 62 QToolButton *tb1 = new QToolButton(vbox1, tr("Move Up"));
59 tb1->setPixmap(Resource::loadPixmap("up")); 63 tb1->setPixmap(Resource::loadPixmap("up"));
60 tb1->setAutoRaise(TRUE); 64 tb1->setAutoRaise(TRUE);
61 tb1->setFocusPolicy(QWidget::NoFocus); 65 tb1->setFocusPolicy(QWidget::NoFocus);
62 tb1->setToggleButton(FALSE); 66 tb1->setToggleButton(FALSE);
63 connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp())); 67 connect(tb1, SIGNAL(clicked()), this, SLOT(moveSelectedUp()));
64 68
65 QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down")); 69 QToolButton *tb2 = new QToolButton(vbox1, tr("Move Down"));
66 tb2->setPixmap(Resource::loadPixmap("down")); 70 tb2->setPixmap(Resource::loadPixmap("down"));
67 tb2->setAutoRaise(TRUE); 71 tb2->setAutoRaise(TRUE);
68 tb2->setFocusPolicy(QWidget::NoFocus); 72 tb2->setFocusPolicy(QWidget::NoFocus);
69 tb2->setToggleButton(FALSE); 73 tb2->setToggleButton(FALSE);
70 connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown())); 74 connect(tb2, SIGNAL(clicked()), this, SLOT(moveSelectedDown()));
71 75
72 QString cur(tr("Current Language")); 76 QString cur(tr("Current Language"));
73 keymaps->insertItem(cur); 77 keymaps->insertItem(cur);
74 keymaps->setSelected(0, true); 78 keymaps->setSelected(0, true);
75 79
76 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); 80 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap");
77 default_maps = map_dir.entryList(); // so i can access it in other places 81 default_maps = map_dir.entryList(); // so i can access it in other places
78 custom_maps = config.readListEntry("maps", QChar('|')); 82 custom_maps = config.readListEntry("maps", QChar('|'));
79 sw_maps = ConfigDlg::loadSw(); 83 sw_maps = ConfigDlg::loadSw();
80 84
81 QStringList sw_copy(sw_maps); 85 QStringList sw_copy(sw_maps);
82 for (uint i = 0; i < sw_copy.count(); i++) { 86 for (uint i = 0; i < sw_copy.count(); i++) {
83 87
84 QString keymap_map; 88 QString keymap_map;
85 if (sw_copy[i][0] != '/') { /* share/multikey */ 89 if (sw_copy[i][0] != '/') { /* share/multikey */
86 90
87 keymap_map = map_dir.absPath() + "/" + sw_copy[i]; 91 keymap_map = map_dir.absPath() + "/" + sw_copy[i];
88 } else { 92 } else {
89 93
90 if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false) 94 if (map_dir.exists(QFileInfo(sw_copy[i]).fileName(), false)
91 || !QFile::exists(sw_copy[i])) { 95 || !QFile::exists(sw_copy[i])) {
92 96
93 custom_maps.remove(sw_copy[i]); 97 custom_maps.remove(sw_copy[i]);
94 sw_maps.remove(sw_copy[i]); 98 sw_maps.remove(sw_copy[i]);
95 99
96 // remove it from the list too 100 // remove it from the list too
97 config.writeEntry("maps", custom_maps.join("|")); 101 config.writeEntry("maps", custom_maps.join("|"));
98 102
99 continue; 103 continue;
100 } 104 }
101 keymap_map = sw_copy[i]; 105 keymap_map = sw_copy[i];
102 } 106 }
103 107
104 QFile map(keymap_map); 108 QFile map(keymap_map);
105 if (map.open(IO_ReadOnly)) { 109 if (map.open(IO_ReadOnly)) {
106 110
107 QString line; bool found = 0; 111 QString line; bool found = 0;
108 112
109 map.readLine(line, 1024); 113 map.readLine(line, 1024);
110 while (!map.atEnd()) { 114 while (!map.atEnd()) {
111 115
112 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { 116 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) {
113 117
114 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 118 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
115 found = 1; 119 found = 1;
116 break; 120 break;
117 } 121 }
118 map.readLine(line, 1024); 122 map.readLine(line, 1024);
119 } 123 }
120 if (!found) 124 if (!found)
121 keymaps->insertItem(keymap_map); 125 keymaps->insertItem(keymap_map);
122 126
123 map.close(); 127 map.close();
124 } 128 }
125 129
126 if (keymap_map == current_map) { 130 if (keymap_map == current_map) {
127 keymaps->setSelected(i + 1, true); 131 keymaps->setSelected(i + 1, true);
128 } 132 }
129 } 133 }
130 134
131 // have to "+1" because the "current language" listItem... remember? 135 // have to "+1" because the "current language" listItem... remember?
132
133 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); 136 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int)));
134 137
135 QGrid *add_remove_grid = new QGrid(2, map_group); 138 QGrid *add_remove_grid = new QGrid(2, map_group);
136 add_remove_grid->setMargin(3); 139 add_remove_grid->setMargin(3);
137 add_remove_grid->setSpacing(3); 140 add_remove_grid->setSpacing(3);
138 141
139 add_button = new QPushButton(tr("Add"), add_remove_grid); 142 add_button = new QPushButton(tr("Add"), add_remove_grid);
140 add_button->setFlat(TRUE); 143 add_button->setFlat(TRUE);
141 connect(add_button, SIGNAL(clicked()), SLOT(addMap())); 144 connect(add_button, SIGNAL(clicked()), SLOT(addMap()));
142 145
143 remove_button = new QPushButton(tr("Remove"), add_remove_grid); 146 remove_button = new QPushButton(tr("Remove"), add_remove_grid);
144 remove_button->setFlat(TRUE); 147 remove_button->setFlat(TRUE);
145 if (default_maps.find(QFileInfo(current_map).fileName()) != default_maps.end()) 148 if (keymaps->currentItem() == 0 || default_maps.find(QFileInfo(current_map).fileName()) != default_maps.end())
146 remove_button->setDisabled(true); 149 remove_button->setDisabled(true);
147 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); 150 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap()));
148 151
152 gen_lay->addWidget(map_group);
153
149 // make a box that will contain the buttons on the bottom 154 // make a box that will contain the buttons on the bottom
150 QGrid *other_grid = new QGrid(2, gen_box); 155 QGrid *other_grid = new QGrid(2, gen_box);
151 pick_button = new QCheckBox(tr("Pickboard"), other_grid); 156 pick_button = new QCheckBox(tr("Pickboard"), other_grid);
152 157
153 config.setGroup ("general"); 158 config.setGroup ("general");
154 bool pick_open = config.readBoolEntry ("usePickboard", FALSE); // default closed 159 bool pick_open = config.readBoolEntry ("usePickboard", FALSE); // default closed
155 if (pick_open) { 160 if (pick_open) {
156 161
157 pick_button->setChecked(true); 162 pick_button->setChecked(true);
158 } 163 }
159 164
160 // by connecting it after checking it, the signal isn't emmited
161 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog()));
162
163 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); 165 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid);
164 bool repeat_on = config.readBoolEntry ("useRepeat", TRUE); 166 bool repeat_on = config.readBoolEntry ("useRepeat", TRUE);
165 167
166 if (repeat_on) { 168 if (repeat_on) {
167 169
168 repeat_button->setChecked(true); 170 repeat_button->setChecked(true);
169 } 171 }
170 connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog())); 172
173 gen_lay->addWidget(other_grid);
174 tabs->addTab(gen_box, tr("General Settings"));
171 175
172 /* 176 /*
173 * 'color' tab 177 * 'color' tab
174 */ 178 */
175 179
176 QGrid *color_box = new QGrid(2, this); 180 QWidget *color_box = new QWidget(tabs, "color_tab");
177 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 181
178 color_box->setMargin(3); 182 QGridLayout *color_lay = new QGridLayout(color_box);
179 color_box->setSpacing(3); 183 QGrid *color_grid = new QGrid(2, color_box);
180 addTab(color_box, tr("Colors")); 184 color_lay->setAlignment(Qt::AlignTop);
185 color_grid->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
186 color_grid->layout()->setAlignment(Qt::AlignTop);
187 color_grid->setMargin(3);
188 color_grid->setSpacing(3);
181 189
182 QLabel *label; 190 QLabel *label;
183 QStringList color; 191 QStringList color;
184 config.setGroup("colors"); 192 config.setGroup("colors");
185 193
186 label = new QLabel(tr("Key Color"), color_box); 194 label = new QLabel(tr("Key Color"), color_grid);
187 keycolor_button = new QPushButton(color_box); 195 keycolor_button = new QPushButton(color_grid);
188 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); 196 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked()));
189 keycolor_button->setFlat(TRUE); 197 keycolor_button->setFlat(TRUE);
190 color = config.readListEntry("keycolor", QChar(',')); 198 color = config.readListEntry("keycolor", QChar(','));
191 /* 199 /*
192 * hopefully not required 200 * hopefully not required
193 201
194 if (color.isEmpty()) { 202 if (color.isEmpty()) {
195 color = QStringList::split(",", "240,240,240"); 203 color = QStringList::split(",", "240,240,240");
196 config.writeEntry("keycolor", color.join(",")); 204 config.writeEntry("keycolor", color.join(","));
197 205
198 } 206 }
199 */ 207 */
200 keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))); 208 keycolor_button->setPalette(QPalette(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())));
201 209
202 210
203 label = new QLabel(tr("Key Pressed Color"), color_box); 211 label = new QLabel(tr("Key Pressed Color"), color_grid);
204 keycolor_pressed_button = new QPushButton(color_box); 212 keycolor_pressed_button = new QPushButton(color_grid);
205 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); 213 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked()));
206 keycolor_pressed_button->setFlat(TRUE); 214 keycolor_pressed_button->setFlat(TRUE);
207 color = config.readListEntry("keycolor_pressed", QChar(',')); 215 color = config.readListEntry("keycolor_pressed", QChar(','));
208 keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 216 keycolor_pressed_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
209 217
210 label = new QLabel(tr("Line Color"), color_box); 218 label = new QLabel(tr("Line Color"), color_grid);
211 keycolor_lines_button = new QPushButton(color_box); 219 keycolor_lines_button = new QPushButton(color_grid);
212 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); 220 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked()));
213 keycolor_lines_button->setFlat(TRUE); 221 keycolor_lines_button->setFlat(TRUE);
214 color = config.readListEntry("keycolor_lines", QChar(',')); 222 color = config.readListEntry("keycolor_lines", QChar(','));
215 keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 223 keycolor_lines_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
216 224
217 225
218 label = new QLabel(tr("Text Color"), color_box); 226 label = new QLabel(tr("Text Color"), color_grid);
219 textcolor_button = new QPushButton(color_box); 227 textcolor_button = new QPushButton(color_grid);
220 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); 228 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked()));
221 textcolor_button->setFlat(TRUE); 229 textcolor_button->setFlat(TRUE);
222 color = config.readListEntry("textcolor", QChar(',')); 230 color = config.readListEntry("textcolor", QChar(','));
223 textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())))); 231 textcolor_button->setPalette(QPalette((QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()))));
224 232
225 label = new QLabel("", color_box); // a spacer so the above buttons dont expand 233 label = new QLabel("", color_grid); // a spacer so the above buttons dont expand
226 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 234 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
227} 235 /* FIXME: hacked spacer height */
236 QSpacerItem *spacer = new QSpacerItem(0, 300, QSizePolicy::Expanding, QSizePolicy::Maximum);
228 237
229ConfigDlg::~ConfigDlg() 238 color_lay->addWidget(color_grid, 0, 0);
230{ 239 color_lay->addItem(spacer);
231 emit reloadSw(); 240
241 tabs->addTab(color_box, tr("Colors"));
242 base_lay->addWidget(tabs);
232} 243}
233 244
234QStringList ConfigDlg::loadSw() 245QStringList ConfigDlg::loadSw()
235{ 246{
236 Config *config = new Config("multikey"); 247 Config *config = new Config("multikey");
237 config->setGroup("keymaps"); 248 config->setGroup("keymaps");
238 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); 249 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap");
239 QStringList d_maps = map_dir.entryList(); // so i can access it in other places 250 QStringList d_maps = map_dir.entryList(); // so i can access it in other places
240 QStringList c_maps = config->readListEntry("maps", QChar('|')); 251 QStringList c_maps = config->readListEntry("maps", QChar('|'));
241 QStringList s_maps = config->readListEntry("sw", QChar('|')); 252 QStringList s_maps = config->readListEntry("sw", QChar('|'));
242 delete config; 253 delete config;
243 254
244 if (!s_maps.count()) 255 if (!s_maps.count())
245 { 256 {
246 s_maps = d_maps+c_maps; 257 s_maps = d_maps+c_maps;
247 } 258 }
248 else 259 else
249 { 260 {
250 /* Clear non existents entries */ 261 /* Clear non existents entries */
251 QStringList s_copy = s_maps; 262 QStringList s_copy(s_maps);
252 for (uint i = 0; i < s_copy.count(); ++i) { 263 for (uint i = 0; i < s_copy.count(); ++i) {
253 if (d_maps.find(s_copy[i]) == d_maps.end() 264 if (d_maps.find(s_copy[i]) == d_maps.end()
254 && c_maps.find(s_copy[i]) == c_maps.end()) { 265 && c_maps.find(s_copy[i]) == c_maps.end()) {
255 s_maps.remove(s_copy[i]); 266 s_maps.remove(s_copy[i]);
256 } 267 }
257 } 268 }
258 /* Update sw_maps from default_maps */ 269 /* Update sw_maps from default_maps */
259 for (uint i = 0; i < d_maps.count(); ++i) { 270 for (uint i = 0; i < d_maps.count(); ++i) {
260 if (s_maps.find(d_maps[i]) == s_maps.end()) { 271 if (s_maps.find(d_maps[i]) == s_maps.end()) {
261 s_maps.append(d_maps[i]); 272 s_maps.append(d_maps[i]);
262 } 273 }
263 } 274 }
264 /* Update sw_maps from custom_maps */ 275 /* Update sw_maps from custom_maps */
265 for (uint i = 0; i < c_maps.count(); ++i) { 276 for (uint i = 0; i < c_maps.count(); ++i) {
266 if (s_maps.find(c_maps[i]) == s_maps.end()) { 277 if (s_maps.find(c_maps[i]) == s_maps.end()) {
267 s_maps.append(c_maps[i]); 278 s_maps.append(c_maps[i]);
268 } 279 }
269 } 280 }
270 } 281 }
271 282
272 return s_maps; 283 return s_maps;
273} 284}
274 285
286void ConfigDlg::accept()
287{
288 /* Writing all stuffs to config */
289 Config *config = new Config("multikey");
290 config->setGroup("general");
291 config->writeEntry("usePickboard", pick_button->isChecked()); // default closed
292 config->writeEntry("useRepeat", repeat_button->isChecked()); // default closed
293
294 config->setGroup("keymaps");
295 config->writeEntry("sw", sw_maps, QChar('|'));
296 config->writeEntry("maps", custom_maps, QChar('|'));
297 delete config;
298
299 int index = keymaps->currentItem();
300 if (index == 0) {
301
302 remove_button->setDisabled(true);
303 emit setMapToDefault();
304 }
305 else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) {
306
307 remove_button->setDisabled(true);
308 emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]);
309
310 } else {
311
312 remove_button->setEnabled(true);
313 emit setMapToFile(sw_maps[index - 1]);
314 }
315
316 emit pickboardToggled(pick_button->isChecked());
317 emit repeatToggled(repeat_button->isChecked());
318 emit reloadSw();
319
320 QDialog::accept();
321 emit configDlgClosed();
322}
323
275void ConfigDlg::moveSelectedUp() 324void ConfigDlg::moveSelectedUp()
276{ 325{
277 int i = keymaps->currentItem(); 326 int i = keymaps->currentItem();
278 /* Ignore Current Language */ 327 /* Ignore Current Language */
279 if (i > 1) { 328 if (i > 1) {
280 QString t = sw_maps[i-1]; 329 QString t = sw_maps[i-1];
281 sw_maps[i-1] = sw_maps[i-2]; 330 sw_maps[i-1] = sw_maps[i-2];
282 sw_maps[i-2] = t; 331 sw_maps[i-2] = t;
283 332
284 QString item = keymaps->currentText(); 333 QString item = keymaps->currentText();
285 keymaps->removeItem(i); 334 keymaps->removeItem(i);
286 keymaps->insertItem(item, i-1); 335 keymaps->insertItem(item, i-1);
287 keymaps->setCurrentItem(i-1); 336 keymaps->setCurrentItem(i-1);
288
289 Config config("multikey");
290 config.setGroup("keymaps");
291 config.writeEntry("sw", sw_maps, QChar('|'));
292 } 337 }
293} 338}
294 339
295void ConfigDlg::moveSelectedDown() 340void ConfigDlg::moveSelectedDown()
296{ 341{
297 int i = keymaps->currentItem(); 342 int i = keymaps->currentItem();
298 /* Ignore Current Language */ 343 /* Ignore Current Language */
299 if (i > 0 && i < (int)keymaps->count() - 1) { 344 if (i > 0 && i < (int)keymaps->count() - 1) {
300 QString t = sw_maps[i-1]; 345 QString t = sw_maps[i-1];
301 sw_maps[i-1] = sw_maps[i]; 346 sw_maps[i-1] = sw_maps[i];
302 sw_maps[i] = t; 347 sw_maps[i] = t;
303 348
304 QString item = keymaps->currentText(); 349 QString item = keymaps->currentText();
305 keymaps->removeItem(i); 350 keymaps->removeItem(i);
306 keymaps->insertItem(item, i+1); 351 keymaps->insertItem(item, i+1);
307 keymaps->setCurrentItem(i+1); 352 keymaps->setCurrentItem(i+1);
308
309 Config config("multikey");
310 config.setGroup("keymaps");
311 config.writeEntry("sw", sw_maps, QChar('|'));
312 } 353 }
313} 354}
314 355
315void ConfigDlg::pickTog() {
316
317 Config config ("multikey");
318 config.setGroup ("general");
319 config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed
320
321 emit pickboardToggled(pick_button->isChecked());
322}
323
324void ConfigDlg::repeatTog() {
325
326 Config config ("multikey");
327 config.setGroup ("general");
328 config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed
329
330 emit repeatToggled(repeat_button->isChecked());
331}
332
333void ConfigDlg::closeEvent(QCloseEvent *) { 356void ConfigDlg::closeEvent(QCloseEvent *) {
334 357
335 // tell the parent it was closed, so delete me 358 // tell the parent it was closed, so delete me
336 emit configDlgClosed(); 359 emit configDlgClosed();
337} 360}
338 361
339// ConfigDlg::setMap {{{1
340
341/*
342 * the index is kinda screwy, because in the config file, index 0 is just the
343 * first element in the QStringList, but here it's the "Current Language"
344 * listItem. therefor you have to minus one to the index before you access it.
345 *
346 */
347
348void ConfigDlg::setMap(int index) { 362void ConfigDlg::setMap(int index) {
349 363
350 if (index == 0) { 364 if (index == 0) {
351
352 remove_button->setDisabled(true); 365 remove_button->setDisabled(true);
353 emit setMapToDefault();
354 } 366 }
355 else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) { 367 else if (default_maps.find(sw_maps[index-1]) != default_maps.end()) {
356
357 remove_button->setDisabled(true); 368 remove_button->setDisabled(true);
358 emit setMapToFile(QPEApplication::qpeDir() + "share/multikey/" + sw_maps[index - 1]);
359
360 } else { 369 } else {
361
362 remove_button->setEnabled(true); 370 remove_button->setEnabled(true);
363 emit setMapToFile(sw_maps[index - 1]);
364 } 371 }
365} 372}
366 373
367// ConfigDlg::addMap() {{{1 374// ConfigDlg::addMap() {{{1
368void ConfigDlg::addMap() { 375void ConfigDlg::addMap() {
369 376
370 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); 377 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath());
371 378
372 if (map.isNull()) return; 379 if (map.isNull()) return;
373 380
374 Config config ("multikey"); 381 Config config ("multikey");
375 config.setGroup("keymaps"); 382 config.setGroup("keymaps");
376 QStringList maps = config.readListEntry("maps", QChar('|')); 383 QStringList maps = config.readListEntry("maps", QChar('|'));
377 maps.append(map); 384 maps.append(map);
378 custom_maps.append(map); 385 custom_maps.append(map);
379 if (sw_maps.find(map) == sw_maps.end()) 386 if (sw_maps.find(map) == sw_maps.end())
380 sw_maps.append(map); 387 sw_maps.append(map);
381 388
382 QFile map_file (map); 389 QFile map_file (map);
383 if (map_file.open(IO_ReadOnly)) { 390 if (map_file.open(IO_ReadOnly)) {
384 391
385 QString line; bool found = 0; 392 QString line; bool found = 0;
386 393
387 map_file.readLine(line, 1024); 394 map_file.readLine(line, 1024);
388 while (!map_file.atEnd()) { 395 while (!map_file.atEnd()) {
389 396
390 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) { 397 if (line.find(QRegExp("^title\\s*=\\s*")) != -1) {
391 398
392 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace()); 399 keymaps->insertItem(line.right(line.length() - line.find(QChar('=')) - 1).stripWhiteSpace());
393 found = 1; 400 found = 1;
394 break; 401 break;
395 } 402 }
396 map_file.readLine(line, 1024); 403 map_file.readLine(line, 1024);
397 } 404 }
398 if (!found) keymaps->insertItem(map); 405 if (!found) keymaps->insertItem(map);
399 406
400 map_file.close(); 407 map_file.close();
401 } 408 }
402 409
403 keymaps->setSelected(keymaps->count() - 1, true); 410 keymaps->setSelected(keymaps->count() - 1, true);
404
405
406 config.writeEntry("maps", maps, QChar('|'));
407 config.writeEntry("sw", sw_maps, QChar('|'));
408 config.writeEntry("current", map);
409
410} 411}
411 412
412// ConfigDlg::removeMap() {{{1 413// ConfigDlg::removeMap() {{{1
413void ConfigDlg::removeMap() { 414void ConfigDlg::removeMap() {
414 415
415 // move selection up one 416 // move selection up one
416 keymaps->setSelected(keymaps->currentItem() - 1, true); 417 keymaps->setSelected(keymaps->currentItem() - 1, true);
417 // delete the next selected item cus you just moved it up 418 // delete the next selected item cus you just moved it up
418 keymaps->removeItem(keymaps->currentItem() + 1); 419 keymaps->removeItem(keymaps->currentItem() + 1);
419 420
420 custom_maps.remove(sw_maps[keymaps->currentItem()]); 421 custom_maps.remove(sw_maps[keymaps->currentItem()]);
421 sw_maps.remove(sw_maps.at(keymaps->currentItem())); 422 sw_maps.remove(sw_maps.at(keymaps->currentItem()));
422
423 // write the changes
424 Config config ("multikey");
425 config.setGroup("keymaps");
426 config.writeEntry("maps", custom_maps, QChar('|'));
427 config.writeEntry("sw", sw_maps, QChar('|'));
428} 423}
429 424
430/* ConfigDlg::slots for the color buttons {{{1 425/* ConfigDlg::slots for the color buttons {{{1
431 * 426 *
432 * these four slots are almost the same, except for the names. i was thinking 427 * these four slots are almost the same, except for the names. i was thinking
433 * of making a map with pointers to the buttons and names of the configEntry 428 * of making a map with pointers to the buttons and names of the configEntry
434 * so it could be one slot, but then there would be no way of telling which 429 * so it could be one slot, but then there would be no way of telling which
435 * of the buttons was clicked if they all connect to the same slot. 430 * of the buttons was clicked if they all connect to the same slot.
436 * 431 *
437 */ 432 */
438 433
439void ConfigDlg::keyColorClicked() { 434void ConfigDlg::keyColorClicked() {
440 435
441 Config config ("multikey"); 436 Config config ("multikey");
442 config.setGroup ("colors"); 437 config.setGroup ("colors");
443 438
444 QStringList color = config.readListEntry("keycolor", QChar(',')); 439 QStringList color = config.readListEntry("keycolor", QChar(','));
445 440
446 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 441 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
447 442
448 color[0].setNum(newcolor.red()); 443 color[0].setNum(newcolor.red());
449 color[1].setNum(newcolor.green()); 444 color[1].setNum(newcolor.green());
450 color[2].setNum(newcolor.blue()); 445 color[2].setNum(newcolor.blue());
451 446
452 config.writeEntry("keycolor", color, QChar(',')); 447 config.writeEntry("keycolor", color, QChar(','));
453 config.write(); 448 config.write();
454 449
455 keycolor_button->setPalette(QPalette(newcolor)); 450 keycolor_button->setPalette(QPalette(newcolor));
456 emit reloadKeyboard(); 451 emit reloadKeyboard();
457} 452}
458void ConfigDlg::keyColorPressedClicked() { 453void ConfigDlg::keyColorPressedClicked() {
459 454
460 Config config ("multikey"); 455 Config config ("multikey");
461 config.setGroup ("colors"); 456 config.setGroup ("colors");
462 457
463 QStringList color = config.readListEntry("keycolor_pressed", QChar(',')); 458 QStringList color = config.readListEntry("keycolor_pressed", QChar(','));
464 459
465 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 460 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
466 461
467 color[0].setNum(newcolor.red()); 462 color[0].setNum(newcolor.red());
468 color[1].setNum(newcolor.green()); 463 color[1].setNum(newcolor.green());
469 color[2].setNum(newcolor.blue()); 464 color[2].setNum(newcolor.blue());
470 465
471 config.writeEntry("keycolor_pressed", color, QChar(',')); 466 config.writeEntry("keycolor_pressed", color, QChar(','));
472 config.write(); 467 config.write();
473 468
474 keycolor_pressed_button->setPalette(QPalette(newcolor)); 469 keycolor_pressed_button->setPalette(QPalette(newcolor));
475 emit reloadKeyboard(); 470 emit reloadKeyboard();
476} 471}
477void ConfigDlg::keyColorLinesClicked() { 472void ConfigDlg::keyColorLinesClicked() {
478 473
479 Config config ("multikey"); 474 Config config ("multikey");
480 config.setGroup ("colors"); 475 config.setGroup ("colors");
481 476
482 QStringList color = config.readListEntry("keycolor_lines", QChar(',')); 477 QStringList color = config.readListEntry("keycolor_lines", QChar(','));
483 478
484 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 479 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
485 480
486 color[0].setNum(newcolor.red()); 481 color[0].setNum(newcolor.red());
487 color[1].setNum(newcolor.green()); 482 color[1].setNum(newcolor.green());
488 color[2].setNum(newcolor.blue()); 483 color[2].setNum(newcolor.blue());
489 484
490 config.writeEntry("keycolor_lines", color, QChar(',')); 485 config.writeEntry("keycolor_lines", color, QChar(','));
491 config.write(); 486 config.write();
492 487
493 keycolor_lines_button->setPalette(QPalette(newcolor)); 488 keycolor_lines_button->setPalette(QPalette(newcolor));
494 emit reloadKeyboard(); 489 emit reloadKeyboard();
495} 490}
496void ConfigDlg::textColorClicked() { 491void ConfigDlg::textColorClicked() {
497 492
498 Config config ("multikey"); 493 Config config ("multikey");
499 config.setGroup ("colors"); 494 config.setGroup ("colors");
500 495
501 QStringList color = config.readListEntry("textcolor", QChar(',')); 496 QStringList color = config.readListEntry("textcolor", QChar(','));
502 497
503 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 498 QColor newcolor = OColorDialog::getColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
504 499
505 color[0].setNum(newcolor.red()); 500 color[0].setNum(newcolor.red());
506 color[1].setNum(newcolor.green()); 501 color[1].setNum(newcolor.green());
507 color[2].setNum(newcolor.blue()); 502 color[2].setNum(newcolor.blue());
508 503
509 config.writeEntry("textcolor", color, QChar(',')); 504 config.writeEntry("textcolor", color, QChar(','));
510 config.write(); 505 config.write();
511 506
512 textcolor_button->setPalette(QPalette(newcolor)); 507 textcolor_button->setPalette(QPalette(newcolor));
513 emit reloadKeyboard(); 508 emit reloadKeyboard();
514} 509}
diff --git a/inputmethods/multikey/configdlg.h b/inputmethods/multikey/configdlg.h
index ea157c5..91ae429 100644
--- a/inputmethods/multikey/configdlg.h
+++ b/inputmethods/multikey/configdlg.h
@@ -1,67 +1,65 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qtabwidget.h> 2#include <qdialog.h>
3#include <qcheckbox.h> 3#include <qcheckbox.h>
4#include <qlistbox.h> 4#include <qlistbox.h>
5#include <qpushbutton.h> 5#include <qpushbutton.h>
6 6
7#ifndef CONFIGDLG_H 7#ifndef CONFIGDLG_H
8#define CONFIGDLG_H 8#define CONFIGDLG_H
9 9
10class ConfigDlg : public QTabWidget 10class ConfigDlg : public QDialog
11{ 11{
12 Q_OBJECT 12 Q_OBJECT
13 13
14public: 14public:
15 ConfigDlg (); 15 ConfigDlg ();
16 ~ConfigDlg ();
17 static QStringList ConfigDlg::loadSw(); 16 static QStringList ConfigDlg::loadSw();
18 17
19signals: 18signals:
20 void pickboardToggled(bool on_off); 19 void pickboardToggled(bool on_off);
21 void repeatToggled(bool on_off); 20 void repeatToggled(bool on_off);
22 void setMapToDefault(); 21 void setMapToDefault();
23 void setMapToFile(QString map); 22 void setMapToFile(QString map);
24 void reloadKeyboard(); 23 void reloadKeyboard();
25 void configDlgClosed(); 24 void configDlgClosed();
26 void reloadSw(); 25 void reloadSw();
27 26
27protected:
28 virtual void accept();
29
28protected slots: 30protected slots:
29 void moveSelectedUp(); 31 void moveSelectedUp();
30 void moveSelectedDown(); 32 void moveSelectedDown();
31 33
32private slots: 34private slots:
33 void pickTog();
34 void repeatTog();
35 void setMap(int index); 35 void setMap(int index);
36 void addMap(); 36 void addMap();
37 void removeMap(); 37 void removeMap();
38 virtual void closeEvent ( QCloseEvent * ); 38 virtual void closeEvent ( QCloseEvent * );
39 39
40
41 // all those required slots for the color push buttons 40 // all those required slots for the color push buttons
42 void keyColorClicked(); 41 void keyColorClicked();
43 void keyColorPressedClicked(); 42 void keyColorPressedClicked();
44 void keyColorLinesClicked(); 43 void keyColorLinesClicked();
45 void textColorClicked(); 44 void textColorClicked();
46 45
47private: 46private:
48 QCheckBox *pick_button; 47 QCheckBox *pick_button;
49 QCheckBox *repeat_button; 48 QCheckBox *repeat_button;
50 QListBox *keymaps; 49 QListBox *keymaps;
51 QPushButton *add_button; 50 QPushButton *add_button;
52 QPushButton *remove_button; 51 QPushButton *remove_button;
53 52
54
55 QStringList default_maps; // the maps in your share/multikey/ dir 53 QStringList default_maps; // the maps in your share/multikey/ dir
56 QStringList custom_maps; // maps you added with the 'add' button 54 QStringList custom_maps; // maps you added with the 'add' button
57 QStringList sw_maps; // maps, which used in keyboard switch rotation ring 55 QStringList sw_maps; // maps, which used in keyboard switch rotation ring
58 56
59 /* color buttons */ 57 /* color buttons */
60 QPushButton *keycolor_button; 58 QPushButton *keycolor_button;
61 QPushButton *keycolor_pressed_button; 59 QPushButton *keycolor_pressed_button;
62 QPushButton *keycolor_lines_button; 60 QPushButton *keycolor_lines_button;
63 QPushButton *textcolor_button; 61 QPushButton *textcolor_button;
64 62
65}; 63};
66 64
67#endif 65#endif
diff --git a/share/multikey/ru.keymap b/share/multikey/ru.keymap
new file mode 100644
index 0000000..8cda846
--- a/dev/null
+++ b/share/multikey/ru.keymap
@@ -0,0 +1,255 @@
1# Created by Anton Kachalov (mouse@altlinux.ru)
2title = Russian
3sw = RU
4
51 0x1000 0 2 # and you can write whatever you want after the last element
6
7
8 "9 9 2 1"
9 ". c None"
10 "a c #000000"
11 "........."
12 "........."
13 ".aa.aa.aa"
14 ".a..a..a."
15 ".aa.aa.a."
16 ".a...a.a."
17 ".aa.aa.aa"
18 "........."
19 "........."
20
21 1 0 0x0451 2 # £
221 0 0x31 2 # 1
23 1 0 0x32 2# 2
241 0 0x33 2 # 3
251 0 0x34 2 # 4
261 0 0x35 2 # 5
271 0 0x36 2 # 6
281 0 0x37 2 # 7
291 0 0x38 2 # 8
301 0 0x39 2 # 9
31 1 0 0x30 2# 0
32 1 0 0x2d 2# -
33 1 0 0x3d 2# =
341 0x1003 0 2
35
36 "9 9 2 1"
37 ". c None"
38 "a c #000000"
39 "........."
40 "........."
41 "...a....."
42 "..aa....."
43 ".aaaaaaaa"
44 "..aa....."
45 "...a....."
46 "........."
47 "........."
48
49
502 0x1001 0x9 3 # tab char, but why doesnt this work...?
51
52
53 "11 9 2 1"
54 ". c None"
55 "a c #000000"
56 "..........."
57 "..........."
58 ".....a..a.."
59 ".....aa.a.."
60 ".aaaaaaaa.."
61 ".....aa.a.."
62 ".....a..a.."
63 "..........."
64 "..........."
652 0 0x0439 2 # Ê
662 0 0x0446 2 # Ã
672 0 0x0443 2 # Õ
682 0 0x043a 2 # Ë
692 0 0x0435 2 # Å
702 0 0x043d 2 # Î
712 0 0x0433 2 # Ç
722 0 0x0448 2 # Û
732 0 0x0449 2 # Ý
742 0 0x0437 2 # Ú
752 0 0x0445 2 # È
762 0 0x044a 2 # ß
772 0 0x2f 4 # /
78
793 0x1024 0 4
80 "17 7 2 1"
81 " c None"
82 ". c #000000"
83 " "
84 " .. . .. .. "
85 " . . . . . . "
86 " . ... .. . "
87 " . . . . . "
88 " .. . . . .. "
89 " "
903 0 0x0444 2 # Æ
913 0 0x044b 2 # Ù
923 0 0x0432 2 # ×
933 0 0x0430 2 # Á
943 0 0x043f 2 # Ð
953 0 0x0440 2 # Ò
963 0 0x043e 2 # Ï
973 0 0x043b 2 # Ì
983 0 0x0434 2 # Ä
993 0 0x0436 2 # Ö
1003 0 0x044d 2 # Ü
1013 0x1004 0 5 # ENTER
102 "16 9 2 1"
103 ". c None"
104 "a c #000000"
105 "................"
106 "................"
107 "...........a...."
108 "....aa.....a...."
109 "...aa......a...."
110 "..aaaaaaaaaa...."
111 "...aa..........."
112 "....aa.........."
113 "................"
114
1154 0x1020 0 5
116 "21 7 2 1"
117 " c None"
118 ". c #000000"
119 " "
120 " .. . . ... ... ... "
121 " . . . . . . "
122 " . ... . .. . "
123 " . . . . . . "
124 " .. . . ... . . "
125 " "
1264 0 0x044f 2 # Ñ
1274 0 0x0447 2 # Þ
1284 0 0x0441 2 # Ó
1294 0 0x043c 2 # Í
1304 0 0x0438 2 # É
1314 0 0x0442 2 # Ô
1324 0 0x044c 2 # Ø
1334 0 0x0431 2 # Â
1344 0 0x044e 2 # À
1354 0 0x2e 2 # .
1364 0x1020 0 5 # SHIFT
137 "21 7 2 1"
138 " c None"
139 ". c #000000"
140 " "
141 " .. . . ... ... ... "
142 " . . . . . . "
143 " . ... . .. . "
144 " . . . . . . "
145 " .. . . ... . . "
146 " "
147
1485 0x1021 0 3
149 "17 7 2 1"
150 " c None"
151 ". c #000000"
152 " "
153 " .. ... .. . "
154 " . . . . . "
155 " . . .. . "
156 " . . . . . "
157 " .. . . . ... "
158 " "
1595 0x1023 0 3
160 "13 7 2 1"
161 " c None"
162 ". c #000000"
163 " "
164 " . . ... "
165 " . . . . "
166 " ... . . "
167 " . . . . "
168 " . . ... . "
169 " "
1705 0 0x20 16
1715 0x1023 0 3
172 "13 7 2 1"
173 " c None"
174 ". c #000000"
175 " "
176 " . . ... "
177 " . . . . "
178 " ... . . "
179 " . . . . "
180 " . . ... . "
181 " "
1825 0x1021 0 3
183 "17 7 2 1"
184 " c None"
185 ". c #000000"
186 " "
187 " .. ... .. . "
188 " . . . . . "
189 " . . .. . "
190 " . . . . . "
191 " .. . . . ... "
192 " "
1935 0x1030 0 2 #original code is F1, but i'll use it for turning on/off the config dialog
194 "13 7 2 1"
195 " c None"
196 ". c #000000"
197 " "
198 " . "
199 " ... "
200 " ..... "
201 " . "
202 " . "
203 " "
204
205# shift table
2060x0451 0x0401 # £ -> ³
2070x31 0x21 # 1 -> !
2080x32 0x22 # 2 -> "
2090x33 0x4e # 3 -> N
2100x34 0x3b # 4 -> ;
2110x35 0x25 # 5 -> %
2120x36 0x3a # 6 -> :
2130x37 0x3f # 7 -> ?
2140x38 0x2a # 8 -> *
2150x39 0x28 # 9 -> (
2160x30 0x29 # 0 -> )
2170x2d 0x5f # - -> _
2180x3d 0x2b # = -> +
219
2200x0439 0x0419 # Ê -> ê
2210x0446 0x0426 # Ã -> ã
2220x0443 0x0423 # Õ -> õ
2230x043a 0x041a # Ë -> ë
2240x0435 0x0415 # Å -> å
2250x043d 0x041d # Î -> î
2260x0433 0x0413 # Ç -> ç
2270x0448 0x0428 # Û -> û
2280x0449 0x0429 # Ý -> ý
2290x0437 0x0417 # Ú -> ú
2300x0445 0x0425 # È -> è
2310x044a 0x042a # ß -> ÿ
232
2330x0444 0x0424 # Æ -> æ
2340x044b 0x042b # Ù -> ù
2350x0432 0x0412 # × -> ÷
2360x0430 0x0410 # Á -> á
2370x043f 0x041f # Ð -> ð
2380x0440 0x0420 # Ò -> ò
2390x043e 0x041e # Ï -> ï
2400x043b 0x041b # Ì -> ì
2410x0434 0x0414 # Ä -> ä
2420x0436 0x0416 # Ö -> ö
2430x044d 0x042d # Ü -> ü
244
2450x044f 0x042f # Ñ -> ñ
2460x0447 0x0427 # Þ -> þ
2470x0441 0x0421 # Ó -> ó
2480x043c 0x041c # Í -> í
2490x0438 0x0418 # É -> é
2500x0442 0x0422 # Ô -> ô
2510x044c 0x042c # Ø -> ø
2520x0431 0x0411 # Â -> â
2530x044e 0x042e # À -> à
2540x2f 0x7c # / -> |
2550x2e 0x2c # . -> ,