summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index e8741a2..7b20fdc 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -482,122 +482,131 @@ void LauncherView::updateTools()
482 482
483 Categories cats( 0 ); 483 Categories cats( 0 );
484 cats.load( categoryFileName() ); 484 cats.load( categoryFileName() );
485 QArray<int> vl( 0 ); 485 QArray<int> vl( 0 );
486 catmb->setCategories( vl, "Document View", tr("Document View") ); 486 catmb->setCategories( vl, "Document View", tr("Document View") );
487 catmb->setRemoveCategoryEdit( TRUE ); 487 catmb->setRemoveCategoryEdit( TRUE );
488 catmb->setAllCategories( TRUE ); 488 catmb->setAllCategories( TRUE );
489 489
490 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&))); 490 connect(typemb, SIGNAL(selected(const QString&)), this, SLOT(showType(const QString&)));
491 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); 491 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
492} 492}
493 493
494void LauncherView::sortBy(int s) 494void LauncherView::sortBy(int s)
495{ 495{
496 icons->setSortMethod((LauncherIconView::SortMethod)s); 496 icons->setSortMethod((LauncherIconView::SortMethod)s);
497} 497}
498 498
499void LauncherView::showType(const QString& t) 499void LauncherView::showType(const QString& t)
500{ 500{
501 if ( t == tr("All") ) { 501 if ( t == tr("All") ) {
502 icons->setTypeFilter("",TRUE); 502 icons->setTypeFilter("",TRUE);
503 } else { 503 } else {
504 icons->setTypeFilter(t+"/*",TRUE); 504 icons->setTypeFilter(t+"/*",TRUE);
505 } 505 }
506} 506}
507 507
508void LauncherView::showCategory( int c ) 508void LauncherView::showCategory( int c )
509{ 509{
510 icons->setCategoryFilter( c, TRUE ); 510 icons->setCategoryFilter( c, TRUE );
511} 511}
512 512
513void LauncherView::resizeEvent(QResizeEvent *e) 513void LauncherView::resizeEvent(QResizeEvent *e)
514{ 514{
515 QVBox::resizeEvent( e ); 515 QVBox::resizeEvent( e );
516 if ( e->size().width() != e->oldSize().width() ) 516 if ( e->size().width() != e->oldSize().width() )
517 sort(); 517 sort();
518} 518}
519 519
520void LauncherView::populate( AppLnkSet *folder, const QString& typefilter ) 520void LauncherView::populate( AppLnkSet *folder, const QString& typefilter )
521{ 521{
522 icons->clear(); 522 icons->clear();
523 internalPopulate( folder, typefilter ); 523 internalPopulate( folder, typefilter );
524} 524}
525 525
526void LauncherView::selectionChanged() 526void LauncherView::selectionChanged()
527{ 527{
528 QIconViewItem* item = icons->currentItem(); 528 QIconViewItem* item = icons->currentItem();
529 if ( item && item->isSelected() ) { 529 if ( item && item->isSelected() ) {
530 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 530 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
531 if ( icons->inKeyEvent() ) // not for mouse press 531 if ( icons->inKeyEvent() ) // not for mouse press
532 emit clicked( appLnk ); 532 emit clicked( appLnk );
533 item->setSelected(FALSE); 533 item->setSelected(FALSE);
534 } 534 }
535} 535}
536 536
537void LauncherView::returnPressed( QIconViewItem *item ) 537void LauncherView::returnPressed( QIconViewItem *item )
538{ 538{
539 if ( item ) { 539 if ( item ) {
540 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 540 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
541 emit clicked( appLnk ); 541 emit clicked( appLnk );
542 } 542 }
543} 543}
544 544
545void LauncherView::itemClicked( int btn, QIconViewItem *item ) 545void LauncherView::itemClicked( int btn, QIconViewItem *item )
546{ 546{
547 if ( item ) { 547 if ( item ) {
548 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 548 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
549 if ( btn == LeftButton ) { 549 if ( btn == LeftButton ) {
550 // Make sure it's the item we execute that gets highlighted 550 // Make sure it's the item we execute that gets highlighted
551 icons->setCurrentItem( item ); 551 icons->setCurrentItem( item );
552 emit clicked( appLnk ); 552 emit clicked( appLnk );
553 } 553 }
554 item->setSelected(FALSE); 554 item->setSelected(FALSE);
555 } 555 }
556} 556}
557 557
558void LauncherView::itemPressed( int btn, QIconViewItem *item ) 558void LauncherView::itemPressed( int btn, QIconViewItem *item )
559{ 559{
560 if ( item ) { 560 if ( item ) {
561 AppLnk *appLnk = ((LauncherItem *)item)->appLnk(); 561 AppLnk *appLnk = ((LauncherItem *)item)->appLnk();
562 if ( btn == RightButton ) 562 if ( btn == RightButton )
563 emit rightPressed( appLnk ); 563 emit rightPressed( appLnk );
564/* 564/*
565 else if ( btn == LeftButton ) 565 else if ( btn == LeftButton )
566 emit clicked( appLnk ); 566 emit clicked( appLnk );
567*/ 567*/
568 item->setSelected(FALSE); 568 item->setSelected(FALSE);
569 } 569 }
570} 570}
571 571
572void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter ) 572void LauncherView::internalPopulate( AppLnkSet *folder, const QString& typefilter )
573{ 573{
574 QListIterator<AppLnk> it( folder->children() ); 574 QListIterator<AppLnk> it( folder->children() );
575 icons->setTypeFilter(typefilter,FALSE); 575 icons->setTypeFilter(typefilter,FALSE);
576 576
577 while ( it.current() ) { 577 while ( it.current() ) {
578 icons->addItem(*it,FALSE); 578 // show only the icons for existing files
579 if (!QFile(it.current()->file()).exists() )
580 {
581 //maybe insert some .desktop file deletion code later
582 //maybe dir specific
583 }
584 else
585 {
586 icons->addItem(*it,FALSE);
587 }
579 ++it; 588 ++it;
580 } 589 }
581 590
582 icons->sort(); 591 icons->sort();
583} 592}
584 593
585bool LauncherView::removeLink(const QString& linkfile) 594bool LauncherView::removeLink(const QString& linkfile)
586{ 595{
587 return icons->removeLink(linkfile); 596 return icons->removeLink(linkfile);
588} 597}
589 598
590void LauncherView::sort() 599void LauncherView::sort()
591{ 600{
592 icons->sort(); 601 icons->sort();
593} 602}
594 603
595void LauncherView::addItem(AppLnk* app, bool resort) 604void LauncherView::addItem(AppLnk* app, bool resort)
596{ 605{
597 icons->addItem(app,resort); 606 icons->addItem(app,resort);
598} 607}
599 608
600void LauncherView::setFileSystems(const QList<FileSystem> &) 609void LauncherView::setFileSystems(const QList<FileSystem> &)
601{ 610{
602 // ### does nothing now... 611 // ### does nothing now...
603} 612}