Skip to content

Commit

Permalink
MainWindow: add Cancel button to the "Minimize or Close?" message box.
Browse files Browse the repository at this point in the history
  • Loading branch information
rxl211 authored and mkrautz committed Jan 12, 2014
1 parent 1d0b1c8 commit d9d81a9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/mumble/MainWindow.cpp
Expand Up @@ -398,13 +398,17 @@ void MainWindow::closeEvent(QCloseEvent *e) {
QMessageBox mb(QMessageBox::Warning, QLatin1String("Mumble"), tr("Mumble is currently connected to a server. Do you want to Close or Minimize it?"), QMessageBox::NoButton, this);
QPushButton *qpbClose = mb.addButton(tr("Close"), QMessageBox::YesRole);
QPushButton *qpbMinimize = mb.addButton(tr("Minimize"), QMessageBox::NoRole);
mb.setDefaultButton(qpbMinimize);
mb.setEscapeButton(qpbMinimize);
QPushButton *qpbCancel = mb.addButton(tr("Cancel"), QMessageBox::RejectRole);
mb.setDefaultButton(qpbCancel);
mb.setEscapeButton(qpbCancel);
mb.exec();
if (mb.clickedButton() != qpbClose) {
if (mb.clickedButton() == qpbMinimize) {
showMinimized();
e->ignore();
return;
} else if (mb.clickedButton() == qpbCancel) {
e->ignore();
return;
}
}
sh.reset();
Expand Down

0 comments on commit d9d81a9

Please sign in to comment.