author | sandman <sandman> | 2002-12-30 14:39:13 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-30 14:39:13 (UTC) |
commit | a0eca1c0925a6893fa8f3ebfacd6363f906189df (patch) (unidiff) | |
tree | 83863ca74f9a9f52dd5de4f8ddb1e0d595cfde2d | |
parent | b1d3c5e4a2be3b3905bc813815d1ef898ad585fa (diff) | |
download | opie-a0eca1c0925a6893fa8f3ebfacd6363f906189df.zip opie-a0eca1c0925a6893fa8f3ebfacd6363f906189df.tar.gz opie-a0eca1c0925a6893fa8f3ebfacd6363f906189df.tar.bz2 |
removed the "Width 240" qWarning()
-rw-r--r-- | library/qpeapplication.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index e7e210a..b21428a 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp | |||
@@ -256,513 +256,513 @@ public: | |||
256 | }; | 256 | }; |
257 | 257 | ||
258 | class ResourceMimeFactory : public QMimeSourceFactory | 258 | class ResourceMimeFactory : public QMimeSourceFactory |
259 | { | 259 | { |
260 | public: | 260 | public: |
261 | ResourceMimeFactory() | 261 | ResourceMimeFactory() |
262 | { | 262 | { |
263 | setFilePath( Global::helpPath() ); | 263 | setFilePath( Global::helpPath() ); |
264 | setExtensionType( "html", "text/html;charset=UTF-8" ); | 264 | setExtensionType( "html", "text/html;charset=UTF-8" ); |
265 | } | 265 | } |
266 | 266 | ||
267 | const QMimeSource* data( const QString& abs_name ) const | 267 | const QMimeSource* data( const QString& abs_name ) const |
268 | { | 268 | { |
269 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); | 269 | const QMimeSource * r = QMimeSourceFactory::data( abs_name ); |
270 | if ( !r ) { | 270 | if ( !r ) { |
271 | int sl = abs_name.length(); | 271 | int sl = abs_name.length(); |
272 | do { | 272 | do { |
273 | sl = abs_name.findRev( '/', sl - 1 ); | 273 | sl = abs_name.findRev( '/', sl - 1 ); |
274 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; | 274 | QString name = sl >= 0 ? abs_name.mid( sl + 1 ) : abs_name; |
275 | int dot = name.findRev( '.' ); | 275 | int dot = name.findRev( '.' ); |
276 | if ( dot >= 0 ) | 276 | if ( dot >= 0 ) |
277 | name = name.left( dot ); | 277 | name = name.left( dot ); |
278 | QImage img = Resource::loadImage( name ); | 278 | QImage img = Resource::loadImage( name ); |
279 | if ( !img.isNull() ) | 279 | if ( !img.isNull() ) |
280 | r = new QImageDrag( img ); | 280 | r = new QImageDrag( img ); |
281 | } | 281 | } |
282 | while ( !r && sl > 0 ); | 282 | while ( !r && sl > 0 ); |
283 | } | 283 | } |
284 | return r; | 284 | return r; |
285 | } | 285 | } |
286 | }; | 286 | }; |
287 | 287 | ||
288 | static int muted = 0; | 288 | static int muted = 0; |
289 | static int micMuted = 0; | 289 | static int micMuted = 0; |
290 | 290 | ||
291 | static void setVolume( int t = 0, int percent = -1 ) | 291 | static void setVolume( int t = 0, int percent = -1 ) |
292 | { | 292 | { |
293 | switch ( t ) { | 293 | switch ( t ) { |
294 | case 0: { | 294 | case 0: { |
295 | Config cfg( "qpe" ); | 295 | Config cfg( "qpe" ); |
296 | cfg.setGroup( "Volume" ); | 296 | cfg.setGroup( "Volume" ); |
297 | if ( percent < 0 ) | 297 | if ( percent < 0 ) |
298 | percent = cfg.readNumEntry( "VolumePercent", 50 ); | 298 | percent = cfg.readNumEntry( "VolumePercent", 50 ); |
299 | int fd = 0; | 299 | int fd = 0; |
300 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 300 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
301 | int vol = muted ? 0 : percent; | 301 | int vol = muted ? 0 : percent; |
302 | // set both channels to same volume | 302 | // set both channels to same volume |
303 | vol |= vol << 8; | 303 | vol |= vol << 8; |
304 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); | 304 | ioctl( fd, MIXER_WRITE( 0 ), &vol ); |
305 | ::close( fd ); | 305 | ::close( fd ); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | break; | 308 | break; |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | static void setMic( int t = 0, int percent = -1 ) | 312 | static void setMic( int t = 0, int percent = -1 ) |
313 | { | 313 | { |
314 | switch ( t ) { | 314 | switch ( t ) { |
315 | case 0: { | 315 | case 0: { |
316 | Config cfg( "qpe" ); | 316 | Config cfg( "qpe" ); |
317 | cfg.setGroup( "Volume" ); | 317 | cfg.setGroup( "Volume" ); |
318 | if ( percent < 0 ) | 318 | if ( percent < 0 ) |
319 | percent = cfg.readNumEntry( "Mic", 50 ); | 319 | percent = cfg.readNumEntry( "Mic", 50 ); |
320 | 320 | ||
321 | int fd = 0; | 321 | int fd = 0; |
322 | int mic = micMuted ? 0 : percent; | 322 | int mic = micMuted ? 0 : percent; |
323 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 323 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
324 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); | 324 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_MIC ), &mic ); |
325 | ::close( fd ); | 325 | ::close( fd ); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | break; | 328 | break; |
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | 332 | ||
333 | static void setBass( int t = 0, int percent = -1 ) | 333 | static void setBass( int t = 0, int percent = -1 ) |
334 | { | 334 | { |
335 | switch ( t ) { | 335 | switch ( t ) { |
336 | case 0: { | 336 | case 0: { |
337 | Config cfg( "qpe" ); | 337 | Config cfg( "qpe" ); |
338 | cfg.setGroup( "Volume" ); | 338 | cfg.setGroup( "Volume" ); |
339 | if ( percent < 0 ) | 339 | if ( percent < 0 ) |
340 | percent = cfg.readNumEntry( "BassPercent", 50 ); | 340 | percent = cfg.readNumEntry( "BassPercent", 50 ); |
341 | 341 | ||
342 | int fd = 0; | 342 | int fd = 0; |
343 | int bass = percent; | 343 | int bass = percent; |
344 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 344 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
345 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); | 345 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_BASS ), &bass ); |
346 | ::close( fd ); | 346 | ::close( fd ); |
347 | } | 347 | } |
348 | } | 348 | } |
349 | break; | 349 | break; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | 352 | ||
353 | 353 | ||
354 | static void setTreble( int t = 0, int percent = -1 ) | 354 | static void setTreble( int t = 0, int percent = -1 ) |
355 | { | 355 | { |
356 | switch ( t ) { | 356 | switch ( t ) { |
357 | case 0: { | 357 | case 0: { |
358 | Config cfg( "qpe" ); | 358 | Config cfg( "qpe" ); |
359 | cfg.setGroup( "Volume" ); | 359 | cfg.setGroup( "Volume" ); |
360 | if ( percent < 0 ) | 360 | if ( percent < 0 ) |
361 | percent = cfg.readNumEntry( "TreblePercent", 50 ); | 361 | percent = cfg.readNumEntry( "TreblePercent", 50 ); |
362 | 362 | ||
363 | int fd = 0; | 363 | int fd = 0; |
364 | int treble = percent; | 364 | int treble = percent; |
365 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { | 365 | if ( ( fd = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { |
366 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); | 366 | ioctl( fd, MIXER_WRITE( SOUND_MIXER_TREBLE ), &treble ); |
367 | ::close( fd ); | 367 | ::close( fd ); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | break; | 370 | break; |
371 | } | 371 | } |
372 | } | 372 | } |
373 | 373 | ||
374 | 374 | ||
375 | /*! | 375 | /*! |
376 | \class QPEApplication qpeapplication.h | 376 | \class QPEApplication qpeapplication.h |
377 | \brief The QPEApplication class implements various system services | 377 | \brief The QPEApplication class implements various system services |
378 | that are available to all Qtopia applications. | 378 | that are available to all Qtopia applications. |
379 | 379 | ||
380 | Simply by using QPEApplication instead of QApplication, a standard Qt | 380 | Simply by using QPEApplication instead of QApplication, a standard Qt |
381 | application becomes a Qtopia application. It automatically follows | 381 | application becomes a Qtopia application. It automatically follows |
382 | style changes, quits and raises, and in the | 382 | style changes, quits and raises, and in the |
383 | case of \link docwidget.html document-oriented\endlink applications, | 383 | case of \link docwidget.html document-oriented\endlink applications, |
384 | changes the currently displayed document in response to the environment. | 384 | changes the currently displayed document in response to the environment. |
385 | 385 | ||
386 | To create a \link docwidget.html document-oriented\endlink | 386 | To create a \link docwidget.html document-oriented\endlink |
387 | application use showMainDocumentWidget(); to create a | 387 | application use showMainDocumentWidget(); to create a |
388 | non-document-oriented application use showMainWidget(). The | 388 | non-document-oriented application use showMainWidget(). The |
389 | keepRunning() function indicates whether the application will | 389 | keepRunning() function indicates whether the application will |
390 | continue running after it's processed the last \link qcop.html | 390 | continue running after it's processed the last \link qcop.html |
391 | QCop\endlink message. This can be changed using setKeepRunning(). | 391 | QCop\endlink message. This can be changed using setKeepRunning(). |
392 | 392 | ||
393 | A variety of signals are emitted when certain events occur, for | 393 | A variety of signals are emitted when certain events occur, for |
394 | example, timeChanged(), clockChanged(), weekChanged(), | 394 | example, timeChanged(), clockChanged(), weekChanged(), |
395 | dateFormatChanged() and volumeChanged(). If the application receives | 395 | dateFormatChanged() and volumeChanged(). If the application receives |
396 | a \link qcop.html QCop\endlink message on the application's | 396 | a \link qcop.html QCop\endlink message on the application's |
397 | QPE/Application/\e{appname} channel, the appMessage() signal is | 397 | QPE/Application/\e{appname} channel, the appMessage() signal is |
398 | emitted. There are also flush() and reload() signals, which | 398 | emitted. There are also flush() and reload() signals, which |
399 | are emitted when synching begins and ends respectively - upon these | 399 | are emitted when synching begins and ends respectively - upon these |
400 | signals, the application should save and reload any data | 400 | signals, the application should save and reload any data |
401 | files that are involved in synching. Most of these signals will initially | 401 | files that are involved in synching. Most of these signals will initially |
402 | be received and unfiltered through the appMessage() signal. | 402 | be received and unfiltered through the appMessage() signal. |
403 | 403 | ||
404 | This class also provides a set of useful static functions. The | 404 | This class also provides a set of useful static functions. The |
405 | qpeDir() and documentDir() functions return the respective paths. | 405 | qpeDir() and documentDir() functions return the respective paths. |
406 | The grabKeyboard() and ungrabKeyboard() functions are used to | 406 | The grabKeyboard() and ungrabKeyboard() functions are used to |
407 | control whether the application takes control of the device's | 407 | control whether the application takes control of the device's |
408 | physical buttons (e.g. application launch keys). The stylus' mode of | 408 | physical buttons (e.g. application launch keys). The stylus' mode of |
409 | operation is set with setStylusOperation() and retrieved with | 409 | operation is set with setStylusOperation() and retrieved with |
410 | stylusOperation(). There are also setInputMethodHint() and | 410 | stylusOperation(). There are also setInputMethodHint() and |
411 | inputMethodHint() functions. | 411 | inputMethodHint() functions. |
412 | 412 | ||
413 | \ingroup qtopiaemb | 413 | \ingroup qtopiaemb |
414 | */ | 414 | */ |
415 | 415 | ||
416 | /*! | 416 | /*! |
417 | \fn void QPEApplication::clientMoused() | 417 | \fn void QPEApplication::clientMoused() |
418 | 418 | ||
419 | \internal | 419 | \internal |
420 | */ | 420 | */ |
421 | 421 | ||
422 | /*! | 422 | /*! |
423 | \fn void QPEApplication::timeChanged(); | 423 | \fn void QPEApplication::timeChanged(); |
424 | This signal is emitted when the time changes outside the normal | 424 | This signal is emitted when the time changes outside the normal |
425 | passage of time, i.e. if the time is set backwards or forwards. | 425 | passage of time, i.e. if the time is set backwards or forwards. |
426 | */ | 426 | */ |
427 | 427 | ||
428 | /*! | 428 | /*! |
429 | \fn void QPEApplication::clockChanged( bool ampm ); | 429 | \fn void QPEApplication::clockChanged( bool ampm ); |
430 | 430 | ||
431 | This signal is emitted when the user changes the clock's style. If | 431 | This signal is emitted when the user changes the clock's style. If |
432 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, | 432 | \a ampm is TRUE, the user wants a 12-hour AM/PM clock, otherwise, |
433 | they want a 24-hour clock. | 433 | they want a 24-hour clock. |
434 | */ | 434 | */ |
435 | 435 | ||
436 | /*! | 436 | /*! |
437 | \fn void QPEApplication::volumeChanged( bool muted ) | 437 | \fn void QPEApplication::volumeChanged( bool muted ) |
438 | 438 | ||
439 | This signal is emitted whenever the mute state is changed. If \a | 439 | This signal is emitted whenever the mute state is changed. If \a |
440 | muted is TRUE, then sound output has been muted. | 440 | muted is TRUE, then sound output has been muted. |
441 | */ | 441 | */ |
442 | 442 | ||
443 | /*! | 443 | /*! |
444 | \fn void QPEApplication::weekChanged( bool startOnMonday ) | 444 | \fn void QPEApplication::weekChanged( bool startOnMonday ) |
445 | 445 | ||
446 | This signal is emitted if the week start day is changed. If \a | 446 | This signal is emitted if the week start day is changed. If \a |
447 | startOnMonday is TRUE then the first day of the week is Monday; if | 447 | startOnMonday is TRUE then the first day of the week is Monday; if |
448 | \a startOnMonday is FALSE then the first day of the week is | 448 | \a startOnMonday is FALSE then the first day of the week is |
449 | Sunday. | 449 | Sunday. |
450 | */ | 450 | */ |
451 | 451 | ||
452 | /*! | 452 | /*! |
453 | \fn void QPEApplication::dateFormatChanged() | 453 | \fn void QPEApplication::dateFormatChanged() |
454 | 454 | ||
455 | This signal is emitted whenever the date format is changed. | 455 | This signal is emitted whenever the date format is changed. |
456 | */ | 456 | */ |
457 | 457 | ||
458 | /*! | 458 | /*! |
459 | \fn void QPEApplication::flush() | 459 | \fn void QPEApplication::flush() |
460 | 460 | ||
461 | ### | 461 | ### |
462 | */ | 462 | */ |
463 | 463 | ||
464 | /*! | 464 | /*! |
465 | \fn void QPEApplication::reload() | 465 | \fn void QPEApplication::reload() |
466 | 466 | ||
467 | */ | 467 | */ |
468 | 468 | ||
469 | /*! | 469 | /*! |
470 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) | 470 | \fn void QPEApplication::appMessage( const QCString& msg, const QByteArray& data ) |
471 | 471 | ||
472 | This signal is emitted when a message is received on this | 472 | This signal is emitted when a message is received on this |
473 | application's QPE/Application/<i>appname</i> \link qcop.html | 473 | application's QPE/Application/<i>appname</i> \link qcop.html |
474 | QCop\endlink channel. | 474 | QCop\endlink channel. |
475 | 475 | ||
476 | The slot to which you connect this signal uses \a msg and \a data | 476 | The slot to which you connect this signal uses \a msg and \a data |
477 | in the following way: | 477 | in the following way: |
478 | 478 | ||
479 | \code | 479 | \code |
480 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) | 480 | void MyWidget::receive( const QCString& msg, const QByteArray& data ) |
481 | { | 481 | { |
482 | QDataStream stream( data, IO_ReadOnly ); | 482 | QDataStream stream( data, IO_ReadOnly ); |
483 | if ( msg == "someMessage(int,int,int)" ) { | 483 | if ( msg == "someMessage(int,int,int)" ) { |
484 | int a,b,c; | 484 | int a,b,c; |
485 | stream >> a >> b >> c; | 485 | stream >> a >> b >> c; |
486 | ... | 486 | ... |
487 | } else if ( msg == "otherMessage(QString)" ) { | 487 | } else if ( msg == "otherMessage(QString)" ) { |
488 | ... | 488 | ... |
489 | } | 489 | } |
490 | } | 490 | } |
491 | \endcode | 491 | \endcode |
492 | 492 | ||
493 | \sa qcop.html | 493 | \sa qcop.html |
494 | Note that messages received here may be processed by qpe application | 494 | Note that messages received here may be processed by qpe application |
495 | and emitted as signals, such as flush() and reload(). | 495 | and emitted as signals, such as flush() and reload(). |
496 | */ | 496 | */ |
497 | 497 | ||
498 | /*! | 498 | /*! |
499 | Constructs a QPEApplication just as you would construct | 499 | Constructs a QPEApplication just as you would construct |
500 | a QApplication, passing \a argc, \a argv, and \a t. | 500 | a QApplication, passing \a argc, \a argv, and \a t. |
501 | 501 | ||
502 | For applications, \a t should be the default, GuiClient. Only | 502 | For applications, \a t should be the default, GuiClient. Only |
503 | the Qtopia server passes GuiServer. | 503 | the Qtopia server passes GuiServer. |
504 | */ | 504 | */ |
505 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) | 505 | QPEApplication::QPEApplication( int & argc, char **argv, Type t ) |
506 | : QApplication( argc, argv, t ) | 506 | : QApplication( argc, argv, t ) |
507 | { | 507 | { |
508 | d = new QPEApplicationData; | 508 | d = new QPEApplicationData; |
509 | d->loadTextCodecs(); | 509 | d->loadTextCodecs(); |
510 | d->loadImageCodecs(); | 510 | d->loadImageCodecs(); |
511 | int dw = desktop() ->width(); | 511 | int dw = desktop() ->width(); |
512 | qWarning( "Width %d", dw ); | 512 | |
513 | if ( dw < 200 ) { | 513 | if ( dw < 200 ) { |
514 | setFont( QFont( "helvetica", 8 ) ); | 514 | setFont( QFont( "helvetica", 8 ) ); |
515 | AppLnk::setSmallIconSize( 10 ); | 515 | AppLnk::setSmallIconSize( 10 ); |
516 | AppLnk::setBigIconSize( 28 ); | 516 | AppLnk::setBigIconSize( 28 ); |
517 | } | 517 | } |
518 | else if ( dw > 600 ) { | 518 | else if ( dw > 600 ) { |
519 | setFont( QFont( "helvetica", 12 ) ); | 519 | setFont( QFont( "helvetica", 12 ) ); |
520 | AppLnk::setSmallIconSize( 24 ); | 520 | AppLnk::setSmallIconSize( 24 ); |
521 | AppLnk::setBigIconSize( 48 ); | 521 | AppLnk::setBigIconSize( 48 ); |
522 | } | 522 | } |
523 | else if ( dw > 200 ) { | 523 | else if ( dw > 200 ) { |
524 | setFont( QFont( "helvetica", 10 ) ); | 524 | setFont( QFont( "helvetica", 10 ) ); |
525 | AppLnk::setSmallIconSize( 16 ); | 525 | AppLnk::setSmallIconSize( 16 ); |
526 | AppLnk::setBigIconSize( 32 ); | 526 | AppLnk::setBigIconSize( 32 ); |
527 | } | 527 | } |
528 | 528 | ||
529 | 529 | ||
530 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); | 530 | QMimeSourceFactory::setDefaultFactory( new ResourceMimeFactory ); |
531 | 531 | ||
532 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); | 532 | connect( this, SIGNAL( lastWindowClosed() ), this, SLOT( hideOrQuit() ) ); |
533 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 533 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
534 | 534 | ||
535 | QString qcopfn( "/tmp/qcop-msg-" ); | 535 | QString qcopfn( "/tmp/qcop-msg-" ); |
536 | qcopfn += QString( argv[ 0 ] ); // append command name | 536 | qcopfn += QString( argv[ 0 ] ); // append command name |
537 | 537 | ||
538 | QFile f( qcopfn ); | 538 | QFile f( qcopfn ); |
539 | if ( f.open( IO_ReadOnly ) ) { | 539 | if ( f.open( IO_ReadOnly ) ) { |
540 | flock( f.handle(), LOCK_EX ); | 540 | flock( f.handle(), LOCK_EX ); |
541 | } | 541 | } |
542 | 542 | ||
543 | sysChannel = new QCopChannel( "QPE/System", this ); | 543 | sysChannel = new QCopChannel( "QPE/System", this ); |
544 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 544 | connect( sysChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
545 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); | 545 | this, SLOT( systemMessage( const QCString &, const QByteArray & ) ) ); |
546 | 546 | ||
547 | QCString channel = QCString( argv[ 0 ] ); | 547 | QCString channel = QCString( argv[ 0 ] ); |
548 | channel.replace( QRegExp( ".*/" ), "" ); | 548 | channel.replace( QRegExp( ".*/" ), "" ); |
549 | d->appName = channel; | 549 | d->appName = channel; |
550 | channel = "QPE/Application/" + channel; | 550 | channel = "QPE/Application/" + channel; |
551 | pidChannel = new QCopChannel( channel, this ); | 551 | pidChannel = new QCopChannel( channel, this ); |
552 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), | 552 | connect( pidChannel, SIGNAL( received( const QCString &, const QByteArray & ) ), |
553 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); | 553 | this, SLOT( pidMessage( const QCString &, const QByteArray & ) ) ); |
554 | 554 | ||
555 | if ( f.isOpen() ) { | 555 | if ( f.isOpen() ) { |
556 | d->keep_running = FALSE; | 556 | d->keep_running = FALSE; |
557 | QDataStream ds( &f ); | 557 | QDataStream ds( &f ); |
558 | QCString channel, message; | 558 | QCString channel, message; |
559 | QByteArray data; | 559 | QByteArray data; |
560 | while ( !ds.atEnd() ) { | 560 | while ( !ds.atEnd() ) { |
561 | ds >> channel >> message >> data; | 561 | ds >> channel >> message >> data; |
562 | d->enqueueQCop( channel, message, data ); | 562 | d->enqueueQCop( channel, message, data ); |
563 | } | 563 | } |
564 | 564 | ||
565 | flock( f.handle(), LOCK_UN ); | 565 | flock( f.handle(), LOCK_UN ); |
566 | f.close(); | 566 | f.close(); |
567 | f.remove(); | 567 | f.remove(); |
568 | } | 568 | } |
569 | 569 | ||
570 | for ( int a = 0; a < argc; a++ ) { | 570 | for ( int a = 0; a < argc; a++ ) { |
571 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { | 571 | if ( qstrcmp( argv[ a ], "-preload" ) == 0 ) { |
572 | argv[ a ] = argv[ a + 1 ]; | 572 | argv[ a ] = argv[ a + 1 ]; |
573 | a++; | 573 | a++; |
574 | d->preloaded = TRUE; | 574 | d->preloaded = TRUE; |
575 | argc -= 1; | 575 | argc -= 1; |
576 | } | 576 | } |
577 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { | 577 | else if ( qstrcmp( argv[ a ], "-preload-show" ) == 0 ) { |
578 | argv[ a ] = argv[ a + 1 ]; | 578 | argv[ a ] = argv[ a + 1 ]; |
579 | a++; | 579 | a++; |
580 | d->preloaded = TRUE; | 580 | d->preloaded = TRUE; |
581 | d->forceshow = TRUE; | 581 | d->forceshow = TRUE; |
582 | argc -= 1; | 582 | argc -= 1; |
583 | } | 583 | } |
584 | } | 584 | } |
585 | 585 | ||
586 | /* overide stored arguments */ | 586 | /* overide stored arguments */ |
587 | setArgs( argc, argv ); | 587 | setArgs( argc, argv ); |
588 | 588 | ||
589 | #endif | 589 | #endif |
590 | 590 | ||
591 | // qwsSetDecoration( new QPEDecoration() ); | 591 | // qwsSetDecoration( new QPEDecoration() ); |
592 | 592 | ||
593 | #ifndef QT_NO_TRANSLATION | 593 | #ifndef QT_NO_TRANSLATION |
594 | 594 | ||
595 | QStringList langs = Global::languageList(); | 595 | QStringList langs = Global::languageList(); |
596 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { | 596 | for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { |
597 | QString lang = *it; | 597 | QString lang = *it; |
598 | 598 | ||
599 | QTranslator * trans; | 599 | QTranslator * trans; |
600 | QString tfn; | 600 | QString tfn; |
601 | 601 | ||
602 | trans = new QTranslator( this ); | 602 | trans = new QTranslator( this ); |
603 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; | 603 | tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; |
604 | if ( trans->load( tfn ) ) | 604 | if ( trans->load( tfn ) ) |
605 | installTranslator( trans ); | 605 | installTranslator( trans ); |
606 | else | 606 | else |
607 | delete trans; | 607 | delete trans; |
608 | 608 | ||
609 | trans = new QTranslator( this ); | 609 | trans = new QTranslator( this ); |
610 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; | 610 | tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; |
611 | if ( trans->load( tfn ) ) | 611 | if ( trans->load( tfn ) ) |
612 | installTranslator( trans ); | 612 | installTranslator( trans ); |
613 | else | 613 | else |
614 | delete trans; | 614 | delete trans; |
615 | 615 | ||
616 | //###language/font hack; should look it up somewhere | 616 | //###language/font hack; should look it up somewhere |
617 | #ifdef QWS | 617 | #ifdef QWS |
618 | 618 | ||
619 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { | 619 | if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { |
620 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); | 620 | QFont fn = FontManager::unicodeFont( FontManager::Proportional ); |
621 | setFont( fn ); | 621 | setFont( fn ); |
622 | } | 622 | } |
623 | #endif | 623 | #endif |
624 | 624 | ||
625 | } | 625 | } |
626 | #endif | 626 | #endif |
627 | 627 | ||
628 | applyStyle(); | 628 | applyStyle(); |
629 | 629 | ||
630 | if ( type() == GuiServer ) { | 630 | if ( type() == GuiServer ) { |
631 | setVolume(); | 631 | setVolume(); |
632 | } | 632 | } |
633 | 633 | ||
634 | installEventFilter( this ); | 634 | installEventFilter( this ); |
635 | 635 | ||
636 | QPEMenuToolFocusManager::initialize(); | 636 | QPEMenuToolFocusManager::initialize(); |
637 | 637 | ||
638 | #ifdef QT_NO_QWS_CURSOR | 638 | #ifdef QT_NO_QWS_CURSOR |
639 | // if we have no cursor, probably don't want tooltips | 639 | // if we have no cursor, probably don't want tooltips |
640 | QToolTip::setEnabled( FALSE ); | 640 | QToolTip::setEnabled( FALSE ); |
641 | #endif | 641 | #endif |
642 | } | 642 | } |
643 | 643 | ||
644 | static QPtrDict<void>* inputMethodDict = 0; | 644 | static QPtrDict<void>* inputMethodDict = 0; |
645 | static void createInputMethodDict() | 645 | static void createInputMethodDict() |
646 | { | 646 | { |
647 | if ( !inputMethodDict ) | 647 | if ( !inputMethodDict ) |
648 | inputMethodDict = new QPtrDict<void>; | 648 | inputMethodDict = new QPtrDict<void>; |
649 | } | 649 | } |
650 | 650 | ||
651 | /*! | 651 | /*! |
652 | Returns the currently set hint to the system as to whether | 652 | Returns the currently set hint to the system as to whether |
653 | widget \a w has any use for text input methods. | 653 | widget \a w has any use for text input methods. |
654 | 654 | ||
655 | 655 | ||
656 | \sa setInputMethodHint() InputMethodHint | 656 | \sa setInputMethodHint() InputMethodHint |
657 | */ | 657 | */ |
658 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) | 658 | QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget * w ) |
659 | { | 659 | { |
660 | if ( inputMethodDict && w ) | 660 | if ( inputMethodDict && w ) |
661 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); | 661 | return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); |
662 | return Normal; | 662 | return Normal; |
663 | } | 663 | } |
664 | 664 | ||
665 | /*! | 665 | /*! |
666 | \enum QPEApplication::InputMethodHint | 666 | \enum QPEApplication::InputMethodHint |
667 | 667 | ||
668 | \value Normal the application sometimes needs text input (the default). | 668 | \value Normal the application sometimes needs text input (the default). |
669 | \value AlwaysOff the application never needs text input. | 669 | \value AlwaysOff the application never needs text input. |
670 | \value AlwaysOn the application always needs text input. | 670 | \value AlwaysOn the application always needs text input. |
671 | */ | 671 | */ |
672 | 672 | ||
673 | /*! | 673 | /*! |
674 | Hints to the system that widget \a w has use for text input methods | 674 | Hints to the system that widget \a w has use for text input methods |
675 | as specified by \a mode. | 675 | as specified by \a mode. |
676 | 676 | ||
677 | \sa inputMethodHint() InputMethodHint | 677 | \sa inputMethodHint() InputMethodHint |
678 | */ | 678 | */ |
679 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) | 679 | void QPEApplication::setInputMethodHint( QWidget * w, InputMethodHint mode ) |
680 | { | 680 | { |
681 | createInputMethodDict(); | 681 | createInputMethodDict(); |
682 | if ( mode == Normal ) { | 682 | if ( mode == Normal ) { |
683 | inputMethodDict->remove | 683 | inputMethodDict->remove |
684 | ( w ); | 684 | ( w ); |
685 | } | 685 | } |
686 | else { | 686 | else { |
687 | inputMethodDict->insert( w, ( void* ) mode ); | 687 | inputMethodDict->insert( w, ( void* ) mode ); |
688 | } | 688 | } |
689 | } | 689 | } |
690 | 690 | ||
691 | class HackDialog : public QDialog | 691 | class HackDialog : public QDialog |
692 | { | 692 | { |
693 | public: | 693 | public: |
694 | void acceptIt() | 694 | void acceptIt() |
695 | { | 695 | { |
696 | accept(); | 696 | accept(); |
697 | } | 697 | } |
698 | void rejectIt() | 698 | void rejectIt() |
699 | { | 699 | { |
700 | reject(); | 700 | reject(); |
701 | } | 701 | } |
702 | }; | 702 | }; |
703 | 703 | ||
704 | 704 | ||
705 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) | 705 | void QPEApplication::mapToDefaultAction( QWSKeyEvent * ke, int key ) |
706 | { | 706 | { |
707 | // specialised actions for certain widgets. May want to | 707 | // specialised actions for certain widgets. May want to |
708 | // add more stuff here. | 708 | // add more stuff here. |
709 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) | 709 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QListBox" ) |
710 | && activePopupWidget() ->parentWidget() | 710 | && activePopupWidget() ->parentWidget() |
711 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) | 711 | && activePopupWidget() ->parentWidget() ->inherits( "QComboBox" ) ) |
712 | key = Qt::Key_Return; | 712 | key = Qt::Key_Return; |
713 | 713 | ||
714 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) | 714 | if ( activePopupWidget() && activePopupWidget() ->inherits( "QPopupMenu" ) ) |
715 | key = Qt::Key_Return; | 715 | key = Qt::Key_Return; |
716 | 716 | ||
717 | #ifdef QWS | 717 | #ifdef QWS |
718 | 718 | ||
719 | ke->simpleData.keycode = key; | 719 | ke->simpleData.keycode = key; |
720 | #endif | 720 | #endif |
721 | } | 721 | } |
722 | 722 | ||
723 | class HackWidget : public QWidget | 723 | class HackWidget : public QWidget |
724 | { | 724 | { |
725 | public: | 725 | public: |
726 | bool needsOk() | 726 | bool needsOk() |
727 | { | 727 | { |
728 | return ( getWState() & WState_Reserved1 ); | 728 | return ( getWState() & WState_Reserved1 ); |
729 | } | 729 | } |
730 | }; | 730 | }; |
731 | 731 | ||
732 | /*! | 732 | /*! |
733 | \internal | 733 | \internal |
734 | */ | 734 | */ |
735 | 735 | ||
736 | #ifdef QWS | 736 | #ifdef QWS |
737 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) | 737 | bool QPEApplication::qwsEventFilter( QWSEvent * e ) |
738 | { | 738 | { |
739 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { | 739 | if ( !d->notbusysent && e->type == QWSEvent::Focus ) { |
740 | if ( qApp->type() != QApplication::GuiServer ) { | 740 | if ( qApp->type() != QApplication::GuiServer ) { |
741 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); | 741 | QCopEnvelope e( "QPE/System", "notBusy(QString)" ); |
742 | e << d->appName; | 742 | e << d->appName; |
743 | } | 743 | } |
744 | d->notbusysent = TRUE; | 744 | d->notbusysent = TRUE; |
745 | } | 745 | } |
746 | if ( type() == GuiServer ) { | 746 | if ( type() == GuiServer ) { |
747 | switch ( e->type ) { | 747 | switch ( e->type ) { |
748 | case QWSEvent::Mouse: | 748 | case QWSEvent::Mouse: |
749 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) | 749 | if ( e->asMouse() ->simpleData.state && !QWidget::find( e->window() ) ) |
750 | emit clientMoused(); | 750 | emit clientMoused(); |
751 | break; | 751 | break; |
752 | default: | 752 | default: |
753 | break; | 753 | break; |
754 | } | 754 | } |
755 | } | 755 | } |
756 | if ( e->type == QWSEvent::Key ) { | 756 | if ( e->type == QWSEvent::Key ) { |
757 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; | 757 | QWSKeyEvent *ke = ( QWSKeyEvent * ) e; |
758 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { | 758 | if ( ke->simpleData.keycode == Qt::Key_F33 ) { |
759 | // Use special "OK" key to press "OK" on top level widgets | 759 | // Use special "OK" key to press "OK" on top level widgets |
760 | QWidget * active = activeWindow(); | 760 | QWidget * active = activeWindow(); |
761 | QWidget *popup = 0; | 761 | QWidget *popup = 0; |
762 | if ( active && active->isPopup() ) { | 762 | if ( active && active->isPopup() ) { |
763 | popup = active; | 763 | popup = active; |
764 | active = active->parentWidget(); | 764 | active = active->parentWidget(); |
765 | } | 765 | } |
766 | if ( active && ( int ) active->winId() == ke->simpleData.window && | 766 | if ( active && ( int ) active->winId() == ke->simpleData.window && |
767 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { | 767 | !active->testWFlags( WStyle_Customize | WType_Popup | WType_Desktop ) ) { |
768 | if ( ke->simpleData.is_press ) { | 768 | if ( ke->simpleData.is_press ) { |