Changeset ec381ad


Ignore:
Timestamp:
05/16/14 09:37:02 (16 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, enter/10, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2, releng/10.2, stable/10
Children:
bfcae6c
Parents:
8dd8046
Message:

Make sure that the mimetype-matched applications also show up on the preferred list instead of in the general application list.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lumina/lumina-open/LFileDialog.cpp

    rbb41d1d rec381ad  
    151151void LFileDialog::generateAppList(){ 
    152152  //Now load the preferred applications 
    153   QStringList apps = getPreferredApplications(); 
    154   PREFAPPS.clear(); 
     153  PREFAPPS = getPreferredApplications(); 
    155154  ui->combo_rec->clear(); 
    156   for(int i=0; i<apps.length(); i++){ 
    157     bool ok = false; 
    158     XDGDesktop dFile = LXDG::loadDesktopFile(apps[i], ok); 
    159     if( LXDG::checkValidity(dFile) && ok ){ 
    160       PREFAPPS << apps[i]; 
    161       ui->combo_rec->addItem( LXDG::findIcon(dFile.icon, ":/icons/application.png"), dFile.name); 
    162       if(i==0){ ui->combo_rec->setCurrentIndex(0); } //make sure the first item is selected 
    163     } 
    164   } 
    165155  //Now get the application mimetype for the file extension (if available) 
    166156  QString mimetype = LXDG::findAppMimeForFile(fileEXT); 
     
    182172      if(app[a].mimeList.contains(mimetype) && !mimetype.isEmpty()){ 
    183173        // also put this app at the top of the recommendations 
    184         QTreeWidgetItem *pi = new QTreeWidgetItem(ui->tree_apps,QStringList() << app[a].name); 
    185           pi->setWhatsThis(0, app[a].filePath); 
    186           pi->setIcon(0, LXDG::findIcon(app[a].icon, ":/icons/application.png")); 
    187           pi->setToolTip(0, app[a].comment); 
    188         ui->tree_apps->insertTopLevelItem(0,pi); //put it at the top of the list 
    189         ui->tree_apps->setCurrentItem(pi); //make sure it is selected 
     174        PREFAPPS.prepend(app[a].filePath); 
    190175      } 
    191176    } 
    192177    ui->tree_apps->addTopLevelItem(ci); 
     178  } 
     179  //Now add all the preferred applications 
     180  PREFAPPS.removeDuplicates(); 
     181  for(int i=0; i<PREFAPPS.length(); i++){ 
     182    bool ok = false; 
     183    XDGDesktop dFile = LXDG::loadDesktopFile(PREFAPPS[i], ok); 
     184    if( LXDG::checkValidity(dFile) && ok ){ 
     185      ui->combo_rec->addItem( LXDG::findIcon(dFile.icon, ":/icons/application.png"), dFile.name); 
     186      if(i==0){ ui->combo_rec->setCurrentIndex(0); } //make sure the first item is selected 
     187    }else{ 
     188      PREFAPPS.removeAt(i); //invalid app 
     189      i--; 
     190    } 
    193191  } 
    194192  //Update the UI 
Note: See TracChangeset for help on using the changeset viewer.