author | mickeyl <mickeyl> | 2005-02-01 20:15:54 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-02-01 20:15:54 (UTC) |
commit | ef4a5ca1b376158bfc26b832333c6908e35d181b (patch) (unidiff) | |
tree | bc4d1cb21b594d1abde2e1ab4a361e8b8c88bb62 | |
parent | 62aad63f824740f15357c28e6bb61fbdf2120585 (diff) | |
download | opie-ef4a5ca1b376158bfc26b832333c6908e35d181b.zip opie-ef4a5ca1b376158bfc26b832333c6908e35d181b.tar.gz opie-ef4a5ca1b376158bfc26b832333c6908e35d181b.tar.bz2 |
add C7x0 Mail key that has been forgotten since ages :)
-rw-r--r-- | libopie2/opiecore/device/odevice_zaurus.cpp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/libopie2/opiecore/device/odevice_zaurus.cpp b/libopie2/opiecore/device/odevice_zaurus.cpp index 59f1592..780d130 100644 --- a/libopie2/opiecore/device/odevice_zaurus.cpp +++ b/libopie2/opiecore/device/odevice_zaurus.cpp | |||
@@ -1,354 +1,358 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> | 3 | Copyright (C) The Opie Team <opie-devel@handhelds.org> |
4 | =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 4 | =. Copyright (C) 2003-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "odevice_zaurus.h" | 30 | #include "odevice_zaurus.h" |
31 | 31 | ||
32 | /* QT */ | 32 | /* QT */ |
33 | #include <qapplication.h> | 33 | #include <qapplication.h> |
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
36 | #include <qwindowsystem_qws.h> | 36 | #include <qwindowsystem_qws.h> |
37 | 37 | ||
38 | /* OPIE */ | 38 | /* OPIE */ |
39 | #include <qpe/config.h> | 39 | #include <qpe/config.h> |
40 | #include <qpe/resource.h> | 40 | #include <qpe/resource.h> |
41 | #include <qpe/sound.h> | 41 | #include <qpe/sound.h> |
42 | #include <qpe/qcopenvelope_qws.h> | 42 | #include <qpe/qcopenvelope_qws.h> |
43 | 43 | ||
44 | /* STD */ | 44 | /* STD */ |
45 | #include <fcntl.h> | 45 | #include <fcntl.h> |
46 | #include <math.h> | 46 | #include <math.h> |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> |
48 | #include <signal.h> | 48 | #include <signal.h> |
49 | #include <sys/ioctl.h> | 49 | #include <sys/ioctl.h> |
50 | #include <sys/time.h> | 50 | #include <sys/time.h> |
51 | #include <unistd.h> | 51 | #include <unistd.h> |
52 | #ifndef QT_NO_SOUND | 52 | #ifndef QT_NO_SOUND |
53 | #include <linux/soundcard.h> | 53 | #include <linux/soundcard.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | using namespace Opie::Core; | 56 | using namespace Opie::Core; |
57 | using namespace Opie::Core::Internal; | 57 | using namespace Opie::Core::Internal; |
58 | 58 | ||
59 | struct z_button z_buttons [] = { | 59 | struct z_button z_buttons [] = { |
60 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 60 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
61 | "devicebuttons/z_calendar", | 61 | "devicebuttons/z_calendar", |
62 | "datebook", "nextView()", | 62 | "datebook", "nextView()", |
63 | "today", "raise()" }, | 63 | "today", "raise()" }, |
64 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 64 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
65 | "devicebuttons/z_contact", | 65 | "devicebuttons/z_contact", |
66 | "addressbook", "raise()", | 66 | "addressbook", "raise()", |
67 | "addressbook", "beamBusinessCard()" }, | 67 | "addressbook", "beamBusinessCard()" }, |
68 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 68 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
69 | "devicebuttons/z_home", | 69 | "devicebuttons/z_home", |
70 | "QPE/Launcher", "home()", | 70 | "QPE/Launcher", "home()", |
71 | "buttonsettings", "raise()" }, | 71 | "buttonsettings", "raise()" }, |
72 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 72 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
73 | "devicebuttons/z_menu", | 73 | "devicebuttons/z_menu", |
74 | "QPE/TaskBar", "toggleMenu()", | 74 | "QPE/TaskBar", "toggleMenu()", |
75 | "QPE/TaskBar", "toggleStartMenu()" }, | 75 | "QPE/TaskBar", "toggleStartMenu()" }, |
76 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 76 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
77 | "devicebuttons/z_mail", | 77 | "devicebuttons/z_mail", |
78 | "opiemail", "raise()", | 78 | "opiemail", "raise()", |
79 | "opiemail", "newMail()" }, | 79 | "opiemail", "newMail()" }, |
80 | }; | 80 | }; |
81 | 81 | ||
82 | struct z_button z_buttons_c700 [] = { | 82 | struct z_button z_buttons_c700 [] = { |
83 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 83 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
84 | "devicebuttons/z_calendar", | 84 | "devicebuttons/z_calendar", |
85 | "datebook", "nextView()", | 85 | "datebook", "nextView()", |
86 | "today", "raise()" }, | 86 | "today", "raise()" }, |
87 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 87 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
88 | "devicebuttons/z_contact", | 88 | "devicebuttons/z_contact", |
89 | "addressbook", "raise()", | 89 | "addressbook", "raise()", |
90 | "addressbook", "beamBusinessCard()" }, | 90 | "addressbook", "beamBusinessCard()" }, |
91 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 91 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
92 | "devicebuttons/z_home", | 92 | "devicebuttons/z_home", |
93 | "QPE/Launcher", "home()", | 93 | "QPE/Launcher", "home()", |
94 | "buttonsettings", "raise()" }, | 94 | "buttonsettings", "raise()" }, |
95 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 95 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
96 | "devicebuttons/z_menu", | 96 | "devicebuttons/z_menu", |
97 | "QPE/TaskBar", "toggleMenu()", | 97 | "QPE/TaskBar", "toggleMenu()", |
98 | "QPE/TaskBar", "toggleStartMenu()" }, | 98 | "QPE/TaskBar", "toggleStartMenu()" }, |
99 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | ||
100 | "devicebuttons/z_mail", | ||
101 | "opiemail", "raise()", | ||
102 | "opiemail", "newMail()" }, | ||
99 | { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), | 103 | { Qt::Key_F14, QT_TRANSLATE_NOOP("Button", "Display Rotate"), |
100 | "devicebuttons/z_hinge", | 104 | "devicebuttons/z_hinge", |
101 | "QPE/Rotation", "rotateDefault()", | 105 | "QPE/Rotation", "rotateDefault()", |
102 | "QPE/Dummy", "doNothing()" }, | 106 | "QPE/Dummy", "doNothing()" }, |
103 | }; | 107 | }; |
104 | 108 | ||
105 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus | 109 | // FIXME This gets unnecessary complicated. We should think about splitting the Zaurus |
106 | // class up into individual classes. We need three classes | 110 | // class up into individual classes. We need three classes |
107 | // | 111 | // |
108 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) | 112 | // Zaurus-Collie (SA-model w/ 320x240 lcd, for SL5500 and SL5000) |
109 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) | 113 | // Zaurus-Poodle (PXA-model w/ 320x240 lcd, for SL5600) |
110 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) | 114 | // Zaurus-Corgi (PXA-model w/ 640x480 lcd, for C700, C750, C760, C860, C3000) |
111 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) | 115 | // Zaurus-Tosa (PXA-model w/ 480x640 lcd, for SL6000) |
112 | // | 116 | // |
113 | // Only question right now is: Do we really need to do it? Because as soon | 117 | // Only question right now is: Do we really need to do it? Because as soon |
114 | // as the OpenZaurus kernel is ready, there will be a unified interface for all | 118 | // as the OpenZaurus kernel is ready, there will be a unified interface for all |
115 | // Zaurus models (concerning apm, backlight, buttons, etc.) | 119 | // Zaurus models (concerning apm, backlight, buttons, etc.) |
116 | // | 120 | // |
117 | // Comments? - mickeyl. | 121 | // Comments? - mickeyl. |
118 | 122 | ||
119 | void Zaurus::init(const QString& cpu_info) | 123 | void Zaurus::init(const QString& cpu_info) |
120 | { | 124 | { |
121 | // generic distribution code already scanned /etc/issue at that point - | 125 | // generic distribution code already scanned /etc/issue at that point - |
122 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" | 126 | // embedix releases contain "Embedix <version> | Linux for Embedded Devices" |
123 | if ( d->m_sysverstr.contains( "embedix", false ) ) | 127 | if ( d->m_sysverstr.contains( "embedix", false ) ) |
124 | { | 128 | { |
125 | d->m_vendorstr = "Sharp"; | 129 | d->m_vendorstr = "Sharp"; |
126 | d->m_vendor = Vendor_Sharp; | 130 | d->m_vendor = Vendor_Sharp; |
127 | d->m_systemstr = "Zaurus"; | 131 | d->m_systemstr = "Zaurus"; |
128 | d->m_system = System_Zaurus; | 132 | d->m_system = System_Zaurus; |
129 | m_embedix = true; | 133 | m_embedix = true; |
130 | } | 134 | } |
131 | else | 135 | else |
132 | { | 136 | { |
133 | d->m_vendorstr = "OpenZaurus Team"; | 137 | d->m_vendorstr = "OpenZaurus Team"; |
134 | d->m_systemstr = "OpenZaurus"; | 138 | d->m_systemstr = "OpenZaurus"; |
135 | d->m_system = System_OpenZaurus; | 139 | d->m_system = System_OpenZaurus; |
136 | // sysver already gathered | 140 | // sysver already gathered |
137 | 141 | ||
138 | // OpenZaurus sometimes uses the embedix kernel, check if this is one | 142 | // OpenZaurus sometimes uses the embedix kernel, check if this is one |
139 | FILE *uname = popen("uname -r", "r"); | 143 | FILE *uname = popen("uname -r", "r"); |
140 | QFile f; | 144 | QFile f; |
141 | QString line; | 145 | QString line; |
142 | if ( f.open(IO_ReadOnly, uname) ) { | 146 | if ( f.open(IO_ReadOnly, uname) ) { |
143 | QTextStream ts ( &f ); | 147 | QTextStream ts ( &f ); |
144 | line = ts. readLine(); | 148 | line = ts. readLine(); |
145 | int loc = line. find ( "embedix" ); | 149 | int loc = line. find ( "embedix" ); |
146 | if ( loc != -1 ) | 150 | if ( loc != -1 ) |
147 | m_embedix = true; | 151 | m_embedix = true; |
148 | else | 152 | else |
149 | m_embedix = false; | 153 | m_embedix = false; |
150 | f.close(); | 154 | f.close(); |
151 | } | 155 | } |
152 | pclose(uname); | 156 | pclose(uname); |
153 | } | 157 | } |
154 | 158 | ||
155 | // check the Zaurus model | 159 | // check the Zaurus model |
156 | QString model; | 160 | QString model; |
157 | int loc = cpu_info.find( ":" ); | 161 | int loc = cpu_info.find( ":" ); |
158 | if ( loc != -1 ) | 162 | if ( loc != -1 ) |
159 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); | 163 | model = cpu_info.mid( loc+2 ).simplifyWhiteSpace(); |
160 | else | 164 | else |
161 | model = cpu_info; | 165 | model = cpu_info; |
162 | 166 | ||
163 | if ( model == "SHARP Corgi" ) { | 167 | if ( model == "SHARP Corgi" ) { |
164 | d->m_model = Model_Zaurus_SLC7x0; | 168 | d->m_model = Model_Zaurus_SLC7x0; |
165 | d->m_modelstr = "Zaurus SL-C700"; | 169 | d->m_modelstr = "Zaurus SL-C700"; |
166 | } else if ( model == "SHARP Shepherd" ) { | 170 | } else if ( model == "SHARP Shepherd" ) { |
167 | d->m_model = Model_Zaurus_SLC7x0; | 171 | d->m_model = Model_Zaurus_SLC7x0; |
168 | d->m_modelstr = "Zaurus SL-C750"; | 172 | d->m_modelstr = "Zaurus SL-C750"; |
169 | } else if ( model == "SHARP Husky" ) { | 173 | } else if ( model == "SHARP Husky" ) { |
170 | d->m_model = Model_Zaurus_SLC7x0; | 174 | d->m_model = Model_Zaurus_SLC7x0; |
171 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 175 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
172 | } else if ( model == "SHARP Boxer" ) { | 176 | } else if ( model == "SHARP Boxer" ) { |
173 | d->m_model = Model_Zaurus_SLC7x0; | 177 | d->m_model = Model_Zaurus_SLC7x0; |
174 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; | 178 | d->m_modelstr = "Zaurus SL-C760 or SL-C860"; |
175 | } else if ( model == "SHARP Poodle" ) { | 179 | } else if ( model == "SHARP Poodle" ) { |
176 | d->m_model = Model_Zaurus_SLB600; | 180 | d->m_model = Model_Zaurus_SLB600; |
177 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; | 181 | d->m_modelstr = "Zaurus SL-B500 or SL-5600"; |
178 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { | 182 | } else if ( model == "Sharp-Collie" || model == "Collie" ) { |
179 | d->m_model = Model_Zaurus_SL5500; | 183 | d->m_model = Model_Zaurus_SL5500; |
180 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; | 184 | d->m_modelstr = "Zaurus SL-5500 or SL-5000d"; |
181 | } else if ( model == "SHARP Tosa" ) { | 185 | } else if ( model == "SHARP Tosa" ) { |
182 | d->m_model = Model_Zaurus_SL6000; | 186 | d->m_model = Model_Zaurus_SL6000; |
183 | d->m_modelstr = "Zaurus SL-6000"; | 187 | d->m_modelstr = "Zaurus SL-6000"; |
184 | } else if ( model == "SHARP Spitz" ) { | 188 | } else if ( model == "SHARP Spitz" ) { |
185 | d->m_model = Model_Zaurus_SLC3000; | 189 | d->m_model = Model_Zaurus_SLC3000; |
186 | d->m_modelstr = "Zaurus SL-C3000"; | 190 | d->m_modelstr = "Zaurus SL-C3000"; |
187 | } else { | 191 | } else { |
188 | d->m_model = Model_Zaurus_SL5500; | 192 | d->m_model = Model_Zaurus_SL5500; |
189 | d->m_modelstr = "Unknown Zaurus"; | 193 | d->m_modelstr = "Unknown Zaurus"; |
190 | } | 194 | } |
191 | 195 | ||
192 | // set initial rotation | 196 | // set initial rotation |
193 | switch( d->m_model ) { | 197 | switch( d->m_model ) { |
194 | case Model_Zaurus_SL6000: // fallthrough | 198 | case Model_Zaurus_SL6000: // fallthrough |
195 | case Model_Zaurus_SLA300: | 199 | case Model_Zaurus_SLA300: |
196 | d->m_rotation = Rot0; | 200 | d->m_rotation = Rot0; |
197 | break; | 201 | break; |
198 | case Model_Zaurus_SLC3000: // fallthrough | 202 | case Model_Zaurus_SLC3000: // fallthrough |
199 | case Model_Zaurus_SLC7x0: | 203 | case Model_Zaurus_SLC7x0: |
200 | d->m_rotation = rotation(); | 204 | d->m_rotation = rotation(); |
201 | d->m_direction = direction(); | 205 | d->m_direction = direction(); |
202 | break; | 206 | break; |
203 | case Model_Zaurus_SLB600: // fallthrough | 207 | case Model_Zaurus_SLB600: // fallthrough |
204 | case Model_Zaurus_SL5000: // fallthrough | 208 | case Model_Zaurus_SL5000: // fallthrough |
205 | case Model_Zaurus_SL5500: // fallthrough | 209 | case Model_Zaurus_SL5500: // fallthrough |
206 | default: | 210 | default: |
207 | d->m_rotation = Rot270; | 211 | d->m_rotation = Rot270; |
208 | break; | 212 | break; |
209 | } | 213 | } |
210 | m_leds[0] = Led_Off; | 214 | m_leds[0] = Led_Off; |
211 | 215 | ||
212 | if ( m_embedix ) | 216 | if ( m_embedix ) |
213 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); | 217 | qDebug( "Zaurus::init() - Using the Embedix HAL on a %s", (const char*) d->m_modelstr ); |
214 | else | 218 | else |
215 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); | 219 | qDebug( "Zaurus::init() - Using the OpenZaurus HAL on a %s", (const char*) d->m_modelstr ); |
216 | } | 220 | } |
217 | 221 | ||
218 | void Zaurus::initButtons() | 222 | void Zaurus::initButtons() |
219 | { | 223 | { |
220 | if ( d->m_buttons ) | 224 | if ( d->m_buttons ) |
221 | return; | 225 | return; |
222 | 226 | ||
223 | d->m_buttons = new QValueList <ODeviceButton>; | 227 | d->m_buttons = new QValueList <ODeviceButton>; |
224 | 228 | ||
225 | struct z_button * pz_buttons; | 229 | struct z_button * pz_buttons; |
226 | int buttoncount; | 230 | int buttoncount; |
227 | switch ( d->m_model ) { | 231 | switch ( d->m_model ) { |
228 | case Model_Zaurus_SLC3000: // fallthrough | 232 | case Model_Zaurus_SLC3000: // fallthrough |
229 | case Model_Zaurus_SLC7x0: | 233 | case Model_Zaurus_SLC7x0: |
230 | pz_buttons = z_buttons_c700; | 234 | pz_buttons = z_buttons_c700; |
231 | buttoncount = ARRAY_SIZE(z_buttons_c700); | 235 | buttoncount = ARRAY_SIZE(z_buttons_c700); |
232 | break; | 236 | break; |
233 | default: | 237 | default: |
234 | pz_buttons = z_buttons; | 238 | pz_buttons = z_buttons; |
235 | buttoncount = ARRAY_SIZE(z_buttons); | 239 | buttoncount = ARRAY_SIZE(z_buttons); |
236 | break; | 240 | break; |
237 | } | 241 | } |
238 | 242 | ||
239 | for ( int i = 0; i < buttoncount; i++ ) { | 243 | for ( int i = 0; i < buttoncount; i++ ) { |
240 | struct z_button *zb = pz_buttons + i; | 244 | struct z_button *zb = pz_buttons + i; |
241 | ODeviceButton b; | 245 | ODeviceButton b; |
242 | 246 | ||
243 | b.setKeycode( zb->code ); | 247 | b.setKeycode( zb->code ); |
244 | b.setUserText( QObject::tr( "Button", zb->utext )); | 248 | b.setUserText( QObject::tr( "Button", zb->utext )); |
245 | b.setPixmap( Resource::loadPixmap( zb->pix )); | 249 | b.setPixmap( Resource::loadPixmap( zb->pix )); |
246 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); | 250 | b.setFactoryPresetPressedAction( OQCopMessage( makeChannel ( zb->fpressedservice ), zb->fpressedaction )); |
247 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); | 251 | b.setFactoryPresetHeldAction( OQCopMessage( makeChannel ( zb->fheldservice ), zb->fheldaction )); |
248 | d->m_buttons->append( b ); | 252 | d->m_buttons->append( b ); |
249 | } | 253 | } |
250 | 254 | ||
251 | reloadButtonMapping(); | 255 | reloadButtonMapping(); |
252 | } | 256 | } |
253 | 257 | ||
254 | 258 | ||
255 | 259 | ||
256 | typedef struct sharp_led_status { | 260 | typedef struct sharp_led_status { |
257 | int which; /* select which LED status is wanted. */ | 261 | int which; /* select which LED status is wanted. */ |
258 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ | 262 | int status; /* set new led status if you call SHARP_LED_SETSTATUS */ |
259 | } sharp_led_status; | 263 | } sharp_led_status; |
260 | 264 | ||
261 | void Zaurus::buzzer( int sound ) | 265 | void Zaurus::buzzer( int sound ) |
262 | { | 266 | { |
263 | #ifndef QT_NO_SOUND | 267 | #ifndef QT_NO_SOUND |
264 | Sound *snd = 0; | 268 | Sound *snd = 0; |
265 | 269 | ||
266 | // All devices except SL5500 have a DSP device | 270 | // All devices except SL5500 have a DSP device |
267 | if ( d->m_model != Model_Zaurus_SL5000 | 271 | if ( d->m_model != Model_Zaurus_SL5000 |
268 | && d->m_model != Model_Zaurus_SL5500 ) { | 272 | && d->m_model != Model_Zaurus_SL5500 ) { |
269 | 273 | ||
270 | switch ( sound ){ | 274 | switch ( sound ){ |
271 | case SHARP_BUZ_TOUCHSOUND: { | 275 | case SHARP_BUZ_TOUCHSOUND: { |
272 | static Sound touch_sound("touchsound"); | 276 | static Sound touch_sound("touchsound"); |
273 | snd = &touch_sound; | 277 | snd = &touch_sound; |
274 | } | 278 | } |
275 | break; | 279 | break; |
276 | case SHARP_BUZ_KEYSOUND: { | 280 | case SHARP_BUZ_KEYSOUND: { |
277 | static Sound key_sound( "keysound" ); | 281 | static Sound key_sound( "keysound" ); |
278 | snd = &key_sound; | 282 | snd = &key_sound; |
279 | } | 283 | } |
280 | break; | 284 | break; |
281 | case SHARP_BUZ_SCHEDULE_ALARM: | 285 | case SHARP_BUZ_SCHEDULE_ALARM: |
282 | default: { | 286 | default: { |
283 | static Sound alarm_sound("alarm"); | 287 | static Sound alarm_sound("alarm"); |
284 | snd = &alarm_sound; | 288 | snd = &alarm_sound; |
285 | } | 289 | } |
286 | break; | 290 | break; |
287 | } | 291 | } |
288 | } | 292 | } |
289 | 293 | ||
290 | // If a soundname is defined, we expect that this device has | 294 | // If a soundname is defined, we expect that this device has |
291 | // sound capabilities.. Otherwise we expect to have the buzzer | 295 | // sound capabilities.. Otherwise we expect to have the buzzer |
292 | // device.. | 296 | // device.. |
293 | if ( snd && snd->isFinished() ){ | 297 | if ( snd && snd->isFinished() ){ |
294 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); | 298 | changeMixerForAlarm( 0, "/dev/sound/mixer", snd ); |
295 | snd->play(); | 299 | snd->play(); |
296 | } else if( !snd ) { | 300 | } else if( !snd ) { |
297 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); | 301 | int fd = ::open ( "/dev/sharp_buz", O_WRONLY|O_NONBLOCK ); |
298 | 302 | ||
299 | if ( fd >= 0 ) { | 303 | if ( fd >= 0 ) { |
300 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); | 304 | ::ioctl ( fd, SHARP_BUZZER_MAKESOUND, sound ); |
301 | ::close ( fd ); | 305 | ::close ( fd ); |
302 | } | 306 | } |
303 | 307 | ||
304 | } | 308 | } |
305 | #endif | 309 | #endif |
306 | } | 310 | } |
307 | 311 | ||
308 | 312 | ||
309 | void Zaurus::playAlarmSound() | 313 | void Zaurus::playAlarmSound() |
310 | { | 314 | { |
311 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); | 315 | buzzer( SHARP_BUZ_SCHEDULE_ALARM ); |
312 | } | 316 | } |
313 | 317 | ||
314 | void Zaurus::playTouchSound() | 318 | void Zaurus::playTouchSound() |
315 | { | 319 | { |
316 | buzzer( SHARP_BUZ_TOUCHSOUND ); | 320 | buzzer( SHARP_BUZ_TOUCHSOUND ); |
317 | } | 321 | } |
318 | 322 | ||
319 | void Zaurus::playKeySound() | 323 | void Zaurus::playKeySound() |
320 | { | 324 | { |
321 | buzzer( SHARP_BUZ_KEYSOUND ); | 325 | buzzer( SHARP_BUZ_KEYSOUND ); |
322 | } | 326 | } |
323 | 327 | ||
324 | 328 | ||
325 | QValueList <OLed> Zaurus::ledList() const | 329 | QValueList <OLed> Zaurus::ledList() const |
326 | { | 330 | { |
327 | QValueList <OLed> vl; | 331 | QValueList <OLed> vl; |
328 | vl << Led_Mail; | 332 | vl << Led_Mail; |
329 | return vl; | 333 | return vl; |
330 | } | 334 | } |
331 | 335 | ||
332 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const | 336 | QValueList <OLedState> Zaurus::ledStateList( OLed l ) const |
333 | { | 337 | { |
334 | QValueList <OLedState> vl; | 338 | QValueList <OLedState> vl; |
335 | 339 | ||
336 | if ( l == Led_Mail ) | 340 | if ( l == Led_Mail ) |
337 | vl << Led_Off << Led_On << Led_BlinkSlow; | 341 | vl << Led_Off << Led_On << Led_BlinkSlow; |
338 | return vl; | 342 | return vl; |
339 | } | 343 | } |
340 | 344 | ||
341 | OLedState Zaurus::ledState( OLed which ) const | 345 | OLedState Zaurus::ledState( OLed which ) const |
342 | { | 346 | { |
343 | if ( which == Led_Mail ) | 347 | if ( which == Led_Mail ) |
344 | return m_leds [0]; | 348 | return m_leds [0]; |
345 | else | 349 | else |
346 | return Led_Off; | 350 | return Led_Off; |
347 | } | 351 | } |
348 | 352 | ||
349 | bool Zaurus::setLedState( OLed which, OLedState st ) | 353 | bool Zaurus::setLedState( OLed which, OLedState st ) |
350 | { | 354 | { |
351 | // Currently not supported on non_embedix kernels | 355 | // Currently not supported on non_embedix kernels |
352 | if (!m_embedix) | 356 | if (!m_embedix) |
353 | { | 357 | { |
354 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); | 358 | qDebug( "Zaurus::setLedState: ODevice handling for non-embedix kernels not yet implemented" ); |