Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:pcbsd/pcbsd

  • Loading branch information...
commit 959fb5c294e5e7111c1da579804dca76b74078d7 2 parents f615958 + d5ff236
@kmoore134 kmoore134 authored
View
30 src-qt4/pc-mounttray/menuItem.cpp
@@ -105,11 +105,23 @@ bool MenuItem::isConnected(){
bool MenuItem::isMounted(){
//Check if device is mounted
+ QStringList chk = pcbsd::Utils::runShellCommand("mount");
+ bool mounted=false;
+ for(int i=0; i<chk.length(); i++){
+ mounted = chk[i].contains(device) || chk[i].contains(devLabel->text()) || chk[i].contains(devLabel->text().replace(" ","-"));
+ if(mounted){
+ //Save the mountpoint if it is mounted
+ mountpoint = chk[i].section(" on ",1,10).section("(",0,0).simplified();
+ break;
+ }
+ }
+ return mounted;
+ /*
QString chk = pcbsd::Utils::runShellCommandSearch("mount",device);
if(chk.isEmpty() ){ chk = pcbsd::Utils::runShellCommandSearch("mount",devLabel->text().replace(" ","-")); }
-
if(chk.isEmpty() ){ return FALSE; }
else{ return TRUE; }
+ */
}
//Cleanup function
@@ -247,21 +259,17 @@ void MenuItem::mountItem(){
void MenuItem::unmountItem(){
//Unmount the device
-
+
//Check to see if the current mountpoint exists or if it is somewhere else
if( !QFile::exists(mountpoint) ){
- if( isMounted() ){ //double check that it is actually mounted
- //mounted someplace else - find it
- QString output = pcbsd::Utils::runShellCommandSearch("mount",device);
- mountpoint = output.section(" on ",1,1).section(" (",0,0).replace(" ","-");
- }else{
+ if( !isMounted() ){ //double check that it is actually mounted (and fix the mountpoint)
//it is not mounted to begin with
return;
}
}
-
- QString cmd1 = "umount " + mountpoint;
- QString cmd2 = "rmdir " + mountpoint;
+ //Make sure there are no spaces in the mounpoint path
+ QString cmd1 = "umount \"" + mountpoint +"\"";
+ QString cmd2 = "rmdir \"" + mountpoint +"\"";
qDebug() << "Unmounting device from" << mountpoint;
//Run the commands
QStringList output;
@@ -296,7 +304,7 @@ void MenuItem::updateSizes(){
//this method only works if the device is currently mounted
bool ok = FALSE;
if(isMounted()){
- QString cmd = "df "+mountpoint;
+ QString cmd = "df \""+mountpoint+"\"";
QStringList output = systemCMD(cmd); //make sure we use the one with a 1K blocksize
if(output.length() > 1){
//parse the output (1K blocks) and save them
View
2  src-qt4/pc-mounttray/mountTray.cpp
@@ -310,7 +310,7 @@ void MountTray::openMediaDir(QString dir){
}
//Open the default file manager to the given directory as that user
qDebug() << "Opening the media directory with user permissions";
- QString cmd = "su -m "+USERNAME+" -c \'"+FILEMAN+" "+dir+"\' &";
+ QString cmd = "su -m "+USERNAME+" -c \'"+FILEMAN+" \""+dir+"\"\' &";
if(DEBUG_MODE){ qDebug() << " -cmd:" << cmd; }
system( cmd.toUtf8() );
}
Please sign in to comment.
Something went wrong with that request. Please try again.