Ignore:
Timestamp:
08/26/13 09:15:28 (12 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
1b29242
Parents:
408039b
Message:

Add the ability for the mount tray to "force" an unmount (given a warning ahead of time)

File:
1 edited

Legend:

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

    rdadf169 r22f21be  
    254254} 
    255255 
    256 void MenuItem::unmountItem(){ 
     256void MenuItem::unmountItem(bool force){ 
    257257  //Unmount the device 
    258258         
     
    266266  //Make sure there are no spaces in the mounpoint path 
    267267  QString cmd1 = "umount \"" + mountpoint +"\""; 
     268  if(force){ cmd1.replace("umount ","umount -f "); } 
    268269  QString cmd2 = "rmdir \"" + mountpoint +"\""; 
    269270  qDebug() << "Unmounting device from" << mountpoint; 
     
    288289    } 
    289290  }else{ 
     291    if(!force){ 
     292      if(QMessageBox::Yes == QMessageBox::question(0,tr("Device Busy"), 
     293                 tr("The device appears to be busy. Would you like to unmount it anyway?")+"\n\n"+tr("NOTE: This is generally not recommended unless you are sure that you don't have any applications using the device."), 
     294                 QMessageBox::Yes | QMessageBox::No, QMessageBox::No) ){ 
     295        unmountItem(true); //force the unmount recursively 
     296        return; 
     297      } 
     298    } 
    290299    qDebug() << "pc-mounttray: Error unmounting mountpoint:" << mountpoint; 
    291300    qDebug() << " - Error message:" << output; 
Note: See TracChangeset for help on using the changeset viewer.