ui: "cancel" button should be default button
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 17 Jun 2015 06:43:20 +0000 (15:43 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Thu, 18 Jun 2015 07:55:04 +0000 (16:55 +0900)
Change-Id: I43ce35784b09a33f8fb28b2f3ffefb05805bc35b
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/menu/contextmenu.h

index 442e9968f29725bc22a458696da5d419af34a143..f4a98c24b7a7212ba23cf3d3f0551ad3b6e4598c 100644 (file)
@@ -769,7 +769,8 @@ void ContextMenu::slotForceClose()
 
     QMessageBox *msgBox = showMsgBox(QMessageBox::Question,
         "If you force stop an emulator, it may cause some problems.\n"
-        "Are you sure you want to continue?", QMessageBox::Yes | QMessageBox::No);
+        "Are you sure you want to continue?",
+        QMessageBox::Cancel | QMessageBox::Ok, QMessageBox::Cancel);
 
     connect(msgBox, SIGNAL(buttonClicked(QAbstractButton *)),
         this, SLOT(slotForceCloseSelected(QAbstractButton *)));
@@ -784,12 +785,12 @@ void ContextMenu::slotForceCloseSelected(QAbstractButton *button)
     }
 
     switch(msgBox->standardButton(button)) {
-        case QMessageBox::Yes:
+        case QMessageBox::Ok:
             qDebug() << "exit!";
             shutdown_qemu_gracefully(3);
 
             break;
-        case QMessageBox::No:
+        case QMessageBox::Cancel:
             qDebug() << "cancel";
 
             break;
@@ -837,12 +838,17 @@ QAction *ContextMenu::getActionTopMost()
 }
 
 QMessageBox *ContextMenu::showMsgBox(
-    int iconType, const QString &text, int buttons)
+    QMessageBox::Icon iconType, const QString &text,
+    QMessageBox::StandardButtons buttons,
+    QMessageBox::StandardButton defaultButton)
 {
     qDebug() << text;
 
-    QMessageBox *msgBox = new QMessageBox((QMessageBox::Icon)iconType,
-        "Emulator", text, (QMessageBox::StandardButton)buttons, parent);
+    QMessageBox *msgBox = new QMessageBox(iconType,
+        "Emulator", text, buttons, parent);
+    if (defaultButton != QMessageBox::NoButton) {
+        msgBox->setDefaultButton(defaultButton);
+    }
     msgBox->setAttribute(Qt::WA_DeleteOnClose);
     msgBox->show(); /* non-blocking */
 
index 8a55471d76454548ad7781dad439577588543ced..b710322dcf26d34b9bd3e6454a8ca9c34fe65938 100644 (file)
@@ -114,7 +114,9 @@ protected:
 private:
     QAction *addGeneralAction(QMenu *menu,
         const QIcon &icon, const QString &text, const char *slot);
-    QMessageBox *showMsgBox(int iconType, const QString &text, int buttons = 0);
+    QMessageBox *showMsgBox(QMessageBox::Icon iconType, const QString &text,
+            QMessageBox::StandardButtons buttons = QMessageBox::NoButton,
+            QMessageBox::StandardButton defaultButton = QMessageBox::NoButton);
 
     MainWindow *parent;
     QString vmName;