backkey handling modification
authorKyusung Cho <ks0128.cho@samsung.com>
Fri, 5 Jul 2013 01:31:14 +0000 (10:31 +0900)
committerKyusung Cho <ks0128.cho@samsung.com>
Fri, 5 Jul 2013 01:31:14 +0000 (10:31 +0900)
Change-Id: I734d584cd5cb9f0ccf11539450827dddb0091f61
Signed-off-by: Kyusung Cho <ks0128.cho@samsung.com>
project/inc/QrCodeRecognizerSample.h
project/src/QrCodeRecognizerSample.cpp

index 6c3f285..78644c3 100644 (file)
@@ -88,9 +88,6 @@ private:
     TouchForm*                  __pForm;
     Tizen::Ui::Controls::Popup* __pPopup;
 
-    static const Tizen::Base::String MESSAGE_BOX_NAME;
-    static const Tizen::Base::String POPUP_NAME;
-
     static const int ID_BUTTON_YES = 200;
     static const int ID_BUTTON_NO  = 201;
 };
index 068b986..d674ca0 100644 (file)
@@ -26,8 +26,6 @@ using namespace Tizen::Ui;
 using namespace Tizen::Ui::Controls;
 
 const char* pTagApp = "QrCodeRecognizer";
-const String QrCodeRecognizer::MESSAGE_BOX_NAME = "MessageBox";
-const String QrCodeRecognizer::POPUP_NAME = "Popup";
 
 QrCodeRecognizer::QrCodeRecognizer()
     : __pTracker(0)
@@ -66,7 +64,6 @@ QrCodeRecognizer::OnAppInitialized(void)
     // Creates an instance of Popup
     __pPopup = new Tizen::Ui::Controls::Popup();
     __pPopup->Construct(true, Tizen::Graphics::Dimension(530, 250));
-    __pPopup->SetName(POPUP_NAME);
     __pPopup->SetPropagatedKeyEventListener(this);
 
     __pForm = new TouchForm();
@@ -88,17 +85,8 @@ QrCodeRecognizer::OnAppInitialized(void)
 
                        msgBox.Construct("Warning", "Low battery. Terminating App.", MSGBOX_STYLE_NONE, 3000);
                        msgBox.ShowAndWait(result);
-
-                       switch (result)
-                       {
-                               case MSGBOX_RESULT_CLOSE:
-                                       Tizen::App::Application::GetInstance()->Terminate();
-                                       return false;
-                                       break;
-
-                               default:
-                                       break;
-                       }
+                       Tizen::App::Application::GetInstance()->Terminate();
+                       return false;
                }
        }
 
@@ -109,18 +97,10 @@ QrCodeRecognizer::OnAppInitialized(void)
 
                msgBox.Construct("Warning", "Cannot init OpenGL. Terminating App.", MSGBOX_STYLE_NONE, 3000);
                msgBox.ShowAndWait(result);
-
-               switch (result)
-               {
-                       case MSGBOX_RESULT_CLOSE:
-                               Tizen::App::Application::GetInstance()->Terminate();
-                               return false;
-                               break;
-
-                       default:
-                               break;
-               }
+               Tizen::App::Application::GetInstance()->Terminate();
+               return false;
     }
+
     __pTracker = new Tracker();
     __pForm->SendUserEvent(TouchForm::REQUEST_ACTIVATE, null);
 
@@ -131,17 +111,8 @@ QrCodeRecognizer::OnAppInitialized(void)
 
                msgBox.Construct("Warning","Cannot init camera. Terminating App.", MSGBOX_STYLE_NONE, 3000);
                msgBox.ShowAndWait(result);
-
-               switch (result)
-               {
-                       case MSGBOX_RESULT_CLOSE:
-                               Tizen::App::Application::GetInstance()->Terminate();
-                               return false;
-                               break;
-
-                       default:
-                               break;
-               }
+               Tizen::App::Application::GetInstance()->Terminate();
+               return false;
     }
 
        __pTracker->Init(__pForm);
@@ -199,18 +170,8 @@ QrCodeRecognizer::OnForeground(void)
                int result = 0;
 
                msgBox.Construct("Warning","Cannot restart camera. Terminating App.", MSGBOX_STYLE_OK, 0);
-               msgBox.SetName(MESSAGE_BOX_NAME);
-               msgBox.SetPropagatedKeyEventListener(this);
                msgBox.ShowAndWait(result);
-
-               switch (result)
-               {
-                       case MSGBOX_RESULT_OK:
-                               Tizen::App::Application::GetInstance()->Terminate();
-                               break;
-                       default:
-                               break;
-               }
+               Tizen::App::Application::GetInstance()->Terminate();
     }
 }
 
@@ -239,15 +200,8 @@ QrCodeRecognizer::OnBatteryLevelChanged(BatteryLevel batteryLevel)
                        int result = 0;
 
                        msgBox.Construct("Warning","Low Battery.\nPlease charge to use.",MSGBOX_STYLE_OK);
-                       msgBox.SetName(MESSAGE_BOX_NAME);
-                       msgBox.SetPropagatedKeyEventListener(this);
                        msgBox.ShowAndWait(result);
-
-                       if(result == MSGBOX_RESULT_OK)
-                       {
-                               Application::GetInstance()->Terminate();
-                               return;
-                       }
+                       Application::GetInstance()->Terminate();
                }
        }
 }
@@ -255,7 +209,7 @@ QrCodeRecognizer::OnBatteryLevelChanged(BatteryLevel batteryLevel)
 bool
 QrCodeRecognizer::OnKeyPressed (Control &source, const KeyEventInfo &keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 bool
@@ -263,35 +217,27 @@ QrCodeRecognizer::OnKeyReleased (Control &source, const KeyEventInfo &keyEventIn
 {
        if(keyEventInfo.GetKeyCode() == KEY_BACK)
        {
-               if(source.GetName().CompareTo(MESSAGE_BOX_NAME) == 0)
-               {
-                       Tizen::App::Application::GetInstance()->Terminate();
-               }
-               else if(source.GetName().CompareTo(POPUP_NAME) == 0)
-               {
-                       OnActionPerformed(source, ID_BUTTON_NO);
-               }
-
+               OnActionPerformed(source, ID_BUTTON_NO);
        }
-       return true;
+       return false;
 }
 
 bool
 QrCodeRecognizer::OnPreviewKeyPressed (Control &source, const KeyEventInfo &keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 bool
 QrCodeRecognizer::OnPreviewKeyReleased (Control &source, const KeyEventInfo &keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 bool
 QrCodeRecognizer::TranslateKeyEventInfo (Control &source, KeyEventInfo &keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 void