summaryrefslogtreecommitdiff
authorzecke <zecke>2004-12-20 22:49:19 (UTC)
committer zecke <zecke>2004-12-20 22:49:19 (UTC)
commit3d9ea198ea8046d3f2c5b88efd721ffb00df2c22 (patch) (unidiff)
tree14ae80693ed5faadd7d8a177f8a86ecefff476b6
parent21b825786deeb195fa73462f09fe70709aa5a628 (diff)
downloadopie-3d9ea198ea8046d3f2c5b88efd721ffb00df2c22.zip
opie-3d9ea198ea8046d3f2c5b88efd721ffb00df2c22.tar.gz
opie-3d9ea198ea8046d3f2c5b88efd721ffb00df2c22.tar.bz2
Patch from Hrw for 1493
"Launcher starts in one column mode" Set the QIconView to adjust its layout on resize
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/launcherview.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/launcherview.cpp b/core/launcher/launcherview.cpp
index 2783423..dc4c57f 100644
--- a/core/launcher/launcherview.cpp
+++ b/core/launcher/launcherview.cpp
@@ -497,385 +497,385 @@ void LauncherIconView::updateCategoriesAndMimeTypes()
497 cats.clear(); 497 cats.clear();
498 LauncherItem* item = (LauncherItem*)firstItem(); 498 LauncherItem* item = (LauncherItem*)firstItem();
499 while (item) { 499 while (item) {
500 addCatsAndMimes(item->appLnk()); 500 addCatsAndMimes(item->appLnk());
501 item = (LauncherItem*)item->nextItem(); 501 item = (LauncherItem*)item->nextItem();
502 } 502 }
503 QListIterator<AppLnk> it(hidden); 503 QListIterator<AppLnk> it(hidden);
504 AppLnk* l; 504 AppLnk* l;
505 while ((l=it.current())) { 505 while ((l=it.current())) {
506 addCatsAndMimes(l); 506 addCatsAndMimes(l);
507 ++it; 507 ++it;
508 } 508 }
509} 509}
510 510
511void LauncherIconView::hideOrShowItems(bool resort) 511void LauncherIconView::hideOrShowItems(bool resort)
512{ 512{
513 viewport()->setUpdatesEnabled( FALSE ); 513 viewport()->setUpdatesEnabled( FALSE );
514 hidden.setAutoDelete(FALSE); 514 hidden.setAutoDelete(FALSE);
515 QList<AppLnk> links=hidden; 515 QList<AppLnk> links=hidden;
516 hidden.clear(); 516 hidden.clear();
517 hidden.setAutoDelete(TRUE); 517 hidden.setAutoDelete(TRUE);
518 LauncherItem* item = (LauncherItem*)firstItem(); 518 LauncherItem* item = (LauncherItem*)firstItem();
519 while (item) { 519 while (item) {
520 links.append(item->takeAppLnk()); 520 links.append(item->takeAppLnk());
521 item = (LauncherItem*)item->nextItem(); 521 item = (LauncherItem*)item->nextItem();
522 } 522 }
523 clear(); 523 clear();
524 QListIterator<AppLnk> it(links); 524 QListIterator<AppLnk> it(links);
525 AppLnk* l; 525 AppLnk* l;
526 while ((l=it.current())) { 526 while ((l=it.current())) {
527 addItem(l,FALSE); 527 addItem(l,FALSE);
528 ++it; 528 ++it;
529 } 529 }
530 if ( resort && !autoArrange() ) 530 if ( resort && !autoArrange() )
531 sort(); 531 sort();
532 viewport()->setUpdatesEnabled( TRUE ); 532 viewport()->setUpdatesEnabled( TRUE );
533} 533}
534 534
535bool LauncherIconView::removeLink(const QString& linkfile,bool removeCache) 535bool LauncherIconView::removeLink(const QString& linkfile,bool removeCache)
536{ 536{
537 LauncherItem* item = (LauncherItem*)firstItem(); 537 LauncherItem* item = (LauncherItem*)firstItem();
538 AppLnk* l; 538 AppLnk* l;
539 bool did = FALSE; 539 bool did = FALSE;
540 DocLnk dl(linkfile); 540 DocLnk dl(linkfile);
541 while (item) { 541 while (item) {
542 l = item->appLnk(); 542 l = item->appLnk();
543 LauncherItem *nextItem = (LauncherItem *)item->nextItem(); 543 LauncherItem *nextItem = (LauncherItem *)item->nextItem();
544 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() && 544 if ( l->linkFileKnown() && l->linkFile() == linkfile || l->fileKnown() &&
545 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) { 545 ( l->file() == linkfile || dl.isValid() && dl.file() == l->file() ) ) {
546 if (removeCache) sm_EyeCache->remove(l->file()); 546 if (removeCache) sm_EyeCache->remove(l->file());
547 delete item; 547 delete item;
548 did = TRUE; 548 did = TRUE;
549 } 549 }
550 item = nextItem; 550 item = nextItem;
551 } 551 }
552 QListIterator<AppLnk> it(hidden); 552 QListIterator<AppLnk> it(hidden);
553 while ((l=it.current())) { 553 while ((l=it.current())) {
554 ++it; 554 ++it;
555 if ( l->linkFileKnown() && l->linkFile() == linkfile 555 if ( l->linkFileKnown() && l->linkFile() == linkfile
556 || l->file() == linkfile 556 || l->file() == linkfile
557 || dl.isValid() && dl.file() == l->file() ) { 557 || dl.isValid() && dl.file() == l->file() ) {
558 hidden.removeRef(l); 558 hidden.removeRef(l);
559 did = TRUE; 559 did = TRUE;
560 } 560 }
561 } 561 }
562 return did; 562 return did;
563} 563}
564 564
565void LauncherIconView::addItem(AppLnk* app, bool resort) 565void LauncherIconView::addItem(AppLnk* app, bool resort)
566{ 566{
567 addCatsAndMimes(app); 567 addCatsAndMimes(app);
568 if ( (tf.isEmpty() || tf.match(app->type()) >= 0) 568 if ( (tf.isEmpty() || tf.match(app->type()) >= 0)
569 && (cf == 0 || app->categories().contains(cf) 569 && (cf == 0 || app->categories().contains(cf)
570 || cf == -1 && app->categories().count() == 0 ) ) { 570 || cf == -1 && app->categories().count() == 0 ) ) {
571 addCheckItem(app); 571 addCheckItem(app);
572 } else { 572 } else {
573 hidden.append(app); 573 hidden.append(app);
574 } 574 }
575 if ( resort ){ 575 if ( resort ){
576 sort(); 576 sort();
577 } 577 }
578} 578}
579 579
580void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink) 580void LauncherIconView::changeItem(const AppLnk&old,AppLnk*nlink)
581{ 581{
582 QString oldfile = old.file(); 582 QString oldfile = old.file();
583 QString newfile = nlink->file(); 583 QString newfile = nlink->file();
584 584
585 if (newfile != oldfile) { 585 if (newfile != oldfile) {
586 QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile); 586 QMap<QString,QPixmap>::Iterator it = sm_EyeCache->find(oldfile);
587 if (it != sm_EyeCache->end()) { 587 if (it != sm_EyeCache->end()) {
588 (*sm_EyeCache)[newfile]=(*it); 588 (*sm_EyeCache)[newfile]=(*it);
589 } 589 }
590 removeLink(old.linkFile()); 590 removeLink(old.linkFile());
591 } else { 591 } else {
592 removeLink(old.linkFile(),false); 592 removeLink(old.linkFile(),false);
593 } 593 }
594 addItem(nlink,false); 594 addItem(nlink,false);
595} 595}
596 596
597void LauncherIconView::timerEvent( QTimerEvent *te ) 597void LauncherIconView::timerEvent( QTimerEvent *te )
598{ 598{
599 if ( te->timerId() == busyTimer ) { 599 if ( te->timerId() == busyTimer ) {
600 if ( bsy ) 600 if ( bsy )
601 bsy->animateIcon(); 601 bsy->animateIcon();
602 } else { 602 } else {
603 QIconView::timerEvent( te ); 603 QIconView::timerEvent( te );
604 } 604 }
605} 605}
606 606
607void LauncherIconView::setBigIcons( bool bi ) 607void LauncherIconView::setBigIcons( bool bi )
608{ 608{
609 sm_EyeCache->clear(); 609 sm_EyeCache->clear();
610 bigIcns = bi; 610 bigIcns = bi;
611#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY 611#ifdef USE_ANIMATED_BUSY_ICON_OVERLAY
612 busyPix.resize(0,0); 612 busyPix.resize(0,0);
613#endif 613#endif
614} 614}
615 615
616QIconViewItem* LauncherIconView::busyItem() const 616QIconViewItem* LauncherIconView::busyItem() const
617{ 617{
618 return bsy; 618 return bsy;
619} 619}
620 620
621void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; } 621void LauncherIconView::setBusyIndicatorType ( BusyIndicatorType t ) { busyType = t; }
622 622
623void LauncherIconView::calculateGrid( ItemTextPos pos ) 623void LauncherIconView::calculateGrid( ItemTextPos pos )
624{ 624{
625 int dw = QApplication::desktop()->width(); 625 int dw = QApplication::desktop()->width();
626 int viewerWidth = dw-style().scrollBarExtent().width(); 626 int viewerWidth = dw-style().scrollBarExtent().width();
627 if ( pos == Bottom ) { 627 if ( pos == Bottom ) {
628 int cols = 3; 628 int cols = 3;
629 if ( viewerWidth <= 200 ) 629 if ( viewerWidth <= 200 )
630 cols = 2; 630 cols = 2;
631 else if ( viewerWidth >= 400 ) 631 else if ( viewerWidth >= 400 )
632 cols = viewerWidth/96; 632 cols = viewerWidth/96;
633 setSpacing( 4 ); 633 setSpacing( 4 );
634 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 634 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
635 setGridY( fontMetrics().height()*2+24 ); 635 setGridY( fontMetrics().height()*2+24 );
636 } else { 636 } else {
637 int cols = 2; 637 int cols = 2;
638 if ( viewerWidth < 150 ) 638 if ( viewerWidth < 150 )
639 cols = 1; 639 cols = 1;
640 else if ( viewerWidth >= 400 ) 640 else if ( viewerWidth >= 400 )
641 cols = viewerWidth/150; 641 cols = viewerWidth/150;
642 setSpacing( 2 ); 642 setSpacing( 2 );
643 setGridX( (viewerWidth-(cols+1)*spacing())/cols ); 643 setGridX( (viewerWidth-(cols+1)*spacing())/cols );
644 setGridY( fontMetrics().height()+2 ); 644 setGridY( fontMetrics().height()+2 );
645 } 645 }
646} 646}
647 647
648void LauncherIconView::styleChange( QStyle &old ) 648void LauncherIconView::styleChange( QStyle &old )
649{ 649{
650 QIconView::styleChange( old ); 650 QIconView::styleChange( old );
651 calculateGrid( itemTextPos() ); 651 calculateGrid( itemTextPos() );
652} 652}
653 653
654void LauncherIconView::keyPressEvent(QKeyEvent* e) 654void LauncherIconView::keyPressEvent(QKeyEvent* e)
655{ 655{
656 ike = TRUE; 656 ike = TRUE;
657 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) { 657 if ( e->key() == Key_F33 /* OK button */ || e->key() == Key_Space ) {
658 if ( (e->state() & ShiftButton) ) 658 if ( (e->state() & ShiftButton) )
659 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() ); 659 emit mouseButtonPressed(ShiftButton, currentItem(), QPoint() );
660 else 660 else
661 returnPressed(currentItem()); 661 returnPressed(currentItem());
662 } 662 }
663 663
664 QIconView::keyPressEvent(e); 664 QIconView::keyPressEvent(e);
665 ike = FALSE; 665 ike = FALSE;
666} 666}
667 667
668//=========================================================================== 668//===========================================================================
669// Implemantation of LauncherIconview end 669// Implemantation of LauncherIconview end
670//=========================================================================== 670//===========================================================================
671 671
672 672
673//=========================================================================== 673//===========================================================================
674LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl ) 674LauncherView::LauncherView( QWidget* parent, const char* name, WFlags fl )
675 : QVBox( parent, name, fl ) 675 : QVBox( parent, name, fl )
676{ 676{
677 catmb = 0; 677 catmb = 0;
678 icons = new LauncherIconView( this ); 678 icons = new LauncherIconView( this );
679 setFocusProxy(icons); 679 setFocusProxy(icons);
680 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold ); 680 QPEApplication::setStylusOperation( icons->viewport(), QPEApplication::RightOnHold );
681 681
682 icons->setItemsMovable( FALSE ); 682 icons->setItemsMovable( FALSE );
683 icons->setAutoArrange( TRUE ); 683 icons->setAutoArrange( TRUE );
684 icons->setSorting( TRUE ); 684 icons->setSorting( TRUE );
685 icons->setFrameStyle( QFrame::NoFrame ); 685 icons->setFrameStyle( QFrame::NoFrame );
686 icons->setMargin( 0 ); 686 icons->setMargin( 0 );
687 icons->setSelectionMode( QIconView::NoSelection ); 687 icons->setSelectionMode( QIconView::NoSelection );
688 icons->setBackgroundMode( PaletteBase ); 688 icons->setBackgroundMode( PaletteBase );
689 icons->setResizeMode( QIconView::Fixed ); 689 icons->setResizeMode( QIconView::Adjust );
690 vmode = (ViewMode)-1; 690 vmode = (ViewMode)-1;
691 setViewMode( Icon ); 691 setViewMode( Icon );
692 692
693 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)), 693 connect( icons, SIGNAL(mouseButtonClicked(int,QIconViewItem*,const QPoint&)),
694 SLOT(itemClicked(int,QIconViewItem*)) ); 694 SLOT(itemClicked(int,QIconViewItem*)) );
695 connect( icons, SIGNAL(selectionChanged()), 695 connect( icons, SIGNAL(selectionChanged()),
696 SLOT(selectionChanged()) ); 696 SLOT(selectionChanged()) );
697 connect( icons, SIGNAL(returnPressed(QIconViewItem*)), 697 connect( icons, SIGNAL(returnPressed(QIconViewItem*)),
698 SLOT(returnPressed(QIconViewItem*)) ); 698 SLOT(returnPressed(QIconViewItem*)) );
699 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)), 699 connect( icons, SIGNAL(mouseButtonPressed(int,QIconViewItem*,const QPoint&)),
700 SLOT(itemPressed(int,QIconViewItem*)) ); 700 SLOT(itemPressed(int,QIconViewItem*)) );
701 701
702 tools = 0; 702 tools = 0;
703 setBackgroundType( Ruled, QString::null ); 703 setBackgroundType( Ruled, QString::null );
704} 704}
705 705
706LauncherView::~LauncherView() 706LauncherView::~LauncherView()
707{ 707{
708 if ( bgCache && bgCache->contains( bgName ) ) 708 if ( bgCache && bgCache->contains( bgName ) )
709 (*bgCache)[bgName]->ref--; 709 (*bgCache)[bgName]->ref--;
710} 710}
711 711
712 712
713bool LauncherView::bsy=FALSE; 713bool LauncherView::bsy=FALSE;
714 714
715void LauncherView::setBusy(bool on) 715void LauncherView::setBusy(bool on)
716{ 716{
717 icons->setBusy(on); 717 icons->setBusy(on);
718} 718}
719 719
720void LauncherView::setBusyIndicatorType( const QString& type ) { 720void LauncherView::setBusyIndicatorType( const QString& type ) {
721 if ( type. lower ( ) == "animated" ) 721 if ( type. lower ( ) == "animated" )
722 icons->setBusyIndicatorType( BIT_Animated ) ; 722 icons->setBusyIndicatorType( BIT_Animated ) ;
723 else 723 else
724 icons->setBusyIndicatorType( BIT_Normal ) ; 724 icons->setBusyIndicatorType( BIT_Normal ) ;
725} 725}
726 726
727void LauncherView::hideIcons() 727void LauncherView::hideIcons()
728{ 728{
729 icons->hide(); 729 icons->hide();
730} 730}
731 731
732void LauncherView::setToolsEnabled(bool y) 732void LauncherView::setToolsEnabled(bool y)
733{ 733{
734 if ( !y != !tools ) { 734 if ( !y != !tools ) {
735 if ( y ) { 735 if ( y ) {
736 tools = new QHBox(this); 736 tools = new QHBox(this);
737 // Type filter 737 // Type filter
738 typemb = new QComboBox(tools); 738 typemb = new QComboBox(tools);
739 QSizePolicy p = typemb->sizePolicy(); 739 QSizePolicy p = typemb->sizePolicy();
740 p.setHorData(QSizePolicy::Expanding); 740 p.setHorData(QSizePolicy::Expanding);
741 typemb->setSizePolicy(p); 741 typemb->setSizePolicy(p);
742 // Category filter 742 // Category filter
743 updateTools(); 743 updateTools();
744 tools->show(); 744 tools->show();
745 } else { 745 } else {
746 delete tools; 746 delete tools;
747 tools = 0; 747 tools = 0;
748 } 748 }
749 } 749 }
750} 750}
751 751
752void LauncherView::updateTools() 752void LauncherView::updateTools()
753{ 753{
754 disconnect( typemb, SIGNAL(activated(int)), 754 disconnect( typemb, SIGNAL(activated(int)),
755 this, SLOT(showType(int)) ); 755 this, SLOT(showType(int)) );
756 if ( catmb ) { 756 if ( catmb ) {
757 disconnect( catmb, SIGNAL(signalSelected(int)),this,SLOT(showCategory(int))); 757 disconnect( catmb, SIGNAL(signalSelected(int)),this,SLOT(showCategory(int)));
758 } 758 }
759 759
760 // ### I want to remove this 760 // ### I want to remove this
761 icons->updateCategoriesAndMimeTypes(); 761 icons->updateCategoriesAndMimeTypes();
762 762
763 QString prev; 763 QString prev;
764 764
765 // Type filter 765 // Type filter
766 QStringList types; 766 QStringList types;
767 typelist = icons->mimeTypes(); 767 typelist = icons->mimeTypes();
768 for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) { 768 for (QStringList::ConstIterator it = typelist.begin(); it!=typelist.end(); ++it) {
769 QString t = *it; 769 QString t = *it;
770 if ( t.left(12) == "application/" ) { 770 if ( t.left(12) == "application/" ) {
771 MimeType mt(t); 771 MimeType mt(t);
772 const AppLnk* app = mt.application(); 772 const AppLnk* app = mt.application();
773 if ( app ) 773 if ( app )
774 t = app->name(); 774 t = app->name();
775 else 775 else
776 t = t.mid(12); 776 t = t.mid(12);
777 } else { 777 } else {
778 t[0] = t[0].upper(); 778 t[0] = t[0].upper();
779 } 779 }
780 types += t; 780 types += t;
781 } 781 }
782 types << tr("All types"); 782 types << tr("All types");
783 prev = typemb->currentText(); 783 prev = typemb->currentText();
784 typemb->clear(); 784 typemb->clear();
785 typemb->insertStringList(types); 785 typemb->insertStringList(types);
786 for (int i=0; i<typemb->count(); i++) { 786 for (int i=0; i<typemb->count(); i++) {
787 if ( typemb->text(i) == prev ) { 787 if ( typemb->text(i) == prev ) {
788 typemb->setCurrentItem(i); 788 typemb->setCurrentItem(i);
789 break; 789 break;
790 } 790 }
791 } 791 }
792 if ( prev.isNull() ) { 792 if ( prev.isNull() ) {
793 typemb->setCurrentItem(typemb->count()-1); 793 typemb->setCurrentItem(typemb->count()-1);
794 } 794 }
795 795
796 int pcat = catmb ? catmb->currentCategory() : -2; 796 int pcat = catmb ? catmb->currentCategory() : -2;
797 if ( !catmb ) { 797 if ( !catmb ) {
798 catmb = new CategorySelect(tools); 798 catmb = new CategorySelect(tools);
799 } else if (pcat!=-2) { 799 } else if (pcat!=-2) {
800 800
801 } 801 }
802 Categories cats( 0 ); 802 Categories cats( 0 );
803 cats.load( categoryFileName() ); 803 cats.load( categoryFileName() );
804 QArray<int> vl( 0 ); 804 QArray<int> vl( 0 );
805 catmb->setCategories( vl, "Document View", // No tr 805 catmb->setCategories( vl, "Document View", // No tr
806 tr("Document View") ); 806 tr("Document View") );
807 catmb->setRemoveCategoryEdit( TRUE ); 807 catmb->setRemoveCategoryEdit( TRUE );
808 catmb->setAllCategories( TRUE ); 808 catmb->setAllCategories( TRUE );
809 catmb->setCurrentCategory(pcat); 809 catmb->setCurrentCategory(pcat);
810 810
811 // if type has changed we need to redisplay 811 // if type has changed we need to redisplay
812 if ( typemb->currentText() != prev ) 812 if ( typemb->currentText() != prev )
813 showType( typemb->currentItem() ); 813 showType( typemb->currentItem() );
814 814
815 connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int))); 815 connect(typemb, SIGNAL(activated(int)), this, SLOT(showType(int)));
816 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int))); 816 connect(catmb, SIGNAL(signalSelected(int)), this, SLOT(showCategory(int)));
817} 817}
818 818
819void LauncherView::sortBy(int s) 819void LauncherView::sortBy(int s)
820{ 820{
821 icons->setSortMethod((LauncherIconView::SortMethod)s); 821 icons->setSortMethod((LauncherIconView::SortMethod)s);
822} 822}
823 823
824void LauncherView::showType(int t) 824void LauncherView::showType(int t)
825{ 825{
826 if ( t >= (int)typelist.count() ) { 826 if ( t >= (int)typelist.count() ) {
827 icons->setTypeFilter("",TRUE); 827 icons->setTypeFilter("",TRUE);
828 } else { 828 } else {
829 QString ty = typelist[t]; 829 QString ty = typelist[t];
830 if ( !ty.contains('/') ) 830 if ( !ty.contains('/') )
831 ty += "/*"; 831 ty += "/*";
832 icons->setTypeFilter(ty,TRUE); 832 icons->setTypeFilter(ty,TRUE);
833 } 833 }
834} 834}
835 835
836void LauncherView::showCategory( int c ) 836void LauncherView::showCategory( int c )
837{ 837{
838 icons->setCategoryFilter( c, TRUE ); 838 icons->setCategoryFilter( c, TRUE );
839} 839}
840 840
841void LauncherView::setViewMode( ViewMode m ) 841void LauncherView::setViewMode( ViewMode m )
842{ 842{
843 odebug << "LauncherView::setViewMode( ViewMode m )" << oendl; 843 odebug << "LauncherView::setViewMode( ViewMode m )" << oendl;
844 if ( vmode != m ) { 844 if ( vmode != m ) {
845 bool bigIcons = m == Icon; 845 bool bigIcons = m == Icon;
846 icons->viewport()->setUpdatesEnabled( FALSE ); 846 icons->viewport()->setUpdatesEnabled( FALSE );
847 icons->setBigIcons( bigIcons ); 847 icons->setBigIcons( bigIcons );
848 switch ( m ) { 848 switch ( m ) {
849 case List: 849 case List:
850 icons->setItemTextPos( QIconView::Right ); 850 icons->setItemTextPos( QIconView::Right );
851 break; 851 break;
852 case Icon: 852 case Icon:
853 icons->setItemTextPos( QIconView::Bottom ); 853 icons->setItemTextPos( QIconView::Bottom );
854 break; 854 break;
855 } 855 }
856 icons->hideOrShowItems( FALSE ); 856 icons->hideOrShowItems( FALSE );
857 icons->viewport()->setUpdatesEnabled( TRUE ); 857 icons->viewport()->setUpdatesEnabled( TRUE );
858 vmode = m; 858 vmode = m;
859 } 859 }
860} 860}
861 861
862// 862//
863// User images may require scaling. 863// User images may require scaling.
864// 864//
865QImage LauncherView::loadBackgroundImage(QString &bgName) 865QImage LauncherView::loadBackgroundImage(QString &bgName)
866{ 866{
867 QImageIO imgio; 867 QImageIO imgio;
868 QSize ds = qApp->desktop()->size(); // should be launcher, not desktop 868 QSize ds = qApp->desktop()->size(); // should be launcher, not desktop
869 bool further_scaling = TRUE; 869 bool further_scaling = TRUE;
870 870
871 imgio.setFileName( bgName ); 871 imgio.setFileName( bgName );
872 imgio.setParameters("GetHeaderInformation"); 872 imgio.setParameters("GetHeaderInformation");
873 873
874 if (imgio.read() == FALSE) { 874 if (imgio.read() == FALSE) {
875 return imgio.image(); 875 return imgio.image();
876 } 876 }
877 877
878 if (imgio.image().width() < ds.width() && 878 if (imgio.image().width() < ds.width() &&
879 imgio.image().height() < ds.height()) { 879 imgio.image().height() < ds.height()) {
880 further_scaling = FALSE; 880 further_scaling = FALSE;
881 } 881 }