From 7048c238f8e45229c54a296e2f6ed8a44655673c Mon Sep 17 00:00:00 2001 From: "hyunjin816.lee" Date: Mon, 11 Aug 2014 20:26:59 +0900 Subject: [PATCH] ui: modify Popup menu that non-blocking was not adjusted before it has adjusted Shell, Control panel, Force close menu Change-Id: Ie95023482eeac50eac3a051f16243b42cee6eda1 Signed-off-by: hyunjin816.lee --- tizen/src/ui/menu/contextmenu.cpp | 74 +++++++++++++++++++------------ tizen/src/ui/menu/contextmenu.h | 1 + 2 files changed, 47 insertions(+), 28 deletions(-) diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 312b32cd3f..aaba9b7831 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -210,10 +210,12 @@ void ContextMenu::slotShell() if (is_sdbd_initialized == 0) { QString msg = "SDB is not ready.\nPlease wait until the emulator is completely boot up."; - QMessageBox msgBox; - msgBox.setWindowTitle("Info"); - msgBox.setText(msg); - msgBox.exec(); + QMessageBox *msgBox = new QMessageBox(); + msgBox->setAttribute(Qt::WA_DeleteOnClose); + msgBox->setWindowTitle("Info"); + msgBox->setText(msg); + msgBox->setModal(false); + msgBox->show(); qDebug() << msg; return; } @@ -233,10 +235,12 @@ void ContextMenu::slotShell() QFileInfo fileInfo(sdbPath); if (!fileInfo.exists()) { QString msg = "SDB file does not exist : " + fileInfo.absoluteFilePath(); - QMessageBox msgBox; - msgBox.setWindowTitle("Error"); - msgBox.setText(msg); - msgBox.exec(); + QMessageBox *msgBox = new QMessageBox(); + msgBox->setAttribute(Qt::WA_DeleteOnClose); + msgBox->setWindowTitle("Error"); + msgBox->setText(msg); + msgBox->setModal(false); + msgBox->show(); qWarning() << msg; return; } @@ -262,10 +266,12 @@ void ContextMenu::slotShell() terminal->start(command, arguments); } catch (QString error) { QString msg = "Fail to open Shell : " + error; - QMessageBox msgBox; - msgBox.setWindowTitle("Fail"); - msgBox.setText(msg); - msgBox.exec(); + QMessageBox *msgBox = new QMessageBox(); + msgBox->setAttribute(Qt::WA_DeleteOnClose); + msgBox->setWindowTitle("Fail"); + msgBox->setText(msg); + msgBox->setModal(false); + msgBox->show(); qDebug() << msg; return; } @@ -287,10 +293,12 @@ void ContextMenu::slotControlPanel() QFileInfo fileInfo(ecpPath); if (!fileInfo.exists()) { QString msg = "Control Panel file does not exist in the following path.\n" + fileInfo.absoluteFilePath(); - QMessageBox msgBox; - msgBox.setWindowTitle("Error"); - msgBox.setText(msg); - msgBox.exec(); + QMessageBox *msgBox = new QMessageBox(); + msgBox->setAttribute(Qt::WA_DeleteOnClose); + msgBox->setWindowTitle("Error"); + msgBox->setText(msg); + msgBox->setModal(false); + msgBox->show(); qWarning() << msg; return; } @@ -310,10 +318,12 @@ void ContextMenu::slotControlPanel() terminal->start(command, arguments); } catch (QString error) { QString msg = "Fail to open control panel : " + error; - QMessageBox msgBox; - msgBox.setWindowTitle("Fail"); - msgBox.setText(msg); - msgBox.exec(); + QMessageBox *msgBox = new QMessageBox(); + msgBox->setAttribute(Qt::WA_DeleteOnClose); + msgBox->setWindowTitle("Fail"); + msgBox->setText(msg); + msgBox->setModal(false); + msgBox->show(); qDebug() << msg; return; } @@ -333,14 +343,22 @@ void ContextMenu::slotForceClose() qDebug("force close"); QMessageBox *msg = new QMessageBox(); - QMessageBox::StandardButton *reply = new QMessageBox::StandardButton(); - *reply = msg->question((QWidget *)this->parent(), "Emulator", - "If you force stop an emulator, it may cause some problems.\n" - "Are you sure you want to continue?", - QMessageBox::Yes | QMessageBox::No, - QMessageBox::Yes); - - if (*reply == QMessageBox::Yes) { + msg->setAttribute(Qt::WA_DeleteOnClose); + msg->setWindowTitle("Emulator"); + msg->setText("If you force stop an emulator, it may cause some problems.\n" + "Are you sure you want to continue?"); + msg->setStandardButtons(QMessageBox::Yes|QMessageBox::No); + msg->setDefaultButton(QMessageBox::Yes); + msg->setIcon(QMessageBox::Question); + msg->setModal(false); + msg->show(); + connect(msg, SIGNAL(buttonClicked(QAbstractButton *)), + this, SLOT(slotForceCloseSelected(QAbstractButton *))); +} + +void ContextMenu::slotForceCloseSelected(QAbstractButton *btn) +{ + if (btn->text().compare("&Yes") == 0) { qDebug() << "exit!"; /* force close */ shutdown_qemu_gracefully(); diff --git a/tizen/src/ui/menu/contextmenu.h b/tizen/src/ui/menu/contextmenu.h index 0bfeeab62b..a2a41a74fb 100644 --- a/tizen/src/ui/menu/contextmenu.h +++ b/tizen/src/ui/menu/contextmenu.h @@ -34,6 +34,7 @@ public slots: void slotControlPanel(); void slotAbout(); void slotForceClose(); + void slotForceCloseSelected(QAbstractButton *); void slotClose(); void slotPwkeyRelease(); -- 2.34.1