summaryrefslogtreecommitdiff
path: root/core/launcher/launcher.cpp
Unidiff
Diffstat (limited to 'core/launcher/launcher.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcher.cpp296
1 files changed, 148 insertions, 148 deletions
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 6afbcd8..779fe54 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -95,13 +95,13 @@ LauncherTabWidget::LauncherTabWidget( Launcher* parent ) :
95 95
96#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 96#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
97 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this ); 97 QCopChannel *channel = new QCopChannel( "QPE/Launcher", this );
98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)), 98 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
99 this, SLOT(launcherMessage(const QCString&,const QByteArray&)) ); 99 this, SLOT(launcherMessage(const QCString&,const QByteArray&)) );
100 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)), 100 connect( qApp, SIGNAL(appMessage(const QCString&,const QByteArray&)),
101 this, SLOT(appMessage(const QCString&,const QByteArray&))); 101 this, SLOT(appMessage(const QCString&,const QByteArray&)));
102#endif 102#endif
103 103
104 createDocLoadingWidget(); 104 createDocLoadingWidget();
105} 105}
106 106
107void LauncherTabWidget::createDocLoadingWidget() 107void LauncherTabWidget::createDocLoadingWidget()
@@ -166,67 +166,67 @@ void LauncherTabWidget::initLayout()
166 categoryBar->showTab("Documents"); 166 categoryBar->showTab("Documents");
167} 167}
168 168
169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&) 169void LauncherTabWidget::appMessage(const QCString& message, const QByteArray&)
170{ 170{
171 if ( message == "nextView()" ) 171 if ( message == "nextView()" )
172 categoryBar->nextTab(); 172 categoryBar->nextTab();
173} 173}
174 174
175void LauncherTabWidget::raiseTabWidget() 175void LauncherTabWidget::raiseTabWidget()
176{ 176{
177 if ( categoryBar->currentView() == docView() 177 if ( categoryBar->currentView() == docView()
178 && docLoadingWidgetEnabled ) { 178 && docLoadingWidgetEnabled ) {
179 stack->raiseWidget( docLoadingWidget ); 179 stack->raiseWidget( docLoadingWidget );
180 docLoadingWidget->updateGeometry(); 180 docLoadingWidget->updateGeometry();
181 } else { 181 } else {
182 stack->raiseWidget( categoryBar->currentView() ); 182 stack->raiseWidget( categoryBar->currentView() );
183 } 183 }
184} 184}
185 185
186void LauncherTabWidget::tabProperties() 186void LauncherTabWidget::tabProperties()
187{ 187{
188 LauncherView *view = categoryBar->currentView(); 188 LauncherView *view = categoryBar->currentView();
189 QPopupMenu *m = new QPopupMenu( this ); 189 QPopupMenu *m = new QPopupMenu( this );
190 m->insertItem( tr("Icon View"), LauncherView::Icon ); 190 m->insertItem( tr("Icon View"), LauncherView::Icon );
191 m->insertItem( tr("List View"), LauncherView::List ); 191 m->insertItem( tr("List View"), LauncherView::List );
192 m->setItemChecked( (int)view->viewMode(), TRUE ); 192 m->setItemChecked( (int)view->viewMode(), TRUE );
193 int rv = m->exec( QCursor::pos() ); 193 int rv = m->exec( QCursor::pos() );
194 if ( rv >= 0 && rv != view->viewMode() ) { 194 if ( rv >= 0 && rv != view->viewMode() ) {
195 view->setViewMode( (LauncherView::ViewMode)rv ); 195 view->setViewMode( (LauncherView::ViewMode)rv );
196 } 196 }
197 197
198 delete m; 198 delete m;
199} 199}
200 200
201void LauncherTabWidget::deleteView( const QString& id ) 201void LauncherTabWidget::deleteView( const QString& id )
202{ 202{
203 LauncherTab *t = categoryBar->launcherTab(id); 203 LauncherTab *t = categoryBar->launcherTab(id);
204 if ( t ) { 204 if ( t ) {
205 stack->removeWidget( t->view ); 205 stack->removeWidget( t->view );
206 delete t->view; 206 delete t->view;
207 categoryBar->removeTab( t ); 207 categoryBar->removeTab( t );
208 } 208 }
209} 209}
210 210
211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label ) 211LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm, const QString& label )
212{ 212{
213 LauncherView* view = new LauncherView( stack ); 213 LauncherView* view = new LauncherView( stack );
214 connect( view, SIGNAL(clicked(const AppLnk*)), 214 connect( view, SIGNAL(clicked(const AppLnk*)),
215 this, SIGNAL(clicked(const AppLnk*))); 215 this, SIGNAL(clicked(const AppLnk*)));
216 connect( view, SIGNAL(rightPressed(AppLnk*)), 216 connect( view, SIGNAL(rightPressed(AppLnk*)),
217 this, SIGNAL(rightPressed(AppLnk*))); 217 this, SIGNAL(rightPressed(AppLnk*)));
218 218
219 int n = categoryBar->count(); 219 int n = categoryBar->count();
220 stack->addWidget( view, n ); 220 stack->addWidget( view, n );
221 221
222 LauncherTab *tab = new LauncherTab( id, view, pm, label ); 222 LauncherTab *tab = new LauncherTab( id, view, pm, label );
223 categoryBar->insertTab( tab, n-1 ); 223 categoryBar->insertTab( tab, n-1 );
224 224
225 if ( id == "Documents" ) 225 if ( id == "Documents" )
226 docview = view; 226 docview = view;
227 227
228 odebug << "inserting " << id << " at " << n-1 << "" << oendl; 228 odebug << "inserting " << id << " at " << n-1 << "" << oendl;
229 229
230 Config cfg("Launcher"); 230 Config cfg("Launcher");
231 setTabAppearance( tab, cfg ); 231 setTabAppearance( tab, cfg );
232 232
@@ -237,26 +237,26 @@ LauncherView* LauncherTabWidget::newView( const QString& id, const QPixmap& pm,
237} 237}
238 238
239LauncherView *LauncherTabWidget::view( const QString &id ) 239LauncherView *LauncherTabWidget::view( const QString &id )
240{ 240{
241 LauncherTab *t = categoryBar->launcherTab(id); 241 LauncherTab *t = categoryBar->launcherTab(id);
242 if ( !t ) 242 if ( !t )
243 return 0; 243 return 0;
244 return t->view; 244 return t->view;
245} 245}
246 246
247LauncherView *LauncherTabWidget::docView() 247LauncherView *LauncherTabWidget::docView()
248{ 248{
249 return docview; 249 return docview;
250} 250}
251 251
252void LauncherTabWidget::setLoadingWidgetEnabled( bool v ) 252void LauncherTabWidget::setLoadingWidgetEnabled( bool v )
253{ 253{
254 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) { 254 if ( v != docLoadingWidgetEnabled && docLoadingWidget ) {
255 docLoadingWidgetEnabled = v; 255 docLoadingWidgetEnabled = v;
256 raiseTabWidget(); 256 raiseTabWidget();
257 } 257 }
258} 258}
259 259
260void LauncherTabWidget::setLoadingProgress( int percent ) 260void LauncherTabWidget::setLoadingProgress( int percent )
261{ 261{
262 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 ); 262 docLoadingWidgetProgress->setProgress( (percent / 4) * 4 );
@@ -265,28 +265,28 @@ void LauncherTabWidget::setLoadingProgress( int percent )
265// ### this function could more to LauncherView 265// ### this function could more to LauncherView
266void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg ) 266void LauncherTabWidget::setTabViewAppearance( LauncherView *v, Config &cfg )
267{ 267{
268 // View 268 // View
269 QString view = cfg.readEntry( "View", "Icon" ); 269 QString view = cfg.readEntry( "View", "Icon" );
270 if ( view == "List" ) // No tr 270 if ( view == "List" ) // No tr
271 v->setViewMode( LauncherView::List ); 271 v->setViewMode( LauncherView::List );
272 QString bgType = cfg.readEntry( "BackgroundType", "Image" ); 272 QString bgType = cfg.readEntry( "BackgroundType", "Image" );
273 if ( bgType == "Image" ) { // No tr 273 if ( bgType == "Image" ) { // No tr
274 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" ); 274 QString pm = cfg.readEntry( "BackgroundImage", "launcher/opie-background" );
275 v->setBackgroundType( LauncherView::Image, pm ); 275 v->setBackgroundType( LauncherView::Image, pm );
276 } else if ( bgType == "SolidColor" ) { 276 } else if ( bgType == "SolidColor" ) {
277 QString c = cfg.readEntry( "BackgroundColor" ); 277 QString c = cfg.readEntry( "BackgroundColor" );
278 v->setBackgroundType( LauncherView::SolidColor, c ); 278 v->setBackgroundType( LauncherView::SolidColor, c );
279 } else { 279 } else {
280 v->setBackgroundType( LauncherView::Ruled, QString::null ); 280 v->setBackgroundType( LauncherView::Ruled, QString::null );
281 } 281 }
282 QString textCol = cfg.readEntry( "TextColor" ); 282 QString textCol = cfg.readEntry( "TextColor" );
283 if ( textCol.isEmpty() ) 283 if ( textCol.isEmpty() )
284 v->setTextColor( QColor() ); 284 v->setTextColor( QColor() );
285 else 285 else
286 v->setTextColor( QColor(textCol) ); 286 v->setTextColor( QColor(textCol) );
287// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE ); 287// bool customFont = cfg.readBoolEntry( "CustomFont", FALSE );
288 288
289 289
290 QStringList font = cfg.readListEntry( "Font", ',' ); 290 QStringList font = cfg.readListEntry( "Font", ',' );
291 if ( font.count() == 4 ) 291 if ( font.count() == 4 )
292 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) ); 292 v->setViewFont( QFont(font[0], font[1].toInt(), font[2].toInt(), font[3].toInt()!=0) );
@@ -302,20 +302,20 @@ void LauncherTabWidget::setTabAppearance( LauncherTab *tab, Config &cfg )
302 302
303 setTabViewAppearance( tab->view, cfg ); 303 setTabViewAppearance( tab->view, cfg );
304 304
305 // Tabs 305 // Tabs
306 QString tabCol = cfg.readEntry( "TabColor" ); 306 QString tabCol = cfg.readEntry( "TabColor" );
307 if ( tabCol.isEmpty() ) 307 if ( tabCol.isEmpty() )
308 tab->bgColor = QColor(); 308 tab->bgColor = QColor();
309 else 309 else
310 tab->bgColor = QColor(tabCol); 310 tab->bgColor = QColor(tabCol);
311 QString tabTextCol = cfg.readEntry( "TabTextColor" ); 311 QString tabTextCol = cfg.readEntry( "TabTextColor" );
312 if ( tabTextCol.isEmpty() ) 312 if ( tabTextCol.isEmpty() )
313 tab->fgColor = QColor(); 313 tab->fgColor = QColor();
314 else 314 else
315 tab->fgColor = QColor(tabTextCol); 315 tab->fgColor = QColor(tabTextCol);
316} 316}
317 317
318void LauncherTabWidget::paletteChange( const QPalette &p ) 318void LauncherTabWidget::paletteChange( const QPalette &p )
319{ 319{
320 QVBox::paletteChange( p ); 320 QVBox::paletteChange( p );
321 QPalette pal = palette(); 321 QPalette pal = palette();
@@ -330,28 +330,28 @@ void LauncherTabWidget::styleChange( QStyle & )
330 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) ); 330 QTimer::singleShot( 0, this, SLOT(setProgressStyle()) );
331} 331}
332 332
333void LauncherTabWidget::setProgressStyle() 333void LauncherTabWidget::setProgressStyle()
334{ 334{
335 if (docLoadingWidgetProgress) { 335 if (docLoadingWidgetProgress) {
336 docLoadingWidgetProgress->setFrameShape( QProgressBar::Box ); 336 docLoadingWidgetProgress->setFrameShape( QProgressBar::Box );
337 docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain ); 337 docLoadingWidgetProgress->setFrameShadow( QProgressBar::Plain );
338 docLoadingWidgetProgress->setMargin( 1 ); 338 docLoadingWidgetProgress->setMargin( 1 );
339 docLoadingWidgetProgress->setLineWidth( 1 ); 339 docLoadingWidgetProgress->setLineWidth( 1 );
340 } 340 }
341} 341}
342 342
343void LauncherTabWidget::setBusy(bool on) 343void LauncherTabWidget::setBusy(bool on)
344{ 344{
345 if ( on ) 345 if ( on )
346 currentView()->setBusy(TRUE); 346 currentView()->setBusy(TRUE);
347 else { 347 else {
348 for ( int i = 0; i < categoryBar->count(); i++ ) { 348 for ( int i = 0; i < categoryBar->count(); i++ ) {
349 LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view; 349 LauncherView *view = ((LauncherTab *)categoryBar->tab(i))->view;
350 view->setBusy( FALSE ); 350 view->setBusy( FALSE );
351 } 351 }
352 } 352 }
353} 353}
354 354
355void LauncherTabWidget::setBusyIndicatorType( const QString& str ) { 355void LauncherTabWidget::setBusyIndicatorType( const QString& str ) {
356 for (int i = 0; i < categoryBar->count(); i++ ) { 356 for (int i = 0; i < categoryBar->count(); i++ ) {
357 LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view; 357 LauncherView* view = static_cast<LauncherTab*>( categoryBar->tab(i) )->view;
@@ -367,57 +367,57 @@ LauncherView *LauncherTabWidget::currentView(void)
367 367
368 368
369void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data) 369void LauncherTabWidget::launcherMessage( const QCString &msg, const QByteArray &data)
370{ 370{
371 QDataStream stream( data, IO_ReadOnly ); 371 QDataStream stream( data, IO_ReadOnly );
372 if ( msg == "setTabView(QString,int)" ) { 372 if ( msg == "setTabView(QString,int)" ) {
373 QString id; 373 QString id;
374 stream >> id; 374 stream >> id;
375 int mode; 375 int mode;
376 stream >> mode; 376 stream >> mode;
377 if ( view(id) ) 377 if ( view(id) )
378 view(id)->setViewMode( (LauncherView::ViewMode)mode ); 378 view(id)->setViewMode( (LauncherView::ViewMode)mode );
379 } else if ( msg == "setTabBackground(QString,int,QString)" ) { 379 } else if ( msg == "setTabBackground(QString,int,QString)" ) {
380 QString id; 380 QString id;
381 stream >> id; 381 stream >> id;
382 int mode; 382 int mode;
383 stream >> mode; 383 stream >> mode;
384 QString pixmapOrColor; 384 QString pixmapOrColor;
385 stream >> pixmapOrColor; 385 stream >> pixmapOrColor;
386 if ( view(id) ) 386 if ( view(id) )
387 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 387 view(id)->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
388 if ( id == "Documents" ) 388 if ( id == "Documents" )
389 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor ); 389 docLoadingWidget->setBackgroundType( (LauncherView::BackgroundType)mode, pixmapOrColor );
390 } else if ( msg == "setTextColor(QString,QString)" ) { 390 } else if ( msg == "setTextColor(QString,QString)" ) {
391 QString id; 391 QString id;
392 stream >> id; 392 stream >> id;
393 QString color; 393 QString color;
394 stream >> color; 394 stream >> color;
395 if ( view(id) ) 395 if ( view(id) )
396 view(id)->setTextColor( QColor(color) ); 396 view(id)->setTextColor( QColor(color) );
397 if ( id == "Documents" ) 397 if ( id == "Documents" )
398 docLoadingWidget->setTextColor( QColor(color) ); 398 docLoadingWidget->setTextColor( QColor(color) );
399 } else if ( msg == "setFont(QString,QString,int,int,int)" ) { 399 } else if ( msg == "setFont(QString,QString,int,int,int)" ) {
400 QString id; 400 QString id;
401 stream >> id; 401 stream >> id;
402 QString fam; 402 QString fam;
403 stream >> fam; 403 stream >> fam;
404 int size; 404 int size;
405 stream >> size; 405 stream >> size;
406 int weight; 406 int weight;
407 stream >> weight; 407 stream >> weight;
408 int italic; 408 int italic;
409 stream >> italic; 409 stream >> italic;
410 if ( view(id) ) { 410 if ( view(id) ) {
411 if ( !fam.isEmpty() ) { 411 if ( !fam.isEmpty() ) {
412 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) ); 412 view(id)->setViewFont( QFont(fam, size, weight, italic!=0) );
413 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl; 413 odebug << "setFont: " << fam << ", " << size << ", " << weight << ", " << italic << "" << oendl;
414 } else { 414 } else {
415 view(id)->clearViewFont(); 415 view(id)->clearViewFont();
416 } 416 }
417 } 417 }
418 }else if ( msg == "setBusyIndicatorType(QString)" ) { 418 }else if ( msg == "setBusyIndicatorType(QString)" ) {
419 QString type; 419 QString type;
420 stream >> type; 420 stream >> type;
421 setBusyIndicatorType( type ); 421 setBusyIndicatorType( type );
422 }else if ( msg == "home()" ) { 422 }else if ( msg == "home()" ) {
423 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) { 423 if ( isVisibleWindow( static_cast<QWidget*>(parent())->winId() ) ) {
@@ -461,19 +461,19 @@ void Launcher::createGUI()
461 461
462 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) ); 462 connect( qApp, SIGNAL(symbol()), this, SLOT(toggleSymbolInput()) );
463 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) ); 463 connect( qApp, SIGNAL(numLockStateToggle()), this, SLOT(toggleNumLockState()) );
464 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) ); 464 connect( qApp, SIGNAL(capsLockStateToggle()), this, SLOT(toggleCapsLockState()) );
465 465
466 connect( tb, SIGNAL(tabSelected(const QString&)), 466 connect( tb, SIGNAL(tabSelected(const QString&)),
467 this, SLOT(showTab(const QString&)) ); 467 this, SLOT(showTab(const QString&)) );
468 connect( tabs, SIGNAL(selected(const QString&)), 468 connect( tabs, SIGNAL(selected(const QString&)),
469 this, SLOT(viewSelected(const QString&)) ); 469 this, SLOT(viewSelected(const QString&)) );
470 connect( tabs, SIGNAL(clicked(const AppLnk*)), 470 connect( tabs, SIGNAL(clicked(const AppLnk*)),
471 this, SLOT(select(const AppLnk*))); 471 this, SLOT(select(const AppLnk*)));
472 connect( tabs, SIGNAL(rightPressed(AppLnk*)), 472 connect( tabs, SIGNAL(rightPressed(AppLnk*)),
473 this, SLOT(properties(AppLnk*))); 473 this, SLOT(properties(AppLnk*)));
474 474
475#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 475#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
476 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this ); 476 QCopChannel* sysChannel = new QCopChannel( "QPE/System", this );
477 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)), 477 connect( sysChannel, SIGNAL(received(const QCString&,const QByteArray&)),
478 this, SLOT(systemMessage(const QCString&,const QByteArray&)) ); 478 this, SLOT(systemMessage(const QCString&,const QByteArray&)) );
479#endif 479#endif
@@ -491,13 +491,13 @@ void Launcher::createGUI()
491 QTimer::singleShot( 500, this, SLOT( makeVisible() ) ); 491 QTimer::singleShot( 500, this, SLOT( makeVisible() ) );
492} 492}
493 493
494Launcher::~Launcher() 494Launcher::~Launcher()
495{ 495{
496 if ( tb ) 496 if ( tb )
497 destroyGUI(); 497 destroyGUI();
498} 498}
499 499
500 bool Launcher::requiresDocuments() const 500 bool Launcher::requiresDocuments() const
501 { 501 {
502 Config cfg( "Launcher" ); 502 Config cfg( "Launcher" );
503 cfg.setGroup( "DocTab" ); 503 cfg.setGroup( "DocTab" );
@@ -518,23 +518,23 @@ void Launcher::destroyGUI()
518} 518}
519 519
520bool Launcher::eventFilter( QObject*, QEvent *ev ) 520bool Launcher::eventFilter( QObject*, QEvent *ev )
521{ 521{
522#ifdef QT_QWS_CUSTOM 522#ifdef QT_QWS_CUSTOM
523 if ( ev->type() == QEvent::KeyPress ) { 523 if ( ev->type() == QEvent::KeyPress ) {
524 QKeyEvent *ke = (QKeyEvent *)ev; 524 QKeyEvent *ke = (QKeyEvent *)ev;
525 if ( ke->key() == Qt::Key_F11 ) { // menu key 525 if ( ke->key() == Qt::Key_F11 ) { // menu key
526 QWidget *active = qApp->activeWindow(); 526 QWidget *active = qApp->activeWindow();
527 if ( active && active->isPopup() ) 527 if ( active && active->isPopup() )
528 active->close(); 528 active->close();
529 else { 529 else {
530 Global::terminateBuiltin("calibrate"); // No tr 530 Global::terminateBuiltin("calibrate"); // No tr
531 tb->launchStartMenu(); 531 tb->launchStartMenu();
532 } 532 }
533 return TRUE; 533 return TRUE;
534 } 534 }
535 } 535 }
536#else 536#else
537 Q_UNUSED(ev); 537 Q_UNUSED(ev);
538#endif 538#endif
539 return FALSE; 539 return FALSE;
540} 540}
@@ -557,14 +557,14 @@ void Launcher::toggleCapsLockState()
557static bool isVisibleWindow(int wid) 557static bool isVisibleWindow(int wid)
558{ 558{
559#ifdef Q_WS_QWS 559#ifdef Q_WS_QWS
560 const QList<QWSWindow> &list = qwsServer->clientWindows(); 560 const QList<QWSWindow> &list = qwsServer->clientWindows();
561 QWSWindow* w; 561 QWSWindow* w;
562 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { 562 for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) {
563 if ( w->winId() == wid ) 563 if ( w->winId() == wid )
564 return !w->isFullyObscured(); 564 return !w->isFullyObscured();
565 } 565 }
566#endif 566#endif
567 return FALSE; 567 return FALSE;
568} 568}
569 569
570void Launcher::viewSelected(const QString& s) 570void Launcher::viewSelected(const QString& s)
@@ -578,75 +578,75 @@ void Launcher::showTab(const QString& id)
578 raise(); 578 raise();
579} 579}
580 580
581void Launcher::select( const AppLnk *appLnk ) 581void Launcher::select( const AppLnk *appLnk )
582{ 582{
583 if ( appLnk->type() == "Folder" ) { // No tr 583 if ( appLnk->type() == "Folder" ) { // No tr
584 // Not supported: flat is simpler for the user 584 // Not supported: flat is simpler for the user
585 } else { 585 } else {
586 if ( appLnk->exec().isNull() ) { 586 if ( appLnk->exec().isNull() ) {
587 int i = QMessageBox::information(this,tr("No application"), 587 int i = QMessageBox::information(this,tr("No application"),
588 tr("<p>No application is defined for this document." 588 tr("<p>No application is defined for this document."
589 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1); 589 "<p>Type is %1.").arg(appLnk->type()), tr("OK"), tr("View as text"), 0, 0, 1);
590 590
591 /* ### Fixme */ 591 /* ### Fixme */
592 if ( i == 1 ) 592 if ( i == 1 )
593 Global::execute("textedit",appLnk->file()); 593 Global::execute("textedit",appLnk->file());
594 594
595 return; 595 return;
596 } 596 }
597 tabs->setBusy(TRUE); 597 tabs->setBusy(TRUE);
598 emit executing( appLnk ); 598 emit executing( appLnk );
599 appLnk->execute(); 599 appLnk->execute();
600 } 600 }
601} 601}
602 602
603void Launcher::properties( AppLnk *appLnk ) 603void Launcher::properties( AppLnk *appLnk )
604{ 604{
605 if ( appLnk->type() == "Folder" ) { // No tr 605 if ( appLnk->type() == "Folder" ) { // No tr
606 // Not supported: flat is simpler for the user 606 // Not supported: flat is simpler for the user
607 } else { 607 } else {
608/* ### libqtopia FIXME also moving docLnks... */ 608/* ### libqtopia FIXME also moving docLnks... */
609 LnkProperties prop(appLnk,0 ); 609 LnkProperties prop(appLnk,0 );
610 610
611 QPEApplication::execDialog( &prop ); 611 QPEApplication::execDialog( &prop );
612 } 612 }
613} 613}
614 614
615void Launcher::storageChanged( const QList<FileSystem> &fs ) 615void Launcher::storageChanged( const QList<FileSystem> &fs )
616{ 616{
617 // ### update combo boxes if we had a combo box for the storage type 617 // ### update combo boxes if we had a combo box for the storage type
618} 618}
619 619
620void Launcher::systemMessage( const QCString &msg, const QByteArray &data) 620void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
621{ 621{
622 QDataStream stream( data, IO_ReadOnly ); 622 QDataStream stream( data, IO_ReadOnly );
623 if ( msg == "busy()" ) { 623 if ( msg == "busy()" ) {
624 tb->startWait(); 624 tb->startWait();
625 } else if ( msg == "notBusy(QString)" ) { 625 } else if ( msg == "notBusy(QString)" ) {
626 QString app; 626 QString app;
627 stream >> app; 627 stream >> app;
628 tabs->setBusy(FALSE); 628 tabs->setBusy(FALSE);
629 tb->stopWait(app); 629 tb->stopWait(app);
630 } else if (msg == "applyStyle()") { 630 } else if (msg == "applyStyle()") {
631 tabs->currentView()->relayout(); 631 tabs->currentView()->relayout();
632 } 632 }
633} 633}
634 634
635// These are the update functions from the server 635// These are the update functions from the server
636void Launcher::typeAdded( const QString& type, const QString& name, 636void Launcher::typeAdded( const QString& type, const QString& name,
637 const QPixmap& pixmap, const QPixmap& ) 637 const QPixmap& pixmap, const QPixmap& )
638{ 638{
639 tabs->newView( type, pixmap, name ); 639 tabs->newView( type, pixmap, name );
640 ids.append( type ); 640 ids.append( type );
641 /* this will be called in applicationScanningProgress with value 100! */ 641 /* this will be called in applicationScanningProgress with value 100! */
642// tb->refreshStartMenu(); 642// tb->refreshStartMenu();
643 643
644 static bool first = TRUE; 644 static bool first = TRUE;
645 if ( first ) { 645 if ( first ) {
646 first = FALSE; 646 first = FALSE;
647 tabs->categoryBar->showTab(type); 647 tabs->categoryBar->showTab(type);
648 } 648 }
649 649
650 tabs->view( type )->setUpdatesEnabled( FALSE ); 650 tabs->view( type )->setUpdatesEnabled( FALSE );
651 tabs->view( type )->setSortEnabled( FALSE ); 651 tabs->view( type )->setSortEnabled( FALSE );
652} 652}
@@ -660,38 +660,38 @@ void Launcher::typeRemoved( const QString& type )
660// tb->refreshStartMenu(); 660// tb->refreshStartMenu();
661} 661}
662 662
663void Launcher::applicationAdded( const QString& type, const AppLnk& app ) 663void Launcher::applicationAdded( const QString& type, const AppLnk& app )
664{ 664{
665 if ( app.type() == "Separator" ) // No tr 665 if ( app.type() == "Separator" ) // No tr
666 return; 666 return;
667 667
668 LauncherView *view = tabs->view( type ); 668 LauncherView *view = tabs->view( type );
669 if ( view ) 669 if ( view )
670 view->addItem( new AppLnk( app ), FALSE ); 670 view->addItem( new AppLnk( app ), FALSE );
671 else 671 else
672 qWarning("addAppLnk: No view for type %s. Can't add app %s!", 672 owarn << "addAppLnk: No view for type " << type.latin1() << ". Can't add app "
673 type.latin1(),app.name().latin1() ); 673 << app.name().latin1() << "!",
674 674
675 MimeType::registerApp( app ); 675 MimeType::registerApp( app );
676} 676}
677 677
678void Launcher::applicationRemoved( const QString& type, const AppLnk& app ) 678void Launcher::applicationRemoved( const QString& type, const AppLnk& app )
679{ 679{
680 LauncherView *view = tabs->view( type ); 680 LauncherView *view = tabs->view( type );
681 if ( view ) 681 if ( view )
682 view->removeLink( app.linkFile() ); 682 view->removeLink( app.linkFile() );
683 else 683 else
684 owarn << "removeAppLnk: No view for " << type << "!" << oendl; 684 owarn << "removeAppLnk: No view for " << type << "!" << oendl;
685} 685}
686 686
687void Launcher::allApplicationsRemoved() 687void Launcher::allApplicationsRemoved()
688{ 688{
689 MimeType::clear(); 689 MimeType::clear();
690 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) 690 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it)
691 tabs->view( (*it) )->removeAllItems(); 691 tabs->view( (*it) )->removeAllItems();
692} 692}
693 693
694void Launcher::documentAdded( const DocLnk& doc ) 694void Launcher::documentAdded( const DocLnk& doc )
695{ 695{
696 tabs->docView()->addItem( new DocLnk( doc ), FALSE ); 696 tabs->docView()->addItem( new DocLnk( doc ), FALSE );
697} 697}
@@ -711,13 +711,13 @@ void Launcher::showLoadingDocs()
711 tabs->docView()->hide(); 711 tabs->docView()->hide();
712} 712}
713 713
714void Launcher::showDocTab() 714void Launcher::showDocTab()
715{ 715{
716 if ( tabs->categoryBar->currentView() == tabs->docView() ) 716 if ( tabs->categoryBar->currentView() == tabs->docView() )
717 tabs->docView()->show(); 717 tabs->docView()->show();
718} 718}
719 719
720void Launcher::documentRemoved( const DocLnk& doc ) 720void Launcher::documentRemoved( const DocLnk& doc )
721{ 721{
722 tabs->docView()->removeLink( doc.linkFile() ); 722 tabs->docView()->removeLink( doc.linkFile() );
723} 723}
@@ -739,48 +739,48 @@ void Launcher::applicationStateChanged( const QString& name, ApplicationState st
739} 739}
740 740
741void Launcher::applicationScanningProgress( int percent ) 741void Launcher::applicationScanningProgress( int percent )
742{ 742{
743 switch ( percent ) { 743 switch ( percent ) {
744 case 0: { 744 case 0: {
745 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 745 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
746 tabs->view( (*it) )->setUpdatesEnabled( FALSE ); 746 tabs->view( (*it) )->setUpdatesEnabled( FALSE );
747 tabs->view( (*it) )->setSortEnabled( FALSE ); 747 tabs->view( (*it) )->setSortEnabled( FALSE );
748 } 748 }
749 break; 749 break;
750 } 750 }
751 case 100: { 751 case 100: {
752 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) { 752 for ( QStringList::ConstIterator it=ids.begin(); it!= ids.end(); ++it) {
753 tabs->view( (*it) )->setUpdatesEnabled( TRUE ); 753 tabs->view( (*it) )->setUpdatesEnabled( TRUE );
754 tabs->view( (*it) )->setSortEnabled( TRUE ); 754 tabs->view( (*it) )->setSortEnabled( TRUE );
755 } 755 }
756 tb->refreshStartMenu(); 756 tb->refreshStartMenu();
757 break; 757 break;
758 } 758 }
759 default: 759 default:
760 break; 760 break;
761 } 761 }
762} 762}
763 763
764void Launcher::documentScanningProgress( int percent ) 764void Launcher::documentScanningProgress( int percent )
765{ 765{
766 switch ( percent ) { 766 switch ( percent ) {
767 case 0: { 767 case 0: {
768 tabs->setLoadingProgress( 0 ); 768 tabs->setLoadingProgress( 0 );
769 tabs->setLoadingWidgetEnabled( TRUE ); 769 tabs->setLoadingWidgetEnabled( TRUE );
770 tabs->docView()->setUpdatesEnabled( FALSE ); 770 tabs->docView()->setUpdatesEnabled( FALSE );
771 tabs->docView()->setSortEnabled( FALSE ); 771 tabs->docView()->setSortEnabled( FALSE );
772 break; 772 break;
773 } 773 }
774 case 100: { 774 case 100: {
775 tabs->docView()->updateTools(); 775 tabs->docView()->updateTools();
776 tabs->docView()->setSortEnabled( TRUE ); 776 tabs->docView()->setSortEnabled( TRUE );
777 tabs->docView()->setUpdatesEnabled( TRUE ); 777 tabs->docView()->setUpdatesEnabled( TRUE );
778 tabs->setLoadingWidgetEnabled( FALSE ); 778 tabs->setLoadingWidgetEnabled( FALSE );
779 break; 779 break;
780 } 780 }
781 default: 781 default:
782 tabs->setLoadingProgress( percent ); 782 tabs->setLoadingProgress( percent );
783 break; 783 break;
784 } 784 }
785} 785}
786 786