summaryrefslogtreecommitdiff
path: root/inputmethods
authorhash <hash>2002-08-21 17:54:33 (UTC)
committer hash <hash>2002-08-21 17:54:33 (UTC)
commit0a61be3b42b4b152468a5ef2def4a18baeda9b4f (patch) (unidiff)
treeaa82e34a4d4984ae334ffbd31582ac60a655e499 /inputmethods
parent24ca0a148bdb23f5c890661dc2edac7ba6120c67 (diff)
downloadopie-0a61be3b42b4b152468a5ef2def4a18baeda9b4f.zip
opie-0a61be3b42b4b152468a5ef2def4a18baeda9b4f.tar.gz
opie-0a61be3b42b4b152468a5ef2def4a18baeda9b4f.tar.bz2
ctrl and alt keys should work now
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/multikey/configdlg.cpp1
-rw-r--r--inputmethods/multikey/keyboard.cpp8
2 files changed, 8 insertions, 1 deletions
diff --git a/inputmethods/multikey/configdlg.cpp b/inputmethods/multikey/configdlg.cpp
index 89b713e..a9137b9 100644
--- a/inputmethods/multikey/configdlg.cpp
+++ b/inputmethods/multikey/configdlg.cpp
@@ -1,260 +1,261 @@
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 cursor thing 4 * make a cursor thing
5 * add meta key support for german, etc
5 * 6 *
6 * 7 *
7 * 8 *
8 */ 9 */
9 10
10#include <iostream.h> 11#include <iostream.h>
11 12
12#include <qpe/qpeapplication.h> 13#include <qpe/qpeapplication.h>
13#include <qpe/config.h> 14#include <qpe/config.h>
14 15
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 <opie/ofiledialog.h> 28#include <opie/ofiledialog.h>
28#include <opie/colordialog.h> 29#include <opie/colordialog.h>
29#include <qdir.h> 30#include <qdir.h>
30#include <qfileinfo.h> 31#include <qfileinfo.h>
31#include "configdlg.h" 32#include "configdlg.h"
32#include "keyboard.h" 33#include "keyboard.h"
33 34
34// ConfigDlg::ConfigDlg() {{{1 35// ConfigDlg::ConfigDlg() {{{1
35ConfigDlg::ConfigDlg () : QTabWidget () 36ConfigDlg::ConfigDlg () : QTabWidget ()
36{ 37{
37 setCaption( tr("Multikey Configuration") ); 38 setCaption( tr("Multikey Configuration") );
38 Config config ("multikey"); 39 Config config ("multikey");
39 config.setGroup("keymaps"); 40 config.setGroup("keymaps");
40 QString current_map = config.readEntry("current", 0); 41 QString current_map = config.readEntry("current", 0);
41 42
42 /* 43 /*
43 * 'general config' tab 44 * 'general config' tab
44 */ 45 */
45 46
46 QVBox *gen_box = new QVBox (this); 47 QVBox *gen_box = new QVBox (this);
47 gen_box->setMargin(3); 48 gen_box->setMargin(3);
48 addTab(gen_box, tr("General Settings")); 49 addTab(gen_box, tr("General Settings"));
49 50
50 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box); 51 QGroupBox *map_group = new QGroupBox (2, Qt::Vertical, tr("Keymap File"), gen_box);
51 52
52 keymaps = new QListBox (map_group); 53 keymaps = new QListBox (map_group);
53 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 54 keymaps->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
54 55
55 QString cur(tr("Current Language")); 56 QString cur(tr("Current Language"));
56 keymaps->insertItem(cur); 57 keymaps->insertItem(cur);
57 keymaps->setSelected(0, true); 58 keymaps->setSelected(0, true);
58 59
59 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap"); 60 QDir map_dir(QPEApplication::qpeDir() + "/share/multikey", "*.keymap");
60 default_maps = map_dir.entryList(); // so i can access it in other places 61 default_maps = map_dir.entryList(); // so i can access it in other places
61 62
62 for (uint i = 0; i <map_dir.count(); i++) { 63 for (uint i = 0; i <map_dir.count(); i++) {
63 64
64 keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]); 65 keymaps->insertItem(map_dir.absPath() + "/" + map_dir[i]);
65 if (map_dir.absPath() + "/" + map_dir[i] == current_map) { 66 if (map_dir.absPath() + "/" + map_dir[i] == current_map) {
66 67
67 keymaps->setSelected(i + 1, true); 68 keymaps->setSelected(i + 1, true);
68 } 69 }
69 70
70 } 71 }
71 72
72 custom_maps = config.readListEntry("maps", QChar('|')); 73 custom_maps = config.readListEntry("maps", QChar('|'));
73 74
74 for (uint i = 0; i < custom_maps.count(); i++) { 75 for (uint i = 0; i < custom_maps.count(); i++) {
75 76
76 if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false) 77 if (map_dir.exists(QFileInfo(custom_maps[i]).fileName(), false)
77 || !QFile::exists(custom_maps[i])) { 78 || !QFile::exists(custom_maps[i])) {
78 79
79 custom_maps.remove(custom_maps.at(i)); 80 custom_maps.remove(custom_maps.at(i));
80 81
81 // remove it from the list too 82 // remove it from the list too
82 config.writeEntry("maps", custom_maps.join("|")); 83 config.writeEntry("maps", custom_maps.join("|"));
83 84
84 85
85 } else { 86 } else {
86 87
87 keymaps->insertItem(custom_maps[i]); 88 keymaps->insertItem(custom_maps[i]);
88 if (custom_maps[i] == current_map) { 89 if (custom_maps[i] == current_map) {
89 90
90 keymaps->setSelected(map_dir.count() + i + 1, true); 91 keymaps->setSelected(map_dir.count() + i + 1, true);
91 } 92 }
92 } 93 }
93 } 94 }
94 95
95 // have to "+1" because the "current language" listItem... remember? 96 // have to "+1" because the "current language" listItem... remember?
96 97
97 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int))); 98 connect(keymaps, SIGNAL(highlighted(int)), SLOT(setMap(int)));
98 99
99 100
100 QGrid *add_remove_grid = new QGrid(2, map_group); 101 QGrid *add_remove_grid = new QGrid(2, map_group);
101 add_remove_grid->setMargin(3); 102 add_remove_grid->setMargin(3);
102 add_remove_grid->setSpacing(3); 103 add_remove_grid->setSpacing(3);
103 104
104 add_button = new QPushButton(tr("Add"), add_remove_grid); 105 add_button = new QPushButton(tr("Add"), add_remove_grid);
105 add_button->setFlat((bool)1); 106 add_button->setFlat((bool)1);
106 connect(add_button, SIGNAL(clicked()), SLOT(addMap())); 107 connect(add_button, SIGNAL(clicked()), SLOT(addMap()));
107 108
108 remove_button = new QPushButton(tr("Remove"), add_remove_grid); 109 remove_button = new QPushButton(tr("Remove"), add_remove_grid);
109 remove_button->setFlat((bool)1); 110 remove_button->setFlat((bool)1);
110 if ((int)map_dir.count() >= keymaps->currentItem()) 111 if ((int)map_dir.count() >= keymaps->currentItem())
111 remove_button->setDisabled(true); 112 remove_button->setDisabled(true);
112 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap())); 113 connect(remove_button, SIGNAL(clicked()), SLOT(removeMap()));
113 114
114 // make a box that will contain the buttons on the bottom 115 // make a box that will contain the buttons on the bottom
115 QGrid *other_grid = new QGrid(2, gen_box); 116 QGrid *other_grid = new QGrid(2, gen_box);
116 pick_button = new QCheckBox(tr("Pickboard"), other_grid); 117 pick_button = new QCheckBox(tr("Pickboard"), other_grid);
117 118
118 config.setGroup ("general"); 119 config.setGroup ("general");
119 bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed 120 bool pick_open = config.readBoolEntry ("usePickboard", (bool)0); // default closed
120 if (pick_open) { 121 if (pick_open) {
121 122
122 pick_button->setChecked(true); 123 pick_button->setChecked(true);
123 } 124 }
124 125
125 // by connecting it after checking it, the signal isn't emmited 126 // by connecting it after checking it, the signal isn't emmited
126 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog())); 127 connect (pick_button, SIGNAL(clicked()), this, SLOT(pickTog()));
127 128
128 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid); 129 repeat_button = new QCheckBox(tr("Key Repeat"), other_grid);
129 bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1); 130 bool repeat_on = config.readBoolEntry ("useRepeat", (bool)1);
130 131
131 if (repeat_on) { 132 if (repeat_on) {
132 133
133 repeat_button->setChecked(true); 134 repeat_button->setChecked(true);
134 } 135 }
135 connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog())); 136 connect (repeat_button, SIGNAL(clicked()), this, SLOT(repeatTog()));
136 137
137 138
138 /* 139 /*
139 * 'color' tab 140 * 'color' tab
140 */ 141 */
141 142
142 QGrid *color_box = new QGrid(2, this); 143 QGrid *color_box = new QGrid(2, this);
143 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); 144 color_box->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed));
144 color_box->setMargin(3); 145 color_box->setMargin(3);
145 color_box->setSpacing(3); 146 color_box->setSpacing(3);
146 addTab(color_box, tr("Colors")); 147 addTab(color_box, tr("Colors"));
147 148
148 QLabel *label; 149 QLabel *label;
149 QStringList color; 150 QStringList color;
150 config.setGroup("colors"); 151 config.setGroup("colors");
151 152
152 label = new QLabel(tr("Key Color"), color_box); 153 label = new QLabel(tr("Key Color"), color_box);
153 keycolor_button = new QPushButton(color_box); 154 keycolor_button = new QPushButton(color_box);
154 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked())); 155 connect(keycolor_button, SIGNAL(clicked()), SLOT(keyColorClicked()));
155 keycolor_button->setFlat((bool)1); 156 keycolor_button->setFlat((bool)1);
156 color = config.readListEntry("keycolor", QChar(',')); 157 color = config.readListEntry("keycolor", QChar(','));
157 /* 158 /*
158 * hopefully not required 159 * hopefully not required
159 160
160 if (color.isEmpty()) { 161 if (color.isEmpty()) {
161 color = QStringList::split(",", "240,240,240"); 162 color = QStringList::split(",", "240,240,240");
162 config.writeEntry("keycolor", color.join(",")); 163 config.writeEntry("keycolor", color.join(","));
163 164
164 } 165 }
165 */ 166 */
166 keycolor_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 167 keycolor_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
167 168
168 169
169 label = new QLabel(tr("Key Pressed Color"), color_box); 170 label = new QLabel(tr("Key Pressed Color"), color_box);
170 keycolor_pressed_button = new QPushButton(color_box); 171 keycolor_pressed_button = new QPushButton(color_box);
171 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked())); 172 connect(keycolor_pressed_button, SIGNAL(clicked()), SLOT(keyColorPressedClicked()));
172 keycolor_pressed_button->setFlat((bool)1); 173 keycolor_pressed_button->setFlat((bool)1);
173 color = config.readListEntry("keycolor_pressed", QChar(',')); 174 color = config.readListEntry("keycolor_pressed", QChar(','));
174 keycolor_pressed_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 175 keycolor_pressed_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
175 176
176 label = new QLabel(tr("Line Color"), color_box); 177 label = new QLabel(tr("Line Color"), color_box);
177 keycolor_lines_button = new QPushButton(color_box); 178 keycolor_lines_button = new QPushButton(color_box);
178 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked())); 179 connect(keycolor_lines_button, SIGNAL(clicked()), SLOT(keyColorLinesClicked()));
179 keycolor_lines_button->setFlat((bool)1); 180 keycolor_lines_button->setFlat((bool)1);
180 color = config.readListEntry("keycolor_lines", QChar(',')); 181 color = config.readListEntry("keycolor_lines", QChar(','));
181 keycolor_lines_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 182 keycolor_lines_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
182 183
183 184
184 label = new QLabel(tr("Text Color"), color_box); 185 label = new QLabel(tr("Text Color"), color_box);
185 textcolor_button = new QPushButton(color_box); 186 textcolor_button = new QPushButton(color_box);
186 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked())); 187 connect(textcolor_button, SIGNAL(clicked()), SLOT(textColorClicked()));
187 textcolor_button->setFlat((bool)1); 188 textcolor_button->setFlat((bool)1);
188 color = config.readListEntry("textcolor", QChar(',')); 189 color = config.readListEntry("textcolor", QChar(','));
189 textcolor_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt())); 190 textcolor_button->setBackgroundColor(QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()));
190 191
191 192
192 label = new QLabel("", color_box); // a spacer so the above buttons dont expand 193 label = new QLabel("", color_box); // a spacer so the above buttons dont expand
193 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); 194 label->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
194 195
195} 196}
196 197
197void ConfigDlg::pickTog() { 198void ConfigDlg::pickTog() {
198 199
199 Config config ("multikey"); 200 Config config ("multikey");
200 config.setGroup ("general"); 201 config.setGroup ("general");
201 config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed 202 config.writeEntry ("usePickboard", pick_button->isChecked()); // default closed
202 203
203 emit pickboardToggled(pick_button->isChecked()); 204 emit pickboardToggled(pick_button->isChecked());
204} 205}
205 206
206void ConfigDlg::repeatTog() { 207void ConfigDlg::repeatTog() {
207 208
208 Config config ("multikey"); 209 Config config ("multikey");
209 config.setGroup ("general"); 210 config.setGroup ("general");
210 config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed 211 config.writeEntry ("useRepeat", repeat_button->isChecked()); // default closed
211 212
212 emit repeatToggled(repeat_button->isChecked()); 213 emit repeatToggled(repeat_button->isChecked());
213} 214}
214 215
215// ConfigDlg::setMap {{{1 216// ConfigDlg::setMap {{{1
216 217
217/* 218/*
218 * 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
219 * 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"
220 * 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.
221 * 222 *
222 */ 223 */
223 224
224void ConfigDlg::setMap(int index) { 225void ConfigDlg::setMap(int index) {
225 226
226 if (index == 0) { 227 if (index == 0) {
227 228
228 remove_button->setDisabled(true); 229 remove_button->setDisabled(true);
229 emit setMapToDefault(); 230 emit setMapToDefault();
230 } 231 }
231 else if ((uint)index <= default_maps.count()) { 232 else if ((uint)index <= default_maps.count()) {
232 233
233 remove_button->setDisabled(true); 234 remove_button->setDisabled(true);
234 emit setMapToFile(keymaps->text(index)); 235 emit setMapToFile(keymaps->text(index));
235 236
236 } else { 237 } else {
237 238
238 remove_button->setEnabled(true); 239 remove_button->setEnabled(true);
239 emit setMapToFile(keymaps->text(index)); 240 emit setMapToFile(keymaps->text(index));
240 } 241 }
241} 242}
242 243
243// ConfigDlg::addMap() {{{1 244// ConfigDlg::addMap() {{{1
244void ConfigDlg::addMap() { 245void ConfigDlg::addMap() {
245 246
246 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath()); 247 QString map = OFileDialog::getOpenFileName(1, QDir::home().absPath());
247 Config config ("multikey"); 248 Config config ("multikey");
248 config.setGroup("keymaps"); 249 config.setGroup("keymaps");
249 QStringList maps = config.readListEntry("maps", QChar('|')); 250 QStringList maps = config.readListEntry("maps", QChar('|'));
250 maps.append(map); 251 maps.append(map);
251 keymaps->insertItem(map); 252 keymaps->insertItem(map);
252 keymaps->setSelected(keymaps->count() - 1, true); 253 keymaps->setSelected(keymaps->count() - 1, true);
253 254
254 255
255 config.writeEntry("maps", maps, QChar('|')); 256 config.writeEntry("maps", maps, QChar('|'));
256 config.writeEntry("current", map); 257 config.writeEntry("current", map);
257 258
258} 259}
259 260
260// ConfigDlg::removeMap() {{{1 261// ConfigDlg::removeMap() {{{1
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index 7334c1c..949164a 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -105,513 +105,519 @@ void Keyboard::resizeEvent(QResizeEvent*)
105 nk = 19; 105 nk = 19;
106 } 106 }
107 defaultKeyWidth = (width()/nk)/2; 107 defaultKeyWidth = (width()/nk)/2;
108 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 108 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
109 109
110} 110}
111 111
112/* KeyboardPicks::initialize {{{1 */ 112/* KeyboardPicks::initialize {{{1 */
113void KeyboardPicks::initialise() 113void KeyboardPicks::initialise()
114{ 114{
115 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 115 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
116 mode = 0; 116 mode = 0;
117 dc = new KeyboardConfig(this); 117 dc = new KeyboardConfig(this);
118 configs.append(dc); 118 configs.append(dc);
119} 119}
120 120
121/* KeyboardPicks::sizeHint {{{1 */ 121/* KeyboardPicks::sizeHint {{{1 */
122QSize KeyboardPicks::sizeHint() const 122QSize KeyboardPicks::sizeHint() const
123{ 123{
124 return QSize(240,fontMetrics().lineSpacing()); 124 return QSize(240,fontMetrics().lineSpacing());
125} 125}
126 126
127 127
128/* KeyboardConfig::generateText {{{1 */ 128/* KeyboardConfig::generateText {{{1 */
129void KeyboardConfig::generateText(const QString &s) 129void KeyboardConfig::generateText(const QString &s)
130{ 130{
131#if defined(Q_WS_QWS) || defined(_WS_QWS_) 131#if defined(Q_WS_QWS) || defined(_WS_QWS_)
132 for (int i=0; i<(int)backspaces; i++) { 132 for (int i=0; i<(int)backspaces; i++) {
133 parent->emitKey( 0, Qt::Key_Backspace, 0, true, false ); 133 parent->emitKey( 0, Qt::Key_Backspace, 0, true, false );
134 parent->emitKey( 0, Qt::Key_Backspace, 0, false, false ); 134 parent->emitKey( 0, Qt::Key_Backspace, 0, false, false );
135 } 135 }
136 for (int i=0; i<(int)s.length(); i++) { 136 for (int i=0; i<(int)s.length(); i++) {
137 parent->emitKey( s[i].unicode(), 0, 0, true, false ); 137 parent->emitKey( s[i].unicode(), 0, 0, true, false );
138 parent->emitKey( s[i].unicode(), 0, 0, false, false ); 138 parent->emitKey( s[i].unicode(), 0, 0, false, false );
139 } 139 }
140 parent->emitKey( 0, Qt::Key_Space, 0, true, false ); 140 parent->emitKey( 0, Qt::Key_Space, 0, true, false );
141 parent->emitKey( 0, Qt::Key_Space, 0, false, false ); 141 parent->emitKey( 0, Qt::Key_Space, 0, false, false );
142 backspaces = 0; 142 backspaces = 0;
143#endif 143#endif
144} 144}
145 145
146 146
147 147
148 148
149/* Keyboard::paintEvent {{{1 */ 149/* Keyboard::paintEvent {{{1 */
150void Keyboard::paintEvent(QPaintEvent* e) 150void Keyboard::paintEvent(QPaintEvent* e)
151{ 151{
152 QPainter painter(this); 152 QPainter painter(this);
153 painter.setClipRect(e->rect()); 153 painter.setClipRect(e->rect());
154 drawKeyboard( painter ); 154 drawKeyboard( painter );
155 picks->dc->draw( &painter ); 155 picks->dc->draw( &painter );
156} 156}
157 157
158 158
159/* Keyboard::drawKeyboard {{{1 */ 159/* Keyboard::drawKeyboard {{{1 */
160 160
161void Keyboard::drawKeyboard(QPainter &p, int row, int col) 161void Keyboard::drawKeyboard(QPainter &p, int row, int col)
162{ 162{
163 163
164 164
165 if (row != -1 && col != -1) { //just redraw one key 165 if (row != -1 && col != -1) { //just redraw one key
166 166
167 int x = 0; 167 int x = 0;
168 for (int i = 0; i < col; i++) { 168 for (int i = 0; i < col; i++) {
169 169
170 x += keys->width(row, i) * defaultKeyWidth; 170 x += keys->width(row, i) * defaultKeyWidth;
171 } 171 }
172 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); 172 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0);
173 173
174 int keyWidth = keys->width(row, col); 174 int keyWidth = keys->width(row, col);
175 175
176 p.fillRect(x + 1, y + 1, 176 p.fillRect(x + 1, y + 1,
177 keyWidth * defaultKeyWidth - 1, keyHeight - 1, 177 keyWidth * defaultKeyWidth - 1, keyHeight - 1,
178 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); 178 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor);
179 179
180 QPixmap *pix = keys->pix(row,col); 180 QPixmap *pix = keys->pix(row,col);
181 181
182 ushort c = keys->uni(row, col); 182 ushort c = keys->uni(row, col);
183 183
184 p.setPen(textcolor); 184 p.setPen(textcolor);
185 if (!pix) 185 if (!pix)
186 p.drawText(x, y, 186 p.drawText(x, y,
187 defaultKeyWidth * keyWidth, keyHeight, 187 defaultKeyWidth * keyWidth, keyHeight,
188 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c); 188 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c);
189 else 189 else
190 // center the image in the middle of the key 190 // center the image in the middle of the key
191 p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2, 191 p.drawPixmap( x + (defaultKeyWidth * keyWidth - pix->width())/2,
192 y + (keyHeight - pix->height())/2 + 1, 192 y + (keyHeight - pix->height())/2 + 1,
193 *pix ); 193 *pix );
194 194
195 // this fixes the problem that the very right end of the board's vertical line 195 // this fixes the problem that the very right end of the board's vertical line
196 // gets painted over, because it's one pixel shorter than all other keys 196 // gets painted over, because it's one pixel shorter than all other keys
197 p.setPen(keycolor_lines); 197 p.setPen(keycolor_lines);
198 p.drawLine(width() - 1, 0, width() - 1, height()); 198 p.drawLine(width() - 1, 0, width() - 1, height());
199 199
200 } else { 200 } else {
201 201
202 202
203 p.fillRect(0, 0, width(), height(), keycolor); 203 p.fillRect(0, 0, width(), height(), keycolor);
204 204
205 for (row = 1; row <= 5; row++) { 205 for (row = 1; row <= 5; row++) {
206 206
207 int x = 0; 207 int x = 0;
208 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); 208 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0);
209 209
210 p.setPen(keycolor_lines); 210 p.setPen(keycolor_lines);
211 p.drawLine(x, y, x + width(), y); 211 p.drawLine(x, y, x + width(), y);
212 212
213 for (int col = 0; col < keys->numKeys(row); col++) { 213 for (int col = 0; col < keys->numKeys(row); col++) {
214 214
215 QPixmap *pix = keys->pix(row, col); 215 QPixmap *pix = keys->pix(row, col);
216 int keyWidth = keys->width(row, col); 216 int keyWidth = keys->width(row, col);
217 217
218 218
219 int keyWidthPix = defaultKeyWidth * keyWidth; 219 int keyWidthPix = defaultKeyWidth * keyWidth;
220 220
221 if (keys->pressed(row, col)) 221 if (keys->pressed(row, col))
222 p.fillRect(x+1, y+1, keyWidthPix - 1, 222 p.fillRect(x+1, y+1, keyWidthPix - 1,
223 keyHeight - 1, keycolor_pressed); 223 keyHeight - 1, keycolor_pressed);
224 224
225 ushort c = keys->uni(row, col); 225 ushort c = keys->uni(row, col);
226 226
227 if (!pix) { 227 if (!pix) {
228 p.setPen(textcolor); 228 p.setPen(textcolor);
229 p.drawText(x, y, 229 p.drawText(x, y,
230 keyWidthPix, keyHeight, 230 keyWidthPix, keyHeight,
231 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c); 231 AlignCenter, ((shift || lock) && keys->shift(c)) ? (QChar)keys->shift(c) : (QChar)c);
232 } 232 }
233 else { 233 else {
234 // center the image in the middle of the key 234 // center the image in the middle of the key
235 p.drawPixmap( x + (keyWidthPix - pix->width())/2, 235 p.drawPixmap( x + (keyWidthPix - pix->width())/2,
236 y + (keyHeight - pix->height())/2 + 1, 236 y + (keyHeight - pix->height())/2 + 1,
237 QPixmap(*pix) ); 237 QPixmap(*pix) );
238 } 238 }
239 239
240 p.setPen(keycolor_lines); 240 p.setPen(keycolor_lines);
241 p.drawLine(x, y, x, y + keyHeight); 241 p.drawLine(x, y, x, y + keyHeight);
242 242
243 x += keyWidthPix; 243 x += keyWidthPix;
244 } 244 }
245 245
246 246
247 } 247 }
248 p.drawLine(0, height() - 1, width(), height() - 1); 248 p.drawLine(0, height() - 1, width(), height() - 1);
249 p.drawLine(width() - 1, 0, width() - 1, height()); 249 p.drawLine(width() - 1, 0, width() - 1, height());
250 } 250 }
251 251
252} 252}
253 253
254 254
255/* Keyboard::mousePressEvent {{{1 */ 255/* Keyboard::mousePressEvent {{{1 */
256void Keyboard::mousePressEvent(QMouseEvent *e) 256void Keyboard::mousePressEvent(QMouseEvent *e)
257{ 257{
258 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; 258 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1;
259 if (row > 5) row = 5; 259 if (row > 5) row = 5;
260 260
261 // figure out the column 261 // figure out the column
262 int col = 0; 262 int col = 0;
263 for (int w = 0; e->x() >= w; col++) 263 for (int w = 0; e->x() >= w; col++)
264 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys 264 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
265 w += keys->width(row,col) * defaultKeyWidth; 265 w += keys->width(row,col) * defaultKeyWidth;
266 else break; 266 else break;
267 267
268 col --; // rewind one... 268 col --; // rewind one...
269 269
270 qkeycode = keys->qcode(row, col); 270 qkeycode = keys->qcode(row, col);
271 unicode = keys->uni(row, col); 271 unicode = keys->uni(row, col);
272 272
273 // might need to repaint if two or more of the same keys. 273 // might need to repaint if two or more of the same keys.
274 // should be faster if just paint one key even though multiple keys exist. 274 // should be faster if just paint one key even though multiple keys exist.
275 bool need_repaint = FALSE; 275 bool need_repaint = FALSE;
276 276
277 if (unicode == 0) { // either Qt char, or nothing 277 if (unicode == 0) { // either Qt char, or nothing
278 278
279 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 279 if (qkeycode == Qt::Key_F1) { // toggle the pickboard
280 280
281 if ( configdlg ) { 281 if ( configdlg ) {
282 delete (ConfigDlg *) configdlg; 282 delete (ConfigDlg *) configdlg;
283 configdlg = 0; 283 configdlg = 0;
284 } 284 }
285 else { 285 else {
286 configdlg = new ConfigDlg (); 286 configdlg = new ConfigDlg ();
287 connect(configdlg, SIGNAL(setMapToDefault()), 287 connect(configdlg, SIGNAL(setMapToDefault()),
288 this, SLOT(setMapToDefault())); 288 this, SLOT(setMapToDefault()));
289 connect(configdlg, SIGNAL(setMapToFile(QString)), 289 connect(configdlg, SIGNAL(setMapToFile(QString)),
290 this, SLOT(setMapToFile(QString))); 290 this, SLOT(setMapToFile(QString)));
291 connect(configdlg, SIGNAL(pickboardToggled(bool)), 291 connect(configdlg, SIGNAL(pickboardToggled(bool)),
292 this, SLOT(togglePickboard(bool))); 292 this, SLOT(togglePickboard(bool)));
293 connect(configdlg, SIGNAL(repeatToggled(bool)), 293 connect(configdlg, SIGNAL(repeatToggled(bool)),
294 this, SLOT(toggleRepeat(bool))); 294 this, SLOT(toggleRepeat(bool)));
295 connect(configdlg, SIGNAL(reloadKeyboard()), 295 connect(configdlg, SIGNAL(reloadKeyboard()),
296 this, SLOT(reloadKeyboard())); 296 this, SLOT(reloadKeyboard()));
297 configdlg->showMaximized(); 297 configdlg->showMaximized();
298 configdlg->show(); 298 configdlg->show();
299 configdlg->raise(); 299 configdlg->raise();
300 } 300 }
301 301
302 } else if (qkeycode == Qt::Key_Control) { 302 } else if (qkeycode == Qt::Key_Control) {
303 ctrl = keys->pressedPtr(row, col); 303 ctrl = keys->pressedPtr(row, col);
304 need_repaint = TRUE; 304 need_repaint = TRUE;
305 *ctrl = !keys->pressed(row, col); 305 *ctrl = !keys->pressed(row, col);
306 306
307 } else if (qkeycode == Qt::Key_Alt) { 307 } else if (qkeycode == Qt::Key_Alt) {
308 alt = keys->pressedPtr(row, col); 308 alt = keys->pressedPtr(row, col);
309 need_repaint = TRUE; 309 need_repaint = TRUE;
310 *alt = !keys->pressed(row, col); 310 *alt = !keys->pressed(row, col);
311 311
312 } else if (qkeycode == Qt::Key_Shift) { 312 } else if (qkeycode == Qt::Key_Shift) {
313 need_repaint = TRUE; 313 need_repaint = TRUE;
314 314
315 if (shift) { 315 if (shift) {
316 *shift = 0; 316 *shift = 0;
317 shift = 0; 317 shift = 0;
318 } 318 }
319 else { 319 else {
320 shift = keys->pressedPtr(row, col); 320 shift = keys->pressedPtr(row, col);
321 *shift = 1; 321 *shift = 1;
322 if (lock) { 322 if (lock) {
323 *lock = 0; 323 *lock = 0;
324 lock = 0; 324 lock = 0;
325 } 325 }
326 } 326 }
327 327
328 } else if (qkeycode == Qt::Key_CapsLock) { 328 } else if (qkeycode == Qt::Key_CapsLock) {
329 need_repaint = TRUE; 329 need_repaint = TRUE;
330 330
331 if (lock) { 331 if (lock) {
332 *lock = 0; 332 *lock = 0;
333 lock = 0; 333 lock = 0;
334 } 334 }
335 else { 335 else {
336 lock = keys->pressedPtr(row, col);; 336 lock = keys->pressedPtr(row, col);;
337 *lock = 1; 337 *lock = 1;
338 if (shift) { 338 if (shift) {
339 *shift = 0; 339 *shift = 0;
340 shift = 0; 340 shift = 0;
341 } 341 }
342 } 342 }
343 343
344 } 344 }
345 345
346 } 346 }
347 else { // normal char 347 else { // normal char
348 if ((shift || lock) && keys->shift(unicode)) { 348 if ((shift || lock) && keys->shift(unicode)) {
349 unicode = keys->shift(unicode); 349 unicode = keys->shift(unicode);
350 } 350 }
351 } 351 }
352 352
353 // korean parsing 353 // korean parsing
354 if (keys->lang == "ko") { 354 if (keys->lang == "ko") {
355 355
356 unicode = parseKoreanInput(unicode); 356 unicode = parseKoreanInput(unicode);
357 } 357 }
358 358
359 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0); 359 modifiers = (ctrl ? Qt::ControlButton : 0) | (alt ? Qt::AltButton : 0);
360 360
361 emit key(unicode, qkeycode, modifiers, true, false); 361 if ('A' <= unicode && unicode <= 'z' && modifiers) {
362
363 qkeycode = QChar(unicode).upper();
364 unicode = qkeycode - '@';
365 }
366
367 QWSServer::sendKeyEvent(unicode, qkeycode, modifiers, true, false);
362 368
363 // pickboard stuff 369 // pickboard stuff
364 if (usePicks) { 370 if (usePicks) {
365 371
366 KeyboardConfig *dc = picks->dc; 372 KeyboardConfig *dc = picks->dc;
367 373
368 if (dc) { 374 if (dc) {
369 if (qkeycode == Qt::Key_Backspace) { 375 if (qkeycode == Qt::Key_Backspace) {
370 dc->input.remove(dc->input.last()); // remove last input 376 dc->input.remove(dc->input.last()); // remove last input
371 dc->decBackspaces(); 377 dc->decBackspaces();
372 } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) { 378 } else if ( qkeycode == Qt::Key_Return || QChar(unicode).isPunct() || QChar(unicode).isSpace() || unicode == 0) {
373 dc->input.clear(); 379 dc->input.clear();
374 dc->resetBackspaces(); 380 dc->resetBackspaces();
375 } else { 381 } else {
376 dc->add(QString(QChar(unicode))); 382 dc->add(QString(QChar(unicode)));
377 dc->incBackspaces(); 383 dc->incBackspaces();
378 } 384 }
379 } 385 }
380 picks->repaint(); 386 picks->repaint();
381 } 387 }
382 388
383 389
384 // painting 390 // painting
385 pressed = TRUE; 391 pressed = TRUE;
386 392
387 pressedKeyRow = row; 393 pressedKeyRow = row;
388 pressedKeyCol = col; 394 pressedKeyCol = col;
389 395
390 if (need_repaint) repaint(FALSE); 396 if (need_repaint) repaint(FALSE);
391 else { // just paint the one key pressed 397 else { // just paint the one key pressed
392 398
393 399
394 400
395 QPainter p(this); 401 QPainter p(this);
396 drawKeyboard(p, row, col); 402 drawKeyboard(p, row, col);
397 403
398 } 404 }
399 405
400 if (useRepeat) repeatTimer->start( 800 ); 406 if (useRepeat) repeatTimer->start( 800 );
401 //pressTid = startTimer(80); 407 //pressTid = startTimer(80);
402 408
403} 409}
404 410
405 411
406/* Keyboard::mouseReleaseEvent {{{1 */ 412/* Keyboard::mouseReleaseEvent {{{1 */
407void Keyboard::mouseReleaseEvent(QMouseEvent*) 413void Keyboard::mouseReleaseEvent(QMouseEvent*)
408{ 414{
409 pressed = FALSE; 415 pressed = FALSE;
410 //if ( pressTid == 0 ) 416 //if ( pressTid == 0 )
411#if defined(Q_WS_QWS) || defined(_WS_QWS_) 417#if defined(Q_WS_QWS) || defined(_WS_QWS_)
412 if ( unicode != -1 ) { 418 if ( unicode != -1 ) {
413 emit key( unicode, qkeycode, modifiers, false, false ); 419 emit key( unicode, qkeycode, modifiers, false, false );
414 repeatTimer->stop(); 420 repeatTimer->stop();
415 } 421 }
416#endif 422#endif
417 if (shift && unicode != 0) { 423 if (shift && unicode != 0) {
418 424
419 425
420 *shift = 0; // unpress shift key 426 *shift = 0; // unpress shift key
421 shift = 0; // reset the shift pointer 427 shift = 0; // reset the shift pointer
422 repaint(FALSE); 428 repaint(FALSE);
423 429
424 } 430 }
425 else 431 else
426 432
427 clearHighlight(); 433 clearHighlight();
428} 434}
429 435
430/* Keyboard::timerEvent {{{1 */ 436/* Keyboard::timerEvent {{{1 */
431 437
432/* dont know what this does, but i think it is here so that if your screen 438/* dont know what this does, but i think it is here so that if your screen
433 * sticks (like on an ipaq) then it will stop repeating if you click another 439 * sticks (like on an ipaq) then it will stop repeating if you click another
434 * key... but who knows what anything does in this thing anyway? 440 * key... but who knows what anything does in this thing anyway?
435 441
436 void Keyboard::timerEvent(QTimerEvent* e) 442 void Keyboard::timerEvent(QTimerEvent* e)
437{ 443{
438 if ( e->timerId() == pressTid ) { 444 if ( e->timerId() == pressTid ) {
439 killTimer(pressTid); 445 killTimer(pressTid);
440 pressTid = 0; 446 pressTid = 0;
441 if ( !pressed ) 447 if ( !pressed )
442 cout << "calling clearHighlight from timerEvent\n"; 448 cout << "calling clearHighlight from timerEvent\n";
443 //clearHighlight(); 449 //clearHighlight();
444 } 450 }
445} 451}
446*/ 452*/
447 453
448void Keyboard::repeat() 454void Keyboard::repeat()
449{ 455{
450 456
451 repeatTimer->start( 200 ); 457 repeatTimer->start( 200 );
452 emit key( unicode, qkeycode, modifiers, true, true ); 458 emit key( unicode, qkeycode, modifiers, true, true );
453} 459}
454 460
455void Keyboard::clearHighlight() 461void Keyboard::clearHighlight()
456{ 462{
457 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) { 463 if ( pressedKeyRow >= 0 && pressedKeyCol >= 0) {
458 int tmpRow = pressedKeyRow; 464 int tmpRow = pressedKeyRow;
459 int tmpCol = pressedKeyCol; 465 int tmpCol = pressedKeyCol;
460 466
461 pressedKeyRow = -1; 467 pressedKeyRow = -1;
462 pressedKeyCol = -1; 468 pressedKeyCol = -1;
463 469
464 QPainter p(this); 470 QPainter p(this);
465 drawKeyboard(p, tmpRow, tmpCol); 471 drawKeyboard(p, tmpRow, tmpCol);
466 } 472 }
467} 473}
468 474
469 475
470/* Keyboard::sizeHint {{{1 */ 476/* Keyboard::sizeHint {{{1 */
471QSize Keyboard::sizeHint() const 477QSize Keyboard::sizeHint() const
472{ 478{
473 QFontMetrics fm=fontMetrics(); 479 QFontMetrics fm=fontMetrics();
474 int keyHeight = fm.lineSpacing() + 2; 480 int keyHeight = fm.lineSpacing() + 2;
475 481
476 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1); 482 return QSize( 240, keyHeight * 5 + (usePicks ? picks->sizeHint().height() : 0) + 1);
477} 483}
478 484
479 485
480void Keyboard::resetState() 486void Keyboard::resetState()
481{ 487{
482 schar = mchar = echar = 0; 488 schar = mchar = echar = 0;
483 picks->resetState(); 489 picks->resetState();
484} 490}
485 491
486/* Keyboard::togglePickboard {{{1 */ 492/* Keyboard::togglePickboard {{{1 */
487void Keyboard::togglePickboard(bool on_off) 493void Keyboard::togglePickboard(bool on_off)
488{ 494{
489 usePicks = on_off; 495 usePicks = on_off;
490 if (usePicks) { 496 if (usePicks) {
491 picks->show(); 497 picks->show();
492 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send 498 //move(x(), y() - picks->height()); // not required anymore because QCopChannel::send
493 //adjustSize(); 499 //adjustSize();
494 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 500 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
495 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 501 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
496 } else { 502 } else {
497 503
498 picks->hide(); 504 picks->hide();
499 picks->resetState(); 505 picks->resetState();
500 //move(x(), y() + picks->height()); 506 //move(x(), y() + picks->height());
501 //adjustSize(); 507 //adjustSize();
502 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 508 QObject::disconnect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
503 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 509 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
504 510
505 } 511 }
506 /* 512 /*
507 * this closes && opens the input method 513 * this closes && opens the input method
508 */ 514 */
509 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()"); 515 QCopChannel::send ("QPE/TaskBar", "hideInputMethod()");
510 QCopChannel::send ("QPE/TaskBar", "showInputMethod()"); 516 QCopChannel::send ("QPE/TaskBar", "showInputMethod()");
511} 517}
512 518
513void Keyboard::toggleRepeat(bool on) { 519void Keyboard::toggleRepeat(bool on) {
514 520
515 useRepeat = on; 521 useRepeat = on;
516 cout << "setting useRepeat to: " << useRepeat << "\n"; 522 cout << "setting useRepeat to: " << useRepeat << "\n";
517} 523}
518 524
519/* Keyboard::setMapTo ... {{{1 */ 525/* Keyboard::setMapTo ... {{{1 */
520void Keyboard::setMapToDefault() { 526void Keyboard::setMapToDefault() {
521 527
522 528
523 /* load current locale language map */ 529 /* load current locale language map */
524 Config *config = new Config("locale"); 530 Config *config = new Config("locale");
525 config->setGroup( "Language" ); 531 config->setGroup( "Language" );
526 QString l = config->readEntry( "Language" , "en" ); 532 QString l = config->readEntry( "Language" , "en" );
527 delete config; 533 delete config;
528 534
529 QString key_map = QPEApplication::qpeDir() + "/share/multikey/" 535 QString key_map = QPEApplication::qpeDir() + "/share/multikey/"
530 + l + ".keymap"; 536 + l + ".keymap";
531 537
532 /* save change to multikey config file */ 538 /* save change to multikey config file */
533 config = new Config("multikey"); 539 config = new Config("multikey");
534 config->setGroup ("keymaps"); 540 config->setGroup ("keymaps");
535 config->writeEntry ("current", key_map); // default closed 541 config->writeEntry ("current", key_map); // default closed
536 delete config; 542 delete config;
537 543
538 delete keys; 544 delete keys;
539 keys = new Keys(key_map); 545 keys = new Keys(key_map);
540 546
541 // have to repaint the keyboard 547 // have to repaint the keyboard
542 repaint(FALSE); 548 repaint(FALSE);
543} 549}
544 550
545void Keyboard::setMapToFile(QString map) { 551void Keyboard::setMapToFile(QString map) {
546 552
547 /* save change to multikey config file */ 553 /* save change to multikey config file */
548 Config *config = new Config("multikey"); 554 Config *config = new Config("multikey");
549 config->setGroup ("keymaps"); 555 config->setGroup ("keymaps");
550 config->writeEntry ("current", map); // default closed 556 config->writeEntry ("current", map); // default closed
551 557
552 delete config; 558 delete config;
553 559
554 delete keys; 560 delete keys;
555 if (QFile(map).exists()) 561 if (QFile(map).exists())
556 keys = new Keys(map); 562 keys = new Keys(map);
557 else 563 else
558 keys = new Keys(); 564 keys = new Keys();
559 565
560 repaint(FALSE); 566 repaint(FALSE);
561 567
562} 568}
563 569
564/* Keybaord::reloadKeyboard {{{1 */ 570/* Keybaord::reloadKeyboard {{{1 */
565void Keyboard::reloadKeyboard() { 571void Keyboard::reloadKeyboard() {
566 572
567 // reload colors and redraw 573 // reload colors and redraw
568 loadKeyboardColors(); 574 loadKeyboardColors();
569 repaint(); 575 repaint();
570 576
571} 577}
572 578
573void Keyboard::loadKeyboardColors() { 579void Keyboard::loadKeyboardColors() {
574 580
575 Config config ("multikey"); 581 Config config ("multikey");
576 config.setGroup("colors"); 582 config.setGroup("colors");
577 583
578 QStringList color; 584 QStringList color;
579 color = config.readListEntry("keycolor", QChar(',')); 585 color = config.readListEntry("keycolor", QChar(','));
580 if (color.isEmpty()) { 586 if (color.isEmpty()) {
581 color = QStringList::split(",", "240,240,240"); 587 color = QStringList::split(",", "240,240,240");
582 config.writeEntry("keycolor", color.join(",")); 588 config.writeEntry("keycolor", color.join(","));
583 589
584 } 590 }
585 keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 591 keycolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
586 592
587 color = config.readListEntry("keycolor_pressed", QChar(',')); 593 color = config.readListEntry("keycolor_pressed", QChar(','));
588 if (color.isEmpty()) { 594 if (color.isEmpty()) {
589 color = QStringList::split(",", "171,183,198"); 595 color = QStringList::split(",", "171,183,198");
590 config.writeEntry("keycolor_pressed", color.join(",")); 596 config.writeEntry("keycolor_pressed", color.join(","));
591 597
592 } 598 }
593 keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 599 keycolor_pressed = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
594 600
595 color = config.readListEntry("keycolor_lines", QChar(',')); 601 color = config.readListEntry("keycolor_lines", QChar(','));
596 if (color.isEmpty()) { 602 if (color.isEmpty()) {
597 color = QStringList::split(",", "138,148,160"); 603 color = QStringList::split(",", "138,148,160");
598 config.writeEntry("keycolor_lines", color.join(",")); 604 config.writeEntry("keycolor_lines", color.join(","));
599 605
600 } 606 }
601 keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 607 keycolor_lines = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
602 608
603 color = config.readListEntry("textcolor", QChar(',')); 609 color = config.readListEntry("textcolor", QChar(','));
604 if (color.isEmpty()) { 610 if (color.isEmpty()) {
605 color = QStringList::split(",", "43,54,68"); 611 color = QStringList::split(",", "43,54,68");
606 config.writeEntry("textcolor", color.join(",")); 612 config.writeEntry("textcolor", color.join(","));
607 613
608 } 614 }
609 textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt()); 615 textcolor = QColor(color[0].toInt(), color[1].toInt(), color[2].toInt());
610 616
611} 617}
612 618
613/* korean input functions {{{1 619/* korean input functions {{{1
614 * 620 *
615 * TODO 621 * TODO
616 * one major problem with this implementation is that you can't move the 622 * one major problem with this implementation is that you can't move the
617 * cursor after inputing korean chars, otherwise it will eat up and replace 623 * cursor after inputing korean chars, otherwise it will eat up and replace