Fixed the messagebox display issue when user enters invalid recipient 75/14675/1
authorSrinivasa Rao Payyavula <p.srinivasa@samsung.com>
Thu, 9 Jan 2014 14:04:47 +0000 (19:34 +0530)
committerSrinivasa Rao Payyavula <p.srinivasa@samsung.com>
Thu, 9 Jan 2014 14:04:47 +0000 (19:34 +0530)
Change-Id: I0b04a20eea7a1ed81310aa8701ff2a6b2325c922
Signed-off-by: Srinivasa Rao Payyavula <p.srinivasa@samsung.com>
inc/EmRecipientField.h
src/EmEmailApp.cpp
src/EmRecipientField.cpp

index c4567a9..22c7e38 100755 (executable)
@@ -57,6 +57,7 @@ class RecipientField
        , public Tizen::Ui::Controls::ITokenFilter
        , public Tizen::Ui::IFocusEventListener
        , public Tizen::Ui::IKeyEventListener
+       , public Tizen::Ui::IWindowEventListener
 {
 public:
 
@@ -96,6 +97,9 @@ public:
 
        virtual void OnUserEventReceivedN(RequestId requestId, Tizen::Base::Collection::IList* pArgs);
 
+       virtual void    OnWindowActivated (const Tizen::Ui::Window &source);
+       virtual void    OnWindowDeactivated (const Tizen::Ui::Window &source);
+
        void AdjustHeight(void);
        void SetMode(MODE newMode);
        void SetUserEventFlagValue(bool value);
@@ -103,6 +107,8 @@ public:
 private:
 
        MODE __mode;
+       bool __isWindowDeactived;
+       int __showMessageBox;
        int __width;
        float __expandedHeight;
        bool __alreadyValidated;
index 31c30d6..a976457 100755 (executable)
@@ -128,6 +128,7 @@ EmailApp::OnAppInitialized(void)
        EmailFrame* pEmailFrame = new (std::nothrow) EmailFrame();
        pEmailFrame->Construct();
        pEmailFrame->SetName(IDS_EMAIL_TEXT);
+       pEmailFrame->SetOrientation(ORIENTATION_AUTOMATIC_FOUR_DIRECTION);
        AddFrame(*pEmailFrame);
 
        mem = GetAvailableMemory();
index 0bf0472..695698a 100755 (executable)
@@ -32,6 +32,8 @@ using namespace Tizen::Ui::Controls;
 
 RecipientField::RecipientField(void)
        : __mode(READ_WRITE_MODE)
+       , __isWindowDeactived(false)
+       , __showMessageBox(0)
        , __width(W_RECIPIENT_AREA)
        , __expandedHeight(H_RECIPIENT_AREA)
        , __alreadyValidated(false)
@@ -48,11 +50,18 @@ RecipientField::RecipientField(void)
 
 RecipientField::~RecipientField(void)
 {
+       AppLogDebug("ENTER");
+
        if (__pRecipientList != null)
        {
                __pRecipientList->RemoveAll(true);
                delete __pRecipientList;
        }
+
+       Frame* pFrame = EmailApp::GetInstance()->GetFrame(IDS_EMAIL_TEXT);
+       pFrame->RemoveWindowEventListener(*this);
+
+       AppLogDebug("EXIT");
 }
 
 result
@@ -73,6 +82,9 @@ RecipientField::Construct(const FloatRectangle& bounds, MODE mode)
 
        Panel::Construct(relLayout, bounds, GROUP_STYLE_NONE);
 
+       Frame* pFrame = EmailApp::GetInstance()->GetFrame(IDS_EMAIL_TEXT);
+       pFrame->AddWindowEventListener(*this);
+
        if (pAppResource)
        {
                pContactBitmap = pAppResource->GetBitmapN(IDB_ADDCONTACT, BITMAP_PIXEL_FORMAT_ARGB8888);
@@ -844,13 +856,54 @@ RecipientField::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
        }
        else if (requestId == IDA_SHOW_INVALID_ADDRESS_MESSAGE_BOX)
        {
+               if (__isWindowDeactived == true)
+               {
+                       __showMessageBox = IDA_SHOW_INVALID_ADDRESS_MESSAGE_BOX;
+               }
+               else
+               {
+                       int modRes;
+                       MessageBox msgBox;
+                       msgBox.Construct(Utils::GetResourceString(L"IDS_COM_POP_ERROR"), Utils::GetResourceString(L"IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"), MSGBOX_STYLE_OK, 300000);
+                       msgBox.ShowAndWait(modRes);
+               }
+       }
+       else if (requestId == IDA_SHOW_DUPLICATE_ADDRESS_MESSAGE_BOX)
+       {
+               if (__isWindowDeactived == true)
+               {
+                       __showMessageBox = IDA_SHOW_DUPLICATE_ADDRESS_MESSAGE_BOX;
+               }
+               else
+               {
+                       int modRes;
+                       MessageBox msgBox;
+                       msgBox.Construct(Utils::GetResourceString(L"IDS_COM_POP_ERROR"), Utils::GetResourceString(L"IDS_MSGC_BODY_DUPLICATED_RECIPIENT"), MSGBOX_STYLE_OK, 300000);
+                       msgBox.ShowAndWait(modRes);
+               }
+       }
+
+       AppLogDebug("EXIT");
+}
+
+void
+RecipientField::OnWindowActivated (const Tizen::Ui::Window &source)
+{
+       AppLogDebug("ENTER");
+
+       __isWindowDeactived = false;
+
+       if (__showMessageBox == IDA_SHOW_INVALID_ADDRESS_MESSAGE_BOX)
+       {
+               __showMessageBox = 0;
                int modRes;
                MessageBox msgBox;
                msgBox.Construct(Utils::GetResourceString(L"IDS_COM_POP_ERROR"), Utils::GetResourceString(L"IDS_EMAIL_POP_INVALID_EMAIL_ADDRESS"), MSGBOX_STYLE_OK, 300000);
                msgBox.ShowAndWait(modRes);
        }
-       else if (requestId == IDA_SHOW_DUPLICATE_ADDRESS_MESSAGE_BOX)
+       else if (__showMessageBox == IDA_SHOW_DUPLICATE_ADDRESS_MESSAGE_BOX)
        {
+               __showMessageBox = 0;
                int modRes;
                MessageBox msgBox;
                msgBox.Construct(Utils::GetResourceString(L"IDS_COM_POP_ERROR"), Utils::GetResourceString(L"IDS_MSGC_BODY_DUPLICATED_RECIPIENT"), MSGBOX_STYLE_OK, 300000);
@@ -859,3 +912,14 @@ RecipientField::OnUserEventReceivedN(RequestId requestId, IList* pArgs)
 
        AppLogDebug("EXIT");
 }
+
+void
+RecipientField::OnWindowDeactivated (const Tizen::Ui::Window &source)
+{
+       AppLogDebug("ENTER");
+
+       __isWindowDeactived = true;
+
+       AppLogDebug("EXIT");
+}
+