Skip to content
Browse files

Fix a bug with the mount tray where memory disks mounted outside the …

…tray are automatically unmounted by the tray.

TRAC Ticket: https://trac.pcbsd.org/ticket/773
  • Loading branch information...
1 parent 04421bd commit c69425e60d16115bb27502d3206ded3c7085ca69 @beanpole135 beanpole135 committed
Showing with 17 additions and 2 deletions.
  1. +16 −2 src-qt4/pc-mounttray/menuItem.cpp
  2. +1 −0 src-qt4/pc-mounttray/menuItem.h
View
18 src-qt4/pc-mounttray/menuItem.cpp
@@ -51,7 +51,7 @@ MenuItem::MenuItem(QWidget* parent, QString newdevice, QString newlabel, QString
else if(devType == "SCSI"){devIcon->setPixmap(QPixmap(":icons/harddrive.png")); }
//Start the automount procedure if necessary
if(checkAutomount->isChecked() || devType=="ISO"){
- QTimer::singleShot(500,this,SLOT( slotMountClicked() ));
+ QTimer::singleShot(500,this,SLOT( slotAutoMount() ));
}
//Update the Item based upon current device status
updateItem();
@@ -150,6 +150,18 @@ void MenuItem::slotMountClicked(){
updateItem();
}
+void MenuItem::slotAutoMount(){
+//Just like slotMountClicked, but will only mount the device if appropriate (no removals);
+ if( isConnected() ){
+ if( !isMounted() ){
+ mountItem();
+ }
+ }else{
+ emit itemRemoved(device);
+ }
+ updateItem();
+}
+
void MenuItem::slotAutoMountToggled(bool checked){
qDebug() << "Auto-mount toggled for:" << device << checked;
QString entry = devLabel->text()+":::"+devType+":::"+filesystem;
@@ -276,7 +288,9 @@ void MenuItem::unmountItem(bool force){
output = pcbsd::Utils::runShellCommand(cmd1);
if(output.join(" ").simplified().isEmpty()){
//unmounting successful, remove the mount point directory
- output = pcbsd::Utils::runShellCommand(cmd2);
+ if(mountpoint != "/mnt" && mountpoint != "/media"){ //make sure not to remove base directories
+ output = pcbsd::Utils::runShellCommand(cmd2);
+ }
if(!output.join(" ").simplified().isEmpty()){
qDebug() << "pc-mounttray: Error removing mountpoint:" << mountpoint;
qDebug() << " - Error message:" << output;
View
1 src-qt4/pc-mounttray/menuItem.h
@@ -67,6 +67,7 @@ class MenuItem : public QWidgetAction
private slots:
void slotMountClicked();
+ void slotAutoMount();
void slotAutoMountToggled(bool);
signals:

0 comments on commit c69425e

Please sign in to comment.
Something went wrong with that request. Please try again.