-rw-r--r-- | core/launcher/launcher.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 54efb0b..5d0c778 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp | |||
@@ -53,100 +53,100 @@ | |||
53 | #include "startmenu.h" | 53 | #include "startmenu.h" |
54 | #include "taskbar.h" | 54 | #include "taskbar.h" |
55 | 55 | ||
56 | #include "serverinterface.h" | 56 | #include "serverinterface.h" |
57 | #include "launcherview.h" | 57 | #include "launcherview.h" |
58 | #include "launcher.h" | 58 | #include "launcher.h" |
59 | #include "server.h" | 59 | #include "server.h" |
60 | 60 | ||
61 | #define QTOPIA_INTERNAL_FSLP | 61 | #define QTOPIA_INTERNAL_FSLP |
62 | #include <qtopia/lnkproperties.h> | 62 | #include <qtopia/lnkproperties.h> |
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | #include <assert.h> | 64 | #include <assert.h> |
65 | 65 | ||
66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) | 66 | #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) |
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #include <stdio.h> | 68 | #include <stdio.h> |
69 | #include <sys/vfs.h> | 69 | #include <sys/vfs.h> |
70 | #include <mntent.h> | 70 | #include <mntent.h> |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #ifdef Q_WS_QWS | 73 | #ifdef Q_WS_QWS |
74 | #include <qkeyboard_qws.h> | 74 | #include <qkeyboard_qws.h> |
75 | #include <qpe/lnkproperties.h> | 75 | #include <qpe/lnkproperties.h> |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | 78 | ||
79 | static bool isVisibleWindow( int ); | 79 | static bool isVisibleWindow( int ); |
80 | //=========================================================================== | 80 | //=========================================================================== |
81 | 81 | ||
82 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : | 82 | LauncherTabWidget::LauncherTabWidget( Launcher* parent ) : |
83 | QVBox( parent ), docview( 0 ) | 83 | QVBox( parent ), docview( 0 ) |
84 | { | 84 | { |
85 | docLoadingWidgetEnabled = false; | 85 | docLoadingWidgetEnabled = false; |
86 | docLoadingWidget = 0; | 86 | docLoadingWidget = 0; |
87 | docLoadingWidgetProgress = 0; | 87 | docLoadingWidgetProgress = 0; |
88 | launcher = parent; | 88 | launcher = parent; |
89 | categoryBar = new LauncherTabBar( this ); | 89 | categoryBar = new LauncherTabBar( this ); |
90 | QPalette pal = categoryBar->palette(); | 90 | QPalette pal = categoryBar->palette(); |
91 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); | 91 | pal.setColor( QColorGroup::Light, pal.color(QPalette::Active,QColorGroup::Shadow) ); |
92 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); | 92 | pal.setColor( QColorGroup::Background, pal.active().background().light(110) ); |
93 | categoryBar->setPalette( pal ); | 93 | categoryBar->setPalette( pal ); |
94 | stack = new QWidgetStack(this); | 94 | stack = new QWidgetStack(this); |
95 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); | 95 | connect( categoryBar, SIGNAL(selected(int)), this, SLOT(raiseTabWidget()) ); |
96 | categoryBar->show(); | 96 | categoryBar->show(); |
97 | stack->show(); | 97 | stack->show(); |
98 | 98 | ||
99 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 99 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
100 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); | 100 | QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); |
101 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 101 | connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), |
102 | this, SLOT(launcherMessage(const QCString&, const QByteArray&)) ); | 102 | this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); |
103 | connect( qApp, SIGNAL(appMessage(const QCString&, const QByteArray&)), | 103 | connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), |
104 | this, SLOT(appMessage(const QCString&, const QByteArray&))); | 104 | this, SLOT(appMessage(const QCString&,const QByteArray&))); |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | createDocLoadingWidget(); | 107 | createDocLoadingWidget(); |
108 | } | 108 | } |
109 | 109 | ||
110 | void LauncherTabWidget::createDocLoadingWidget() | 110 | void LauncherTabWidget::createDocLoadingWidget() |
111 | { | 111 | { |
112 | // Construct the 'doc loading widget' shown when finding documents | 112 | // Construct the 'doc loading widget' shown when finding documents |
113 | 113 | ||
114 | // ### LauncherView class needs changing to be more generic so | 114 | // ### LauncherView class needs changing to be more generic so |
115 | // this widget can change its background similar to the iconviews | 115 | // this widget can change its background similar to the iconviews |
116 | // so the background for this matches | 116 | // so the background for this matches |
117 | docLoadingWidget = new LauncherView( stack ); | 117 | docLoadingWidget = new LauncherView( stack ); |
118 | docLoadingWidget->hideIcons(); | 118 | docLoadingWidget->hideIcons(); |
119 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); | 119 | QVBox *docLoadingVBox = new QVBox( docLoadingWidget ); |
120 | 120 | ||
121 | docLoadingVBox->setSpacing( 20 ); | 121 | docLoadingVBox->setSpacing( 20 ); |
122 | docLoadingVBox->setMargin( 10 ); | 122 | docLoadingVBox->setMargin( 10 ); |
123 | 123 | ||
124 | QWidget *space1 = new QWidget( docLoadingVBox ); | 124 | QWidget *space1 = new QWidget( docLoadingVBox ); |
125 | docLoadingVBox->setStretchFactor( space1, 1 ); | 125 | docLoadingVBox->setStretchFactor( space1, 1 ); |
126 | 126 | ||
127 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); | 127 | QLabel *waitPixmap = new QLabel( docLoadingVBox ); |
128 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); | 128 | waitPixmap->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, waitPixmap->sizePolicy().hasHeightForWidth() ) ); |
129 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); | 129 | waitPixmap->setPixmap( Resource::loadPixmap( "bigwait" ) ); |
130 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); | 130 | waitPixmap->setAlignment( int( QLabel::AlignCenter ) ); |
131 | 131 | ||
132 | Config cfg( "Launcher" ); | 132 | Config cfg( "Launcher" ); |
133 | cfg.setGroup( "DocTab" ); | 133 | cfg.setGroup( "DocTab" ); |
134 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 134 | bool docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
135 | 135 | ||
136 | QLabel *textLabel = new QLabel( docLoadingVBox ); | 136 | QLabel *textLabel = new QLabel( docLoadingVBox ); |
137 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); | 137 | textLabel->setAlignment( int( QLabel::AlignCenter ) ); |
138 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); | 138 | docLoadingWidgetProgress = new QProgressBar( docLoadingVBox ); |
139 | docLoadingWidgetProgress->setProgress( 0 ); | 139 | docLoadingWidgetProgress->setProgress( 0 ); |
140 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); | 140 | docLoadingWidgetProgress->setCenterIndicator( TRUE ); |
141 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker | 141 | docLoadingWidgetProgress->setBackgroundMode( NoBackground ); // No flicker |
142 | setProgressStyle(); | 142 | setProgressStyle(); |
143 | 143 | ||
144 | if ( docTabEnabled ) | 144 | if ( docTabEnabled ) |
145 | { | 145 | { |
146 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); | 146 | textLabel->setText( tr( "<b>Finding Documents...</b>" ) ); |
147 | } | 147 | } |
148 | else | 148 | else |
149 | { | 149 | { |
150 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" | 150 | textLabel->setText( tr( "<b>The Documents Tab<p>has been disabled.<p>" |
151 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); | 151 | "Use Settings->Launcher->DocTab<p>to reenable it.</b></center>" ) ); |
152 | docLoadingWidgetProgress->hide(); | 152 | docLoadingWidgetProgress->hide(); |
@@ -432,98 +432,98 @@ void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray & | |||
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
435 | 435 | ||
436 | //--------------------------------------------------------------------------- | 436 | //--------------------------------------------------------------------------- |
437 | 437 | ||
438 | Launcher::Launcher() | 438 | Launcher::Launcher() |
439 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) | 439 | : QMainWindow( 0, "PDA User Interface", QWidget::WStyle_Customize | QWidget::WGroupLeader ) |
440 | { | 440 | { |
441 | tabs = 0; | 441 | tabs = 0; |
442 | tb = 0; | 442 | tb = 0; |
443 | Config cfg( "Launcher" ); | 443 | Config cfg( "Launcher" ); |
444 | cfg.setGroup( "DocTab" ); | 444 | cfg.setGroup( "DocTab" ); |
445 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); | 445 | docTabEnabled = cfg.readBoolEntry( "Enable", true ); |
446 | } | 446 | } |
447 | 447 | ||
448 | void Launcher::createGUI() | 448 | void Launcher::createGUI() |
449 | { | 449 | { |
450 | setCaption( tr("Launcher") ); | 450 | setCaption( tr("Launcher") ); |
451 | 451 | ||
452 | // we have a pretty good idea how big we'll be | 452 | // we have a pretty good idea how big we'll be |
453 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); | 453 | setGeometry( 0, 0, qApp->desktop()->width(), qApp->desktop()->height() ); |
454 | 454 | ||
455 | tb = new TaskBar; | 455 | tb = new TaskBar; |
456 | tabs = new LauncherTabWidget( this ); | 456 | tabs = new LauncherTabWidget( this ); |
457 | setCentralWidget( tabs ); | 457 | setCentralWidget( tabs ); |
458 | 458 | ||
459 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); | 459 | ServerInterface::dockWidget( tb, ServerInterface::Bottom ); |
460 | tb->show(); | 460 | tb->show(); |
461 | 461 | ||
462 | qApp->installEventFilter( this ); | 462 | qApp->installEventFilter( this ); |
463 | 463 | ||
464 | 464 | ||
465 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); | 465 | connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); |
466 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); | 466 | connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); |
467 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); | 467 | connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); |
468 | 468 | ||
469 | connect( tb, SIGNAL(tabSelected(const QString&)), | 469 | connect( tb, SIGNAL(tabSelected(const QString&)), |
470 | this, SLOT(showTab(const QString&)) ); | 470 | this, SLOT(showTab(const QString&)) ); |
471 | connect( tabs, SIGNAL(selected(const QString&)), | 471 | connect( tabs, SIGNAL(selected(const QString&)), |
472 | this, SLOT(viewSelected(const QString&)) ); | 472 | this, SLOT(viewSelected(const QString&)) ); |
473 | connect( tabs, SIGNAL(clicked(const AppLnk*)), | 473 | connect( tabs, SIGNAL(clicked(const AppLnk*)), |
474 | this, SLOT(select(const AppLnk*))); | 474 | this, SLOT(select(const AppLnk*))); |
475 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), | 475 | connect( tabs, SIGNAL(rightPressed(AppLnk*)), |
476 | this, SLOT(properties(AppLnk*))); | 476 | this, SLOT(properties(AppLnk*))); |
477 | 477 | ||
478 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 478 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
479 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); | 479 | QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); |
480 | connect( sysChannel, SIGNAL(received(const QCString &, const QByteArray &)), | 480 | connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), |
481 | this, SLOT(systemMessage( const QCString &, const QByteArray &)) ); | 481 | this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); |
482 | #endif | 482 | #endif |
483 | 483 | ||
484 | // all documents | 484 | // all documents |
485 | QImage img( Resource::loadImage( "DocsIcon" ) ); | 485 | QImage img( Resource::loadImage( "DocsIcon" ) ); |
486 | QPixmap pm; | 486 | QPixmap pm; |
487 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); | 487 | pm = img.smoothScale( AppLnk::smallIconSize(), AppLnk::smallIconSize() ); |
488 | // It could add this itself if it handles docs | 488 | // It could add this itself if it handles docs |
489 | 489 | ||
490 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); | 490 | tabs->newView("Documents", pm, tr("Documents") )->setToolsEnabled( TRUE ); |
491 | 491 | ||
492 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); | 492 | QTimer::singleShot( 0, tabs, SLOT( initLayout() ) ); |
493 | qApp->setMainWidget( this ); | 493 | qApp->setMainWidget( this ); |
494 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); | 494 | QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); |
495 | } | 495 | } |
496 | 496 | ||
497 | Launcher::~Launcher() | 497 | Launcher::~Launcher() |
498 | { | 498 | { |
499 | if ( tb ) | 499 | if ( tb ) |
500 | destroyGUI(); | 500 | destroyGUI(); |
501 | } | 501 | } |
502 | 502 | ||
503 | bool Launcher::requiresDocuments() const | 503 | bool Launcher::requiresDocuments() const |
504 | { | 504 | { |
505 | Config cfg( "Launcher" ); | 505 | Config cfg( "Launcher" ); |
506 | cfg.setGroup( "DocTab" ); | 506 | cfg.setGroup( "DocTab" ); |
507 | return cfg.readBoolEntry( "Enable", true ); | 507 | return cfg.readBoolEntry( "Enable", true ); |
508 | } | 508 | } |
509 | 509 | ||
510 | void Launcher::makeVisible() | 510 | void Launcher::makeVisible() |
511 | { | 511 | { |
512 | showMaximized(); | 512 | showMaximized(); |
513 | } | 513 | } |
514 | 514 | ||
515 | void Launcher::destroyGUI() | 515 | void Launcher::destroyGUI() |
516 | { | 516 | { |
517 | delete tb; | 517 | delete tb; |
518 | tb = 0; | 518 | tb = 0; |
519 | delete tabs; | 519 | delete tabs; |
520 | tabs =0; | 520 | tabs =0; |
521 | } | 521 | } |
522 | 522 | ||
523 | bool Launcher::eventFilter( QObject*, QEvent *ev ) | 523 | bool Launcher::eventFilter( QObject*, QEvent *ev ) |
524 | { | 524 | { |
525 | #ifdef QT_QWS_CUSTOM | 525 | #ifdef QT_QWS_CUSTOM |
526 | if ( ev->type() == QEvent::KeyPress ) { | 526 | if ( ev->type() == QEvent::KeyPress ) { |
527 | QKeyEvent *ke = (QKeyEvent *)ev; | 527 | QKeyEvent *ke = (QKeyEvent *)ev; |
528 | if ( ke->key() == Qt::Key_F11 ) { // menu key | 528 | if ( ke->key() == Qt::Key_F11 ) { // menu key |
529 | QWidget *active = qApp->activeWindow(); | 529 | QWidget *active = qApp->activeWindow(); |