summaryrefslogtreecommitdiff
authorzecke <zecke>2002-10-17 17:05:26 (UTC)
committer zecke <zecke>2002-10-17 17:05:26 (UTC)
commit9ac29a12a1ba49069a85f8966b1aac89dda7817c (patch) (unidiff)
tree7c959c1ec504d01616601ddb6d71195b42a42db4
parentd7cdf9468af510848688584caf34cb1cc03b8562 (diff)
downloadopie-9ac29a12a1ba49069a85f8966b1aac89dda7817c.zip
opie-9ac29a12a1ba49069a85f8966b1aac89dda7817c.tar.gz
opie-9ac29a12a1ba49069a85f8966b1aac89dda7817c.tar.bz2
More implementation and stubs to build launcher
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.cpp26
-rw-r--r--x11/libqpe-x11/qpe/qpeapplication.h9
-rw-r--r--x11/libqpe-x11/qt/qwindowsystem_qws.h19
3 files changed, 53 insertions, 1 deletions
diff --git a/x11/libqpe-x11/qpe/qpeapplication.cpp b/x11/libqpe-x11/qpe/qpeapplication.cpp
index 6e4a96c..8785c74 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.cpp
+++ b/x11/libqpe-x11/qpe/qpeapplication.cpp
@@ -251,422 +251,448 @@ QPEApplication::QPEApplication(int &arg, char** argv, Type t)
251 connect(m_sys, SIGNAL( received( const QCString&, const QByteArray& ) ), 251 connect(m_sys, SIGNAL( received( const QCString&, const QByteArray& ) ),
252 this, SLOT(systemMessage( const QCString&, const QByteArray& ) ) ); 252 this, SLOT(systemMessage( const QCString&, const QByteArray& ) ) );
253 253
254 // private channel QPE/Application/appname 254 // private channel QPE/Application/appname
255 QCString channel = QCString( argv[0] ); 255 QCString channel = QCString( argv[0] );
256 channel.replace( QRegExp( ".*/"), "" ); 256 channel.replace( QRegExp( ".*/"), "" );
257 d->appName = channel; 257 d->appName = channel;
258 channel = "QPE/Application/"+ channel; 258 channel = "QPE/Application/"+ channel;
259 m_pid = new QCopChannel( channel, 0l ); 259 m_pid = new QCopChannel( channel, 0l );
260 connect(m_pid, SIGNAL( received( const QCString&, const QByteArray& ) ), 260 connect(m_pid, SIGNAL( received( const QCString&, const QByteArray& ) ),
261 this, SLOT( pidMessage( const QCString&, const QByteArray& ) ) ); 261 this, SLOT( pidMessage( const QCString&, const QByteArray& ) ) );
262 262
263 // read the Pre QCOP Stuff from the file 263 // read the Pre QCOP Stuff from the file
264 if ( file.isOpen() ) { 264 if ( file.isOpen() ) {
265 d->keep_running = FALSE; 265 d->keep_running = FALSE;
266 QDataStream ds( &file ); 266 QDataStream ds( &file );
267 QCString chanel, message; 267 QCString chanel, message;
268 QByteArray data; 268 QByteArray data;
269 while (!ds.atEnd() ) { 269 while (!ds.atEnd() ) {
270 ds >> chanel >> message >> data; 270 ds >> chanel >> message >> data;
271 d->enqueueQCop( chanel, message, data ); 271 d->enqueueQCop( chanel, message, data );
272 } 272 }
273 flock( file.handle(), LOCK_UN ); 273 flock( file.handle(), LOCK_UN );
274 file.close(); 274 file.close();
275 file.remove(); 275 file.remove();
276 } 276 }
277 277
278 // read in some stuff from the command line 278 // read in some stuff from the command line
279 // we do not have setArgs so we need to take 279 // we do not have setArgs so we need to take
280 // care of that 280 // care of that
281 for ( int a = 0; a < arg; a++ ) { 281 for ( int a = 0; a < arg; a++ ) {
282 if ( qstrcmp( argv[a], "-preload" ) == 0 ) { 282 if ( qstrcmp( argv[a], "-preload" ) == 0 ) {
283 d->preloaded = TRUE; 283 d->preloaded = TRUE;
284 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) { 284 }else if ( qstrcmp( argv[a ] , "-preload-show" ) == 0 ) {
285 d->preloaded = TRUE; 285 d->preloaded = TRUE;
286 d->forceshow = TRUE; 286 d->forceshow = TRUE;
287 } 287 }
288 } 288 }
289 initTranslations(); 289 initTranslations();
290 applyStyle(); 290 applyStyle();
291 291
292 if ( type() == GuiServer ) 292 if ( type() == GuiServer )
293 ; 293 ;
294 294
295 installEventFilter( this ); 295 installEventFilter( this );
296 QPEMenuToolFocusManager::initialize(); 296 QPEMenuToolFocusManager::initialize();
297} 297}
298void QPEApplication::initTranslations() { 298void QPEApplication::initTranslations() {
299 // Translations add it 299 // Translations add it
300 QStringList langs = Global::languageList(); 300 QStringList langs = Global::languageList();
301 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { 301 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) {
302 QString lang = *it; 302 QString lang = *it;
303 303
304 QTranslator * trans; 304 QTranslator * trans;
305 QString tfn; 305 QString tfn;
306 306
307 trans = new QTranslator( this ); 307 trans = new QTranslator( this );
308 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm"; 308 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm";
309 if ( trans->load( tfn ) ) 309 if ( trans->load( tfn ) )
310 installTranslator( trans ); 310 installTranslator( trans );
311 else 311 else
312 delete trans; 312 delete trans;
313 313
314 trans = new QTranslator( this ); 314 trans = new QTranslator( this );
315 tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm"; 315 tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm";
316 if ( trans->load( tfn ) ) 316 if ( trans->load( tfn ) )
317 installTranslator( trans ); 317 installTranslator( trans );
318 else 318 else
319 delete trans; 319 delete trans;
320 } 320 }
321} 321}
322QString QPEApplication::qpeDir() { 322QString QPEApplication::qpeDir() {
323 const char * base = getenv( "OPIEDIR" ); 323 const char * base = getenv( "OPIEDIR" );
324 if ( base ) 324 if ( base )
325 return QString( base ) + "/"; 325 return QString( base ) + "/";
326 326
327 return QString( "../" ); 327 return QString( "../" );
328} 328}
329QString QPEApplication::documentDir() { 329QString QPEApplication::documentDir() {
330 const char* base = getenv( "HOME"); 330 const char* base = getenv( "HOME");
331 if ( base ) 331 if ( base )
332 return QString( base ) + "/Documents"; 332 return QString( base ) + "/Documents";
333 333
334 return QString( "../Documents" ); 334 return QString( "../Documents" );
335} 335}
336void QPEApplication::applyStyle() { 336void QPEApplication::applyStyle() {
337 Config config( "qpe" ); 337 Config config( "qpe" );
338 338
339 config.setGroup( "Appearance" ); 339 config.setGroup( "Appearance" );
340 340
341 // Widget style 341 // Widget style
342 QString style = config.readEntry( "Style", "Light" ); 342 QString style = config.readEntry( "Style", "Light" );
343 internalSetStyle( style ); 343 internalSetStyle( style );
344 344
345 // Colors 345 // Colors
346 QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) ); 346 QColor bgcolor( config.readEntry( "Background", "#E5E1D5" ) );
347 QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) ); 347 QColor btncolor( config.readEntry( "Button", "#D6CDBB" ) );
348 QPalette pal( btncolor, bgcolor ); 348 QPalette pal( btncolor, bgcolor );
349 QString color = config.readEntry( "Highlight", "#800000" ); 349 QString color = config.readEntry( "Highlight", "#800000" );
350 pal.setColor( QColorGroup::Highlight, QColor( color ) ); 350 pal.setColor( QColorGroup::Highlight, QColor( color ) );
351 color = config.readEntry( "HighlightedText", "#FFFFFF" ); 351 color = config.readEntry( "HighlightedText", "#FFFFFF" );
352 pal.setColor( QColorGroup::HighlightedText, QColor( color ) ); 352 pal.setColor( QColorGroup::HighlightedText, QColor( color ) );
353 color = config.readEntry( "Text", "#000000" ); 353 color = config.readEntry( "Text", "#000000" );
354 pal.setColor( QColorGroup::Text, QColor( color ) ); 354 pal.setColor( QColorGroup::Text, QColor( color ) );
355 color = config.readEntry( "ButtonText", "#000000" ); 355 color = config.readEntry( "ButtonText", "#000000" );
356 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) ); 356 pal.setColor( QPalette::Active, QColorGroup::ButtonText, QColor( color ) );
357 color = config.readEntry( "Base", "#FFFFFF" ); 357 color = config.readEntry( "Base", "#FFFFFF" );
358 pal.setColor( QColorGroup::Base, QColor( color ) ); 358 pal.setColor( QColorGroup::Base, QColor( color ) );
359 359
360 pal.setColor( QPalette::Disabled, QColorGroup::Text, 360 pal.setColor( QPalette::Disabled, QColorGroup::Text,
361 pal.color( QPalette::Active, QColorGroup::Background ).dark() ); 361 pal.color( QPalette::Active, QColorGroup::Background ).dark() );
362 362
363 setPalette( pal, TRUE ); 363 setPalette( pal, TRUE );
364 364
365 365
366 366
367 // Font 367 // Font
368 QString ff = config.readEntry( "FontFamily", font().family() ); 368 QString ff = config.readEntry( "FontFamily", font().family() );
369 int fs = config.readNumEntry( "FontSize", font().pointSize() ); 369 int fs = config.readNumEntry( "FontSize", font().pointSize() );
370 setFont( QFont(ff, fs) ); 370 setFont( QFont(ff, fs) );
371} 371}
372int QPEApplication::defaultRotation() { 372int QPEApplication::defaultRotation() {
373 return 0; 373 return 0;
374} 374}
375void QPEApplication::setDefaultRotation(int r ) { 375void QPEApplication::setDefaultRotation(int r ) {
376 376
377} 377}
378void QPEApplication::grabKeyboard() { 378void QPEApplication::grabKeyboard() {
379 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; 379 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d;
380 if ( qApp->type() == QApplication::GuiServer ) 380 if ( qApp->type() == QApplication::GuiServer )
381 d->kbgrabber = 0; 381 d->kbgrabber = 0;
382 else { 382 else {
383 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); 383 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
384 e << d->appName; 384 e << d->appName;
385 385
386 d->kbgrabber = 2; // me 386 d->kbgrabber = 2; // me
387 } 387 }
388} 388}
389void QPEApplication::ungrabKeyboard() { 389void QPEApplication::ungrabKeyboard() {
390 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d; 390 QPEApplication::Private * d = ( ( QPEApplication* ) qApp ) ->d;
391 if ( d->kbgrabber == 2 ) { 391 if ( d->kbgrabber == 2 ) {
392 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" ); 392 QCopEnvelope e( "QPE/System", "grabKeyboard(QString)" );
393 e << QString::null; 393 e << QString::null;
394 394
395 d->kbregrab = FALSE; 395 d->kbregrab = FALSE;
396 d->kbgrabber = 0; 396 d->kbgrabber = 0;
397 } 397 }
398} 398}
399void QPEApplication::showMainWidget( QWidget* wid, bool b) { 399void QPEApplication::showMainWidget( QWidget* wid, bool b) {
400 d->show(wid, b ); 400 d->show(wid, b );
401} 401}
402void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) { 402void QPEApplication::showMainDocumentWidget( QWidget* mw, bool m) {
403 if ( mw && argc() == 2 ) 403 if ( mw && argc() == 2 )
404 Global::setDocument( mw, QString::fromUtf8(argv()[1] ) ); 404 Global::setDocument( mw, QString::fromUtf8(argv()[1] ) );
405 405
406 d->show(mw, m ); 406 d->show(mw, m );
407} 407}
408void QPEApplication::showDialog( QDialog* d, bool nomax ) { 408void QPEApplication::showDialog( QDialog* d, bool nomax ) {
409 QSize sh = d->sizeHint(); 409 QSize sh = d->sizeHint();
410 int w = QMAX(sh.width(),d->width()); 410 int w = QMAX(sh.width(),d->width());
411 int h = QMAX(sh.height(),d->height()); 411 int h = QMAX(sh.height(),d->height());
412 if ( !nomax 412 if ( !nomax
413 && ( w > qApp->desktop()->width()*3/4 413 && ( w > qApp->desktop()->width()*3/4
414 || h > qApp->desktop()->height()*3/4 ) ) 414 || h > qApp->desktop()->height()*3/4 ) )
415 { 415 {
416 d->showMaximized(); 416 d->showMaximized();
417 } else { 417 } else {
418 d->resize(w,h); 418 d->resize(w,h);
419 d->show(); 419 d->show();
420 } 420 }
421} 421}
422int QPEApplication::execDialog( QDialog* d, bool nomax) { 422int QPEApplication::execDialog( QDialog* d, bool nomax) {
423 showDialog(d,nomax); 423 showDialog(d,nomax);
424 return d->exec(); 424 return d->exec();
425} 425}
426void QPEApplication::setKeepRunning() { 426void QPEApplication::setKeepRunning() {
427 if ( qApp && qApp->inherits( "QPEApplication" ) ) { 427 if ( qApp && qApp->inherits( "QPEApplication" ) ) {
428 QPEApplication * qpeApp = ( QPEApplication* ) qApp; 428 QPEApplication * qpeApp = ( QPEApplication* ) qApp;
429 qpeApp->d->keep_running = TRUE; 429 qpeApp->d->keep_running = TRUE;
430 } 430 }
431} 431}
432bool QPEApplication::keepRunning()const { 432bool QPEApplication::keepRunning()const {
433 return d->keep_running; 433 return d->keep_running;
434} 434}
435bool QPEApplication::keyboardGrabbed()const { 435bool QPEApplication::keyboardGrabbed()const {
436 return d->kbgrabber; 436 return d->kbgrabber;
437} 437}
438int QPEApplication::exec() { 438int QPEApplication::exec() {
439 /* now send the QCOP stuff gotten from the file */ 439 /* now send the QCOP stuff gotten from the file */
440 d->sendQCopQ(); 440 d->sendQCopQ();
441 441
442 if ( d->keep_running ) { 442 if ( d->keep_running ) {
443 qWarning("going to exec"); 443 qWarning("going to exec");
444 int a = QApplication::exec(); 444 int a = QApplication::exec();
445 qWarning("left"); 445 qWarning("left");
446 return a; 446 return a;
447 } 447 }
448 448
449 { 449 {
450 QCopEnvelope e( "QPE/System", "closing(QString)" ); 450 QCopEnvelope e( "QPE/System", "closing(QString)" );
451 e << d->appName; 451 e << d->appName;
452 } 452 }
453 qWarning("processing events!"); 453 qWarning("processing events!");
454 processEvents(); 454 processEvents();
455 return 0; 455 return 0;
456} 456}
457void QPEApplication::internalSetStyle( const QString& ) { 457void QPEApplication::internalSetStyle( const QString& ) {
458 458
459} 459}
460void QPEApplication::systemMessage( const QCString&, const QByteArray& ) { 460void QPEApplication::systemMessage( const QCString&, const QByteArray& ) {
461 461
462} 462}
463void QPEApplication::pidMessage( const QCString&, const QByteArray& ) { 463void QPEApplication::pidMessage( const QCString&, const QByteArray& ) {
464 464
465} 465}
466void QPEApplication::timerEvent( QTimerEvent* e ) { 466void QPEApplication::timerEvent( QTimerEvent* e ) {
467 if ( e->timerId() == d->presstimer && d->presswidget ) { 467 if ( e->timerId() == d->presstimer && d->presswidget ) {
468 // Right pressed 468 // Right pressed
469 postEvent( d->presswidget, 469 postEvent( d->presswidget,
470 new QMouseEvent( QEvent::MouseButtonPress, d->presspos, 470 new QMouseEvent( QEvent::MouseButtonPress, d->presspos,
471 RightButton, LeftButton ) ); 471 RightButton, LeftButton ) );
472 killTimer( d->presstimer ); 472 killTimer( d->presstimer );
473 d->presstimer = 0; 473 d->presstimer = 0;
474 } 474 }
475} 475}
476 476
477// InputMethods Hints 477// InputMethods Hints
478namespace { 478namespace {
479 static QPtrDict<void>* inputMethodDict = 0; 479 static QPtrDict<void>* inputMethodDict = 0;
480 static void createInputMethodDict(){ 480 static void createInputMethodDict(){
481 if ( !inputMethodDict ) 481 if ( !inputMethodDict )
482 inputMethodDict = new QPtrDict<void>; 482 inputMethodDict = new QPtrDict<void>;
483 } 483 }
484 484
485 static QPtrDict<void>* stylusDict = 0; 485 static QPtrDict<void>* stylusDict = 0;
486 static void createDict() { 486 static void createDict() {
487 if ( !stylusDict ) 487 if ( !stylusDict )
488 stylusDict = new QPtrDict<void>; 488 stylusDict = new QPtrDict<void>;
489 } 489 }
490}; 490};
491 491
492void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) { 492void QPEApplication::setInputMethodHint( QWidget* w, InputMethodHint mode ) {
493 createInputMethodDict(); 493 createInputMethodDict();
494 if ( mode == Normal ) { 494 if ( mode == Normal ) {
495 inputMethodDict->remove 495 inputMethodDict->remove
496 ( w ); 496 ( w );
497 }else { 497 }else {
498 inputMethodDict->insert( w, ( void* ) mode ); 498 inputMethodDict->insert( w, ( void* ) mode );
499 } 499 }
500} 500}
501QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) { 501QPEApplication::InputMethodHint QPEApplication::inputMethodHint( QWidget* w) {
502 if ( inputMethodDict && w ) 502 if ( inputMethodDict && w )
503 return ( InputMethodHint ) ( int ) inputMethodDict->find( w ); 503 return ( InputMethodHint ) ( int ) inputMethodDict->find( w );
504 return Normal; 504 return Normal;
505} 505}
506 506
507 507
508void QPEApplication::removeSenderFromStylusDict() { 508void QPEApplication::removeSenderFromStylusDict() {
509 stylusDict->remove( ( void* ) sender() ); 509 stylusDict->remove( ( void* ) sender() );
510 if ( d->presswidget == sender() ) 510 if ( d->presswidget == sender() )
511 d->presswidget = 0; 511 d->presswidget = 0;
512} 512}
513void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) { 513void QPEApplication::setStylusOperation( QWidget* w, StylusMode mode) {
514 createDict(); 514 createDict();
515 if ( mode == LeftOnly ) { 515 if ( mode == LeftOnly ) {
516 stylusDict->remove 516 stylusDict->remove
517 ( w ); 517 ( w );
518 w->removeEventFilter( qApp ); 518 w->removeEventFilter( qApp );
519 }else { 519 }else {
520 stylusDict->insert( w, ( void* ) mode ); 520 stylusDict->insert( w, ( void* ) mode );
521 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) ); 521 connect( w, SIGNAL( destroyed() ), qApp, SLOT( removeSenderFromStylusDict() ) );
522 w->installEventFilter( qApp ); 522 w->installEventFilter( qApp );
523 } 523 }
524} 524}
525QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) { 525QPEApplication::StylusMode QPEApplication::stylusOperation( QWidget* w) {
526 if ( stylusDict ) 526 if ( stylusDict )
527 return ( StylusMode ) ( int ) stylusDict->find( w ); 527 return ( StylusMode ) ( int ) stylusDict->find( w );
528 return LeftOnly; 528 return LeftOnly;
529} 529}
530 530
531// eventFilter...... 531// eventFilter......
532bool QPEApplication::eventFilter( QObject* o, QEvent* e ) { 532bool QPEApplication::eventFilter( QObject* o, QEvent* e ) {
533 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) { 533 if ( stylusDict && e->type() >= QEvent::MouseButtonPress && e->type() <= QEvent::MouseMove ) {
534 QMouseEvent * me = ( QMouseEvent* ) e; 534 QMouseEvent * me = ( QMouseEvent* ) e;
535 StylusMode mode = (StylusMode)(int)stylusDict->find(o); 535 StylusMode mode = (StylusMode)(int)stylusDict->find(o);
536 switch (mode) { 536 switch (mode) {
537 case RightOnHold: 537 case RightOnHold:
538 switch ( me->type() ) { 538 switch ( me->type() ) {
539 case QEvent::MouseButtonPress: 539 case QEvent::MouseButtonPress:
540 if ( me->button() == LeftButton ) { 540 if ( me->button() == LeftButton ) {
541 d->presstimer = startTimer(500); // #### pref. 541 d->presstimer = startTimer(500); // #### pref.
542 d->presswidget = (QWidget*)o; 542 d->presswidget = (QWidget*)o;
543 d->presspos = me->pos(); 543 d->presspos = me->pos();
544 d->rightpressed = FALSE; 544 d->rightpressed = FALSE;
545 } 545 }
546 break; 546 break;
547 case QEvent::MouseMove: 547 case QEvent::MouseMove:
548 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) { 548 if (d->presstimer && (me->pos() - d->presspos).manhattanLength() > 8) {
549 killTimer(d->presstimer); 549 killTimer(d->presstimer);
550 d->presstimer = 0; 550 d->presstimer = 0;
551 } 551 }
552 break; 552 break;
553 case QEvent::MouseButtonRelease: 553 case QEvent::MouseButtonRelease:
554 if ( me->button() == LeftButton ) { 554 if ( me->button() == LeftButton ) {
555 if ( d->presstimer ) { 555 if ( d->presstimer ) {
556 killTimer(d->presstimer); 556 killTimer(d->presstimer);
557 d->presstimer = 0; 557 d->presstimer = 0;
558 } 558 }
559 if ( d->rightpressed && d->presswidget ) { 559 if ( d->rightpressed && d->presswidget ) {
560 // Right released 560 // Right released
561 postEvent( d->presswidget, 561 postEvent( d->presswidget,
562 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(), 562 new QMouseEvent( QEvent::MouseButtonRelease, me->pos(),
563 RightButton, LeftButton + RightButton ) ); 563 RightButton, LeftButton + RightButton ) );
564 // Left released, off-widget 564 // Left released, off-widget
565 postEvent( d->presswidget, 565 postEvent( d->presswidget,
566 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1), 566 new QMouseEvent( QEvent::MouseMove, QPoint( -1, -1),
567 LeftButton, LeftButton ) ); 567 LeftButton, LeftButton ) );
568 postEvent( d->presswidget, 568 postEvent( d->presswidget,
569 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1), 569 new QMouseEvent( QEvent::MouseButtonRelease, QPoint( -1, -1),
570 LeftButton, LeftButton ) ); 570 LeftButton, LeftButton ) );
571 d->rightpressed = FALSE; 571 d->rightpressed = FALSE;
572 return TRUE; // don't send the real Left release 572 return TRUE; // don't send the real Left release
573 } 573 }
574 } 574 }
575 break; 575 break;
576 default: 576 default:
577 break; 577 break;
578 } 578 }
579 break; 579 break;
580 default: 580 default:
581 ; 581 ;
582 } 582 }
583 } 583 }
584 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) { 584 else if ( e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease ) {
585 QKeyEvent *ke = (QKeyEvent *)e; 585 QKeyEvent *ke = (QKeyEvent *)e;
586 if ( ke->key() == Key_Enter ) { 586 if ( ke->key() == Key_Enter ) {
587 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) { 587 if ( o->isA( "QRadioButton" ) || o->isA( "QCheckBox" ) ) {
588 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ', 588 postEvent( o, new QKeyEvent( e->type(), Key_Space, ' ',
589 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) ); 589 ke->state(), " ", ke->isAutoRepeat(), ke->count() ) );
590 return TRUE; 590 return TRUE;
591 } 591 }
592 } 592 }
593 } 593 }
594 return FALSE; 594 return FALSE;
595} 595}
596 596
597// Quit stuff 597// Quit stuff
598void QPEApplication::restart() { 598void QPEApplication::restart() {
599 599
600} 600}
601void QPEApplication::shutdown() { 601void QPEApplication::shutdown() {
602 602
603} 603}
604void QPEApplication::tryQuit() { 604void QPEApplication::tryQuit() {
605 qWarning("TryQuit!!"); 605 qWarning("TryQuit!!");
606 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 ) 606 if ( activeModalWidget() || strcmp( argv() [ 0 ], "embeddedkonsole" ) == 0 )
607 return ; // Inside modal loop or konsole. Too hard to save state. 607 return ; // Inside modal loop or konsole. Too hard to save state.
608 { 608 {
609 QCopEnvelope e( "QPE/System", "closing(QString)" ); 609 QCopEnvelope e( "QPE/System", "closing(QString)" );
610 e << d->appName; 610 e << d->appName;
611 } 611 }
612 processEvents(); 612 processEvents();
613 613
614 quit(); 614 quit();
615} 615}
616void QPEApplication::hideOrQuit() { 616void QPEApplication::hideOrQuit() {
617 qWarning("hide or close"); 617 qWarning("hide or close");
618 processEvents(); 618 processEvents();
619 qWarning("past processing"); 619 qWarning("past processing");
620 620
621 // If we are a preloaded application we don't actually quit, so emit 621 // If we are a preloaded application we don't actually quit, so emit
622 // a System message indicating we're quasi-closing. 622 // a System message indicating we're quasi-closing.
623 if ( d->preloaded && d->qpe_main_widget ) 623 if ( d->preloaded && d->qpe_main_widget )
624 624
625 { 625 {
626 qWarning("hiding"); 626 qWarning("hiding");
627 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" ); 627 QCopEnvelope e("QPE/System", "fastAppHiding(QString)" );
628 e << d->appName; 628 e << d->appName;
629 d->qpe_main_widget->hide(); 629 d->qpe_main_widget->hide();
630 } 630 }
631 else 631 else
632 quit(); 632 quit();
633} 633}
634 634
635/*!
636 \internal
637*/
638void QPEApplication::prepareForTermination( bool willrestart )
639{
640 if ( willrestart ) {
641 // Draw a big wait icon, the image can be altered in later revisions
642 // QWidget *d = QApplication::desktop();
643 QImage img = Resource::loadImage( "launcher/new_wait" );
644 QPixmap pix;
645 pix.convertFromImage( img.smoothScale( 1 * img.width(), 1 * img.height() ) );
646 QLabel *lblWait = new QLabel( 0, "wait hack!", QWidget::WStyle_Customize |
647 QWidget::WStyle_NoBorder | QWidget::WStyle_Tool );
648 lblWait->setPixmap( pix );
649 lblWait->setAlignment( QWidget::AlignCenter );
650 lblWait->show();
651 lblWait->showMaximized();
652 }
653#ifndef SINGLE_APP
654 { QCopEnvelope envelope( "QPE/System", "forceQuit()" );
655 }
656 processEvents(); // ensure the message goes out.
657 sleep( 1 ); // You have 1 second to comply.
658#endif
659}
660
635#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 661#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX)
636 662
637// The libraries with the skiff package (and possibly others) have 663// The libraries with the skiff package (and possibly others) have
638// completely useless implementations of builtin new and delete that 664// completely useless implementations of builtin new and delete that
639// use about 50% of your CPU. Here we revert to the simple libc 665// use about 50% of your CPU. Here we revert to the simple libc
640// functions. 666// functions.
641 667
642void* operator new[]( size_t size ) 668void* operator new[]( size_t size )
643{ 669{
644 return malloc( size ); 670 return malloc( size );
645} 671}
646 672
647void* operator new( size_t size ) 673void* operator new( size_t size )
648{ 674{
649 return malloc( size ); 675 return malloc( size );
650} 676}
651 677
652void operator delete[]( void* p ) 678void operator delete[]( void* p )
653{ 679{
654 free( p ); 680 free( p );
655} 681}
656 682
657void operator delete[]( void* p, size_t /*size*/ ) 683void operator delete[]( void* p, size_t /*size*/ )
658{ 684{
659 free( p ); 685 free( p );
660} 686}
661 687
662void operator delete( void* p ) 688void operator delete( void* p )
663{ 689{
664 free( p ); 690 free( p );
665} 691}
666 692
667void operator delete( void* p, size_t /*size*/ ) 693void operator delete( void* p, size_t /*size*/ )
668{ 694{
669 free( p ); 695 free( p );
670} 696}
671 697
672#endif 698#endif
diff --git a/x11/libqpe-x11/qpe/qpeapplication.h b/x11/libqpe-x11/qpe/qpeapplication.h
index 2af1c66..333f331 100644
--- a/x11/libqpe-x11/qpe/qpeapplication.h
+++ b/x11/libqpe-x11/qpe/qpeapplication.h
@@ -1,93 +1,102 @@
1#ifndef OPIE_QPE_APPLICATION_H 1#ifndef OPIE_QPE_APPLICATION_H
2#define OPIE_QPE_APPLICATION_H 2#define OPIE_QPE_APPLICATION_H
3 3
4/** 4/**
5 * LGPLed 5 * LGPLed
6 */ 6 */
7 7
8#include <qapplication.h> 8#include <qapplication.h>
9#include <qevent.h> 9#include <qevent.h>
10 10
11#include <qpe/timestring.h> 11#include <qpe/timestring.h>
12 12
13class QCopChannel; 13class QCopChannel;
14class QPEApplication : public QApplication { 14class QPEApplication : public QApplication {
15 Q_OBJECT 15 Q_OBJECT
16public: 16public:
17 QPEApplication(int& argc, char** argv, Type=GuiClient ); 17 QPEApplication(int& argc, char** argv, Type=GuiClient );
18 ~QPEApplication(); 18 ~QPEApplication();
19 19
20 20
21 static QString qpeDir(); 21 static QString qpeDir();
22 static QString documentDir(); 22 static QString documentDir();
23 void applyStyle(); 23 void applyStyle();
24 24
25 static int defaultRotation(); 25 static int defaultRotation();
26 static void setDefaultRotation( int r ); 26 static void setDefaultRotation( int r );
27 static void grabKeyboard(); 27 static void grabKeyboard();
28 static void ungrabKeyboard(); 28 static void ungrabKeyboard();
29 29
30 enum StylusMode { 30 enum StylusMode {
31 LeftOnly, 31 LeftOnly,
32 RightOnHold 32 RightOnHold
33 }; 33 };
34 static void setStylusOperation( QWidget*, StylusMode ); 34 static void setStylusOperation( QWidget*, StylusMode );
35 static StylusMode stylusOperation( QWidget* ); 35 static StylusMode stylusOperation( QWidget* );
36 36
37 enum InputMethodHint { 37 enum InputMethodHint {
38 Normal, 38 Normal,
39 AlwaysOff, 39 AlwaysOff,
40 AlwaysOn 40 AlwaysOn
41 }; 41 };
42 static void setInputMethodHint( QWidget*, InputMethodHint ); 42 static void setInputMethodHint( QWidget*, InputMethodHint );
43 static InputMethodHint inputMethodHint( QWidget* ); 43 static InputMethodHint inputMethodHint( QWidget* );
44 44
45 void showMainWidget( QWidget*, bool nomax = FALSE ); 45 void showMainWidget( QWidget*, bool nomax = FALSE );
46 void showMainDocumentWidget( QWidget*, bool nomax = FALSE ); 46 void showMainDocumentWidget( QWidget*, bool nomax = FALSE );
47 47
48 static void showDialog( QDialog*, bool nomax = FALSE ); 48 static void showDialog( QDialog*, bool nomax = FALSE );
49 static int execDialog( QDialog*, bool nomax = FALSE ); 49 static int execDialog( QDialog*, bool nomax = FALSE );
50 50
51 static void setKeepRunning(); 51 static void setKeepRunning();
52 bool keepRunning()const; 52 bool keepRunning()const;
53 53
54 bool keyboardGrabbed()const; 54 bool keyboardGrabbed()const;
55 int exec(); 55 int exec();
56 56
57// QWS bits
58 enum screenSaverHint {
59 Disable = 0,
60 DisableLightOff = 1,
61 DisableSuspend = 2,
62 Enable = 100
63 };
64
57signals: 65signals:
58 void clientMoused(); 66 void clientMoused();
59 void timeChanged(); 67 void timeChanged();
60 void clockChanged( bool pm ); 68 void clockChanged( bool pm );
61 void micChanged( bool muted ); 69 void micChanged( bool muted );
62 void volumeChanged( bool muted ); 70 void volumeChanged( bool muted );
63 void appMessage( const QCString& msg, const QByteArray& data); 71 void appMessage( const QCString& msg, const QByteArray& data);
64 void weekChanged( bool startOnMonday ); 72 void weekChanged( bool startOnMonday );
65 void dateFormatChanged( DateFormat ); 73 void dateFormatChanged( DateFormat );
66 void flush(); 74 void flush();
67 void reload(); 75 void reload();
68 76
69private: 77private:
70 void initTranslations(); 78 void initTranslations();
71 void internalSetStyle(const QString&); 79 void internalSetStyle(const QString&);
72 80
73private slots: 81private slots:
74 void hideOrQuit(); 82 void hideOrQuit();
75 void systemMessage( const QCString&, const QByteArray& ); 83 void systemMessage( const QCString&, const QByteArray& );
76 void pidMessage( const QCString&, const QByteArray& ); 84 void pidMessage( const QCString&, const QByteArray& );
77 void removeSenderFromStylusDict(); 85 void removeSenderFromStylusDict();
78protected: 86protected:
79 virtual void restart(); 87 virtual void restart();
80 virtual void shutdown(); 88 virtual void shutdown();
89 void prepareForTermination(bool willrestart);
81 bool eventFilter( QObject*, QEvent* ); 90 bool eventFilter( QObject*, QEvent* );
82 void timerEvent( QTimerEvent* ); 91 void timerEvent( QTimerEvent* );
83 void raiseAppropriateWindow(); 92 void raiseAppropriateWindow();
84 virtual void tryQuit(); 93 virtual void tryQuit();
85 94
86private: 95private:
87 class Private; 96 class Private;
88 Private* d; 97 Private* d;
89 QCopChannel *m_sys; 98 QCopChannel *m_sys;
90 QCopChannel *m_pid; 99 QCopChannel *m_pid;
91}; 100};
92 101
93#endif 102#endif
diff --git a/x11/libqpe-x11/qt/qwindowsystem_qws.h b/x11/libqpe-x11/qt/qwindowsystem_qws.h
index 7bc43c5..2652f5f 100644
--- a/x11/libqpe-x11/qt/qwindowsystem_qws.h
+++ b/x11/libqpe-x11/qt/qwindowsystem_qws.h
@@ -1,18 +1,35 @@
1#ifndef OPIE_QWINDOWSYSTEM_H 1#ifndef OPIE_QWINDOWSYSTEM_H
2#define OPIE_QWINDOWSYSTEM_H 2#define OPIE_QWINDOWSYSTEM_H
3 3
4class QWSScreenSaver;
4class QWSServer { 5class QWSServer {
5public: 6public:
6QWSServer(){} 7QWSServer(){}
7~QWSServer(){} 8~QWSServer(){}
8 static void sendKeyEvent(int, int, int, bool, bool ) { } 9 static void sendKeyEvent(int, int, int, bool, bool ) { }
9 struct KeyboardFilter { 10 struct KeyboardFilter {
10 }; 11 };
11 static void setKeyboardFilter( KeyboardFilter* ) { 12 static void setKeyboardFilter( KeyboardFilter* ) {
12 13
13 } 14 }
15 static void setScreenSaver( QWSScreenSaver* ) {
14 16
15}; 17 }
18 static void setScreenSaverInterval( int ) {
19
20 }
21 static void setScreenSaverIntervals( int[] ) {
22
23 }
24 static void screenSaverActivate( bool ) {
16 25
26 }
27 static void setDesktopBackground( const QImage& ) {
28
29 }
30
31};
32struct QWSScreenSaver {
33};
17 34
18#endif 35#endif