Opened 17 years ago
Last modified 8 years ago
#973 closed enhancement
Supress dialog box when closing a VM Guest — at Initial Version
| Reported by: | bigmudcake | Owned by: | |
|---|---|---|---|
| Component: | GUI | Version: | VirtualBox 1.5.2 |
| Keywords: | Cc: | ||
| Guest type: | other | Host type: | other |
Description
The code below is designed to achive the following
"Close the virtual machine window (or shutdown the host OS) and the virtual machine's guest OS shuts down or suspends gracefully, then the vm window closes automatically."
In other words prevent the dialog box from appearing when closing a VM session.
Here is a suggested change in the file trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleWnd.cpp (R5923)
1199 /* The stuck VM can only be powered off; disable anything
1200 * else and choose PowerOff */
1201 dlg.rbSave->setEnabled (false);
1202 dlg.buttonGroup->setButton (dlg.buttonGroup->id (dlg.rbPowerOff));
1203 }
1204
1205 bool wasShutdown = false;
bool dialogAccepted = true;
QStringList suppressCloseDialog =
QStringList::split (',', cmachine.GetExtraData (VBoxDefs::GUI_SupressCloseDialog));
if (supressCloseDialog [0] != 'Yes')
{
dialogAccepted = (dlg.exec() == QDialog::Accepted);
}
1206
1207 if (dialogAccepted)
1208 {
1209 CConsole cconsole = console->console();
1210
1211 if (dlg.rbSave->isChecked())
Not sure if the code is correct as I havent done much c++ coding, but what it achieves is that if "GUI_SupressCloseDialog" is set to "Yes" then do not show the dialog box but instead close VM according to the action set in "GUI_LastCloseAction" or the default close action if its not set.

