summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-01-05 15:22:09 (UTC)
committer mickeyl <mickeyl>2005-01-05 15:22:09 (UTC)
commit34ae22499b91f483f1cf505e515047ea11e8eaf0 (patch) (unidiff)
tree555ad0f77c87d445f1ca688f96a78fe903211190
parent80823d4cbd234a54a15d6b439bd37a8ea42e7904 (diff)
downloadopie-34ae22499b91f483f1cf505e515047ea11e8eaf0.zip
opie-34ae22499b91f483f1cf505e515047ea11e8eaf0.tar.gz
opie-34ae22499b91f483f1cf505e515047ea11e8eaf0.tar.bz2
remove hard coded fonts for dvorak, keyboard, multikey, pickboard, and unikeyboard
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog3
-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
6 files changed, 45 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index ff579d5..8847714 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,184 +1,185 @@
1 2005-??-??Opie 1.2.0 1 2005-??-??Opie 1.2.0
2 2
3 New Features 3 New Features
4 ------------ 4 ------------
5 5
6 Fixed Bugs 6 Fixed Bugs
7 ---------- 7 ----------
8 * #1501 - Fixing bug in todo sql backend (eilers) 8 * #1501 - Fixed bug in todo sql backend (eilers)
9 * n.a - Removed hard coded font sizes in a couple of inputmethods (mickeyl)
9 10
10 Internal 11 Internal
11 -------- 12 --------
12 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl) 13 * Added the Qtopia 1.7 SDK macros for quick-apps to easa compilation of 3rd party apps against our headers (mickeyl)
13 14
14 2004-11-26Opie 1.1.8 15 2004-11-26Opie 1.1.8
15 16
16 New Features 17 New Features
17 ------------ 18 ------------
18 * PackageManager supports installation of local ipkg files (drw) 19 * PackageManager supports installation of local ipkg files (drw)
19 * PackageManager supports linking of applications to root (drw) 20 * PackageManager supports linking of applications to root (drw)
20 * PackageManager supports src/gz feeds (drw,wimpie) 21 * PackageManager supports src/gz feeds (drw,wimpie)
21 * Added a syslog information tab to sysinfo (mickeyl) 22 * Added a syslog information tab to sysinfo (mickeyl)
22 * Added new, more consistent, PIM icons + a GIMP teplate (ar) 23 * Added new, more consistent, PIM icons + a GIMP teplate (ar)
23 24
24 Fixed Bugs 25 Fixed Bugs
25 ---------- 26 ----------
26 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw) 27 * #1017 - Tetrix doesn't display correctly for high resolution screens (drw)
27 * #1269 - VCards were imported into personal area if it was activated (eilers) 28 * #1269 - VCards were imported into personal area if it was activated (eilers)
28 * #1464 - Packagemanager dont set active filter after install a package (drw) 29 * #1464 - Packagemanager dont set active filter after install a package (drw)
29 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers) 30 * #1479 - Improved VCard-Parser to import VCards created by Evolution 2 and Apple Addressbook (eilers)
30 * #1493 - Fixed one column layout bug of the launcher (hrw) 31 * #1493 - Fixed one column layout bug of the launcher (hrw)
31 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw) 32 * n.a. - PackageManager - (Minor UI tweak) in filter dialog, when option is enabled, set focus to widget that corresponds to that option (drw)
32 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw) 33 * n.a. - PackageManager - (Minor UI tweak) fix double entry in source feed configuration when adding a new feed (drw)
33 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl) 34 * n.a. - Battery Applet - fix sizing of battery info popup (drw,mickeyl)
34 35
35 Internal 36 Internal
36 -------- 37 --------
37 * Moved libopie1 to unsupported (mickeyl) 38 * Moved libopie1 to unsupported (mickeyl)
38 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers) 39 * Implemented generic queryByExample() with incremental searching. A lot of internal changes of the Pim2-library (eilers)
39 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers) 40 * Added fast and full featured and incremental sorted() for SQL addressbook backend (eilers)
40 41
41 2004-11-14Opie 1.1.7 42 2004-11-14Opie 1.1.7
42 43
43 New Features 44 New Features
44 ------------ 45 ------------
45 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers) 46 * libOpieDB now uses SQLite V3 instead V2. Remember to upgrade your database files! (eilers)
46 * Backup now uses the busy indicator when backing up and restore (ar) 47 * Backup now uses the busy indicator when backing up and restore (ar)
47 * OpiePlayer2 gained adding of Directories to the playlist (zecke) 48 * OpiePlayer2 gained adding of Directories to the playlist (zecke)
48 * OpiePlayer2 better error handling (zecke) 49 * OpiePlayer2 better error handling (zecke)
49 * OpiePlayer2 progress indication while streaming (zecke) 50 * OpiePlayer2 progress indication while streaming (zecke)
50 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke) 51 * OpiePlayer2 ported to use libxine 1.0.0-rc6a (brad,zecke)
51 * Ported brightnessapplet from Qtopia 1.7 (mickeyl) 52 * Ported brightnessapplet from Qtopia 1.7 (mickeyl)
52 * Opie-Eye got a Digital Camera File Backend (alwin,zecke) 53 * Opie-Eye got a Digital Camera File Backend (alwin,zecke)
53 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke) 54 * Support for Tuxpad1 of Tradesquare.NL (mickeyl,zecke)
54 * Opie-Console use Custom Font and Size in a Profile (harlekin) 55 * Opie-Console use Custom Font and Size in a Profile (harlekin)
55 * Opie-Console transparently log the Output and Input to a file (harlekin) 56 * Opie-Console transparently log the Output and Input to a file (harlekin)
56 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem) 57 * Added new O-menu icon to lock the PDA immediately: opie-lockapplet (clem)
57 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem) 58 * Opie-Security now hides the plugin-based authentication tabs if no auth. plugin package is installed (clem)
58 * Opie-Security gained a 'test authentication' button (clem) 59 * Opie-Security gained a 'test authentication' button (clem)
59 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults 60 * Opie-Eye got a more unique layout (menubar), a slideshow, user can setup some defaults
60 * Opie-Mail improve the handling of POP mail boxes (alwin) 61 * Opie-Mail improve the handling of POP mail boxes (alwin)
61 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin) 62 * Both Opie-Eye and Opie-Mail were greatly improved due the hard work of Rajko Albrecht(alwin)
62 * Opie IRC - backports of the 'NeIRC fork' (zecke) 63 * Opie IRC - backports of the 'NeIRC fork' (zecke)
63 64
64 Fixed Bugs 65 Fixed Bugs
65 ---------- 66 ----------
66 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke) 67 * #501 - Pickboard is able to show 'Umlaute' (TT,zecke)
67 * #608 - Make Opie usable for left handed users (zecke) 68 * #608 - Make Opie usable for left handed users (zecke)
68 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke) 69 * #957 - Import of VCards/VTodos/VEvents with BASE64 encoding (ljp,zecke)
69 * #1245 - Opie-Go 'paused' (zecke) 70 * #1245 - Opie-Go 'paused' (zecke)
70 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke) 71 * #1358 - DocTab didn't show any MimeTypes (was fixed earlier) (zecke)
71 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke) 72 * #1380 - QDateBookAccess::remove() doesn't remove entries (eilers, zecke)
72 * #1395 - Build VNC Backend with gcc3.4 73 * #1395 - Build VNC Backend with gcc3.4
73 * #1440 - The icon of opie-mobilemsg is missing (CoreDump) 74 * #1440 - The icon of opie-mobilemsg is missing (CoreDump)
74 * #1426 - Add missing opie-bartender Icon (CoreDump) 75 * #1426 - Add missing opie-bartender Icon (CoreDump)
75 * #1445 - Opie-Sheet Has No Icon (CoreDump) 76 * #1445 - Opie-Sheet Has No Icon (CoreDump)
76 * #1448 - Brightness Applet added (mickeyl) 77 * #1448 - Brightness Applet added (mickeyl)
77 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke) 78 * #1450 - ZSame didn't clear the bonus item after winning a game (zecke)
78 * #1482 - Fix OFileSelector to be able to sort by size (zecke) 79 * #1482 - Fix OFileSelector to be able to sort by size (zecke)
79 * n.a. - Opie-mail: fixed some crasher, some layout-problems 80 * n.a. - Opie-mail: fixed some crasher, some layout-problems
80 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke) 81 * n.a. - Converted applications to not hardcode /opt/QtPalmtop but to use QPEApplication::qpeDir (zecke)
81 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke) 82 * n.a. - Converted usage of qpeDir() not to include a '/' as first charachter of the string (zecke)
82 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem) 83 * n.a. - Build system: Enable distcc and ccache when crosscompiling too, and use them everywhere we can (clem)
83 * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem) 84 * n.a. - Build system: Fix deps in several config.in (and fix scripts/deps.pl too) to stop breaking builds, especially with make -j highNumber (clem)
84 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl) 85 * n.a. - Removed hardcoded icon size in a couple of applets (mickeyl)
85 86
86 Internal 87 Internal
87 -------- 88 --------
88 * Opie-Qashmoney has been moved to unsupported (mickeyl) 89 * Opie-Qashmoney has been moved to unsupported (mickeyl)
89 * Opie-Ubrowser has been moved to unsupported (mickeyl) 90 * Opie-Ubrowser has been moved to unsupported (mickeyl)
90 91
91 2004-09-17Opie 1.1.6 92 2004-09-17Opie 1.1.6
92 93
93 New Features 94 New Features
94 ------------ 95 ------------
95 * Fifteen gained configurable number of items (zecke) 96 * Fifteen gained configurable number of items (zecke)
96 * Fifteen can have custom background images (zecke) 97 * Fifteen can have custom background images (zecke)
97 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl) 98 * Added daemonizing capabilities to QWS Server [via Qt/Embedded] (mickeyl)
98 * Integrated the new security framework into libopie2 (zecke,clem) 99 * Integrated the new security framework into libopie2 (zecke,clem)
99 * Converted the launcher to use the new security framework (zecke) 100 * Converted the launcher to use the new security framework (zecke)
100 * Backup can now handle custom locations for backup and restore (ar) 101 * Backup can now handle custom locations for backup and restore (ar)
101 * Implemented right-on-hold feedback (wimpie,zecke) 102 * Implemented right-on-hold feedback (wimpie,zecke)
102 * Lots of new features in opie-reader (tim,pohly) 103 * Lots of new features in opie-reader (tim,pohly)
103 * Build system cleanups (schurig) 104 * Build system cleanups (schurig)
104 105
105 Fixed Bugs 106 Fixed Bugs
106 -------- 107 --------
107 * #1005 - Fixed backup to CompactFlash (ar) 108 * #1005 - Fixed backup to CompactFlash (ar)
108 * #1167 - Fixed Opie write crashing on more text than one page (ar) 109 * #1167 - Fixed Opie write crashing on more text than one page (ar)
109 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl) 110 * #1225 - Fixed repeated light flashing on Zaurus with keyz (mickeyl)
110 * #1359 - Fixed bookmarks in Gutenbrowser (ljp) 111 * #1359 - Fixed bookmarks in Gutenbrowser (ljp)
111 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers) 112 * #1361 - Fixed auto upercase in Opie-Addressbook (eilers)
112 * #1370 - Pimconverter now reacts on cancel key (eilers) 113 * #1370 - Pimconverter now reacts on cancel key (eilers)
113 * #1376 - Bring back the capslock/numlock display (zecke) 114 * #1376 - Bring back the capslock/numlock display (zecke)
114 * #1383 - Language settings now warns about losing open apps (Markus Litz) 115 * #1383 - Language settings now warns about losing open apps (Markus Litz)
115 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl) 116 * #1393 - Fixed line wrap issues in opie-console for the default profile (mickeyl)
116 * #1394 - Fixed oversized headline in opie-login (coredump) 117 * #1394 - Fixed oversized headline in opie-login (coredump)
117 * #1396 - Opie-console captures the escape key and vim is working (zecke) 118 * #1396 - Opie-console captures the escape key and vim is working (zecke)
118 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl) 119 * #1401 - Scrollbar is now only visible if necessary in DocTab (mickeyl)
119 120
120 2004-07-06Opie 1.1.4 121 2004-07-06Opie 1.1.4
121 122
122 New Features 123 New Features
123 ------------ 124 ------------
124 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle) 125 * Added four themes courtesy Robert Griebl (http://www.softforge.de/zstyle)
125 * Added Conversion tool for pim-data (eilers) 126 * Added Conversion tool for pim-data (eilers)
126 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers) 127 * Introduced new OPimAccessFactory and OBackendFactory which simplyfies database access (eilers)
127 * Modified the PIM API for providing generic use of OPimRecords (eilers) 128 * Modified the PIM API for providing generic use of OPimRecords (eilers)
128 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke) 129 * Clicking on the application symbol now iterates over the application's top level widgets if already raised (zecke)
129 130
130 Fixed Bugs 131 Fixed Bugs
131 -------- 132 --------
132 * #1068 - Country Drop Down Box Off Screen 133 * #1068 - Country Drop Down Box Off Screen
133 * #1291 - Opie tinykate does not open .desktop files (ar) 134 * #1291 - Opie tinykate does not open .desktop files (ar)
134 * #1291 - Opie sheet not saving correctly (ar) 135 * #1291 - Opie sheet not saving correctly (ar)
135 * #1294 - Opie does not know about British Summer Time 136 * #1294 - Opie does not know about British Summer Time
136 * #1314 - Drawpad initialization (mickeyl) 137 * #1314 - Drawpad initialization (mickeyl)
137 * #1317 - Packagemanager crashes on hold-down or install (chicken) 138 * #1317 - Packagemanager crashes on hold-down or install (chicken)
138 * #1321 - Batteryapplet graphic glitch (harlekin) 139 * #1321 - Batteryapplet graphic glitch (harlekin)
139 * #1324 - ZSafe not starting up (mickeyl) 140 * #1324 - ZSafe not starting up (mickeyl)
140 * #1328 - Personal Home Address fields is trimmed to 1char (eilers) 141 * #1328 - Personal Home Address fields is trimmed to 1char (eilers)
141 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken) 142 * #1327 - Opie-mail ipk does not depend on libopiedb2 (chicken)
142 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl) 143 * #1345 - Networksettingsplugin wlan plugin dependency on libpcap0 (mickeyl)
143 * #1348 - Datebook dependency on libopiedb2 (chicken) 144 * #1348 - Datebook dependency on libopiedb2 (chicken)
144 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers) 145 * #1328 - Switched SQLDatabase and VCards char encoding from latin1 to unicode (eilers)
145 146
146 2004-04-25Opie 1.1.3 147 2004-04-25Opie 1.1.3
147 148
148 * Introduced first implementation of SQL-Support using SQLite (eilers) 149 * Introduced first implementation of SQL-Support using SQLite (eilers)
149 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp) 150 * Added a new Gutenberg Project reader app - opie-gutenbrowser (ljp)
150 * Added a real system graffiti character set (brad) 151 * Added a real system graffiti character set (brad)
151 * Added Generic Keyconfig Widget (zecke) 152 * Added Generic Keyconfig Widget (zecke)
152 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke) 153 * Improved Screenshotapplet and Drawpad integration. You can now open a screenshot in drawpad and take notes (zecke)
153 * Added new Bible reader app - opie-dagger (drw) 154 * Added new Bible reader app - opie-dagger (drw)
154 * Added a new Image Viewer. Work is ongoing (zecke,alwin) 155 * Added a new Image Viewer. Work is ongoing (zecke,alwin)
155 * Added namespace usage in libopie2 and everywhere (zecke,alwin) 156 * Added namespace usage in libopie2 and everywhere (zecke,alwin)
156 * Enabled the possibility to pass command line arguments to applications (mickeyl) 157 * Enabled the possibility to pass command line arguments to applications (mickeyl)
157 * Added an about applet showing some credits and information about Opie (mickeyl) 158 * Added an about applet showing some credits and information about Opie (mickeyl)
158 * Added benchmarking functionality to sysinfo (mickeyl) 159 * Added benchmarking functionality to sysinfo (mickeyl)
159 * Added applet and configuration application for switching hardware keyboard layouts (alwin) 160 * Added applet and configuration application for switching hardware keyboard layouts (alwin)
160 * Ported applications from libopie1 to libopie2* (drw,ar,alwin) 161 * Ported applications from libopie1 to libopie2* (drw,ar,alwin)
161 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe) 162 * Imported fullscreen and font improvements from the Qkonsole fork to embeddedkonsole (waspe)
162 * Clean-up of package information in control files (drw) 163 * Clean-up of package information in control files (drw)
163 * Repaired mediummount which was broken since integrating the quicklauncher (alwin) 164 * Repaired mediummount which was broken since integrating the quicklauncher (alwin)
164 * Improved big-screen support (zecke,ar) 165 * Improved big-screen support (zecke,ar)
165 * Improved multikeyboard support, added keyboard layout switching applet (mouse) 166 * Improved multikeyboard support, added keyboard layout switching applet (mouse)
166 * Added a new mail client based on libetpan (harlekin,alwin,jgf) 167 * Added a new mail client based on libetpan (harlekin,alwin,jgf)
167 * Added new package manager - opie-packagemanager (drw) 168 * Added new package manager - opie-packagemanager (drw)
168 * Improved light-n-power for C7x0 (mickeyl) 169 * Improved light-n-power for C7x0 (mickeyl)
169 * Added automatic rotation support for C7x0 (treke) 170 * Added automatic rotation support for C7x0 (treke)
170 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl) 171 * Split libopie1 up into a set of smaller - functionally grouped - libraries (mickeyl)
171 * Added scanning the wireless network neighbourhood to networksettings (mickeyl) 172 * Added scanning the wireless network neighbourhood to networksettings (mickeyl)
172 173
173 2003-11-29Opie 1.0.3 174 2003-11-29Opie 1.0.3
174 175
175 * Released as Version 1.0.3 176 * Released as Version 1.0.3
176 * Improved i18n (various contributors) 177 * Improved i18n (various contributors)
177 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin) 178 * Reduced application startup time by integrating the TT quicklauncher (zecke,harlekin)
178 * Made the Documents Tab optional (mickeyl) 179 * Made the Documents Tab optional (mickeyl)
179 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken) 180 * Integrated basic support for HP iPAQ 54xx and the Jornada 5xx (chicken)
180 181
181 2003-08-04Opie 1.0.0 182 2003-08-04Opie 1.0.0
182 183
183 * Released as Version 1.0.0 184 * Released as Version 1.0.0
184 * Including a PPP module for easy dial up (tille,harlekin,zecke) 185 * Including a PPP module for easy dial up (tille,harlekin,zecke)
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,560 +1,567 @@
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.",
305".........", 312".........",
306".a.a.aaa.", 313".a.a.aaa.",
307".a.a.a.a.", 314".a.a.a.a.",
308".aaa.aaa.", 315".aaa.aaa.",
309".....a..."}; 316".....a..."};
310/* XPM */ 317/* XPM */
311static const char * const pagedown_xpm[]={ 318static const char * const pagedown_xpm[]={
312"9 9 2 1", 319"9 9 2 1",
313"a c #000000", 320"a c #000000",
314". c None", 321". c None",
315".aaa.aaa.", 322".aaa.aaa.",
316".a.a.a.a.", 323".a.a.a.a.",
317".aaa..aa.", 324".aaa..aa.",
318".a...aaa.", 325".a...aaa.",
319".........", 326".........",
320"...a.....", 327"...a.....",
321".aaa.aaa.", 328".aaa.aaa.",
322".a.a.a.a.", 329".a.a.a.a.",
323".aaa.a.a."}; 330".aaa.a.a."};
324/* XPM */ 331/* XPM */
325static const char * const expand_xpm[]={ 332static const char * const expand_xpm[]={
326"4 9 2 1", 333"4 9 2 1",
327"a c #408040", 334"a c #408040",
328". c None", 335". c None",
329"a...", 336"a...",
330"aa..", 337"aa..",
331"aaa.", 338"aaa.",
332"aaaa", 339"aaaa",
333"aaaa", 340"aaaa",
334"aaaa", 341"aaaa",
335"aaa.", 342"aaa.",
336"aa..", 343"aa..",
337"a..."}; 344"a..."};
338/* XPM */ 345/* XPM */
339#ifdef USE_SMALL_BACKSPACE 346#ifdef USE_SMALL_BACKSPACE
340static const char * const backspace_xpm[]={ 347static const char * const backspace_xpm[]={
341"9 9 2 1", 348"9 9 2 1",
342"a c #000000", 349"a c #000000",
343". c None", 350". c None",
344".........", 351".........",
345".........", 352".........",
346"...a.....", 353"...a.....",
347"..aa.....", 354"..aa.....",
348".aaaaaaaa", 355".aaaaaaaa",
349"..aa.....", 356"..aa.....",
350"...a.....", 357"...a.....",
351".........", 358".........",
352"........."}; 359"........."};
353#else 360#else
354static const char * const backspace_xpm[]={ 361static const char * const backspace_xpm[]={
355"21 9 2 1", 362"21 9 2 1",
356"a c #000000", 363"a c #000000",
357". c None", 364". c None",
358".....................", 365".....................",
359".....................", 366".....................",
360".....aaa..a..........", 367".....aaa..a..........",
361".a...a..a.a.a.aaa.aaa", 368".a...a..a.a.a.aaa.aaa",
362"aaaa.aaa..aa..aa..a.a", 369"aaaa.aaa..aa..aa..a.a",
363".a...a..a.aaa..aa.a.a", 370".a...a..a.aaa..aa.a.a",
364".....aaaa.a.a.aaa.aa.", 371".....aaaa.a.a.aaa.aa.",
365"..................a..", 372"..................a..",
366"....................."}; 373"....................."};
367#endif 374#endif
368/* XPM */ 375/* XPM */
369static const char * const escape_xpm[]={ 376static const char * const escape_xpm[]={
370"9 9 2 1", 377"9 9 2 1",
371"a c #000000", 378"a c #000000",
372". c None", 379". c None",
373".........", 380".........",
374".........", 381".........",
375".aa.aa.aa", 382".aa.aa.aa",
376".a..a..a.", 383".a..a..a.",
377".aa.aa.a.", 384".aa.aa.a.",
378".a...a.a.", 385".a...a.a.",
379".aa.aa.aa", 386".aa.aa.aa",
380".........", 387".........",
381"........."}; 388"........."};
382 389
383 390
384enum { BSCode = 0x80, TabCode, CapsCode, RetCode, 391enum { BSCode = 0x80, TabCode, CapsCode, RetCode,
385 ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash, 392 ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash,
386 UpCode, LeftCode, DownCode, RightCode, Blank, Expand, 393 UpCode, LeftCode, DownCode, RightCode, Blank, Expand,
387 Opti, ResetDict, 394 Opti, ResetDict,
388 Divide, Multiply, Add, Subtract, Decimal, Equal, 395 Divide, Multiply, Add, Subtract, Decimal, Equal,
389 Percent, Sqrt, Inverse, Escape }; 396 Percent, Sqrt, Inverse, Escape };
390 397
391typedef struct SpecialMap { 398typedef struct SpecialMap {
392 int qcode; 399 int qcode;
393 ushort unicode; 400 ushort unicode;
394 const char * label; 401 const char * label;
395 const char * const * xpm; 402 const char * const * xpm;
396}; 403};
397 404
398 405
399static const SpecialMap specialM[] = { 406static const SpecialMap specialM[] = {
400 { Qt::Key_Backspace, 8,"<", backspace_xpm }, 407 { Qt::Key_Backspace, 8,"<", backspace_xpm },
401 { Qt::Key_Tab, 9,"Tab", NULL }, 408 { Qt::Key_Tab, 9,"Tab", NULL },
402 { Qt::Key_CapsLock, 0,"Caps", NULL }, 409 { Qt::Key_CapsLock, 0,"Caps", NULL },
403 { Qt::Key_Return, 13,"Ret", NULL }, 410 { Qt::Key_Return, 13,"Ret", NULL },
404 { Qt::Key_Shift, 0,"Shift", NULL }, 411 { Qt::Key_Shift, 0,"Shift", NULL },
405 { Qt::Key_Control, 0,"Ctrl", NULL }, 412 { Qt::Key_Control, 0,"Ctrl", NULL },
406 { Qt::Key_Alt, 0,"Alt", NULL }, 413 { Qt::Key_Alt, 0,"Alt", NULL },
407 { Qt::Key_Space, ' ',"", NULL }, 414 { Qt::Key_Space, ' ',"", NULL },
408 { BackSlash, 43,"\\", NULL }, 415 { BackSlash, 43,"\\", NULL },
409 416
410 // Need images? 417 // Need images?
411 { Qt::Key_Up, 0,"^", uparrow_xpm }, 418 { Qt::Key_Up, 0,"^", uparrow_xpm },
412 { Qt::Key_Left, 0,"<", leftarrow_xpm }, 419 { Qt::Key_Left, 0,"<", leftarrow_xpm },
413 { Qt::Key_Down, 0,"v", downarrow_xpm }, 420 { Qt::Key_Down, 0,"v", downarrow_xpm },
414 { Qt::Key_Right, 0,">", rightarrow_xpm }, 421 { Qt::Key_Right, 0,">", rightarrow_xpm },
415 { Qt::Key_Insert, 0,"I", insert_xpm }, 422 { Qt::Key_Insert, 0,"I", insert_xpm },
416 { Qt::Key_Home, 0,"H", home_xpm }, 423 { Qt::Key_Home, 0,"H", home_xpm },
417 { Qt::Key_PageUp, 0,"U", pageup_xpm }, 424 { Qt::Key_PageUp, 0,"U", pageup_xpm },
418 { Qt::Key_End, 0,"E", end_xpm }, 425 { Qt::Key_End, 0,"E", end_xpm },
419 { Qt::Key_Delete, 0,"X", delete_xpm }, 426 { Qt::Key_Delete, 0,"X", delete_xpm },
420 { Qt::Key_PageDown, 0,"D", pagedown_xpm }, 427 { Qt::Key_PageDown, 0,"D", pagedown_xpm },
421 { Blank, 0," ", NULL }, 428 { Blank, 0," ", NULL },
422 { Expand, 0,"->", expand_xpm }, 429 { Expand, 0,"->", expand_xpm },
423 { Opti, 0,"#", NULL }, 430 { Opti, 0,"#", NULL },
424 { ResetDict, 0,"R", NULL }, 431 { ResetDict, 0,"R", NULL },
425 432
426 // number pad stuff 433 // number pad stuff
427 { Divide, 0,"/", NULL }, 434 { Divide, 0,"/", NULL },
428 { Multiply, 0,"*", NULL }, 435 { Multiply, 0,"*", NULL },
429 { Add, 0,"+", NULL }, 436 { Add, 0,"+", NULL },
430 { Subtract, 0,"-", NULL }, 437 { Subtract, 0,"-", NULL },
431 { Decimal, 0,".", NULL }, 438 { Decimal, 0,".", NULL },
432 { Equal, 0,"=", NULL }, 439 { Equal, 0,"=", NULL },
433 { Percent, 0,"%", NULL }, 440 { Percent, 0,"%", NULL },
434 { Sqrt, 0, "^1/2", NULL }, 441 { Sqrt, 0, "^1/2", NULL },
435 { Inverse, 0, "1/x", NULL }, 442 { Inverse, 0, "1/x", NULL },
436 443
437 { Escape, 27, "ESC", escape_xpm } 444 { Escape, 27, "ESC", escape_xpm }
438}; 445};
439 446
440 447
441static int keycode( int i2, int j, const uchar **keyboard ) 448static int keycode( int i2, int j, const uchar **keyboard )
442{ 449{
443 if ( j <0 || j >= 5 ) 450 if ( j <0 || j >= 5 )
444 return 0; 451 return 0;
445 452
446 const uchar *row = keyboard[j]; 453 const uchar *row = keyboard[j];
447 454
448 while ( *row && *row <= i2 ) { 455 while ( *row && *row <= i2 ) {
449 i2 -= *row; 456 i2 -= *row;
450 row += 2; 457 row += 2;
451 } 458 }
452 459
453 if ( !*row ) return 0; 460 if ( !*row ) return 0;
454 461
455 int k; 462 int k;
456 if ( row[1] >= 0x80 ) { 463 if ( row[1] >= 0x80 ) {
457 k = row[1]; 464 k = row[1];
458 } else { 465 } else {
459 k = row[1]+i2/2; 466 k = row[1]+i2/2;
460 } 467 }
461 468
462 return k; 469 return k;
463} 470}
464 471
465 472
466/* 473/*
467 return scancode and width of first key in row \a j if \a j >= 0, 474 return scancode and width of first key in row \a j if \a j >= 0,
468 or next key on current row if \a j < 0. 475 or next key on current row if \a j < 0.
469 476
470*/ 477*/
471 478
472int Keyboard::getKey( int &w, int j ) { 479int Keyboard::getKey( int &w, int j ) {
473 static const uchar *row = 0; 480 static const uchar *row = 0;
474 static int key_i = 0; 481 static int key_i = 0;
475 static int scancode = 0; 482 static int scancode = 0;
476 static int half = 0; 483 static int half = 0;
477 484
478 if ( j >= 0 && j < 5 ) { 485 if ( j >= 0 && j < 5 ) {
479 if (useOptiKeys) 486 if (useOptiKeys)
480 row = keyboard_opti[j]; 487 row = keyboard_opti[j];
481 else 488 else
482 row = keyboard_standard[j]; 489 row = keyboard_standard[j];
483 half=0; 490 half=0;
484 } 491 }
485 492
486 if ( !row || !*row ) { 493 if ( !row || !*row ) {
487 return 0; 494 return 0;
488 } else if ( row[1] >= 0x80 ) { 495 } else if ( row[1] >= 0x80 ) {
489 scancode = row[1]; 496 scancode = row[1];
490 w = (row[0] * w + (half++&1)) / 2; 497 w = (row[0] * w + (half++&1)) / 2;
491 row += 2; 498 row += 2;
492 return scancode; 499 return scancode;
493 } else if ( key_i <= 0 ) { 500 } else if ( key_i <= 0 ) {
494 key_i = row[0]/2; 501 key_i = row[0]/2;
495 scancode = row[1]; 502 scancode = row[1];
496 } 503 }
497 key_i--; 504 key_i--;
498 if ( key_i <= 0 ) 505 if ( key_i <= 0 )
499 row += 2; 506 row += 2;
500 return scancode++; 507 return scancode++;
501} 508}
502 509
503 510
504void Keyboard::paintEvent(QPaintEvent* e) 511void Keyboard::paintEvent(QPaintEvent* e)
505{ 512{
506 QPainter painter(this); 513 QPainter painter(this);
507 painter.setClipRect(e->rect()); 514 painter.setClipRect(e->rect());
508 drawKeyboard( painter ); 515 drawKeyboard( painter );
509 picks->dc->draw( &painter ); 516 picks->dc->draw( &painter );
510} 517}
511 518
512 519
513/* 520/*
514 Draw the keyboard. 521 Draw the keyboard.
515 522
516 If key >= 0, only the specified key is drawn. 523 If key >= 0, only the specified key is drawn.
517*/ 524*/
518void Keyboard::drawKeyboard( QPainter &p, int key ) 525void Keyboard::drawKeyboard( QPainter &p, int key )
519{ 526{
520 const bool threeD = FALSE; 527 const bool threeD = FALSE;
521 const QColorGroup& cg = colorGroup(); 528 const QColorGroup& cg = colorGroup();
522 QColor keycolor = // cg.background(); 529 QColor keycolor = // cg.background();
523 QColor(240,240,230); // Beige! 530 QColor(240,240,230); // Beige!
524 QColor keycolor_pressed = cg.mid(); 531 QColor keycolor_pressed = cg.mid();
525 QColor keycolor_lo = cg.dark(); 532 QColor keycolor_lo = cg.dark();
526 QColor keycolor_hi = cg.light(); 533 QColor keycolor_hi = cg.light();
527 QColor textcolor = QColor(0,0,0); // cg.text(); 534 QColor textcolor = QColor(0,0,0); // cg.text();
528 535
529 int margin = threeD ? 1 : 0; 536 int margin = threeD ? 1 : 0;
530 537
531// p.fillRect( 0, , kw-1, keyHeight-2, keycolor_pressed ); 538// p.fillRect( 0, , kw-1, keyHeight-2, keycolor_pressed );
532 539
533 for ( int j = 0; j < 5; j++ ) { 540 for ( int j = 0; j < 5; j++ ) {
534 int y = j * keyHeight + picks->height() + 1; 541 int y = j * keyHeight + picks->height() + 1;
535 int x = xoffs; 542 int x = xoffs;
536 int kw = defaultKeyWidth; 543 int kw = defaultKeyWidth;
537 int k= getKey( kw, j ); 544 int k= getKey( kw, j );
538 while ( k ) { 545 while ( k ) {
539 if ( key < 0 || k == key ) { 546 if ( key < 0 || k == key ) {
540 QString s; 547 QString s;
541 bool pressed = (k == pressedKey); 548 bool pressed = (k == pressedKey);
542 bool blank = (k == 0223); 549 bool blank = (k == 0223);
543 const char * const * xpm = NULL; 550 const char * const * xpm = NULL;
544 551
545 if ( k >= 0x80 ) { 552 if ( k >= 0x80 ) {
546 s = specialM[k - 0x80].label; 553 s = specialM[k - 0x80].label;
547 554
548 xpm = specialM[k - 0x80].xpm; 555 xpm = specialM[k - 0x80].xpm;
549 556
550 if ( k == ShiftCode ) { 557 if ( k == ShiftCode ) {
551 pressed = shift; 558 pressed = shift;
552 } else if ( k == CapsCode ) { 559 } else if ( k == CapsCode ) {
553 pressed = lock; 560 pressed = lock;
554 } else if ( k == CtrlCode ) { 561 } else if ( k == CtrlCode ) {
555 pressed = ctrl; 562 pressed = ctrl;
556 } else if ( k == AltCode ) { 563 } else if ( k == AltCode ) {
557 pressed = alt; 564 pressed = alt;
558 } 565 }
559 } else { 566 } else {
560#if defined(Q_WS_QWS) || defined(_WS_QWS_) 567#if defined(Q_WS_QWS) || defined(_WS_QWS_)
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,561 +1,568 @@
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",
306"a..a.a.a.a", 313"a..a.a.a.a",
307"aa.a.a.aaa", 314"aa.a.a.aaa",
308"..........", 315"..........",
309".........."}; 316".........."};
310/* XPM */ 317/* XPM */
311static const char * const pageup_xpm[]={ 318static const char * const pageup_xpm[]={
312"9 9 2 1", 319"9 9 2 1",
313"a c #000000", 320"a c #000000",
314". c None", 321". c None",
315".aaa.aaa.", 322".aaa.aaa.",
316".a.a.a.a.", 323".a.a.a.a.",
317".aaa..aa.", 324".aaa..aa.",
318".a...aaa.", 325".a...aaa.",
319".........", 326".........",
320".a.a.aaa.", 327".a.a.aaa.",
321".a.a.a.a.", 328".a.a.a.a.",
322".aaa.aaa.", 329".aaa.aaa.",
323".....a..."}; 330".....a..."};
324/* XPM */ 331/* XPM */
325static const char * const pagedown_xpm[]={ 332static const char * const pagedown_xpm[]={
326"9 9 2 1", 333"9 9 2 1",
327"a c #000000", 334"a c #000000",
328". c None", 335". c None",
329".aaa.aaa.", 336".aaa.aaa.",
330".a.a.a.a.", 337".a.a.a.a.",
331".aaa..aa.", 338".aaa..aa.",
332".a...aaa.", 339".a...aaa.",
333".........", 340".........",
334"...a.....", 341"...a.....",
335".aaa.aaa.", 342".aaa.aaa.",
336".a.a.a.a.", 343".a.a.a.a.",
337".aaa.a.a."}; 344".aaa.a.a."};
338/* XPM */ 345/* XPM */
339static const char * const expand_xpm[]={ 346static const char * const expand_xpm[]={
340"4 9 2 1", 347"4 9 2 1",
341"a c #408040", 348"a c #408040",
342". c None", 349". c None",
343"a...", 350"a...",
344"aa..", 351"aa..",
345"aaa.", 352"aaa.",
346"aaaa", 353"aaaa",
347"aaaa", 354"aaaa",
348"aaaa", 355"aaaa",
349"aaa.", 356"aaa.",
350"aa..", 357"aa..",
351"a..."}; 358"a..."};
352/* XPM */ 359/* XPM */
353#ifdef USE_SMALL_BACKSPACE 360#ifdef USE_SMALL_BACKSPACE
354static const char * const backspace_xpm[]={ 361static const char * const backspace_xpm[]={
355"9 9 2 1", 362"9 9 2 1",
356"a c #000000", 363"a c #000000",
357". c None", 364". c None",
358".........", 365".........",
359".........", 366".........",
360"...a.....", 367"...a.....",
361"..aa.....", 368"..aa.....",
362".aaaaaaaa", 369".aaaaaaaa",
363"..aa.....", 370"..aa.....",
364"...a.....", 371"...a.....",
365".........", 372".........",
366"........."}; 373"........."};
367#else 374#else
368static const char * const backspace_xpm[]={ 375static const char * const backspace_xpm[]={
369"21 9 2 1", 376"21 9 2 1",
370"a c #000000", 377"a c #000000",
371". c None", 378". c None",
372".....................", 379".....................",
373".....................", 380".....................",
374".....aaa..a..........", 381".....aaa..a..........",
375".a...a..a.a.a.aaa.aaa", 382".a...a..a.a.a.aaa.aaa",
376"aaaa.aaa..aa..aa..a.a", 383"aaaa.aaa..aa..aa..a.a",
377".a...a..a.aaa..aa.a.a", 384".a...a..a.aaa..aa.a.a",
378".....aaaa.a.a.aaa.aa.", 385".....aaaa.a.a.aaa.aa.",
379"..................a..", 386"..................a..",
380"....................."}; 387"....................."};
381#endif 388#endif
382/* XPM */ 389/* XPM */
383static const char * const escape_xpm[]={ 390static const char * const escape_xpm[]={
384"9 9 2 1", 391"9 9 2 1",
385"a c #000000", 392"a c #000000",
386". c None", 393". c None",
387".........", 394".........",
388".........", 395".........",
389".aa.aa.aa", 396".aa.aa.aa",
390".a..a..a.", 397".a..a..a.",
391".aa.aa.a.", 398".aa.aa.a.",
392".a...a.a.", 399".a...a.a.",
393".aa.aa.aa", 400".aa.aa.aa",
394".........", 401".........",
395"........."}; 402"........."};
396 403
397 404
398enum { BSCode = 0x80, TabCode, CapsCode, RetCode, 405enum { BSCode = 0x80, TabCode, CapsCode, RetCode,
399 ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash, 406 ShiftCode, CtrlCode, AltCode, SpaceCode, BackSlash,
400 UpCode, LeftCode, DownCode, RightCode, Blank, Expand, 407 UpCode, LeftCode, DownCode, RightCode, Blank, Expand,
401 Opti, ResetDict, 408 Opti, ResetDict,
402 Divide, Multiply, Add, Subtract, Decimal, Equal, 409 Divide, Multiply, Add, Subtract, Decimal, Equal,
403 Percent, Sqrt, Inverse, Escape }; 410 Percent, Sqrt, Inverse, Escape };
404 411
405typedef struct SpecialMap { 412typedef struct SpecialMap {
406 int qcode; 413 int qcode;
407 ushort unicode; 414 ushort unicode;
408 const char * label; 415 const char * label;
409 const char * const * xpm; 416 const char * const * xpm;
410}; 417};
411 418
412 419
413static const SpecialMap specialM[] = { 420static const SpecialMap specialM[] = {
414 { Qt::Key_Backspace, 8,"<", backspace_xpm }, 421 { Qt::Key_Backspace, 8,"<", backspace_xpm },
415 { Qt::Key_Tab, 9,"Tab", NULL }, 422 { Qt::Key_Tab, 9,"Tab", NULL },
416 { Qt::Key_CapsLock, 0,"Caps", NULL }, 423 { Qt::Key_CapsLock, 0,"Caps", NULL },
417 { Qt::Key_Return, 13,"Ret", NULL }, 424 { Qt::Key_Return, 13,"Ret", NULL },
418 { Qt::Key_Shift, 0,"Shift", NULL }, 425 { Qt::Key_Shift, 0,"Shift", NULL },
419 { Qt::Key_Control, 0,"Ctrl", NULL }, 426 { Qt::Key_Control, 0,"Ctrl", NULL },
420 { Qt::Key_Alt, 0,"Alt", NULL }, 427 { Qt::Key_Alt, 0,"Alt", NULL },
421 { Qt::Key_Space, ' ',"", NULL }, 428 { Qt::Key_Space, ' ',"", NULL },
422 { BackSlash, 43,"\\", NULL }, 429 { BackSlash, 43,"\\", NULL },
423 430
424 // Need images? 431 // Need images?
425 { Qt::Key_Up, 0,"^", uparrow_xpm }, 432 { Qt::Key_Up, 0,"^", uparrow_xpm },
426 { Qt::Key_Left, 0,"<", leftarrow_xpm }, 433 { Qt::Key_Left, 0,"<", leftarrow_xpm },
427 { Qt::Key_Down, 0,"v", downarrow_xpm }, 434 { Qt::Key_Down, 0,"v", downarrow_xpm },
428 { Qt::Key_Right, 0,">", rightarrow_xpm }, 435 { Qt::Key_Right, 0,">", rightarrow_xpm },
429 { Qt::Key_Insert, 0,"I", insert_xpm }, 436 { Qt::Key_Insert, 0,"I", insert_xpm },
430 { Qt::Key_Home, 0,"H", home_xpm }, 437 { Qt::Key_Home, 0,"H", home_xpm },
431 { Qt::Key_PageUp, 0,"U", pageup_xpm }, 438 { Qt::Key_PageUp, 0,"U", pageup_xpm },
432 { Qt::Key_End, 0,"E", end_xpm }, 439 { Qt::Key_End, 0,"E", end_xpm },
433 { Qt::Key_Delete, 0,"X", delete_xpm }, 440 { Qt::Key_Delete, 0,"X", delete_xpm },
434 { Qt::Key_PageDown, 0,"D", pagedown_xpm }, 441 { Qt::Key_PageDown, 0,"D", pagedown_xpm },
435 { Blank, 0," ", NULL }, 442 { Blank, 0," ", NULL },
436 { Expand, 0,"->", expand_xpm }, 443 { Expand, 0,"->", expand_xpm },
437 { Opti, 0,"#", NULL }, 444 { Opti, 0,"#", NULL },
438 { ResetDict, 0,"R", NULL }, 445 { ResetDict, 0,"R", NULL },
439 446
440 // number pad stuff 447 // number pad stuff
441 { Divide, 0,"/", NULL }, 448 { Divide, 0,"/", NULL },
442 { Multiply, 0,"*", NULL }, 449 { Multiply, 0,"*", NULL },
443 { Add, 0,"+", NULL }, 450 { Add, 0,"+", NULL },
444 { Subtract, 0,"-", NULL }, 451 { Subtract, 0,"-", NULL },
445 { Decimal, 0,".", NULL }, 452 { Decimal, 0,".", NULL },
446 { Equal, 0,"=", NULL }, 453 { Equal, 0,"=", NULL },
447 { Percent, 0,"%", NULL }, 454 { Percent, 0,"%", NULL },
448 { Sqrt, 0, "^1/2", NULL }, 455 { Sqrt, 0, "^1/2", NULL },
449 { Inverse, 0, "1/x", NULL }, 456 { Inverse, 0, "1/x", NULL },
450 457
451 { Escape, 27, "ESC", escape_xpm } 458 { Escape, 27, "ESC", escape_xpm }
452}; 459};
453 460
454 461
455static int keycode( int i2, int j, const uchar **keyboard ) 462static int keycode( int i2, int j, const uchar **keyboard )
456{ 463{
457 if ( j <0 || j >= 5 ) 464 if ( j <0 || j >= 5 )
458 return 0; 465 return 0;
459 466
460 const uchar *row = keyboard[j]; 467 const uchar *row = keyboard[j];
461 468
462 while ( *row && *row <= i2 ) { 469 while ( *row && *row <= i2 ) {
463 i2 -= *row; 470 i2 -= *row;
464 row += 2; 471 row += 2;
465 } 472 }
466 473
467 if ( !*row ) return 0; 474 if ( !*row ) return 0;
468 475
469 int k; 476 int k;
470 if ( row[1] >= 0x80 ) { 477 if ( row[1] >= 0x80 ) {
471 k = row[1]; 478 k = row[1];
472 } else { 479 } else {
473 k = row[1]+i2/2; 480 k = row[1]+i2/2;
474 } 481 }
475 482
476 return k; 483 return k;
477} 484}
478 485
479 486
480/* 487/*
481 return scancode and width of first key in row \a j if \a j >= 0, 488 return scancode and width of first key in row \a j if \a j >= 0,
482 or next key on current row if \a j < 0. 489 or next key on current row if \a j < 0.
483 490
484*/ 491*/
485 492
486int Keyboard::getKey( int &w, int j ) { 493int Keyboard::getKey( int &w, int j ) {
487 static const uchar *row = 0; 494 static const uchar *row = 0;
488 static int key_i = 0; 495 static int key_i = 0;
489 static int scancode = 0; 496 static int scancode = 0;
490 static int half = 0; 497 static int half = 0;
491 498
492 if ( j >= 0 && j < 5 ) { 499 if ( j >= 0 && j < 5 ) {
493 if (useOptiKeys) 500 if (useOptiKeys)
494 row = keyboard_opti[j]; 501 row = keyboard_opti[j];
495 else 502 else
496 row = keyboard_standard[j]; 503 row = keyboard_standard[j];
497 half=0; 504 half=0;
498 } 505 }
499 506
500 if ( !row || !*row ) { 507 if ( !row || !*row ) {
501 return 0; 508 return 0;
502 } else if ( row[1] >= 0x80 ) { 509 } else if ( row[1] >= 0x80 ) {
503 scancode = row[1]; 510 scancode = row[1];
504 w = (row[0] * w + (half++&1)) / 2; 511 w = (row[0] * w + (half++&1)) / 2;
505 row += 2; 512 row += 2;
506 return scancode; 513 return scancode;
507 } else if ( key_i <= 0 ) { 514 } else if ( key_i <= 0 ) {
508 key_i = row[0]/2; 515 key_i = row[0]/2;
509 scancode = row[1]; 516 scancode = row[1];
510 } 517 }
511 key_i--; 518 key_i--;
512 if ( key_i <= 0 ) 519 if ( key_i <= 0 )
513 row += 2; 520 row += 2;
514 return scancode++; 521 return scancode++;
515} 522}
516 523
517 524
518void Keyboard::paintEvent(QPaintEvent* e) 525void Keyboard::paintEvent(QPaintEvent* e)
519{ 526{
520 QPainter painter(this); 527 QPainter painter(this);
521 painter.setClipRect(e->rect()); 528 painter.setClipRect(e->rect());
522 drawKeyboard( painter ); 529 drawKeyboard( painter );
523 picks->dc->draw( &painter ); 530 picks->dc->draw( &painter );
524} 531}
525 532
526 533
527/* 534/*
528 Draw the keyboard. 535 Draw the keyboard.
529 536
530 If key >= 0, only the specified key is drawn. 537 If key >= 0, only the specified key is drawn.
531*/ 538*/
532void Keyboard::drawKeyboard( QPainter &p, int key ) 539void Keyboard::drawKeyboard( QPainter &p, int key )
533{ 540{
534 const bool threeD = FALSE; 541 const bool threeD = FALSE;
535 const QColorGroup& cg = colorGroup(); 542 const QColorGroup& cg = colorGroup();
536 QColor keycolor = // cg.background(); 543 QColor keycolor = // cg.background();
537 QColor(240,240,230); // Beige! 544 QColor(240,240,230); // Beige!
538 QColor keycolor_pressed = cg.mid(); 545 QColor keycolor_pressed = cg.mid();
539 QColor keycolor_lo = cg.dark(); 546 QColor keycolor_lo = cg.dark();
540 QColor keycolor_hi = cg.light(); 547 QColor keycolor_hi = cg.light();
541 QColor textcolor = QColor(0,0,0); // cg.text(); 548 QColor textcolor = QColor(0,0,0); // cg.text();
542 549
543 int margin = threeD ? 1 : 0; 550 int margin = threeD ? 1 : 0;
544 551
545// p.fillRect( 0, , kw-1, keyHeight-2, keycolor_pressed ); 552// p.fillRect( 0, , kw-1, keyHeight-2, keycolor_pressed );
546 553
547 for ( int j = 0; j < 5; j++ ) { 554 for ( int j = 0; j < 5; j++ ) {
548 int y = j * keyHeight + picks->height() + 1; 555 int y = j * keyHeight + picks->height() + 1;
549 int x = xoffs; 556 int x = xoffs;
550 int kw = defaultKeyWidth; 557 int kw = defaultKeyWidth;
551 int k= getKey( kw, j ); 558 int k= getKey( kw, j );
552 while ( k ) { 559 while ( k ) {
553 if ( key < 0 || k == key ) { 560 if ( key < 0 || k == key ) {
554 QString s; 561 QString s;
555 bool pressed = (k == pressedKey); 562 bool pressed = (k == pressedKey);
556 bool blank = (k == 0223); 563 bool blank = (k == 0223);
557 const char * const * xpm = NULL; 564 const char * const * xpm = NULL;
558 565
559 if ( k >= 0x80 ) { 566 if ( k >= 0x80 ) {
560 s = specialM[k - 0x80].label; 567 s = specialM[k - 0x80].label;
561 568
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,593 +1,593 @@
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}
338 338
339 339
340/* Keyboard::mousePressEvent {{{1 */ 340/* Keyboard::mousePressEvent {{{1 */
341void Keyboard::mousePressEvent(QMouseEvent *e) 341void Keyboard::mousePressEvent(QMouseEvent *e)
342{ 342{
343 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1; 343 int row = (e->y() - (usePicks ? picks->height() : 0)) / keyHeight + 1;
344 if (row > 5) row = 5; 344 if (row > 5) row = 5;
345 345
346 // figure out the column 346 // figure out the column
347 int col = 0; 347 int col = 0;
348 for (int w = 0; e->x() >= w; col++) 348 for (int w = 0; e->x() >= w; col++)
349 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys 349 if (col < keys->numKeys(row)) // it segfaults if it trys to read past numKeys
350 w += keys->width(row,col) * defaultKeyWidth; 350 w += keys->width(row,col) * defaultKeyWidth;
351 else break; 351 else break;
352 352
353 if (col <= 0) return; 353 if (col <= 0) return;
354 354
355 col --; // rewind one... 355 col --; // rewind one...
356 356
357 qkeycode = keys->qcode(row, col); 357 qkeycode = keys->qcode(row, col);
358 unicode = keys->uni(row, col); 358 unicode = keys->uni(row, col);
359 359
360 // might need to repaint if two or more of the same keys. 360 // might need to repaint if two or more of the same keys.
361 // should be faster if just paint one key even though multiple keys exist. 361 // should be faster if just paint one key even though multiple keys exist.
362 bool need_repaint = FALSE; 362 bool need_repaint = FALSE;
363 363
364 // circumflex and diaeresis support 364 // circumflex and diaeresis support
365 // messy to have this here, but too hard to implement any other method 365 // messy to have this here, but too hard to implement any other method
366 if (unicode == 0x2c6) { 366 if (unicode == 0x2c6) {
367 367
368 unicode = 0; 368 unicode = 0;
369 if (shift || lock) { 369 if (shift || lock) {
370 370
371 // diaeresis 371 // diaeresis
372 qkeycode = 0x2001; 372 qkeycode = 0x2001;
373 } 373 }
374 else { 374 else {
375 375
376 // circumflex 376 // circumflex
377 qkeycode = 0x2000; 377 qkeycode = 0x2000;
378 } 378 }
379 } 379 }
380 380
381 // Back accent character support 381 // Back accent character support
382 382
383 // the keys from 2c6 ~ 2cf should be used instead of the ascii one 383 // the keys from 2c6 ~ 2cf should be used instead of the ascii one
384 if (unicode == 0x2cb) { 384 if (unicode == 0x2cb) {
385 385
386 unicode = 0; 386 unicode = 0;
387 if (shift || lock) { 387 if (shift || lock) {
388 388
389 // circumblex 389 // circumblex
390 qkeycode = 0x2000; 390 qkeycode = 0x2000;
391 } 391 }
392 else { 392 else {
393 393
394 // back accent 394 // back accent
395 qkeycode = 0x2002; 395 qkeycode = 0x2002;
396 } 396 }
397 } 397 }
398 398
399 // Accent character support 399 // Accent character support
400 400
401 if (unicode == 0x2ca) { 401 if (unicode == 0x2ca) {
402 402
403 unicode = 0; 403 unicode = 0;
404 if (shift || lock) { 404 if (shift || lock) {
405 405
406 // diaeresis 406 // diaeresis
407 qkeycode = 0x2001; 407 qkeycode = 0x2001;
408 } 408 }
409 else { 409 else {
410 410
411 // accent 411 // accent
412 qkeycode = 0x2003; 412 qkeycode = 0x2003;
413 } 413 }
414 } 414 }
415 415
416 416
417 if (unicode == 0) { // either Qt char, or nothing 417 if (unicode == 0) { // either Qt char, or nothing
418 418
419 if (qkeycode == Qt::Key_F1) { // toggle the pickboard 419 if (qkeycode == Qt::Key_F1) { // toggle the pickboard
420 420
421 if ( configdlg ) { 421 if ( configdlg ) {
422 422
423 delete configdlg; 423 delete configdlg;
424 configdlg = 0; 424 configdlg = 0;
425 } 425 }
426 else { 426 else {
427 configdlg = new ConfigDlg (); 427 configdlg = new ConfigDlg ();
428 connect(configdlg, SIGNAL(setMapToDefault()), 428 connect(configdlg, SIGNAL(setMapToDefault()),
429 this, SLOT(setMapToDefault())); 429 this, SLOT(setMapToDefault()));
430 connect(configdlg, SIGNAL(setMapToFile(QString)), 430 connect(configdlg, SIGNAL(setMapToFile(QString)),
431 this, SLOT(setMapToFile(QString))); 431 this, SLOT(setMapToFile(QString)));
432 connect(configdlg, SIGNAL(pickboardToggled(bool)), 432 connect(configdlg, SIGNAL(pickboardToggled(bool)),
433 this, SLOT(togglePickboard(bool))); 433 this, SLOT(togglePickboard(bool)));
434 connect(configdlg, SIGNAL(repeatToggled(bool)), 434 connect(configdlg, SIGNAL(repeatToggled(bool)),
435 this, SLOT(toggleRepeat(bool))); 435 this, SLOT(toggleRepeat(bool)));
436 connect(configdlg, SIGNAL(reloadKeyboard()), 436 connect(configdlg, SIGNAL(reloadKeyboard()),
437 this, SLOT(reloadKeyboard())); 437 this, SLOT(reloadKeyboard()));
438 connect(configdlg, SIGNAL(configDlgClosed()), 438 connect(configdlg, SIGNAL(configDlgClosed()),
439 this, SLOT(cleanupConfigDlg())); 439 this, SLOT(cleanupConfigDlg()));
440 connect(configdlg, SIGNAL(reloadSw()), 440 connect(configdlg, SIGNAL(reloadSw()),
441 this, SLOT(reloadSw())); 441 this, SLOT(reloadSw()));
442 configdlg->showMaximized(); 442 configdlg->showMaximized();
443 configdlg->show(); 443 configdlg->show();
444 configdlg->raise(); 444 configdlg->raise();
445 } 445 }
446 446
447 } else if (qkeycode == Qt::Key_Control) { 447 } else if (qkeycode == Qt::Key_Control) {
448 need_repaint = TRUE; 448 need_repaint = TRUE;
449 449
450 if (ctrl) { 450 if (ctrl) {
451 451
452 *ctrl = 0; 452 *ctrl = 0;
453 ctrl = 0; 453 ctrl = 0;
454 454
455 } else { 455 } else {
456 456
457 ctrl = keys->pressedPtr(row, col); 457 ctrl = keys->pressedPtr(row, col);
458 need_repaint = TRUE; 458 need_repaint = TRUE;
459 *ctrl = !keys->pressed(row, col); 459 *ctrl = !keys->pressed(row, col);
460 460
461 } 461 }
462 462
463 } else if (qkeycode == Qt::Key_Alt) { 463 } else if (qkeycode == Qt::Key_Alt) {
464 need_repaint = TRUE; 464 need_repaint = TRUE;
465 465
466 if (alt) { 466 if (alt) {
467 *alt = 0; 467 *alt = 0;
468 alt = 0; 468 alt = 0;
469 469
470 } else { 470 } else {
471 471
472 alt = keys->pressedPtr(row, col); 472 alt = keys->pressedPtr(row, col);
473 need_repaint = TRUE; 473 need_repaint = TRUE;
474 *alt = !keys->pressed(row, col); 474 *alt = !keys->pressed(row, col);
475 } 475 }
476 476
477 } else if (qkeycode == Qt::Key_Shift) { 477 } else if (qkeycode == Qt::Key_Shift) {
478 need_repaint = TRUE; 478 need_repaint = TRUE;
479 479
480 if (shift) { 480 if (shift) {
481 *shift = 0; 481 *shift = 0;
482 shift = 0; 482 shift = 0;
483 } 483 }
484 else { 484 else {
485 shift = keys->pressedPtr(row, col); 485 shift = keys->pressedPtr(row, col);
486 *shift = 1; 486 *shift = 1;
487 if (lock) { 487 if (lock) {
488 *lock = 0; 488 *lock = 0;
489 lock = 0; 489 lock = 0;
490 } 490 }
491 } 491 }
492 492
493 493
494 /* 494 /*
495 * want to be able to hit circumflex/diaeresis -> shift 495 * want to be able to hit circumflex/diaeresis -> shift
496 * to type in shifted circumflex/diaeresis chars. 496 * to type in shifted circumflex/diaeresis chars.
497 * same thing with meta 497 * same thing with meta
498 498
499 if (meta) { *meta = 0; meta = 0; } 499 if (meta) { *meta = 0; meta = 0; }
500 if (circumflex) { *circumflex = 0; circumflex = 0; } 500 if (circumflex) { *circumflex = 0; circumflex = 0; }
501 if (diaeresis) { *diaeresis = 0; diaeresis = 0; } 501 if (diaeresis) { *diaeresis = 0; diaeresis = 0; }
502 502
503 */ 503 */
504 504
505 } else if (qkeycode == Qt::Key_CapsLock) { 505 } else if (qkeycode == Qt::Key_CapsLock) {
506 need_repaint = TRUE; 506 need_repaint = TRUE;
507 507
508 if (lock) { 508 if (lock) {
509 *lock = 0; 509 *lock = 0;
510 lock = 0; 510 lock = 0;
511 } 511 }
512 else { 512 else {
513 lock = keys->pressedPtr(row, col);; 513 lock = keys->pressedPtr(row, col);;
514 *lock = true;; 514 *lock = true;;
515 if (shift) { 515 if (shift) {
516 *shift = 0; 516 *shift = 0;
517 shift = 0; 517 shift = 0;
518 } 518 }
519 } 519 }
520 520
521 /* 521 /*
522 if (meta) { *meta = 0; meta = 0; } 522 if (meta) { *meta = 0; meta = 0; }
523 if (circumflex) { *circumflex = 0; circumflex = 0; } 523 if (circumflex) { *circumflex = 0; circumflex = 0; }
524 if (diaeresis) { *diaeresis = 0; diaeresis = 0; } 524 if (diaeresis) { *diaeresis = 0; diaeresis = 0; }
525 */ 525 */
526 526
527 } else if (qkeycode == Qt::Key_Meta) { 527 } else if (qkeycode == Qt::Key_Meta) {
528 need_repaint = TRUE; 528 need_repaint = TRUE;
529 529
530 if (meta) { 530 if (meta) {
531 *meta = 0; 531 *meta = 0;
532 meta = 0; 532 meta = 0;
533 533
534 } else { 534 } else {
535 535
536 meta = keys->pressedPtr(row, col); 536 meta = keys->pressedPtr(row, col);
537 *meta = true; 537 *meta = true;
538 } 538 }
539 539
540 // reset all the other keys 540 // reset all the other keys
541 if (shift) { *shift = 0; shift = 0; } 541 if (shift) { *shift = 0; shift = 0; }
542 if (lock) { *lock = 0; lock = 0; } 542 if (lock) { *lock = 0; lock = 0; }
543 if (circumflex) { *circumflex = 0; circumflex = 0; } 543 if (circumflex) { *circumflex = 0; circumflex = 0; }
544 if (diaeresis) { *diaeresis = 0; diaeresis = 0; } 544 if (diaeresis) { *diaeresis = 0; diaeresis = 0; }
545 if (baccent) { *baccent = 0; baccent = 0; } 545 if (baccent) { *baccent = 0; baccent = 0; }
546 if (accent) { *accent = 0; accent = 0; } 546 if (accent) { *accent = 0; accent = 0; }
547 547
548 // dont need to emit this key... acts same as alt 548 // dont need to emit this key... acts same as alt
549 qkeycode = 0; 549 qkeycode = 0;
550 550
551 // circumflex 551 // circumflex
552 } else if (qkeycode == 0x2000) { 552 } else if (qkeycode == 0x2000) {
553 need_repaint = TRUE; 553 need_repaint = TRUE;
554 554
555 if (circumflex) { 555 if (circumflex) {
556 556
557 *circumflex = 0; 557 *circumflex = 0;
558 circumflex = 0; 558 circumflex = 0;
559 559
560 } else { 560 } else {
561 561
562 circumflex = keys->pressedPtr(row, col); 562 circumflex = keys->pressedPtr(row, col);
563 *circumflex = true; 563 *circumflex = true;
564 } 564 }
565 565
566 /* no need to turn off shift or lock if circumflex 566 /* no need to turn off shift or lock if circumflex
567 * keys are pressed 567 * keys are pressed
568 568
569 if (shift) { *shift = 0; shift = 0; } 569 if (shift) { *shift = 0; shift = 0; }
570 if (lock) { *lock = 0; lock = 0; } 570 if (lock) { *lock = 0; lock = 0; }
571 571
572 */ 572 */
573 573
574 // have to reset all the other keys 574 // have to reset all the other keys
575 if (meta) { *meta = 0; meta = 0; } 575 if (meta) { *meta = 0; meta = 0; }
576 if (diaeresis) { 576 if (diaeresis) {
577 577
578 // *diaeresis and *circumflex point to the same thing 578 // *diaeresis and *circumflex point to the same thing
579 // when diaeresis is enabled and you hit the circumflex 579 // when diaeresis is enabled and you hit the circumflex
580 // since they are the same key, it should turn off the 580 // since they are the same key, it should turn off the
581 // key 581 // key
582 582
583 *diaeresis = 0; 583 *diaeresis = 0;
584 diaeresis = 0; 584 diaeresis = 0;
585 circumflex = 0; 585 circumflex = 0;
586 } 586 }
587 587
588 qkeycode = 0; 588 qkeycode = 0;
589 589
590 // diaeresis 590 // diaeresis
591 } else if (qkeycode == 0x2001) { 591 } else if (qkeycode == 0x2001) {
592 need_repaint = TRUE; 592 need_repaint = TRUE;
593 593
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}