Ignore:
Timestamp:
Sep 12, 2013 1:21:00 PM (7 months ago)
Author:
Ken <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
23f66b8
Parents:
5a2e630f
Message:

Add the ability to specify a file manager for a "broken" desktop (LXDE at the moment) using the de-info utility to the mount tray - use xdg-open by default.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-mounttray/mountTray.cpp

    rb3ee7b3 r74b4950  
    2121  MTINIT=true; //set the flag that the mount tray is initializing; 
    2222  getInitialUsername(); //try to detect the non-root user who is running the program with root permissions 
     23  getFileManager(); 
     24     
    2325  loadSavedSettings(); 
    2426   
     
    287289} 
    288290 
     291void MountTray::getFileManager(){ 
     292  //Check for broken DE's that need a FM manually set 
     293  FMCMD = "xdg-open"; //the default auto-detection application 
     294    QStringList DEI = pcbsd::Utils::runShellCommand("de-info"); 
     295    QStringList broken; broken << "LXDE"; 
     296    for(int i=0; i<DEI.length(); i++){ 
     297      if(DEI[i].contains("DE name:")){ //this is always at the top of the output 
     298        QString DE = DEI[i].section(":",1,1).simplified(); 
     299        qDebug() << "-Desktop Detected:" << DE; 
     300        if( !broken.contains( DE ) ){ break; } //this DE is fine 
     301      }else if(DEI[i].contains("File manager:")){ 
     302        FMCMD = DEI[i].section(":",1,1).section(" ",0,0, QString::SectionSkipEmpty).simplified(); 
     303        break; 
     304      } 
     305    } 
     306  qDebug() << "-File Manager:" << FMCMD; 
     307} 
    289308void MountTray::slotOpenMediaDir(){ 
    290309  openMediaDir(MOUNTDIR); 
     
    303322  //Open the default file manager to the given directory as that user 
    304323  qDebug() << "Opening the media directory with user permissions"; 
    305   QString cmd = "su -m "+USERNAME+" -c \"xdg-open \'"+dir+"\' \""; 
     324  QString cmd = "su -m "+USERNAME+" -c \""+FMCMD+" \'"+dir+"\' \""; 
    306325  if(DEBUG_MODE){ qDebug() << " -cmd:" << cmd ; } 
    307326  cmd.prepend("("); cmd.append(") &"); 
Note: See TracChangeset for help on using the changeset viewer.