Changeset ced25c9


Ignore:
Timestamp:
07/30/13 17:41:30 (17 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2, releng/10.0.3, releng/10.1
Children:
467009e, b3cb948
Parents:
7112fa8
Message:

Add the ability to detect if there are unsaved changes and warn the user before exiting.

Location:
src-qt4/pc-bootconfig
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-bootconfig/mainUI.cpp

    rcd554b1 rced25c9  
    441441    ui->tool_GRUBresetentries->setEnabled(true); 
    442442} 
     443 
     444// =================== 
     445// ===== PROTECTED ===== 
     446// =================== 
     447void mainUI::closeEvent(QCloseEvent *event){ 
     448  bool changes = ui->tool_GRUBsavedefaults->isEnabled() || ui->tool_GRUBsaveentries->isEnabled(); 
     449  if(changes){ 
     450    //Verify that they want to continue 
     451    QMessageBox::StandardButton button = QMessageBox::warning(this, tr("Unsaved Changes"), tr("You currently have unsaved changes in the GRUB configuration. Do you want to quit anyway?"), QMessageBox::Yes | QMessageBox::Cancel,QMessageBox::Cancel); 
     452    if(button != QMessageBox::Yes){  
     453      //Ignore close request 
     454      event->ignore(); 
     455      return; 
     456    } 
     457  } 
     458  this->close(); 
     459} 
  • src-qt4/pc-bootconfig/mainUI.h

    rcd554b1 rced25c9  
    7777        void GRUBchangeentries(); 
    7878         
     79protected: 
     80        void closeEvent(QCloseEvent *event); 
     81         
    7982}; 
    8083#endif 
Note: See TracChangeset for help on using the changeset viewer.