Changeset daab719


Ignore:
Timestamp:
12/05/13 08:01:40 (11 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
a0b0a6d
Parents:
d29f2cb
Message:

Make sure that the list of DE's is alphabetical, with the highest priority DE getting selected by default if no DE was ever loaded before. (highest priority DE is the first valid *.desktop found, which works for PC-BSD since they are orginazed as 01<something>.desktop, 02<something>.desktop, etc..)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/src/pcdm-gui.cpp

    rf2fe669 rdaab719  
    494494    QStringList deList = Backend::getAvailableDesktops(); 
    495495    QString lastDE = Backend::getLastDE(loginW->currentUsername()); 
     496    //Organize the desktop list alphabetically 
     497    QStringList DEL; 
     498    for(int i=0; i<deList.length(); i++){ 
     499      //Check the icon 
     500        QString deIcon = Backend::getDesktopIcon(deList[i]); 
     501        if( deIcon.isEmpty() ){ deIcon = currentTheme->itemIcon("desktop"); } //set the default icon if none given 
     502        if( !QFile::exists(deIcon) ){ deIcon = ":/images/desktop.png"; } 
     503      QString entry = deList[i] +";;;"+deIcon+";;;"+Backend::getDesktopComment(deList[i]); 
     504      DEL << entry; 
     505      if(lastDE.isEmpty()){ lastDE = deList[i]; } //grab the highest-priority DE if empty 
     506    } 
     507    DEL.sort(); //make it alphabetical 
    496508    //Now fill the switcher 
    497509    if(!simpleDESwitcher){ 
    498510      deSwitcher->removeAllItems(); 
    499       for(int i=0; i<deList.length(); i++){ 
    500         QString deIcon = Backend::getDesktopIcon(deList[i]); 
    501         if( deIcon.isEmpty() ){ deIcon = currentTheme->itemIcon("desktop"); } //set the default icon if none given 
    502         if( !QFile::exists(deIcon) ){ deIcon = ":/images/desktop.png"; } 
    503         //Now add the item back to the widget 
    504         deSwitcher->addItem( deList[i], deIcon, Backend::getDesktopComment(deList[i]) ); 
     511      for(int i=0; i<DEL.length(); i++){ 
     512        //Now add the item 
     513        deSwitcher->addItem( DEL[i].section(";;;",0,0), DEL[i].section(";;;",1,1), DEL[i].section(";;;",2,2) ); 
    505514      } 
    506515      //Set the switcher to the last used desktop environment 
     
    509518    }else{ 
    510519      //Simple switcher on the login widget 
    511       QStringList deIcons, deInfo; 
    512       for(int i=0; i<deList.length(); i++){  
    513         QString ico = Backend::getDesktopIcon(deList[i]); 
    514         if(ico.isEmpty()){ ico = currentTheme->itemIcon("desktop"); } 
    515         if(!QFile::exists(ico)){ ico = ":/images/desktop.png"; } 
    516         deIcons << ico; 
    517         deInfo << Backend::getDesktopComment(deList[i]); 
     520      QStringList deNames, deIcons, deInfo; 
     521      for(int i=0; i<DEL.length(); i++){ 
     522        deNames << DEL[i].section(";;;",0,0); 
     523        deIcons << DEL[i].section(";;;",1,1); 
     524        deInfo << DEL[i].section(";;;",2,2); 
    518525      } 
    519526      loginW->setDesktops(deList, deIcons, deInfo); 
Note: See TracChangeset for help on using the changeset viewer.