summaryrefslogtreecommitdiff
path: root/inputmethods
Unidiff
Diffstat (limited to 'inputmethods') (more/less context) (ignore whitespace changes)
-rw-r--r--inputmethods/dvorak/dvorak.cpp13
-rw-r--r--inputmethods/keyboard/keyboard.cpp13
-rw-r--r--inputmethods/multikey/keyboard.cpp6
-rw-r--r--inputmethods/pickboard/pickboard.cpp15
-rw-r--r--inputmethods/unikeyboard/unikeyboard.cpp12
5 files changed, 43 insertions, 16 deletions
diff --git a/inputmethods/dvorak/dvorak.cpp b/inputmethods/dvorak/dvorak.cpp
index 2137f22..3781e38 100644
--- a/inputmethods/dvorak/dvorak.cpp
+++ b/inputmethods/dvorak/dvorak.cpp
@@ -1,304 +1,311 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "dvorak.h" 21#include "dvorak.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24 24#include <qpe/config.h>
25#include <qwindowsystem_qws.h> 25#include <qwindowsystem_qws.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <ctype.h> 29#include <ctype.h>
30 30
31 31
32#define USE_SMALL_BACKSPACE 32#define USE_SMALL_BACKSPACE
33 33
34using namespace Dvorak; 34using namespace Dvorak;
35 35
36Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) : 36Keyboard::Keyboard(QWidget* parent, const char* name, WFlags f) :
37 QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), 37 QFrame(parent, name, f), shift(FALSE), lock(FALSE), ctrl(FALSE),
38 alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), 38 alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1),
39 unicode(-1), qkeycode(0), modifiers(0) 39 unicode(-1), qkeycode(0), modifiers(0)
40{ 40{
41 // setPalette(QPalette(QColor(240,240,230))); // Beige! 41 // setPalette(QPalette(QColor(240,240,230))); // Beige!
42 // setFont( QFont( "Helvetica", 8 ) ); 42 // setFont( QFont( "Helvetica", 8 ) );
43// setPalette(QPalette(QColor(200,200,200))); // Gray 43// setPalette(QPalette(QColor(200,200,200))); // Gray
44 setPalette(QPalette(QColor(220,220,220))); // Gray 44 setPalette(QPalette(QColor(220,220,220))); // Gray
45 45
46 // get the default font
47 Config *config = new Config( "qpe" );
48 config->setGroup( "Appearance" );
49 QString familyStr = config->readEntry( "FontFamily", "smallsmooth" );
50 int fontSize = config->readNumEntry( "FontSize", 10 );
51 delete config;
52
46 picks = new KeyboardPicks( this ); 53 picks = new KeyboardPicks( this );
47 picks->setFont( QFont( "smallsmooth", 9 ) ); 54 picks->setFont( QFont( familyStr, fontSize ) );
48 setFont( QFont( "smallsmooth", 9 ) ); 55 setFont( QFont( familyStr, fontSize ) );
49 picks->initialise(); 56 picks->initialise();
50 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 57 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
51 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 58 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
52 59
53 repeatTimer = new QTimer( this ); 60 repeatTimer = new QTimer( this );
54 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 61 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
55} 62}
56 63
57void Keyboard::resizeEvent(QResizeEvent*) 64void Keyboard::resizeEvent(QResizeEvent*)
58{ 65{
59 int ph = picks->sizeHint().height(); 66 int ph = picks->sizeHint().height();
60 picks->setGeometry( 0, 0, width(), ph ); 67 picks->setGeometry( 0, 0, width(), ph );
61 keyHeight = (height()-ph)/5; 68 keyHeight = (height()-ph)/5;
62 int nk; 69 int nk;
63 if ( useOptiKeys ) { 70 if ( useOptiKeys ) {
64 nk = 15; 71 nk = 15;
65 } else if ( useLargeKeys ) { 72 } else if ( useLargeKeys ) {
66 nk = 15; 73 nk = 15;
67 } else { 74 } else {
68 nk = 19; 75 nk = 19;
69 } 76 }
70 defaultKeyWidth = width()/nk; 77 defaultKeyWidth = width()/nk;
71 xoffs = (width()-defaultKeyWidth*nk)/2; 78 xoffs = (width()-defaultKeyWidth*nk)/2;
72} 79}
73 80
74void KeyboardPicks::initialise() 81void KeyboardPicks::initialise()
75{ 82{
76 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 83 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
77 mode = 0; 84 mode = 0;
78 dc = new KeyboardConfig(this); 85 dc = new KeyboardConfig(this);
79 configs.append(dc); 86 configs.append(dc);
80} 87}
81 88
82QSize KeyboardPicks::sizeHint() const 89QSize KeyboardPicks::sizeHint() const
83{ 90{
84 return QSize(240,fontMetrics().lineSpacing()); 91 return QSize(240,fontMetrics().lineSpacing());
85} 92}
86 93
87 94
88void KeyboardConfig::generateText(const QString &s) 95void KeyboardConfig::generateText(const QString &s)
89{ 96{
90#if defined(Q_WS_QWS) || defined(_WS_QWS_) 97#if defined(Q_WS_QWS) || defined(_WS_QWS_)
91 for (int i=0; i<(int)backspaces; i++) { 98 for (int i=0; i<(int)backspaces; i++) {
92 parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); 99 parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false );
93 parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); 100 parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false );
94 } 101 }
95 for (int i=0; i<(int)s.length(); i++) { 102 for (int i=0; i<(int)s.length(); i++) {
96 parent->emitKey( s[i].unicode(), 0, 0, true, false ); 103 parent->emitKey( s[i].unicode(), 0, 0, true, false );
97 parent->emitKey( s[i].unicode(), 0, 0, false, false ); 104 parent->emitKey( s[i].unicode(), 0, 0, false, false );
98 } 105 }
99 parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); 106 parent->emitKey( 0, ::Qt::Key_Space, 0, true, false );
100 parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); 107 parent->emitKey( 0, ::Qt::Key_Space, 0, false, false );
101 backspaces = 0; 108 backspaces = 0;
102#endif 109#endif
103} 110}
104 111
105 112
106//PC keyboard layout and scancodes 113//PC keyboard layout and scancodes
107 114
108/* 115/*
109 Format: length, code, length, code, ..., 0 116 Format: length, code, length, code, ..., 0
110 117
111 length is measured in half the width of a standard key. 118 length is measured in half the width of a standard key.
112 If code < 0x80 we have length/2 consecutive standard keys, 119 If code < 0x80 we have length/2 consecutive standard keys,
113 starting with scancode code. 120 starting with scancode code.
114 121
115 Special keys are hardcoded, one at a time, with length of key 122 Special keys are hardcoded, one at a time, with length of key
116 and code >= 0x80, these are NOT standard PC scancodes, but are looked 123 and code >= 0x80, these are NOT standard PC scancodes, but are looked
117 up in specialM[]. (The special keys are not keymappable.) 124 up in specialM[]. (The special keys are not keymappable.)
118 125
119 */ 126 */
120 127
121static const uchar * const keyboard_opti[5] = { 128static const uchar * const keyboard_opti[5] = {
122 (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", 129 (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236",
123 (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", 130 (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065",
124 (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", 131 (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055",
125 (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", 132 (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014",
126 (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" 133 (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230"
127}; 134};
128 135
129static const uchar * const keyboard_standard[5] = { 136static const uchar * const keyboard_standard[5] = {
130 137
131#ifdef USE_SMALL_BACKSPACE 138#ifdef USE_SMALL_BACKSPACE
132 (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\002\200\002\223\002\215\002\216\002\217", 139 (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\002\200\002\223\002\215\002\216\002\217",
133#else 140#else
134 (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\004\200\002\223\002\215\002\216\002\217", 141 (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002[\002]\004\200\002\223\002\215\002\216\002\217",
135#endif 142#endif
136 //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP 143 //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP
137 144
138 (const uchar *const)"\003\201\002'\002,\002.\002p\002y\002f\002g\002c\002r\002l\002/\002=\002\\\001\224\002\223\002\221\002\220\002\222", 145 (const uchar *const)"\003\201\002'\002,\002.\002p\002y\002f\002g\002c\002r\002l\002/\002=\002\\\001\224\002\223\002\221\002\220\002\222",
139 //TAB + qwerty.. + backslash //+ DEL + END + PGDN 146 //TAB + qwerty.. + backslash //+ DEL + END + PGDN
140 147
141 (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203", 148 (const uchar *const)"\004\202\002a\002o\002e\002u\002i\002d\002h\002t\002n\002s\002-\004\203",
142 //CAPS + asdf.. + RETURN 149 //CAPS + asdf.. + RETURN
143 150
144 (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211", 151 (const uchar *const)"\005\204\002;\002q\002j\002k\002x\002b\002m\002w\002v\002z\005\204\002\223\002\223\002\211",
145 //SHIFT + zxcv... //+ UP 152 //SHIFT + zxcv... //+ UP
146 153
147 (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" 154 (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214"
148 //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT 155 //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT
149 156
150}; 157};
151 158
152 159
153struct ShiftMap { 160struct ShiftMap {
154 char normal; 161 char normal;
155 char shifted; 162 char shifted;
156}; 163};
157 164
158 165
159static const ShiftMap shiftMap[] = { 166static const ShiftMap shiftMap[] = {
160 { '`', '~' }, 167 { '`', '~' },
161 { '1', '!' }, 168 { '1', '!' },
162 { '2', '@' }, 169 { '2', '@' },
163 { '3', '#' }, 170 { '3', '#' },
164 { '4', '$' }, 171 { '4', '$' },
165 { '5', '%' }, 172 { '5', '%' },
166 { '6', '^' }, 173 { '6', '^' },
167 { '7', '&' }, 174 { '7', '&' },
168 { '8', '*' }, 175 { '8', '*' },
169 { '9', '(' }, 176 { '9', '(' },
170 { '0', ')' }, 177 { '0', ')' },
171 { '-', '_' }, 178 { '-', '_' },
172 { '=', '+' }, 179 { '=', '+' },
173 { '\\', '|' }, 180 { '\\', '|' },
174 { '[', '{' }, 181 { '[', '{' },
175 { ']', '}' }, 182 { ']', '}' },
176 { ';', ':' }, 183 { ';', ':' },
177 { '\'', '"' }, 184 { '\'', '"' },
178 { ',', '<' }, 185 { ',', '<' },
179 { '.', '>' }, 186 { '.', '>' },
180 { '/', '?' } 187 { '/', '?' }
181}; 188};
182 189
183 190
184/* XPM */ 191/* XPM */
185static const char * const uparrow_xpm[]={ 192static const char * const uparrow_xpm[]={
186"9 9 2 1", 193"9 9 2 1",
187"a c #000000", 194"a c #000000",
188". c None", 195". c None",
189".........", 196".........",
190"....a....", 197"....a....",
191"...aaa...", 198"...aaa...",
192"..aaaaa..", 199"..aaaaa..",
193"....a....", 200"....a....",
194"....a....", 201"....a....",
195"....a....", 202"....a....",
196"....a....", 203"....a....",
197"........."}; 204"........."};
198/* XPM */ 205/* XPM */
199static const char * const leftarrow_xpm[]={ 206static const char * const leftarrow_xpm[]={
200"9 9 2 1", 207"9 9 2 1",
201"a c #000000", 208"a c #000000",
202". c None", 209". c None",
203".........", 210".........",
204".........", 211".........",
205"...a.....", 212"...a.....",
206"..aa.....", 213"..aa.....",
207".aaaaaaa.", 214".aaaaaaa.",
208"..aa.....", 215"..aa.....",
209"...a.....", 216"...a.....",
210".........", 217".........",
211"........."}; 218"........."};
212/* XPM */ 219/* XPM */
213static const char * const downarrow_xpm[]={ 220static const char * const downarrow_xpm[]={
214"9 9 2 1", 221"9 9 2 1",
215"a c #000000", 222"a c #000000",
216". c None", 223". c None",
217".........", 224".........",
218"....a....", 225"....a....",
219"....a....", 226"....a....",
220"....a....", 227"....a....",
221"....a....", 228"....a....",
222"..aaaaa..", 229"..aaaaa..",
223"...aaa...", 230"...aaa...",
224"....a....", 231"....a....",
225"........."}; 232"........."};
226/* XPM */ 233/* XPM */
227static const char * const rightarrow_xpm[]={ 234static const char * const rightarrow_xpm[]={
228"9 9 2 1", 235"9 9 2 1",
229"a c #000000", 236"a c #000000",
230". c None", 237". c None",
231".........", 238".........",
232".........", 239".........",
233".....a...", 240".....a...",
234".....aa..", 241".....aa..",
235".aaaaaaa.", 242".aaaaaaa.",
236".....aa..", 243".....aa..",
237".....a...", 244".....a...",
238".........", 245".........",
239"........."}; 246"........."};
240/* XPM */ 247/* XPM */
241static const char * const insert_xpm[]={ 248static const char * const insert_xpm[]={
242"9 9 2 1", 249"9 9 2 1",
243"a c #000000", 250"a c #000000",
244". c None", 251". c None",
245".........", 252".........",
246"a........", 253"a........",
247"a.aaa.aaa", 254"a.aaa.aaa",
248"a.a.a.a..", 255"a.a.a.a..",
249"a.a.a..a.", 256"a.a.a..a.",
250"a.a.a...a", 257"a.a.a...a",
251"a.a.a.aaa", 258"a.a.a.aaa",
252".........", 259".........",
253"........."}; 260"........."};
254/* XPM */ 261/* XPM */
255static const char * const delete_xpm[]={ 262static const char * const delete_xpm[]={
256"9 9 2 1", 263"9 9 2 1",
257"a c #000000", 264"a c #000000",
258". c None", 265". c None",
259".........", 266".........",
260"aa......a", 267"aa......a",
261"a.a.aaa.a", 268"a.a.aaa.a",
262"a.a.a.a.a", 269"a.a.a.a.a",
263"a.a.aaa.a.", 270"a.a.aaa.a.",
264"a.a.a...a", 271"a.a.a...a",
265"aaa.aaa.a", 272"aaa.aaa.a",
266".........", 273".........",
267"........."}; 274"........."};
268/* XPM */ 275/* XPM */
269static const char * const home_xpm[]={ 276static const char * const home_xpm[]={
270"9 9 2 1", 277"9 9 2 1",
271"a c #000000", 278"a c #000000",
272". c None", 279". c None",
273"....a....", 280"....a....",
274"...a.a...", 281"...a.a...",
275"..a...a..", 282"..a...a..",
276".a.....a.", 283".a.....a.",
277"aa.aaa.aa", 284"aa.aaa.aa",
278".a.a.a.a.", 285".a.a.a.a.",
279".a.a.a.a.", 286".a.a.a.a.",
280".aaaaaaa.", 287".aaaaaaa.",
281"........."}; 288"........."};
282/* XPM */ 289/* XPM */
283static const char * const end_xpm[]={ 290static const char * const end_xpm[]={
284"10 9 2 1", 291"10 9 2 1",
285"a c #000000", 292"a c #000000",
286". c None", 293". c None",
287"..........", 294"..........",
288"aa.......a", 295"aa.......a",
289"a..aaa.aaa", 296"a..aaa.aaa",
290"aa.a.a.a.a", 297"aa.a.a.a.a",
291"a..a.a.a.a", 298"a..a.a.a.a",
292"a..a.a.a.a", 299"a..a.a.a.a",
293"aa.a.a.aaa", 300"aa.a.a.aaa",
294"..........", 301"..........",
295".........."}; 302".........."};
296/* XPM */ 303/* XPM */
297static const char * const pageup_xpm[]={ 304static const char * const pageup_xpm[]={
298"9 9 2 1", 305"9 9 2 1",
299"a c #000000", 306"a c #000000",
300". c None", 307". c None",
301".aaa.aaa.", 308".aaa.aaa.",
302".a.a.a.a.", 309".a.a.a.a.",
303".aaa..aa.", 310".aaa..aa.",
304".a...aaa.", 311".a...aaa.",
diff --git a/inputmethods/keyboard/keyboard.cpp b/inputmethods/keyboard/keyboard.cpp
index fb88f2a..39d44cd 100644
--- a/inputmethods/keyboard/keyboard.cpp
+++ b/inputmethods/keyboard/keyboard.cpp
@@ -1,305 +1,312 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "keyboard.h" 21#include "keyboard.h"
22 22
23#include <qpe/global.h> 23#include <qpe/global.h>
24 24#include <qpe/config.h>
25#include <qwindowsystem_qws.h> 25#include <qwindowsystem_qws.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qfontmetrics.h> 27#include <qfontmetrics.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <ctype.h> 29#include <ctype.h>
30 30
31#include <sys/utsname.h> 31#include <sys/utsname.h>
32 32
33using namespace KeyboardInput; 33using namespace KeyboardInput;
34 34
35#define USE_SMALL_BACKSPACE 35#define USE_SMALL_BACKSPACE
36 36
37Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 37Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
38 QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE), 38 QFrame(parent, _name, f), shift(FALSE), lock(FALSE), ctrl(FALSE),
39 alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1), 39 alt(FALSE), useLargeKeys(TRUE), useOptiKeys(0), pressedKey(-1),
40 unicode(-1), qkeycode(0), modifiers(0) 40 unicode(-1), qkeycode(0), modifiers(0)
41{ 41{
42 // setPalette(QPalette(QColor(240,240,230))); // Beige! 42 // setPalette(QPalette(QColor(240,240,230))); // Beige!
43 // setFont( QFont( "Helvetica", 8 ) ); 43 // setFont( QFont( "Helvetica", 8 ) );
44// setPalette(QPalette(QColor(200,200,200))); // Gray 44// setPalette(QPalette(QColor(200,200,200))); // Gray
45 setPalette(QPalette(QColor(220,220,220))); // Gray 45 setPalette(QPalette(QColor(220,220,220))); // Gray
46 46
47 // get the default font
48 Config *config = new Config( "qpe" );
49 config->setGroup( "Appearance" );
50 QString familyStr = config->readEntry( "FontFamily", "smallsmooth" );
51 int fontSize = config->readNumEntry( "FontSize", 10 );
52 delete config;
53
47 picks = new KeyboardPicks( this ); 54 picks = new KeyboardPicks( this );
48 picks->setFont( QFont( "smallsmooth", 9 ) ); 55 picks->setFont( QFont( familyStr, fontSize ) );
49 setFont( QFont( "smallsmooth", 9 ) ); 56 setFont( QFont( familyStr, fontSize ) );
50 picks->initialise(); 57 picks->initialise();
51 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 58 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
52 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 59 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
53 60
54 repeatTimer = new QTimer( this ); 61 repeatTimer = new QTimer( this );
55 62
56 // temporary quick and dirty fix for the "sticky keyboard bug" 63 // temporary quick and dirty fix for the "sticky keyboard bug"
57 // on ipaq. 64 // on ipaq.
58// struct utsname name; 65// struct utsname name;
59// if (uname(&name) != -1) 66// if (uname(&name) != -1)
60 // { 67 // {
61 //QString release=name.release; 68 //QString release=name.release;
62 //qWarning("System release: %s\n", name.release); 69 //qWarning("System release: %s\n", name.release);
63 //if(release.find("embedix",0,TRUE) !=-1) 70 //if(release.find("embedix",0,TRUE) !=-1)
64 // { 71 // {
65 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 72 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
66 // } 73 // }
67 // } 74 // }
68} 75}
69 76
70void Keyboard::resizeEvent(QResizeEvent*) 77void Keyboard::resizeEvent(QResizeEvent*)
71{ 78{
72 int ph = picks->sizeHint().height(); 79 int ph = picks->sizeHint().height();
73 picks->setGeometry( 0, 0, width(), ph ); 80 picks->setGeometry( 0, 0, width(), ph );
74 keyHeight = (height()-ph)/5; 81 keyHeight = (height()-ph)/5;
75 int nk; 82 int nk;
76 if ( useOptiKeys ) { 83 if ( useOptiKeys ) {
77 nk = 15; 84 nk = 15;
78 } else if ( useLargeKeys ) { 85 } else if ( useLargeKeys ) {
79 nk = 15; 86 nk = 15;
80 } else { 87 } else {
81 nk = 19; 88 nk = 19;
82 } 89 }
83 defaultKeyWidth = width()/nk; 90 defaultKeyWidth = width()/nk;
84 xoffs = (width()-defaultKeyWidth*nk)/2; 91 xoffs = (width()-defaultKeyWidth*nk)/2;
85} 92}
86 93
87void KeyboardPicks::initialise() 94void KeyboardPicks::initialise()
88{ 95{
89 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 96 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
90 mode = 0; 97 mode = 0;
91 dc = new KeyboardConfig(this); 98 dc = new KeyboardConfig(this);
92 configs.append(dc); 99 configs.append(dc);
93} 100}
94 101
95QSize KeyboardPicks::sizeHint() const 102QSize KeyboardPicks::sizeHint() const
96{ 103{
97 return QSize(240,fontMetrics().lineSpacing()); 104 return QSize(240,fontMetrics().lineSpacing());
98} 105}
99 106
100 107
101void KeyboardConfig::generateText(const QString &s) 108void KeyboardConfig::generateText(const QString &s)
102{ 109{
103#if defined(Q_WS_QWS) || defined(_WS_QWS_) 110#if defined(Q_WS_QWS) || defined(_WS_QWS_)
104 for (int i=0; i<(int)backspaces; i++) { 111 for (int i=0; i<(int)backspaces; i++) {
105 parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); 112 parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false );
106 parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); 113 parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false );
107 } 114 }
108 for (int i=0; i<(int)s.length(); i++) { 115 for (int i=0; i<(int)s.length(); i++) {
109 parent->emitKey( s[i].unicode(), 0, 0, true, false ); 116 parent->emitKey( s[i].unicode(), 0, 0, true, false );
110 parent->emitKey( s[i].unicode(), 0, 0, false, false ); 117 parent->emitKey( s[i].unicode(), 0, 0, false, false );
111 } 118 }
112 parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); 119 parent->emitKey( 0, ::Qt::Key_Space, 0, true, false );
113 parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); 120 parent->emitKey( 0, ::Qt::Key_Space, 0, false, false );
114 backspaces = 0; 121 backspaces = 0;
115#endif 122#endif
116} 123}
117 124
118 125
119//PC keyboard layout and scancodes 126//PC keyboard layout and scancodes
120 127
121/* 128/*
122 Format: length, code, length, code, ..., 0 129 Format: length, code, length, code, ..., 0
123 130
124 length is measured in half the width of a standard key. 131 length is measured in half the width of a standard key.
125 If code < 0x80 we have length/2 consecutive standard keys, 132 If code < 0x80 we have length/2 consecutive standard keys,
126 starting with scancode code. 133 starting with scancode code.
127 134
128 Special keys are hardcoded, one at a time, with length of key 135 Special keys are hardcoded, one at a time, with length of key
129 and code >= 0x80, these are NOT standard PC scancodes, but are looked 136 and code >= 0x80, these are NOT standard PC scancodes, but are looked
130 up in specialM[]. (The special keys are not keymappable.) 137 up in specialM[]. (The special keys are not keymappable.)
131 138
132 */ 139 */
133 140
134static const uchar * const keyboard_opti[5] = { 141static const uchar * const keyboard_opti[5] = {
135 (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236", 142 (const uchar *const) "\001\223\003\240\002\20\002\41\002\26\002\62\002\56\002\45\002\54\003\200\001\223\002\226\002\235\002\234\002\236",
136 (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065", 143 (const uchar *const) "\001\223\003\201\004\207\002\30\002\24\002\43\004\207\003\203\001\223\006\002\002\065",
137 (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055", 144 (const uchar *const) "\001\223\003\202\002\60\002\37\002\23\002\22\002\36\002\21\002\55\003\203\001\223\006\005\002\055",
138 (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014", 145 (const uchar *const) "\001\223\003\205\004\207\002\27\002\61\002\40\004\207\003\204\001\223\006\010\002\014",
139 (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230" 146 (const uchar *const) "\001\223\003\206\002\44\002\31\002\57\002\42\002\46\002\25\002\207\003\204\001\223\002\013\002\064\002\015\002\230"
140}; 147};
141 148
142 149
143static const uchar * const keyboard_standard[5] = { 150static const uchar * const keyboard_standard[5] = {
144 151
145#ifdef USE_SMALL_BACKSPACE 152#ifdef USE_SMALL_BACKSPACE
146 (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217", 153 (const uchar *const)"\002\240\002`\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\002\200\002\223\002\215\002\216\002\217",
147#else 154#else
148 (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217", 155 (const uchar *const)"\002\051\0021\0022\0023\0024\0025\0026\0027\0028\0029\0020\002-\002=\004\200\002\223\002\215\002\216\002\217",
149#endif 156#endif
150 //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP 157 //~ + 123...+ BACKSPACE //+ INSERT + HOME + PGUP
151 158
152 (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222", 159 (const uchar *const)"\003\201\002q\002w\002e\002r\002t\002y\002u\002i\002o\002p\002[\002]\002\\\001\224\002\223\002\221\002\220\002\222",
153 //TAB + qwerty.. + backslash //+ DEL + END + PGDN 160 //TAB + qwerty.. + backslash //+ DEL + END + PGDN
154 161
155 (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203", 162 (const uchar *const)"\004\202\002a\002s\002d\002f\002g\002h\002j\002k\002l\002;\002'\004\203",
156 //CAPS + asdf.. + RETURN 163 //CAPS + asdf.. + RETURN
157 164
158 (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211", 165 (const uchar *const)"\005\204\002z\002x\002c\002v\002b\002n\002m\002,\002.\002/\005\204\002\223\002\223\002\211",
159 //SHIFT + zxcv... //+ UP 166 //SHIFT + zxcv... //+ UP
160 167
161 (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214" 168 (const uchar *const)"\003\205\003\206\022\207\003\206\003\205\002\223\002\212\002\213\002\214"
162 //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT 169 //CTRL + ALT + SPACE //+ LEFT + DOWN + RIGHT
163 170
164}; 171};
165 172
166 173
167struct ShiftMap { 174struct ShiftMap {
168 char normal; 175 char normal;
169 char shifted; 176 char shifted;
170}; 177};
171 178
172 179
173static const ShiftMap shiftMap[] = { 180static const ShiftMap shiftMap[] = {
174 { '`', '~' }, 181 { '`', '~' },
175 { '1', '!' }, 182 { '1', '!' },
176 { '2', '@' }, 183 { '2', '@' },
177 { '3', '#' }, 184 { '3', '#' },
178 { '4', '$' }, 185 { '4', '$' },
179 { '5', '%' }, 186 { '5', '%' },
180 { '6', '^' }, 187 { '6', '^' },
181 { '7', '&' }, 188 { '7', '&' },
182 { '8', '*' }, 189 { '8', '*' },
183 { '9', '(' }, 190 { '9', '(' },
184 { '0', ')' }, 191 { '0', ')' },
185 { '-', '_' }, 192 { '-', '_' },
186 { '=', '+' }, 193 { '=', '+' },
187 { '\\', '|' }, 194 { '\\', '|' },
188 { '[', '{' }, 195 { '[', '{' },
189 { ']', '}' }, 196 { ']', '}' },
190 { ';', ':' }, 197 { ';', ':' },
191 { '\'', '"' }, 198 { '\'', '"' },
192 { ',', '<' }, 199 { ',', '<' },
193 { '.', '>' }, 200 { '.', '>' },
194 { '/', '?' } 201 { '/', '?' }
195}; 202};
196 203
197 204
198/* XPM */ 205/* XPM */
199static const char * const uparrow_xpm[]={ 206static const char * const uparrow_xpm[]={
200"9 9 2 1", 207"9 9 2 1",
201"a c #000000", 208"a c #000000",
202". c None", 209". c None",
203".........", 210".........",
204"....a....", 211"....a....",
205"...aaa...", 212"...aaa...",
206"..aaaaa..", 213"..aaaaa..",
207"....a....", 214"....a....",
208"....a....", 215"....a....",
209"....a....", 216"....a....",
210"....a....", 217"....a....",
211"........."}; 218"........."};
212/* XPM */ 219/* XPM */
213static const char * const leftarrow_xpm[]={ 220static const char * const leftarrow_xpm[]={
214"9 9 2 1", 221"9 9 2 1",
215"a c #000000", 222"a c #000000",
216". c None", 223". c None",
217".........", 224".........",
218".........", 225".........",
219"...a.....", 226"...a.....",
220"..aa.....", 227"..aa.....",
221".aaaaaaa.", 228".aaaaaaa.",
222"..aa.....", 229"..aa.....",
223"...a.....", 230"...a.....",
224".........", 231".........",
225"........."}; 232"........."};
226/* XPM */ 233/* XPM */
227static const char * const downarrow_xpm[]={ 234static const char * const downarrow_xpm[]={
228"9 9 2 1", 235"9 9 2 1",
229"a c #000000", 236"a c #000000",
230". c None", 237". c None",
231".........", 238".........",
232"....a....", 239"....a....",
233"....a....", 240"....a....",
234"....a....", 241"....a....",
235"....a....", 242"....a....",
236"..aaaaa..", 243"..aaaaa..",
237"...aaa...", 244"...aaa...",
238"....a....", 245"....a....",
239"........."}; 246"........."};
240/* XPM */ 247/* XPM */
241static const char * const rightarrow_xpm[]={ 248static const char * const rightarrow_xpm[]={
242"9 9 2 1", 249"9 9 2 1",
243"a c #000000", 250"a c #000000",
244". c None", 251". c None",
245".........", 252".........",
246".........", 253".........",
247".....a...", 254".....a...",
248".....aa..", 255".....aa..",
249".aaaaaaa.", 256".aaaaaaa.",
250".....aa..", 257".....aa..",
251".....a...", 258".....a...",
252".........", 259".........",
253"........."}; 260"........."};
254/* XPM */ 261/* XPM */
255static const char * const insert_xpm[]={ 262static const char * const insert_xpm[]={
256"9 9 2 1", 263"9 9 2 1",
257"a c #000000", 264"a c #000000",
258". c None", 265". c None",
259".........", 266".........",
260"a........", 267"a........",
261"a.aaa.aaa", 268"a.aaa.aaa",
262"a.a.a.a..", 269"a.a.a.a..",
263"a.a.a..a.", 270"a.a.a..a.",
264"a.a.a...a", 271"a.a.a...a",
265"a.a.a.aaa", 272"a.a.a.aaa",
266".........", 273".........",
267"........."}; 274"........."};
268/* XPM */ 275/* XPM */
269static const char * const delete_xpm[]={ 276static const char * const delete_xpm[]={
270"9 9 2 1", 277"9 9 2 1",
271"a c #000000", 278"a c #000000",
272". c None", 279". c None",
273".........", 280".........",
274"aa......a", 281"aa......a",
275"a.a.aaa.a", 282"a.a.aaa.a",
276"a.a.a.a.a", 283"a.a.a.a.a",
277"a.a.aaa.a.", 284"a.a.aaa.a.",
278"a.a.a...a", 285"a.a.a...a",
279"aaa.aaa.a", 286"aaa.aaa.a",
280".........", 287".........",
281"........."}; 288"........."};
282/* XPM */ 289/* XPM */
283static const char * const home_xpm[]={ 290static const char * const home_xpm[]={
284"9 9 2 1", 291"9 9 2 1",
285"a c #000000", 292"a c #000000",
286". c None", 293". c None",
287"....a....", 294"....a....",
288"...a.a...", 295"...a.a...",
289"..a...a..", 296"..a...a..",
290".a.....a.", 297".a.....a.",
291"aa.aaa.aa", 298"aa.aaa.aa",
292".a.a.a.a.", 299".a.a.a.a.",
293".a.a.a.a.", 300".a.a.a.a.",
294".aaaaaaa.", 301".aaaaaaa.",
295"........."}; 302"........."};
296/* XPM */ 303/* XPM */
297static const char * const end_xpm[]={ 304static const char * const end_xpm[]={
298"10 9 2 1", 305"10 9 2 1",
299"a c #000000", 306"a c #000000",
300". c None", 307". c None",
301"..........", 308"..........",
302"aa.......a", 309"aa.......a",
303"a..aaa.aaa", 310"a..aaa.aaa",
304"aa.a.a.a.a", 311"aa.a.a.a.a",
305"a..a.a.a.a", 312"a..a.a.a.a",
diff --git a/inputmethods/multikey/keyboard.cpp b/inputmethods/multikey/keyboard.cpp
index f8cafd5..96fb484 100644
--- a/inputmethods/multikey/keyboard.cpp
+++ b/inputmethods/multikey/keyboard.cpp
@@ -1,337 +1,337 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "keyboard.h" 21#include "keyboard.h"
22#include "configdlg.h" 22#include "configdlg.h"
23 23
24#include <qpe/global.h> 24#include <qpe/global.h>
25#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
26 26
27#include <qwindowsystem_qws.h> 27#include <qwindowsystem_qws.h>
28#include <qpainter.h> 28#include <qpainter.h>
29#include <qfontmetrics.h> 29#include <qfontmetrics.h>
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
32#include <qpe/config.h> 32#include <qpe/config.h>
33#include <ctype.h> 33#include <ctype.h>
34#include <qdir.h> 34#include <qdir.h>
35#include <qtextstream.h> 35#include <qtextstream.h>
36#include <qstringlist.h> 36#include <qstringlist.h>
37 37
38#include <sys/utsname.h> 38#include <sys/utsname.h>
39 39
40using namespace MultiKey; 40using namespace MultiKey;
41 41
42static const char * const kb_config_xpm[] = { 42static const char * const kb_config_xpm[] = {
43"13 7 2 1", 43"13 7 2 1",
44" c None", 44" c None",
45". c #000000", 45". c #000000",
46" ", 46" ",
47" . ", 47" . ",
48" ... ", 48" ... ",
49" ..... ", 49" ..... ",
50" . ", 50" . ",
51" . ", 51" . ",
52" "}; 52" "};
53 53
54/* Keyboard::Keyboard {{{1 */ 54/* Keyboard::Keyboard {{{1 */
55Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) : 55Keyboard::Keyboard(QWidget* parent, const char* _name, WFlags f) :
56 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0), 56 QFrame(parent, _name, f), shift(0), lock(0), ctrl(0), alt(0),
57 meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0), 57 meta(0), circumflex(0), diaeresis(0), baccent(0), accent(0),
58 useLargeKeys(TRUE), usePicks(0), useRepeat(0), 58 useLargeKeys(TRUE), usePicks(0), useRepeat(0),
59 pressedKeyRow(-1), pressedKeyCol(-1), 59 pressedKeyRow(-1), pressedKeyCol(-1),
60 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0), 60 unicode(-1), qkeycode(0), modifiers(0), schar(0), mchar(0), echar(0),
61 configdlg(0) 61 configdlg(0)
62 62
63{ 63{
64 64
65 // get the default font 65 // get the default font
66 Config *config = new Config( "qpe" ); 66 Config *config = new Config( "qpe" );
67 config->setGroup( "Appearance" ); 67 config->setGroup( "Appearance" );
68 QString familyStr = config->readEntry( "FontFamily", "smallsmooth" ); 68 QString familyStr = config->readEntry( "FontFamily", "smallsmooth" );
69 int fontSize = config->readNumEntry( "FontSize", 10 );
69 delete config; 70 delete config;
70 71
71 config = new Config("multikey"); 72 config = new Config("multikey");
72 config->setGroup ("general"); 73 config->setGroup ("general");
73 usePicks = config->readBoolEntry ("usePickboard", 0); // default closed 74 usePicks = config->readBoolEntry ("usePickboard", 0); // default closed
74 useRepeat = config->readBoolEntry ("useRepeat", 1); 75 useRepeat = config->readBoolEntry ("useRepeat", 1);
75 delete config; 76 delete config;
76 77
77 78 setFont( QFont( familyStr, fontSize ) );
78 setFont( QFont( familyStr, 10 ) );
79 79
80 picks = new KeyboardPicks( this ); 80 picks = new KeyboardPicks( this );
81 picks->setFont( QFont( familyStr, 10 ) ); 81 picks->setFont( QFont( familyStr, fontSize ) );
82 picks->initialise(); 82 picks->initialise();
83 if (usePicks) { 83 if (usePicks) {
84 84
85 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ), 85 QObject::connect( picks, SIGNAL(key(ushort,ushort,ushort,bool,bool) ),
86 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) ); 86 this, SIGNAL(key(ushort,ushort,ushort,bool,bool)) );
87 87
88 } else picks->hide(); 88 } else picks->hide();
89 89
90 loadKeyboardColors(); 90 loadKeyboardColors();
91 91
92 keys = new Keys(); 92 keys = new Keys();
93 93
94 repeatTimer = new QTimer( this ); 94 repeatTimer = new QTimer( this );
95 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) ); 95 connect( repeatTimer, SIGNAL(timeout()), this, SLOT(repeat()) );
96 96
97 QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this); 97 QCopChannel* kbdChannel = new QCopChannel("MultiKey/Keyboard", this);
98 connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)), 98 connect(kbdChannel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(receive(const QCString&,const QByteArray&))); 99 this, SLOT(receive(const QCString&,const QByteArray&)));
100} 100}
101 101
102Keyboard::~Keyboard() { 102Keyboard::~Keyboard() {
103 103
104 if ( configdlg ) { 104 if ( configdlg ) {
105 delete configdlg; 105 delete configdlg;
106 configdlg = 0; 106 configdlg = 0;
107 } 107 }
108 108
109} 109}
110 110
111/* Keyboard::resizeEvent {{{1 */ 111/* Keyboard::resizeEvent {{{1 */
112void Keyboard::resizeEvent(QResizeEvent*) 112void Keyboard::resizeEvent(QResizeEvent*)
113{ 113{
114 int ph = picks->sizeHint().height(); 114 int ph = picks->sizeHint().height();
115 picks->setGeometry( 0, 0, width(), ph ); 115 picks->setGeometry( 0, 0, width(), ph );
116 keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1); 116 keyHeight = (height()-(usePicks ? ph : 0))/(keys->rows()?keys->rows():1);
117 117
118 int nk; // number of keys? 118 int nk; // number of keys?
119 if ( useLargeKeys ) { 119 if ( useLargeKeys ) {
120 nk = 15; 120 nk = 15;
121 } else { 121 } else {
122 nk = 19; 122 nk = 19;
123 } 123 }
124 defaultKeyWidth = (width()/nk)/2; 124 defaultKeyWidth = (width()/nk)/2;
125 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces? 125 xoffs = (width()-defaultKeyWidth*nk)/2; // empty key spaces?
126 126
127} 127}
128 128
129/* KeyboardPicks::initialize {{{1 */ 129/* KeyboardPicks::initialize {{{1 */
130void KeyboardPicks::initialise() 130void KeyboardPicks::initialise()
131{ 131{
132 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed)); 132 setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed));
133 mode = 0; 133 mode = 0;
134 dc = new KeyboardConfig(this); 134 dc = new KeyboardConfig(this);
135 configs.append(dc); 135 configs.append(dc);
136} 136}
137 137
138/* KeyboardPicks::sizeHint {{{1 */ 138/* KeyboardPicks::sizeHint {{{1 */
139QSize KeyboardPicks::sizeHint() const 139QSize KeyboardPicks::sizeHint() const
140{ 140{
141 return QSize(240,fontMetrics().lineSpacing()); 141 return QSize(240,fontMetrics().lineSpacing());
142} 142}
143 143
144 144
145/* KeyboardConfig::generateText {{{1 */ 145/* KeyboardConfig::generateText {{{1 */
146void KeyboardConfig::generateText(const QString &s) 146void KeyboardConfig::generateText(const QString &s)
147{ 147{
148#if defined(Q_WS_QWS) || defined(_WS_QWS_) 148#if defined(Q_WS_QWS) || defined(_WS_QWS_)
149 for (int i=0; i<(int)backspaces; i++) { 149 for (int i=0; i<(int)backspaces; i++) {
150 parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false ); 150 parent->emitKey( 0, ::Qt::Key_Backspace, 0, true, false );
151 parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false ); 151 parent->emitKey( 0, ::Qt::Key_Backspace, 0, false, false );
152 } 152 }
153 for (int i=0; i<(int)s.length(); i++) { 153 for (int i=0; i<(int)s.length(); i++) {
154 parent->emitKey( s[i].unicode(), 0, 0, true, false ); 154 parent->emitKey( s[i].unicode(), 0, 0, true, false );
155 parent->emitKey( s[i].unicode(), 0, 0, false, false ); 155 parent->emitKey( s[i].unicode(), 0, 0, false, false );
156 } 156 }
157 parent->emitKey( 0, ::Qt::Key_Space, 0, true, false ); 157 parent->emitKey( 0, ::Qt::Key_Space, 0, true, false );
158 parent->emitKey( 0, ::Qt::Key_Space, 0, false, false ); 158 parent->emitKey( 0, ::Qt::Key_Space, 0, false, false );
159 backspaces = 0; 159 backspaces = 0;
160#endif 160#endif
161} 161}
162 162
163 163
164 164
165 165
166/* Keyboard::paintEvent {{{1 */ 166/* Keyboard::paintEvent {{{1 */
167void Keyboard::paintEvent(QPaintEvent* e) 167void Keyboard::paintEvent(QPaintEvent* e)
168{ 168{
169 QPainter painter(this); 169 QPainter painter(this);
170 painter.setClipRect(e->rect()); 170 painter.setClipRect(e->rect());
171 drawKeyboard( painter ); 171 drawKeyboard( painter );
172 picks->dc->draw( &painter ); 172 picks->dc->draw( &painter );
173} 173}
174 174
175 175
176/* Keyboard::drawKeyboard {{{1 */ 176/* Keyboard::drawKeyboard {{{1 */
177 177
178void Keyboard::drawKeyboard(QPainter &p, int row, int col) 178void Keyboard::drawKeyboard(QPainter &p, int row, int col)
179{ 179{
180 180
181 181
182 if (row != -1 && col != -1) { //just redraw one key 182 if (row != -1 && col != -1) { //just redraw one key
183 183
184 int x = 0; 184 int x = 0;
185 for (int i = 0; i < col; i++) { 185 for (int i = 0; i < col; i++) {
186 186
187 x += keys->width(row, i) * defaultKeyWidth; 187 x += keys->width(row, i) * defaultKeyWidth;
188 } 188 }
189 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); 189 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0);
190 190
191 int keyWidth = keys->width(row, col); 191 int keyWidth = keys->width(row, col);
192 192
193 p.fillRect(x + 1, y + 1, 193 p.fillRect(x + 1, y + 1,
194 keyWidth * defaultKeyWidth - 1, keyHeight - 1, 194 keyWidth * defaultKeyWidth - 1, keyHeight - 1,
195 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor); 195 pressed || keys->pressed(row, col) ? keycolor_pressed : keycolor);
196 196
197 QImage *pix = keys->pix(row,col); 197 QImage *pix = keys->pix(row,col);
198 198
199 ushort c = keys->uni(row, col); 199 ushort c = keys->uni(row, col);
200 200
201 p.setPen(textcolor); 201 p.setPen(textcolor);
202 if (!pix) { 202 if (!pix) {
203 if ((shift || lock) && keys->shift(c)) 203 if ((shift || lock) && keys->shift(c))
204 204
205 if (circumflex && keys->circumflex(keys->shift(c))) 205 if (circumflex && keys->circumflex(keys->shift(c)))
206 c = keys->circumflex(keys->shift(c)); 206 c = keys->circumflex(keys->shift(c));
207 else if (diaeresis && keys->diaeresis(keys->shift(c))) 207 else if (diaeresis && keys->diaeresis(keys->shift(c)))
208 c = keys->diaeresis(keys->shift(c)); 208 c = keys->diaeresis(keys->shift(c));
209 else if (baccent && keys->baccent(keys->shift(c))) 209 else if (baccent && keys->baccent(keys->shift(c)))
210 c = keys->baccent(keys->shift(c)); 210 c = keys->baccent(keys->shift(c));
211 else if (accent && keys->accent(keys->shift(c))) 211 else if (accent && keys->accent(keys->shift(c)))
212 c = keys->accent(keys->shift(c)); 212 c = keys->accent(keys->shift(c));
213 else if (meta && keys->meta(keys->shift(c))) 213 else if (meta && keys->meta(keys->shift(c)))
214 c = keys->meta(keys->shift(c)); 214 c = keys->meta(keys->shift(c));
215 else 215 else
216 c = keys->shift(c); 216 c = keys->shift(c);
217 217
218 else if (meta && keys->meta(c)) 218 else if (meta && keys->meta(c))
219 c = keys->meta(c); 219 c = keys->meta(c);
220 else if (circumflex && keys->circumflex(c)) 220 else if (circumflex && keys->circumflex(c))
221 c = keys->circumflex(c); 221 c = keys->circumflex(c);
222 else if (baccent && keys->baccent(c)) 222 else if (baccent && keys->baccent(c))
223 c = keys->baccent(c); 223 c = keys->baccent(c);
224 else if (accent && keys->accent(c)) 224 else if (accent && keys->accent(c))
225 c = keys->accent(c); 225 c = keys->accent(c);
226 else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { 226 else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) {
227 227
228 // the diaeresis key itself has to be in the diaeresisMap, 228 // the diaeresis key itself has to be in the diaeresisMap,
229 // or just do this to make it display the diaeresis char. 229 // or just do this to make it display the diaeresis char.
230 230
231 if (c == 0x2c6) 231 if (c == 0x2c6)
232 c = 0xa8; 232 c = 0xa8;
233 else 233 else
234 c = keys->diaeresis(c); 234 c = keys->diaeresis(c);
235 } 235 }
236 236
237 p.drawText(x, y, 237 p.drawText(x, y,
238 defaultKeyWidth * keyWidth + 3, keyHeight, 238 defaultKeyWidth * keyWidth + 3, keyHeight,
239 AlignCenter, (QChar)c); 239 AlignCenter, (QChar)c);
240 } 240 }
241 else 241 else
242 // center the image in the middle of the key 242 // center the image in the middle of the key
243 p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1, 243 p.drawImage( x + (defaultKeyWidth * keyWidth - pix->width())/2 + 1,
244 y + (keyHeight - pix->height())/2 + 1, 244 y + (keyHeight - pix->height())/2 + 1,
245 *pix ); 245 *pix );
246 246
247 // this fixes the problem that the very right end of the board's vertical line 247 // this fixes the problem that the very right end of the board's vertical line
248 // gets painted over, because it's one pixel shorter than all other keys 248 // gets painted over, because it's one pixel shorter than all other keys
249 p.setPen(keycolor_lines); 249 p.setPen(keycolor_lines);
250 p.drawLine(width() - 1, 0, width() - 1, height()); 250 p.drawLine(width() - 1, 0, width() - 1, height());
251 251
252 } else { 252 } else {
253 253
254 254
255 p.fillRect(0, 0, width(), height(), keycolor); 255 p.fillRect(0, 0, width(), height(), keycolor);
256 256
257 for (row = 1; row <= keys->rows(); row++) { 257 for (row = 1; row <= keys->rows(); row++) {
258 258
259 int x = 0; 259 int x = 0;
260 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0); 260 int y = (row - 1) * keyHeight + (usePicks ? picks->height() : 0);
261 261
262 p.setPen(keycolor_lines); 262 p.setPen(keycolor_lines);
263 p.drawLine(x, y, x + width(), y); 263 p.drawLine(x, y, x + width(), y);
264 264
265 for (int col = 0; col < keys->numKeys(row); col++) { 265 for (int col = 0; col < keys->numKeys(row); col++) {
266 266
267 QImage *pix = keys->pix(row, col); 267 QImage *pix = keys->pix(row, col);
268 int keyWidth = keys->width(row, col); 268 int keyWidth = keys->width(row, col);
269 269
270 270
271 int keyWidthPix = defaultKeyWidth * keyWidth; 271 int keyWidthPix = defaultKeyWidth * keyWidth;
272 272
273 if (keys->pressed(row, col)) 273 if (keys->pressed(row, col))
274 p.fillRect(x+1, y+1, keyWidthPix - 1, 274 p.fillRect(x+1, y+1, keyWidthPix - 1,
275 keyHeight - 1, keycolor_pressed); 275 keyHeight - 1, keycolor_pressed);
276 276
277 ushort c = keys->uni(row, col); 277 ushort c = keys->uni(row, col);
278 278
279 p.setPen(textcolor); 279 p.setPen(textcolor);
280 if (!pix) { 280 if (!pix) {
281 if ((shift || lock) && keys->shift(c)) 281 if ((shift || lock) && keys->shift(c))
282 282
283 if (circumflex && keys->circumflex(keys->shift(c))) 283 if (circumflex && keys->circumflex(keys->shift(c)))
284 c = keys->circumflex(keys->shift(c)); 284 c = keys->circumflex(keys->shift(c));
285 else if (diaeresis && keys->diaeresis(keys->shift(c))) 285 else if (diaeresis && keys->diaeresis(keys->shift(c)))
286 c = keys->diaeresis(keys->shift(c)); 286 c = keys->diaeresis(keys->shift(c));
287 else if (baccent && keys->baccent(keys->shift(c))) 287 else if (baccent && keys->baccent(keys->shift(c)))
288 c = keys->baccent(keys->shift(c)); 288 c = keys->baccent(keys->shift(c));
289 else if (accent && keys->accent(keys->shift(c))) 289 else if (accent && keys->accent(keys->shift(c)))
290 c = keys->accent(keys->shift(c)); 290 c = keys->accent(keys->shift(c));
291 else if (meta && keys->meta(keys->shift(c))) 291 else if (meta && keys->meta(keys->shift(c)))
292 c = keys->meta(keys->shift(c)); 292 c = keys->meta(keys->shift(c));
293 else 293 else
294 c = keys->shift(c); 294 c = keys->shift(c);
295 295
296 else if (meta && keys->meta(c)) 296 else if (meta && keys->meta(c))
297 c = keys->meta(c); 297 c = keys->meta(c);
298 else if (circumflex && keys->circumflex(c)) 298 else if (circumflex && keys->circumflex(c))
299 c = keys->circumflex(c); 299 c = keys->circumflex(c);
300 else if (baccent && keys->baccent(c)) 300 else if (baccent && keys->baccent(c))
301 c = keys->baccent(c); 301 c = keys->baccent(c);
302 else if (accent && keys->accent(c)) 302 else if (accent && keys->accent(c))
303 c = keys->accent(c); 303 c = keys->accent(c);
304 else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) { 304 else if (diaeresis && (keys->diaeresis(c) || c == 0x2c6)) {
305 305
306 if (c == 0x2c6) 306 if (c == 0x2c6)
307 c = 0xa8; 307 c = 0xa8;
308 else 308 else
309 c = keys->diaeresis(c); 309 c = keys->diaeresis(c);
310 } 310 }
311 311
312 p.drawText(x, y, 312 p.drawText(x, y,
313 keyWidthPix + 3, keyHeight, 313 keyWidthPix + 3, keyHeight,
314 AlignCenter, (QChar)c); 314 AlignCenter, (QChar)c);
315 } 315 }
316 else { 316 else {
317 // center the image in the middle of the key 317 // center the image in the middle of the key
318 pix->setColor(1, textcolor.rgb()); 318 pix->setColor(1, textcolor.rgb());
319 p.drawImage( x + (keyWidthPix - pix->width())/2 + 1, 319 p.drawImage( x + (keyWidthPix - pix->width())/2 + 1,
320 y + (keyHeight - pix->height())/2 + 1, 320 y + (keyHeight - pix->height())/2 + 1,
321 QImage(*pix) ); 321 QImage(*pix) );
322 } 322 }
323 323
324 p.setPen(keycolor_lines); 324 p.setPen(keycolor_lines);
325 p.drawLine(x, y, x, y + keyHeight); 325 p.drawLine(x, y, x, y + keyHeight);
326 326
327 x += keyWidthPix; 327 x += keyWidthPix;
328 } 328 }
329 329
330 330
331 } 331 }
332 p.setPen(keycolor_lines); 332 p.setPen(keycolor_lines);
333 p.drawLine(0, height() - 1, width(), height() - 1); 333 p.drawLine(0, height() - 1, width(), height() - 1);
334 p.drawLine(width() - 1, 0, width() - 1, height()); 334 p.drawLine(width() - 1, 0, width() - 1, height());
335 } 335 }
336 336
337} 337}
diff --git a/inputmethods/pickboard/pickboard.cpp b/inputmethods/pickboard/pickboard.cpp
index 1611cb0..e5365ba 100644
--- a/inputmethods/pickboard/pickboard.cpp
+++ b/inputmethods/pickboard/pickboard.cpp
@@ -1,110 +1,115 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of the Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include "pickboard.h" 20#include "pickboard.h"
21#include "pickboardpicks.h" 21#include "pickboardpicks.h"
22#include "pickboardcfg.h" 22#include "pickboardcfg.h"
23 23
24#include <qpe/global.h> 24#include <qpe/global.h>
25 25#include <qpe/config.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qlist.h> 27#include <qlist.h>
28#include <qbitmap.h> 28#include <qbitmap.h>
29#include <qlayout.h> 29#include <qlayout.h>
30#include <qvbox.h> 30#include <qvbox.h>
31#include <qdialog.h> 31#include <qdialog.h>
32#include <qscrollview.h> 32#include <qscrollview.h>
33#include <qpopupmenu.h> 33#include <qpopupmenu.h>
34#include <qhbuttongroup.h> 34#include <qhbuttongroup.h>
35#include <qpushbutton.h> 35#include <qpushbutton.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#ifdef QWS 37#ifdef QWS
38#include <qwindowsystem_qws.h> 38#include <qwindowsystem_qws.h>
39#endif 39#endif
40 40
41/*! \class Pickboard 41/*! \class Pickboard
42 \brief The Pickboard class provides an input method 42 \brief The Pickboard class provides an input method
43 based on a virtual keyboard combined with word-completion. 43 based on a virtual keyboard combined with word-completion.
44 44
45 This version of Pickboard is Dual Licensed Software. However, for you to be 45 This version of Pickboard is Dual Licensed Software. However, for you to be
46 able to license the technology to others, you may require a T9(R) Text 46 able to license the technology to others, you may require a T9(R) Text
47 Input license from Tegic Communications Corporation. More information can 47 Input license from Tegic Communications Corporation. More information can
48 be found at http://www.t9.com/. 48 be found at http://www.t9.com/.
49 49
50 \legalese 50 \legalese
51 This version of Pickboard is Dual Licensed Software. However, for you to be 51 This version of Pickboard is Dual Licensed Software. However, for you to be
52 able to license the technology to others, you may require a T9(R) Text 52 able to license the technology to others, you may require a T9(R) Text
53 Input license from Tegic Communications Corporation. More information can 53 Input license from Tegic Communications Corporation. More information can
54 be found at http://www.t9.com/. 54 be found at http://www.t9.com/.
55*/ 55*/
56 56
57/* XPM */ 57/* XPM */
58static const char * const menu_xpm[]={ 58static const char * const menu_xpm[]={
59"9 9 2 1", 59"9 9 2 1",
60"a c #000000", 60"a c #000000",
61". c None", 61". c None",
62".........", 62".........",
63".........", 63".........",
64".........", 64".........",
65"....a....", 65"....a....",
66"...aaa...", 66"...aaa...",
67"..aaaaa..", 67"..aaaaa..",
68".aaaaaaa.", 68".aaaaaaa.",
69".........", 69".........",
70"........."}; 70"........."};
71 71
72class PickboardPrivate { 72class PickboardPrivate {
73public: 73public:
74 PickboardPrivate(Pickboard* parent) 74 PickboardPrivate(Pickboard* parent)
75 { 75 {
76 picks = new PickboardPicks(parent); 76 picks = new PickboardPicks(parent);
77 picks->initialise(); 77 picks->initialise();
78 menu = new QPushButton(parent); 78 menu = new QPushButton(parent);
79 menu->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding)); 79 menu->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Expanding));
80 menu->setPixmap(QPixmap((const char **)menu_xpm)); 80 menu->setPixmap(QPixmap((const char **)menu_xpm));
81 QObject::connect(menu,SIGNAL(clicked()),picks,SLOT(doMenu())); 81 QObject::connect(menu,SIGNAL(clicked()),picks,SLOT(doMenu()));
82 QObject::connect(picks,SIGNAL(key(ushort,ushort,ushort,bool,bool)), 82 QObject::connect(picks,SIGNAL(key(ushort,ushort,ushort,bool,bool)),
83 parent,SIGNAL(key(ushort,ushort,ushort,bool,bool))); 83 parent,SIGNAL(key(ushort,ushort,ushort,bool,bool)));
84 } 84 }
85 85
86 PickboardPicks* picks; 86 PickboardPicks* picks;
87 QPushButton* menu; 87 QPushButton* menu;
88}; 88};
89 89
90Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) : 90Pickboard::Pickboard(QWidget* parent, const char* name, WFlags f) :
91 QFrame(parent,name,f) 91 QFrame(parent,name,f)
92{ 92{
93 (new QHBoxLayout(this))->setAutoAdd(TRUE); 93 (new QHBoxLayout(this))->setAutoAdd(TRUE);
94 d = new PickboardPrivate(this); 94 d = new PickboardPrivate(this);
95// under Win32 we may not have smallsmooth font 95
96#ifndef Q_OS_WIN32 96 // get the default font
97 setFont( QFont( "smallsmooth", 9 ) ); 97 Config *config = new Config( "qpe" );
98#endif 98 config->setGroup( "Appearance" );
99 QString familyStr = config->readEntry( "FontFamily", "smallsmooth" );
100 int fontSize = config->readNumEntry( "FontSize", 10 );
101 delete config;
102
103 setFont( QFont( familyStr, fontSize ) );
99} 104}
100 105
101Pickboard::~Pickboard() 106Pickboard::~Pickboard()
102{ 107{
103 delete d; 108 delete d;
104} 109}
105 110
106void Pickboard::resetState() 111void Pickboard::resetState()
107{ 112{
108 d->picks->resetState(); 113 d->picks->resetState();
109} 114}
110 115
diff --git a/inputmethods/unikeyboard/unikeyboard.cpp b/inputmethods/unikeyboard/unikeyboard.cpp
index aa74c66..23d96ad 100644
--- a/inputmethods/unikeyboard/unikeyboard.cpp
+++ b/inputmethods/unikeyboard/unikeyboard.cpp
@@ -1,278 +1,286 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "unikeyboard.h" 21#include "unikeyboard.h"
22 22
23#include <qpe/fontmanager.h> 23#include <qpe/fontmanager.h>
24 24#include <qpe/config.h>
25#include <qpainter.h> 25#include <qpainter.h>
26#include <qfontmetrics.h> 26#include <qfontmetrics.h>
27#include <qcombobox.h> 27#include <qcombobox.h>
28#if defined(Q_WS_QWS) || defined(_WS_QWS_) 28#if defined(Q_WS_QWS) || defined(_WS_QWS_)
29#include <qwindowsystem_qws.h> 29#include <qwindowsystem_qws.h>
30#endif 30#endif
31 31
32static const int nw = 8; 32static const int nw = 8;
33 33
34typedef struct BlockMap { 34typedef struct BlockMap {
35 ushort start; 35 ushort start;
36 ushort stop; 36 ushort stop;
37 const char *name; 37 const char *name;
38}; 38};
39 39
40//# Start Code; Block Name 40//# Start Code; Block Name
41 41
42static const BlockMap blockMap[] = 42static const BlockMap blockMap[] =
43{ 43{
44{0x0000, 0x007F, "Basic Latin"}, 44{0x0000, 0x007F, "Basic Latin"},
45{0x0080, 0x00FF, "Latin-1 Supplement"}, 45{0x0080, 0x00FF, "Latin-1 Supplement"},
46{0x0100, 0x017F, "Latin Extended-A"}, 46{0x0100, 0x017F, "Latin Extended-A"},
47{0x0180, 0x024F, "Latin Extended-B"}, 47{0x0180, 0x024F, "Latin Extended-B"},
48{0x0250, 0x02AF, "IPA Extensions"}, 48{0x0250, 0x02AF, "IPA Extensions"},
49{0x02B0, 0x02FF, "Spacing Modifier Letters"}, 49{0x02B0, 0x02FF, "Spacing Modifier Letters"},
50{0x0300, 0x036F, "Combining Diacritical Marks"}, 50{0x0300, 0x036F, "Combining Diacritical Marks"},
51{0x0370, 0x03FF, "Greek"}, 51{0x0370, 0x03FF, "Greek"},
52{0x0400, 0x04FF, "Cyrillic"}, 52{0x0400, 0x04FF, "Cyrillic"},
53{0x0530, 0x058F, "Armenian"}, 53{0x0530, 0x058F, "Armenian"},
54{0x0590, 0x05FF, "Hebrew"}, 54{0x0590, 0x05FF, "Hebrew"},
55{0x0600, 0x06FF, "Arabic"}, 55{0x0600, 0x06FF, "Arabic"},
56{0x0700, 0x074F, "Syriac "}, 56{0x0700, 0x074F, "Syriac "},
57{0x0780, 0x07BF, "Thaana"}, 57{0x0780, 0x07BF, "Thaana"},
58{0x0900, 0x097F, "Devanagari"}, 58{0x0900, 0x097F, "Devanagari"},
59{0x0980, 0x09FF, "Bengali"}, 59{0x0980, 0x09FF, "Bengali"},
60{0x0A00, 0x0A7F, "Gurmukhi"}, 60{0x0A00, 0x0A7F, "Gurmukhi"},
61{0x0A80, 0x0AFF, "Gujarati"}, 61{0x0A80, 0x0AFF, "Gujarati"},
62{0x0B00, 0x0B7F, "Oriya"}, 62{0x0B00, 0x0B7F, "Oriya"},
63{0x0B80, 0x0BFF, "Tamil"}, 63{0x0B80, 0x0BFF, "Tamil"},
64{0x0C00, 0x0C7F, "Telugu"}, 64{0x0C00, 0x0C7F, "Telugu"},
65{0x0C80, 0x0CFF, "Kannada"}, 65{0x0C80, 0x0CFF, "Kannada"},
66{0x0D00, 0x0D7F, "Malayalam"}, 66{0x0D00, 0x0D7F, "Malayalam"},
67{0x0D80, 0x0DFF, "Sinhala"}, 67{0x0D80, 0x0DFF, "Sinhala"},
68{0x0E00, 0x0E7F, "Thai"}, 68{0x0E00, 0x0E7F, "Thai"},
69{0x0E80, 0x0EFF, "Lao"}, 69{0x0E80, 0x0EFF, "Lao"},
70{0x0F00, 0x0FFF, "Tibetan"}, 70{0x0F00, 0x0FFF, "Tibetan"},
71{0x1000, 0x109F, "Myanmar "}, 71{0x1000, 0x109F, "Myanmar "},
72{0x10A0, 0x10FF, "Georgian"}, 72{0x10A0, 0x10FF, "Georgian"},
73{0x1100, 0x11FF, "Hangul Jamo"}, 73{0x1100, 0x11FF, "Hangul Jamo"},
74{0x1200, 0x137F, "Ethiopic"}, 74{0x1200, 0x137F, "Ethiopic"},
75{0x13A0, 0x13FF, "Cherokee"}, 75{0x13A0, 0x13FF, "Cherokee"},
76{0x1400, 0x167F, "Unified Canadian Aboriginal Syllabics"}, 76{0x1400, 0x167F, "Unified Canadian Aboriginal Syllabics"},
77{0x1680, 0x169F, "Ogham"}, 77{0x1680, 0x169F, "Ogham"},
78{0x16A0, 0x16FF, "Runic"}, 78{0x16A0, 0x16FF, "Runic"},
79{0x1780, 0x17FF, "Khmer"}, 79{0x1780, 0x17FF, "Khmer"},
80{0x1800, 0x18AF, "Mongolian"}, 80{0x1800, 0x18AF, "Mongolian"},
81{0x1E00, 0x1EFF, "Latin Extended Additional"}, 81{0x1E00, 0x1EFF, "Latin Extended Additional"},
82{0x1F00, 0x1FFF, "Greek Extended"}, 82{0x1F00, 0x1FFF, "Greek Extended"},
83{0x2000, 0x206F, "General Punctuation"}, 83{0x2000, 0x206F, "General Punctuation"},
84{0x2070, 0x209F, "Superscripts and Subscripts"}, 84{0x2070, 0x209F, "Superscripts and Subscripts"},
85{0x20A0, 0x20CF, "Currency Symbols"}, 85{0x20A0, 0x20CF, "Currency Symbols"},
86{0x20D0, 0x20FF, "Combining Marks for Symbols"}, 86{0x20D0, 0x20FF, "Combining Marks for Symbols"},
87{0x2100, 0x214F, "Letterlike Symbols"}, 87{0x2100, 0x214F, "Letterlike Symbols"},
88{0x2150, 0x218F, "Number Forms"}, 88{0x2150, 0x218F, "Number Forms"},
89{0x2190, 0x21FF, "Arrows"}, 89{0x2190, 0x21FF, "Arrows"},
90{0x2200, 0x22FF, "Mathematical Operators"}, 90{0x2200, 0x22FF, "Mathematical Operators"},
91{0x2300, 0x23FF, "Miscellaneous Technical"}, 91{0x2300, 0x23FF, "Miscellaneous Technical"},
92{0x2400, 0x243F, "Control Pictures"}, 92{0x2400, 0x243F, "Control Pictures"},
93{0x2440, 0x245F, "Optical Character Recognition"}, 93{0x2440, 0x245F, "Optical Character Recognition"},
94{0x2460, 0x24FF, "Enclosed Alphanumerics"}, 94{0x2460, 0x24FF, "Enclosed Alphanumerics"},
95{0x2500, 0x257F, "Box Drawing"}, 95{0x2500, 0x257F, "Box Drawing"},
96{0x2580, 0x259F, "Block Elements"}, 96{0x2580, 0x259F, "Block Elements"},
97{0x25A0, 0x25FF, "Geometric Shapes"}, 97{0x25A0, 0x25FF, "Geometric Shapes"},
98{0x2600, 0x26FF, "Miscellaneous Symbols"}, 98{0x2600, 0x26FF, "Miscellaneous Symbols"},
99{0x2700, 0x27BF, "Dingbats"}, 99{0x2700, 0x27BF, "Dingbats"},
100{0x2800, 0x28FF, "Braille Patterns"}, 100{0x2800, 0x28FF, "Braille Patterns"},
101{0x2E80, 0x2EFF, "CJK Radicals Supplement"}, 101{0x2E80, 0x2EFF, "CJK Radicals Supplement"},
102{0x2F00, 0x2FDF, "Kangxi Radicals"}, 102{0x2F00, 0x2FDF, "Kangxi Radicals"},
103{0x2FF0, 0x2FFF, "Ideographic Description Characters"}, 103{0x2FF0, 0x2FFF, "Ideographic Description Characters"},
104{0x3000, 0x303F, "CJK Symbols and Punctuation"}, 104{0x3000, 0x303F, "CJK Symbols and Punctuation"},
105{0x3040, 0x309F, "Hiragana"}, 105{0x3040, 0x309F, "Hiragana"},
106{0x30A0, 0x30FF, "Katakana"}, 106{0x30A0, 0x30FF, "Katakana"},
107{0x3100, 0x312F, "Bopomofo"}, 107{0x3100, 0x312F, "Bopomofo"},
108{0x3130, 0x318F, "Hangul Compatibility Jamo"}, 108{0x3130, 0x318F, "Hangul Compatibility Jamo"},
109{0x3190, 0x319F, "Kanbun"}, 109{0x3190, 0x319F, "Kanbun"},
110{0x31A0, 0x31BF, "Bopomofo Extended"}, 110{0x31A0, 0x31BF, "Bopomofo Extended"},
111{0x3200, 0x32FF, "Enclosed CJK Letters and Months"}, 111{0x3200, 0x32FF, "Enclosed CJK Letters and Months"},
112{0x3300, 0x33FF, "CJK Compatibility"}, 112{0x3300, 0x33FF, "CJK Compatibility"},
113{0x3400, 0x4DB5, "CJK Unified Ideographs Extension A"}, 113{0x3400, 0x4DB5, "CJK Unified Ideographs Extension A"},
114{0x4E00, 0x9FFF, "CJK Unified Ideographs"}, 114{0x4E00, 0x9FFF, "CJK Unified Ideographs"},
115{0xA000, 0xA48F, "Yi Syllables"}, 115{0xA000, 0xA48F, "Yi Syllables"},
116{0xA490, 0xA4CF, "Yi Radicals"}, 116{0xA490, 0xA4CF, "Yi Radicals"},
117{0xAC00, 0xD7A3, "Hangul Syllables"}, 117{0xAC00, 0xD7A3, "Hangul Syllables"},
118{0xD800, 0xDB7F, "High Surrogates"}, 118{0xD800, 0xDB7F, "High Surrogates"},
119{0xDB80, 0xDBFF, "High Private Use Surrogates"}, 119{0xDB80, 0xDBFF, "High Private Use Surrogates"},
120{0xDC00, 0xDFFF, "Low Surrogates"}, 120{0xDC00, 0xDFFF, "Low Surrogates"},
121{0xE000, 0xF8FF, "Private Use"}, 121{0xE000, 0xF8FF, "Private Use"},
122{0xF900, 0xFAFF, "CJK Compatibility Ideographs"}, 122{0xF900, 0xFAFF, "CJK Compatibility Ideographs"},
123{0xFB00, 0xFB4F, "Alphabetic Presentation Forms"}, 123{0xFB00, 0xFB4F, "Alphabetic Presentation Forms"},
124{0xFB50, 0xFDFF, "Arabic Presentation Forms-A"}, 124{0xFB50, 0xFDFF, "Arabic Presentation Forms-A"},
125{0xFE20, 0xFE2F, "Combining Half Marks"}, 125{0xFE20, 0xFE2F, "Combining Half Marks"},
126{0xFE30, 0xFE4F, "CJK Compatibility Forms"}, 126{0xFE30, 0xFE4F, "CJK Compatibility Forms"},
127{0xFE50, 0xFE6F, "Small Form Variants"}, 127{0xFE50, 0xFE6F, "Small Form Variants"},
128{0xFE70, 0xFEFE, "Arabic Presentation Forms-B"}, 128{0xFE70, 0xFEFE, "Arabic Presentation Forms-B"},
129{0xFF00, 0xFEFF, "Halfwidth and Fullwidth Forms"}, 129{0xFF00, 0xFEFF, "Halfwidth and Fullwidth Forms"},
130{0xFFF0, 0xFFEF, "Specials"}, 130{0xFFF0, 0xFFEF, "Specials"},
131 {0xFFFF, 0xFFFF, 0} }; 131 {0xFFFF, 0xFFFF, 0} };
132 132
133 133
134UniScrollview::UniScrollview(QWidget* parent, const char* name, int f) : 134UniScrollview::UniScrollview(QWidget* parent, const char* name, int f) :
135 QScrollView(parent, name, f) 135 QScrollView(parent, name, f)
136{ 136{
137 // smallFont.setRawName( "-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1" ); //###### 137 // smallFont.setRawName( "-adobe-courier-medium-r-normal--10-100-75-75-m-60-iso8859-1" ); //######
138 smallFont = QFont( "Helvetica", 8 ); 138
139 // get the default font
140 Config *config = new Config( "qpe" );
141 config->setGroup( "Appearance" );
142 QString familyStr = config->readEntry( "FontFamily", "Helvetica" );
143 int fontSize = config->readNumEntry( "FontSize", 8 ) - 2;
144 delete config;
145
146 smallFont = QFont( familyStr, fontSize );
139 QFontMetrics sfm( smallFont ); 147 QFontMetrics sfm( smallFont );
140 xoff = sfm.width( "AAA" ); 148 xoff = sfm.width( "AAA" );
141 setFont( FontManager::unicodeFont( FontManager::Fixed ) ); 149 setFont( FontManager::unicodeFont( FontManager::Fixed ) );
142 QFontMetrics fm( font() ); 150 QFontMetrics fm( font() );
143 cellsize = fm.lineSpacing() + 2; 151 cellsize = fm.lineSpacing() + 2;
144 resizeContents( cellsize*nw, cellsize*65536/nw ); 152 resizeContents( cellsize*nw, cellsize*65536/nw );
145 verticalScrollBar()->setLineStep(cellsize); 153 verticalScrollBar()->setLineStep(cellsize);
146 154
147 viewport()->setBackgroundMode( QWidget::PaletteBase ); 155 viewport()->setBackgroundMode( QWidget::PaletteBase );
148} 156}
149 157
150 158
151 159
152void UniScrollview::contentsMousePressEvent(QMouseEvent* e) 160void UniScrollview::contentsMousePressEvent(QMouseEvent* e)
153{ 161{
154 if ( e->x() < xoff || e->x() > xoff + nw*cellsize ) 162 if ( e->x() < xoff || e->x() > xoff + nw*cellsize )
155 return; 163 return;
156 int row = e->y()/cellsize; 164 int row = e->y()/cellsize;
157 int col = (e->x()-xoff)/cellsize; 165 int col = (e->x()-xoff)/cellsize;
158 int u = row*nw+col; 166 int u = row*nw+col;
159#if defined(Q_WS_QWS) || defined(_WS_QWS_) 167#if defined(Q_WS_QWS) || defined(_WS_QWS_)
160 emit key( u, 0, 0, true, false ); 168 emit key( u, 0, 0, true, false );
161 emit key( u, 0, 0, false, false ); 169 emit key( u, 0, 0, false, false );
162#endif 170#endif
163} 171}
164 172
165 173
166void UniScrollview::contentsMouseReleaseEvent(QMouseEvent*) 174void UniScrollview::contentsMouseReleaseEvent(QMouseEvent*)
167{ 175{
168} 176}
169 177
170void UniScrollview::scrollTo( int unicode ) 178void UniScrollview::scrollTo( int unicode )
171{ 179{
172 int row = unicode / nw; 180 int row = unicode / nw;
173 setContentsPos( 0, row*cellsize ); 181 setContentsPos( 0, row*cellsize );
174} 182}
175 183
176 184
177void UniScrollview::drawContents( QPainter *p, int /*cx*/, int cy, int /*cw*/, int ch ) 185void UniScrollview::drawContents( QPainter *p, int /*cx*/, int cy, int /*cw*/, int ch )
178{ 186{
179 QFontMetrics fm = fontMetrics(); 187 QFontMetrics fm = fontMetrics();
180 int row = cy / cellsize; 188 int row = cy / cellsize;
181 int y = row*cellsize; 189 int y = row*cellsize;
182 while ( y < cy+ch ) { 190 while ( y < cy+ch ) {
183 p->drawLine( xoff, y, xoff+nw*cellsize, y ); 191 p->drawLine( xoff, y, xoff+nw*cellsize, y );
184 if ( row*nw%16 == 0 ) { 192 if ( row*nw%16 == 0 ) {
185 p->setFont( smallFont ); 193 p->setFont( smallFont );
186 QString s; 194 QString s;
187 s.sprintf( "%03X", row*nw/16 ); 195 s.sprintf( "%03X", row*nw/16 );
188 p->drawText( 0, y, xoff, cellsize, AlignLeft, s ); 196 p->drawText( 0, y, xoff, cellsize, AlignLeft, s );
189 p->setFont( font() ); 197 p->setFont( font() );
190 } 198 }
191 for ( int i = 0; i < nw; i++ ) { 199 for ( int i = 0; i < nw; i++ ) {
192 p->drawLine( xoff+i*cellsize, y, xoff+i*cellsize, y+cellsize ); 200 p->drawLine( xoff+i*cellsize, y, xoff+i*cellsize, y+cellsize );
193 QChar u = row*nw + i; 201 QChar u = row*nw + i;
194 if ( fm.inFont( u ) ) 202 if ( fm.inFont( u ) )
195 p->drawText( xoff+i*cellsize, y, cellsize, cellsize, AlignCenter, 203 p->drawText( xoff+i*cellsize, y, cellsize, cellsize, AlignCenter,
196 u ); 204 u );
197 } 205 }
198 p->drawLine( xoff+nw*cellsize, y, xoff+nw*cellsize, y+cellsize ); 206 p->drawLine( xoff+nw*cellsize, y, xoff+nw*cellsize, y+cellsize );
199 row++; 207 row++;
200 y += cellsize; 208 y += cellsize;
201 } 209 }
202} 210}
203 211
204 212
205 213
206 214
207UniKeyboard::UniKeyboard(QWidget* parent, const char* name, int f ) 215UniKeyboard::UniKeyboard(QWidget* parent, const char* name, int f )
208 : QFrame( parent, name, f ) 216 : QFrame( parent, name, f )
209{ 217{
210 setFrameStyle( NoFrame ); 218 setFrameStyle( NoFrame );
211 sv = new UniScrollview( this ); 219 sv = new UniScrollview( this );
212 cb = new QComboBox( FALSE, this ); 220 cb = new QComboBox( FALSE, this );
213 currentBlock = 0; 221 currentBlock = 0;
214 QFontMetrics fm = sv->fontMetrics(); 222 QFontMetrics fm = sv->fontMetrics();
215 cbmap = new int[sizeof(blockMap)/sizeof(blockMap[0])]; 223 cbmap = new int[sizeof(blockMap)/sizeof(blockMap[0])];
216 for ( int i = 0; blockMap[i].name; i++ ) { 224 for ( int i = 0; blockMap[i].name; i++ ) {
217 bool any=FALSE; 225 bool any=FALSE;
218 for ( int c=blockMap[i].start; !any && c<=blockMap[i].stop; c++ ) 226 for ( int c=blockMap[i].start; !any && c<=blockMap[i].stop; c++ )
219 any = fm.inFont(QChar(c)); 227 any = fm.inFont(QChar(c));
220 if ( any ) { 228 if ( any ) {
221 cbmap[cb->count()]=i; 229 cbmap[cb->count()]=i;
222 cb->insertItem( blockMap[i].name ); 230 cb->insertItem( blockMap[i].name );
223 } 231 }
224 } 232 }
225 connect( cb, SIGNAL( activated(int)), this, SLOT( handleCombo(int)) ); 233 connect( cb, SIGNAL( activated(int)), this, SLOT( handleCombo(int)) );
226 connect( sv, SIGNAL( contentsMoving(int,int)), this, SLOT( svMove(int,int)) ); 234 connect( sv, SIGNAL( contentsMoving(int,int)), this, SLOT( svMove(int,int)) );
227 connect( sv, SIGNAL( key(ushort,ushort,ushort,bool,bool)), 235 connect( sv, SIGNAL( key(ushort,ushort,ushort,bool,bool)),
228 this, SIGNAL( key(ushort,ushort,ushort,bool,bool)) ); 236 this, SIGNAL( key(ushort,ushort,ushort,bool,bool)) );
229} 237}
230 238
231UniKeyboard::~UniKeyboard() 239UniKeyboard::~UniKeyboard()
232{ 240{
233 delete [] cbmap; 241 delete [] cbmap;
234} 242}
235 243
236void UniKeyboard::resizeEvent(QResizeEvent *) 244void UniKeyboard::resizeEvent(QResizeEvent *)
237{ 245{
238 int d = frameWidth(); 246 int d = frameWidth();
239 cb->setGeometry( d, d, width()-2*d, cb->sizeHint().height() ); 247 cb->setGeometry( d, d, width()-2*d, cb->sizeHint().height() );
240 sv->setGeometry( d, cb->height()+d, width()-2*d, height()-cb->height()-2*d ); 248 sv->setGeometry( d, cb->height()+d, width()-2*d, height()-cb->height()-2*d );
241} 249}
242 250
243void UniKeyboard::svMove( int /*x*/, int y ) 251void UniKeyboard::svMove( int /*x*/, int y )
244{ 252{
245 int cs = sv->cellSize(); 253 int cs = sv->cellSize();
246 int u = ((y+cs-1)/cs) * nw; 254 int u = ((y+cs-1)/cs) * nw;
247 int i = currentBlock; 255 int i = currentBlock;
248 while ( i > 0 && blockMap[i].start > u ) { 256 while ( i > 0 && blockMap[i].start > u ) {
249 i--; 257 i--;
250 } 258 }
251 while ( blockMap[i+1].name && blockMap[i+1].start < u ) { 259 while ( blockMap[i+1].name && blockMap[i+1].start < u ) {
252 i++; 260 i++;
253 } 261 }
254 if ( i != currentBlock ) { 262 if ( i != currentBlock ) {
255 currentBlock = i; 263 currentBlock = i;
256 for (int ind=0; ind<cb->count(); ind++) { 264 for (int ind=0; ind<cb->count(); ind++) {
257 if ( cbmap[ind] == i ) { 265 if ( cbmap[ind] == i ) {
258 cb->setCurrentItem( ind ); 266 cb->setCurrentItem( ind );
259 break; 267 break;
260 } 268 }
261 } 269 }
262 } 270 }
263} 271}
264 272
265void UniKeyboard::handleCombo( int i ) 273void UniKeyboard::handleCombo( int i )
266{ 274{
267 currentBlock = cbmap[i]; 275 currentBlock = cbmap[i];
268 sv->scrollTo( blockMap[currentBlock].start ); 276 sv->scrollTo( blockMap[currentBlock].start );
269} 277}
270 278
271void UniKeyboard::resetState() 279void UniKeyboard::resetState()
272{ 280{
273} 281}
274 282
275QSize UniKeyboard::sizeHint() const 283QSize UniKeyboard::sizeHint() const
276{ 284{
277 return QSize( 240, 2+sv->cellSize()*4+cb->sizeHint().height() ); 285 return QSize( 240, 2+sv->cellSize()*4+cb->sizeHint().height() );
278} 286}