mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 10:22:52 +00:00
kemu: ask if user really wants to quit if machines are running
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
47455da734
commit
36e520aadb
2 changed files with 20 additions and 0 deletions
|
@ -198,6 +198,22 @@ void KEmuMainWindow::quit()
|
|||
qApp->quit();
|
||||
}
|
||||
|
||||
void KEmuMainWindow::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
const int running = m_machines.size();
|
||||
if (running != 0) {
|
||||
const QMessageBox::StandardButton answer = QMessageBox::question(this,
|
||||
i18n("Stop machines and quit?"),
|
||||
i18n("There are still %1 machines running, do you really want to quit?", running),
|
||||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||
if (answer != QMessageBox::Yes) {
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
}
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void KEmuMainWindow::updateStatus()
|
||||
{
|
||||
if (m_machines.size() == 0) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <QListWidgetItem>
|
||||
#include <QSettings>
|
||||
#include <QProcess>
|
||||
#include <QCloseEvent>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class Ui_KEmuWindow;
|
||||
|
@ -39,6 +40,9 @@ public slots:
|
|||
void createHardDisk();
|
||||
void quit();
|
||||
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent *event);
|
||||
|
||||
private slots:
|
||||
void machineLoad(const QString machine);
|
||||
void machineSave(const QString ignored);
|
||||
|
|
Loading…
Add table
Reference in a new issue