[PC-BSD Commits] r17285 - pcbsd/current/src-qt4/pc-mounttray

svn at pcbsd.org svn at pcbsd.org
Thu Jun 14 12:17:55 PDT 2012


Author: kenmoore
Date: 2012-06-14 19:17:52 +0000 (Thu, 14 Jun 2012)
New Revision: 17285

Modified:
   pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
Log:
Fix the file-manager detection for pc-mounttray since de-info got changed. Also add the use of glabel to try and detect a device label if the initial methos did not work.



Modified: pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp	2012-06-14 18:13:28 UTC (rev 17284)
+++ pcbsd/current/src-qt4/pc-mounttray/mountTray.cpp	2012-06-14 19:17:52 UTC (rev 17285)
@@ -106,6 +106,17 @@
   QString output = Utils::runShellCommand(cmd).join(" ");
   // - get the device label
   QString label = output.section("label: \"",1,1).section("\"",0,0).simplified(); //device name
+  if(label.isEmpty()){
+    //Try another method to find the device label
+    QString dev = deviceLocation.section("/",-1);
+    QStringList glout = Utils::runShellCommandSearch("glabel list "+dev,"Name:").split("\n");
+    for(int i=0; i<glout.length(); i++){
+      if(!glout[i].contains(dev)){
+        label = glout[i].section("Name:",1,1).section("/",-1).simplified();
+	break;
+      }
+    }
+  }
   // - trim the label out of the output line for filesystem type detection
   QString devFSsec = output.section("label:",0,0);
   QString devFSsec2 = output.section("label:",1,3).section(",",1,1,QString::SectionSkipEmpty);
@@ -189,7 +200,7 @@
   }else if(act==2){
     //Mount device
     if( mountDevice(device) ){
-      device->setToolTip( device->whatsThis()+" "+tr("mounted")+" - "+MOUNTDIR+device->text() );
+      device->setToolTip( device->whatsThis()+" "+tr("mounted")+" - "+MOUNTDIR+device->text().replace(" ","-") );
       numMount++;
       status = TRUE;
     }
@@ -405,7 +416,7 @@
     numAvail++;
     if(isMounted(newdevice)){ 
       numMount++; 
-      newdevice->setToolTip( tr("Mounted")+" - "+MOUNTDIR+newdevice->text() );
+      newdevice->setToolTip( tr("Mounted")+" - "+MOUNTDIR+newdevice->text().replace(" ","-") );
     }else{
       newdevice->setToolTip(tr("Unmounted - May be removed"));
     }
@@ -508,6 +519,8 @@
           if( updateDeviceList( 1 , newdev ) ){
             showDeviceNotification(1,newdev);
           }
+	}else{ 
+	  qDebug() << " - Ignoring device (Unknown filesystem)";
 	}
       }else{
         qDebug() << "Device removal detected:" <<  newdev->whatsThis();
@@ -589,9 +602,9 @@
 
 void MountTray::getDefaultFileManager(){
   //Get the command to open the appropriate file manager
-  QString fmcmd = Utils::runShellCommandSearch("de-info","File manager command:");
+  QString fmcmd = Utils::runShellCommand("de-info -fileman").join(" ");
   //qDebug() << "de-info result:" << fmcmd;
-  fmcmd = fmcmd.section("File manager command:",0,0,QString::SectionSkipEmpty).section("%s",0,0).simplified();
+  fmcmd = fmcmd.remove("%s").simplified();
   //qDebug() << "FM command found:" << fmcmd;
   if( fmcmd.isEmpty() ){fmcmd= "openwith"; } //Default to the "openwith" command
 



More information about the Commits mailing list