ui: modify Popup menu that non-blocking was not adjusted before 68/25868/1
authorhyunjin816.lee <hyunjin816.lee@samsung.com>
Mon, 11 Aug 2014 11:26:59 +0000 (20:26 +0900)
committerhyunjin816.lee <hyunjin816.lee@samsung.com>
Mon, 11 Aug 2014 11:29:19 +0000 (20:29 +0900)
it has adjusted Shell, Control panel, Force close menu

Change-Id: Ie95023482eeac50eac3a051f16243b42cee6eda1
Signed-off-by: hyunjin816.lee <hyunjin816.lee@samsung.com>
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/menu/contextmenu.h

index 312b32cd3fa6e240e5948dcfcbf7558e29d58ab4..aaba9b78319630e175eb820c187b5eeb6f204d56 100644 (file)
@@ -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();
index 0bfeeab62bf61643753b33e48b4a09e2b2830ea4..a2a41a74fb7b04bc4b509da0367851647d297d74 100644 (file)
@@ -34,6 +34,7 @@ public slots:
     void slotControlPanel();
     void slotAbout();
     void slotForceClose();
+    void slotForceCloseSelected(QAbstractButton *);
     void slotClose();
     void slotPwkeyRelease();