author | kergoth <kergoth> | 2003-01-26 20:27:10 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2003-01-26 20:27:10 (UTC) |
commit | 4ce67fbdfb5e82bbde3a8963d3e956567438689d (patch) (unidiff) | |
tree | e35167d7c0d16aa462b336cd4aa4cba64c292892 | |
parent | 06d7d61516ee27b60c39453ef61215708aa3468a (diff) | |
download | opie-4ce67fbdfb5e82bbde3a8963d3e956567438689d.zip opie-4ce67fbdfb5e82bbde3a8963d3e956567438689d.tar.gz opie-4ce67fbdfb5e82bbde3a8963d3e956567438689d.tar.bz2 |
None->Rot0 name for transformation enum, as it stomped on someone elses None ;)
-rw-r--r-- | libopie/odevice.cpp | 2 | ||||
-rw-r--r-- | library/qpeapplication.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp index 78eb416..9e97c56 100644 --- a/libopie/odevice.cpp +++ b/libopie/odevice.cpp | |||
@@ -126,257 +126,257 @@ protected: | |||
126 | virtual void buzzer ( int snd ); | 126 | virtual void buzzer ( int snd ); |
127 | 127 | ||
128 | OLedState m_leds [1]; | 128 | OLedState m_leds [1]; |
129 | }; | 129 | }; |
130 | 130 | ||
131 | 131 | ||
132 | struct i_button { | 132 | struct i_button { |
133 | uint model; | 133 | uint model; |
134 | Qt::Key code; | 134 | Qt::Key code; |
135 | char *utext; | 135 | char *utext; |
136 | char *pix; | 136 | char *pix; |
137 | char *fpressedservice; | 137 | char *fpressedservice; |
138 | char *fpressedaction; | 138 | char *fpressedaction; |
139 | char *fheldservice; | 139 | char *fheldservice; |
140 | char *fheldaction; | 140 | char *fheldaction; |
141 | } ipaq_buttons [] = { | 141 | } ipaq_buttons [] = { |
142 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 142 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
143 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 143 | Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
144 | "devicebuttons/ipaq_calendar", | 144 | "devicebuttons/ipaq_calendar", |
145 | "datebook", "nextView()", | 145 | "datebook", "nextView()", |
146 | "today", "raise()" }, | 146 | "today", "raise()" }, |
147 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 147 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
148 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 148 | Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
149 | "devicebuttons/ipaq_contact", | 149 | "devicebuttons/ipaq_contact", |
150 | "addressbook", "raise()", | 150 | "addressbook", "raise()", |
151 | "addressbook", "beamBusinessCard()" }, | 151 | "addressbook", "beamBusinessCard()" }, |
152 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, | 152 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx, |
153 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 153 | Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
154 | "devicebuttons/ipaq_menu", | 154 | "devicebuttons/ipaq_menu", |
155 | "QPE/TaskBar", "toggleMenu()", | 155 | "QPE/TaskBar", "toggleMenu()", |
156 | "QPE/TaskBar", "toggleStartMenu()" }, | 156 | "QPE/TaskBar", "toggleStartMenu()" }, |
157 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 157 | { Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
158 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 158 | Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
159 | "devicebuttons/ipaq_mail", | 159 | "devicebuttons/ipaq_mail", |
160 | "mail", "raise()", | 160 | "mail", "raise()", |
161 | "mail", "newMail()" }, | 161 | "mail", "newMail()" }, |
162 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 162 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
163 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 163 | Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
164 | "devicebuttons/ipaq_home", | 164 | "devicebuttons/ipaq_home", |
165 | "QPE/Launcher", "home()", | 165 | "QPE/Launcher", "home()", |
166 | "buttonsettings", "raise()" }, | 166 | "buttonsettings", "raise()" }, |
167 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, | 167 | { Model_iPAQ_H31xx | Model_iPAQ_H36xx | Model_iPAQ_H37xx | Model_iPAQ_H38xx | Model_iPAQ_H39xx, |
168 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), | 168 | Qt::Key_F24, QT_TRANSLATE_NOOP("Button", "Record Button"), |
169 | "devicebuttons/ipaq_record", | 169 | "devicebuttons/ipaq_record", |
170 | "QPE/VMemo", "toggleRecord()", | 170 | "QPE/VMemo", "toggleRecord()", |
171 | "sound", "raise()" }, | 171 | "sound", "raise()" }, |
172 | }; | 172 | }; |
173 | 173 | ||
174 | struct z_button { | 174 | struct z_button { |
175 | Qt::Key code; | 175 | Qt::Key code; |
176 | char *utext; | 176 | char *utext; |
177 | char *pix; | 177 | char *pix; |
178 | char *fpressedservice; | 178 | char *fpressedservice; |
179 | char *fpressedaction; | 179 | char *fpressedaction; |
180 | char *fheldservice; | 180 | char *fheldservice; |
181 | char *fheldaction; | 181 | char *fheldaction; |
182 | } z_buttons [] = { | 182 | } z_buttons [] = { |
183 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), | 183 | { Qt::Key_F9, QT_TRANSLATE_NOOP("Button", "Calendar Button"), |
184 | "devicebuttons/z_calendar", | 184 | "devicebuttons/z_calendar", |
185 | "datebook", "nextView()", | 185 | "datebook", "nextView()", |
186 | "today", "raise()" }, | 186 | "today", "raise()" }, |
187 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), | 187 | { Qt::Key_F10, QT_TRANSLATE_NOOP("Button", "Contacts Button"), |
188 | "devicebuttons/z_contact", | 188 | "devicebuttons/z_contact", |
189 | "addressbook", "raise()", | 189 | "addressbook", "raise()", |
190 | "addressbook", "beamBusinessCard()" }, | 190 | "addressbook", "beamBusinessCard()" }, |
191 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), | 191 | { Qt::Key_F12, QT_TRANSLATE_NOOP("Button", "Home Button"), |
192 | "devicebuttons/z_home", | 192 | "devicebuttons/z_home", |
193 | "QPE/Launcher", "home()", | 193 | "QPE/Launcher", "home()", |
194 | "buttonsettings", "raise()" }, | 194 | "buttonsettings", "raise()" }, |
195 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), | 195 | { Qt::Key_F11, QT_TRANSLATE_NOOP("Button", "Menu Button"), |
196 | "devicebuttons/z_menu", | 196 | "devicebuttons/z_menu", |
197 | "QPE/TaskBar", "toggleMenu()", | 197 | "QPE/TaskBar", "toggleMenu()", |
198 | "QPE/TaskBar", "toggleStartMenu()" }, | 198 | "QPE/TaskBar", "toggleStartMenu()" }, |
199 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), | 199 | { Qt::Key_F13, QT_TRANSLATE_NOOP("Button", "Mail Button"), |
200 | "devicebuttons/z_mail", | 200 | "devicebuttons/z_mail", |
201 | "mail", "raise()", | 201 | "mail", "raise()", |
202 | "mail", "newMail()" }, | 202 | "mail", "newMail()" }, |
203 | }; | 203 | }; |
204 | 204 | ||
205 | static QCString makeChannel ( const char *str ) | 205 | static QCString makeChannel ( const char *str ) |
206 | { | 206 | { |
207 | if ( str && !::strchr ( str, '/' )) | 207 | if ( str && !::strchr ( str, '/' )) |
208 | return QCString ( "QPE/Application/" ) + str; | 208 | return QCString ( "QPE/Application/" ) + str; |
209 | else | 209 | else |
210 | return str; | 210 | return str; |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
214 | 214 | ||
215 | 215 | ||
216 | ODevice *ODevice::inst ( ) | 216 | ODevice *ODevice::inst ( ) |
217 | { | 217 | { |
218 | static ODevice *dev = 0; | 218 | static ODevice *dev = 0; |
219 | 219 | ||
220 | if ( !dev ) { | 220 | if ( !dev ) { |
221 | if ( QFile::exists ( "/proc/hal/model" )) | 221 | if ( QFile::exists ( "/proc/hal/model" )) |
222 | dev = new iPAQ ( ); | 222 | dev = new iPAQ ( ); |
223 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) | 223 | else if ( QFile::exists ( "/dev/sharp_buz" ) || QFile::exists ( "/dev/sharp_led" )) |
224 | dev = new Zaurus ( ); | 224 | dev = new Zaurus ( ); |
225 | else | 225 | else |
226 | dev = new ODevice ( ); | 226 | dev = new ODevice ( ); |
227 | 227 | ||
228 | dev-> init ( ); | 228 | dev-> init ( ); |
229 | } | 229 | } |
230 | return dev; | 230 | return dev; |
231 | } | 231 | } |
232 | 232 | ||
233 | 233 | ||
234 | /************************************************** | 234 | /************************************************** |
235 | * | 235 | * |
236 | * common | 236 | * common |
237 | * | 237 | * |
238 | **************************************************/ | 238 | **************************************************/ |
239 | 239 | ||
240 | 240 | ||
241 | ODevice::ODevice ( ) | 241 | ODevice::ODevice ( ) |
242 | { | 242 | { |
243 | d = new ODeviceData; | 243 | d = new ODeviceData; |
244 | 244 | ||
245 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; | 245 | d-> m_qwsserver = qApp ? ( qApp-> type ( ) == QApplication::GuiServer ) : false; |
246 | 246 | ||
247 | d-> m_modelstr = "Unknown"; | 247 | d-> m_modelstr = "Unknown"; |
248 | d-> m_model = Model_Unknown; | 248 | d-> m_model = Model_Unknown; |
249 | d-> m_vendorstr = "Unknown"; | 249 | d-> m_vendorstr = "Unknown"; |
250 | d-> m_vendor = Vendor_Unknown; | 250 | d-> m_vendor = Vendor_Unknown; |
251 | d-> m_systemstr = "Unknown"; | 251 | d-> m_systemstr = "Unknown"; |
252 | d-> m_system = System_Unknown; | 252 | d-> m_system = System_Unknown; |
253 | d-> m_sysverstr = "0.0"; | 253 | d-> m_sysverstr = "0.0"; |
254 | d-> m_rotation = None; | 254 | d-> m_rotation = Rot0; |
255 | 255 | ||
256 | d-> m_holdtime = 1000; // 1000ms | 256 | d-> m_holdtime = 1000; // 1000ms |
257 | 257 | ||
258 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); | 258 | QCopChannel *sysch = new QCopChannel ( "QPE/System", this ); |
259 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); | 259 | connect ( sysch, SIGNAL( received( const QCString &, const QByteArray & )), this, SLOT( systemMessage ( const QCString &, const QByteArray & ))); |
260 | } | 260 | } |
261 | 261 | ||
262 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) | 262 | void ODevice::systemMessage ( const QCString &msg, const QByteArray & ) |
263 | { | 263 | { |
264 | if ( msg == "deviceButtonMappingChanged()" ) { | 264 | if ( msg == "deviceButtonMappingChanged()" ) { |
265 | reloadButtonMapping ( ); | 265 | reloadButtonMapping ( ); |
266 | } | 266 | } |
267 | } | 267 | } |
268 | 268 | ||
269 | void ODevice::init ( ) | 269 | void ODevice::init ( ) |
270 | { | 270 | { |
271 | // Simulation uses iPAQ 3660 device buttons | 271 | // Simulation uses iPAQ 3660 device buttons |
272 | 272 | ||
273 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { | 273 | for ( uint i = 0; i < ( sizeof( ipaq_buttons ) / sizeof( i_button )); i++ ) { |
274 | i_button *ib = ipaq_buttons + i; | 274 | i_button *ib = ipaq_buttons + i; |
275 | ODeviceButton b; | 275 | ODeviceButton b; |
276 | 276 | ||
277 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { | 277 | if (( ib-> model & Model_iPAQ_H36xx ) == Model_iPAQ_H36xx ) { |
278 | b. setKeycode ( ib-> code ); | 278 | b. setKeycode ( ib-> code ); |
279 | b. setUserText ( qApp-> translate ( "Button", ib-> utext )); | 279 | b. setUserText ( qApp-> translate ( "Button", ib-> utext )); |
280 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); | 280 | b. setPixmap ( Resource::loadPixmap ( ib-> pix )); |
281 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); | 281 | b. setFactoryPresetPressedAction ( OQCopMessage ( makeChannel ( ib-> fpressedservice ), ib-> fpressedaction )); |
282 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); | 282 | b. setFactoryPresetHeldAction ( OQCopMessage ( makeChannel ( ib-> fheldservice ), ib-> fheldaction )); |
283 | 283 | ||
284 | d-> m_buttons. append ( b ); | 284 | d-> m_buttons. append ( b ); |
285 | } | 285 | } |
286 | } | 286 | } |
287 | reloadButtonMapping ( ); | 287 | reloadButtonMapping ( ); |
288 | } | 288 | } |
289 | 289 | ||
290 | ODevice::~ODevice ( ) | 290 | ODevice::~ODevice ( ) |
291 | { | 291 | { |
292 | delete d; | 292 | delete d; |
293 | } | 293 | } |
294 | 294 | ||
295 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) | 295 | bool ODevice::setSoftSuspend ( bool /*soft*/ ) |
296 | { | 296 | { |
297 | return false; | 297 | return false; |
298 | } | 298 | } |
299 | 299 | ||
300 | //#include <linux/apm_bios.h> | 300 | //#include <linux/apm_bios.h> |
301 | 301 | ||
302 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) | 302 | #define APM_IOC_SUSPEND OD_IO( 'A', 2 ) |
303 | 303 | ||
304 | 304 | ||
305 | bool ODevice::suspend ( ) | 305 | bool ODevice::suspend ( ) |
306 | { | 306 | { |
307 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend | 307 | if ( !d-> m_qwsserver ) // only qwsserver is allowed to suspend |
308 | return false; | 308 | return false; |
309 | 309 | ||
310 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices | 310 | if ( d-> m_model == Model_Unknown ) // better don't suspend in qvfb / on unkown devices |
311 | return false; | 311 | return false; |
312 | 312 | ||
313 | bool res = false; | 313 | bool res = false; |
314 | 314 | ||
315 | struct timeval tvs, tvn; | 315 | struct timeval tvs, tvn; |
316 | ::gettimeofday ( &tvs, 0 ); | 316 | ::gettimeofday ( &tvs, 0 ); |
317 | 317 | ||
318 | ::sync ( ); // flush fs caches | 318 | ::sync ( ); // flush fs caches |
319 | res = ( ::system ( "apm --suspend" ) == 0 ); | 319 | res = ( ::system ( "apm --suspend" ) == 0 ); |
320 | 320 | ||
321 | // This is needed because the iPAQ apm implementation is asynchronous and we | 321 | // This is needed because the iPAQ apm implementation is asynchronous and we |
322 | // can not be sure when exactly the device is really suspended | 322 | // can not be sure when exactly the device is really suspended |
323 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. | 323 | // This can be deleted as soon as a stable familiar with a synchronous apm implementation exists. |
324 | 324 | ||
325 | if ( res ) { | 325 | if ( res ) { |
326 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed | 326 | do { // wait at most 1.5 sec: either suspend didn't work or the device resumed |
327 | ::usleep ( 200 * 1000 ); | 327 | ::usleep ( 200 * 1000 ); |
328 | ::gettimeofday ( &tvn, 0 ); | 328 | ::gettimeofday ( &tvn, 0 ); |
329 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); | 329 | } while ((( tvn. tv_sec - tvs. tv_sec ) * 1000 + ( tvn. tv_usec - tvs. tv_usec ) / 1000 ) < 1500 ); |
330 | } | 330 | } |
331 | 331 | ||
332 | return res; | 332 | return res; |
333 | } | 333 | } |
334 | 334 | ||
335 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... | 335 | //#include <linux/fb.h> better not rely on kernel headers in userspace ... |
336 | 336 | ||
337 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 | 337 | #define FBIOBLANK OD_IO( 'F', 0x11 ) // 0x4611 |
338 | 338 | ||
339 | /* VESA Blanking Levels */ | 339 | /* VESA Blanking Levels */ |
340 | #define VESA_NO_BLANKING 0 | 340 | #define VESA_NO_BLANKING 0 |
341 | #define VESA_VSYNC_SUSPEND 1 | 341 | #define VESA_VSYNC_SUSPEND 1 |
342 | #define VESA_HSYNC_SUSPEND 2 | 342 | #define VESA_HSYNC_SUSPEND 2 |
343 | #define VESA_POWERDOWN 3 | 343 | #define VESA_POWERDOWN 3 |
344 | 344 | ||
345 | 345 | ||
346 | bool ODevice::setDisplayStatus ( bool on ) | 346 | bool ODevice::setDisplayStatus ( bool on ) |
347 | { | 347 | { |
348 | if ( d-> m_model == Model_Unknown ) | 348 | if ( d-> m_model == Model_Unknown ) |
349 | return false; | 349 | return false; |
350 | 350 | ||
351 | bool res = false; | 351 | bool res = false; |
352 | int fd; | 352 | int fd; |
353 | 353 | ||
354 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { | 354 | if (( fd = ::open ( "/dev/fb0", O_RDWR )) >= 0 ) { |
355 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); | 355 | res = ( ::ioctl ( fd, FBIOBLANK, on ? VESA_NO_BLANKING : VESA_POWERDOWN ) == 0 ); |
356 | ::close ( fd ); | 356 | ::close ( fd ); |
357 | } | 357 | } |
358 | return res; | 358 | return res; |
359 | } | 359 | } |
360 | 360 | ||
361 | bool ODevice::setDisplayBrightness ( int ) | 361 | bool ODevice::setDisplayBrightness ( int ) |
362 | { | 362 | { |
363 | return false; | 363 | return false; |
364 | } | 364 | } |
365 | 365 | ||
366 | int ODevice::displayBrightnessResolution ( ) const | 366 | int ODevice::displayBrightnessResolution ( ) const |
367 | { | 367 | { |
368 | return 16; | 368 | return 16; |
369 | } | 369 | } |
370 | 370 | ||
371 | QString ODevice::vendorString ( ) const | 371 | QString ODevice::vendorString ( ) const |
372 | { | 372 | { |
373 | return d-> m_vendorstr; | 373 | return d-> m_vendorstr; |
374 | } | 374 | } |
375 | 375 | ||
376 | OVendor ODevice::vendor ( ) const | 376 | OVendor ODevice::vendor ( ) const |
377 | { | 377 | { |
378 | return d-> m_vendor; | 378 | return d-> m_vendor; |
379 | } | 379 | } |
380 | 380 | ||
381 | QString ODevice::modelString ( ) const | 381 | QString ODevice::modelString ( ) const |
382 | { | 382 | { |
diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 7505115..7f74510 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h | |||
@@ -32,157 +32,157 @@ | |||
32 | #include "timestring.h" | 32 | #include "timestring.h" |
33 | 33 | ||
34 | class QCopChannel; | 34 | class QCopChannel; |
35 | class QPEApplicationData; | 35 | class QPEApplicationData; |
36 | class QWSEvent; | 36 | class QWSEvent; |
37 | class QWSKeyEvent; | 37 | class QWSKeyEvent; |
38 | 38 | ||
39 | 39 | ||
40 | class QPEApplication : public QApplication | 40 | class QPEApplication : public QApplication |
41 | { | 41 | { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | QPEApplication( int& argc, char **argv, Type=GuiClient ); | 44 | QPEApplication( int& argc, char **argv, Type=GuiClient ); |
45 | ~QPEApplication(); | 45 | ~QPEApplication(); |
46 | 46 | ||
47 | static QString qpeDir(); | 47 | static QString qpeDir(); |
48 | static QString documentDir(); | 48 | static QString documentDir(); |
49 | void applyStyle(); | 49 | void applyStyle(); |
50 | static int defaultRotation(); | 50 | static int defaultRotation(); |
51 | static void setDefaultRotation(int r); | 51 | static void setDefaultRotation(int r); |
52 | static void setCurrentRotation(int r); | 52 | static void setCurrentRotation(int r); |
53 | static void grabKeyboard(); | 53 | static void grabKeyboard(); |
54 | static void ungrabKeyboard(); | 54 | static void ungrabKeyboard(); |
55 | 55 | ||
56 | enum StylusMode { | 56 | enum StylusMode { |
57 | LeftOnly, | 57 | LeftOnly, |
58 | RightOnHold | 58 | RightOnHold |
59 | // RightOnHoldLeftDelayed, etc. | 59 | // RightOnHoldLeftDelayed, etc. |
60 | }; | 60 | }; |
61 | static void setStylusOperation( QWidget*, StylusMode ); | 61 | static void setStylusOperation( QWidget*, StylusMode ); |
62 | static StylusMode stylusOperation( QWidget* ); | 62 | static StylusMode stylusOperation( QWidget* ); |
63 | 63 | ||
64 | enum InputMethodHint { | 64 | enum InputMethodHint { |
65 | Normal, | 65 | Normal, |
66 | AlwaysOff, | 66 | AlwaysOff, |
67 | AlwaysOn | 67 | AlwaysOn |
68 | }; | 68 | }; |
69 | 69 | ||
70 | enum screenSaverHint { | 70 | enum screenSaverHint { |
71 | Disable = 0, | 71 | Disable = 0, |
72 | DisableLightOff = 1, | 72 | DisableLightOff = 1, |
73 | DisableSuspend = 2, | 73 | DisableSuspend = 2, |
74 | Enable = 100 | 74 | Enable = 100 |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static void setInputMethodHint( QWidget *, InputMethodHint ); | 77 | static void setInputMethodHint( QWidget *, InputMethodHint ); |
78 | static InputMethodHint inputMethodHint( QWidget * ); | 78 | static InputMethodHint inputMethodHint( QWidget * ); |
79 | 79 | ||
80 | void showMainWidget( QWidget*, bool nomax=FALSE ); | 80 | void showMainWidget( QWidget*, bool nomax=FALSE ); |
81 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); | 81 | void showMainDocumentWidget( QWidget*, bool nomax=FALSE ); |
82 | static void showDialog( QDialog*, bool nomax=FALSE ); | 82 | static void showDialog( QDialog*, bool nomax=FALSE ); |
83 | static int execDialog( QDialog*, bool nomax=FALSE ); | 83 | static int execDialog( QDialog*, bool nomax=FALSE ); |
84 | 84 | ||
85 | static void setKeepRunning(); | 85 | static void setKeepRunning(); |
86 | bool keepRunning() const; | 86 | bool keepRunning() const; |
87 | 87 | ||
88 | bool keyboardGrabbed() const; | 88 | bool keyboardGrabbed() const; |
89 | 89 | ||
90 | int exec(); | 90 | int exec(); |
91 | 91 | ||
92 | signals: | 92 | signals: |
93 | void clientMoused(); | 93 | void clientMoused(); |
94 | void timeChanged(); | 94 | void timeChanged(); |
95 | void clockChanged( bool pm ); | 95 | void clockChanged( bool pm ); |
96 | void micChanged( bool muted ); | 96 | void micChanged( bool muted ); |
97 | void volumeChanged( bool muted ); | 97 | void volumeChanged( bool muted ); |
98 | void appMessage( const QCString& msg, const QByteArray& data); | 98 | void appMessage( const QCString& msg, const QByteArray& data); |
99 | void weekChanged( bool startOnMonday ); | 99 | void weekChanged( bool startOnMonday ); |
100 | void dateFormatChanged( DateFormat ); | 100 | void dateFormatChanged( DateFormat ); |
101 | void flush(); | 101 | void flush(); |
102 | void reload(); | 102 | void reload(); |
103 | 103 | ||
104 | private slots: | 104 | private slots: |
105 | void systemMessage( const QCString &msg, const QByteArray &data ); | 105 | void systemMessage( const QCString &msg, const QByteArray &data ); |
106 | void pidMessage( const QCString &msg, const QByteArray &data ); | 106 | void pidMessage( const QCString &msg, const QByteArray &data ); |
107 | void removeSenderFromStylusDict(); | 107 | void removeSenderFromStylusDict(); |
108 | void hideOrQuit(); | 108 | void hideOrQuit(); |
109 | 109 | ||
110 | protected: | 110 | protected: |
111 | bool qwsEventFilter( QWSEvent * ); | 111 | bool qwsEventFilter( QWSEvent * ); |
112 | void internalSetStyle( const QString &style ); | 112 | void internalSetStyle( const QString &style ); |
113 | void prepareForTermination(bool willrestart); | 113 | void prepareForTermination(bool willrestart); |
114 | virtual void restart(); | 114 | virtual void restart(); |
115 | virtual void shutdown(); | 115 | virtual void shutdown(); |
116 | bool eventFilter( QObject *, QEvent * ); | 116 | bool eventFilter( QObject *, QEvent * ); |
117 | void timerEvent( QTimerEvent * ); | 117 | void timerEvent( QTimerEvent * ); |
118 | bool raiseAppropriateWindow(); | 118 | bool raiseAppropriateWindow(); |
119 | virtual void tryQuit(); | 119 | virtual void tryQuit(); |
120 | 120 | ||
121 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) | 121 | virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) |
122 | 122 | ||
123 | private: | 123 | private: |
124 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); | 124 | void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); |
125 | 125 | ||
126 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 126 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
127 | QCopChannel *sysChannel; | 127 | QCopChannel *sysChannel; |
128 | QCopChannel *pidChannel; | 128 | QCopChannel *pidChannel; |
129 | #endif | 129 | #endif |
130 | QPEApplicationData *d; | 130 | QPEApplicationData *d; |
131 | 131 | ||
132 | bool reserved_sh; | 132 | bool reserved_sh; |
133 | 133 | ||
134 | 134 | ||
135 | 135 | ||
136 | }; | 136 | }; |
137 | 137 | ||
138 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) | 138 | inline void QPEApplication::showDialog( QDialog* d, bool nomax ) |
139 | { | 139 | { |
140 | QSize sh = d->sizeHint(); | 140 | QSize sh = d->sizeHint(); |
141 | int w = QMAX(sh.width(),d->width()); | 141 | int w = QMAX(sh.width(),d->width()); |
142 | int h = QMAX(sh.height(),d->height()); | 142 | int h = QMAX(sh.height(),d->height()); |
143 | if ( !nomax | 143 | if ( !nomax |
144 | && ( w > qApp->desktop()->width()*3/4 | 144 | && ( w > qApp->desktop()->width()*3/4 |
145 | || h > qApp->desktop()->height()*3/4 ) ) | 145 | || h > qApp->desktop()->height()*3/4 ) ) |
146 | { | 146 | { |
147 | d->showMaximized(); | 147 | d->showMaximized(); |
148 | } else { | 148 | } else { |
149 | d->resize(w,h); | 149 | d->resize(w,h); |
150 | d->show(); | 150 | d->show(); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) | 154 | inline int QPEApplication::execDialog( QDialog* d, bool nomax ) |
155 | { | 155 | { |
156 | showDialog(d,nomax); | 156 | showDialog(d,nomax); |
157 | return d->exec(); | 157 | return d->exec(); |
158 | } | 158 | } |
159 | 159 | ||
160 | enum Transformation { None, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ | 160 | enum Transformation { Rot0, Rot90, Rot180, Rot270 }; /* from qgfxtransformed_qws.cpp */ |
161 | 161 | ||
162 | inline void QPEApplication::setCurrentRotation( int r ) | 162 | inline void QPEApplication::setCurrentRotation( int r ) |
163 | { | 163 | { |
164 | Transformation e; | 164 | Transformation e; |
165 | 165 | ||
166 | switch (r) { | 166 | switch (r) { |
167 | case 0: | 167 | case 0: |
168 | e = None; | 168 | e = Rot0; |
169 | break; | 169 | break; |
170 | case 90: | 170 | case 90: |
171 | e = Rot90; | 171 | e = Rot90; |
172 | break; | 172 | break; |
173 | case 180: | 173 | case 180: |
174 | e = Rot180; | 174 | e = Rot180; |
175 | break; | 175 | break; |
176 | case 270: | 176 | case 270: |
177 | e = Rot270; | 177 | e = Rot270; |
178 | break; | 178 | break; |
179 | default: | 179 | default: |
180 | return; | 180 | return; |
181 | } | 181 | } |
182 | 182 | ||
183 | qDebug("calling qApp->desktop()->qwsDisplay()->setTransformation( %d )\n", e); | 183 | qDebug("calling qApp->desktop()->qwsDisplay()->setTransformation( %d )\n", e); |
184 | qApp->desktop()->qwsDisplay()->setTransformation( e ); | 184 | qApp->desktop()->qwsDisplay()->setTransformation( e ); |
185 | } | 185 | } |
186 | 186 | ||
187 | 187 | ||
188 | #endif | 188 | #endif |