fixed bug (N_SE-33839, N_SE-34580, N_SE-34413)
authorChulheon <ch.jeong47@samsung.com>
Mon, 15 Apr 2013 14:58:13 +0000 (23:58 +0900)
committerChulheon <ch.jeong47@samsung.com>
Mon, 15 Apr 2013 15:00:21 +0000 (00:00 +0900)
Change-Id: Ia27de1893fd40bd9580a6918fa59ca94e74bee2d

src/ui/FUi_InputConnectionImpl.cpp
src/ui/FUi_InputConnectionImpl.h
src/ui/controls/FUiCtrl_EditPresenter.cpp

index e77823a..efaa197 100644 (file)
@@ -1204,20 +1204,20 @@ _InputConnectionImpl::OnKeyPressed(const _Control& source, const _KeyInfo& keyIn
        pKeyDown->compose = pEvent->compose;
        pKeyDown->timestamp = pEvent->timestamp;
 
-       if(CheckUSBKeyboardStatus() && pKeyDown->string)//usb keyboard exist
-       {
-               int key = (int)*pKeyDown->string;
-               if(IsFilteredKeyOnUSBMode(GetInputPanelStyle(), key))
-               {
-                       free(pKeyDown);
-                       return false;
-               }
-       }
-
        const _Control* pControl = _ControlManager::GetInstance()->GetObject(__controlHandle);
 
        if (&source == pControl)
        {
+               if(CheckUSBKeyboardStatus() && pKeyDown->string)//usb keyboard exist
+               {
+                               const char* key = const_cast<char*>(pKeyDown->string);
+                               if(FilterKeyOnUSBMode(GetInputPanelStyle(), key, true) == E_SUCCESS)
+                       {
+                               free(pKeyDown);
+                               return false;
+                       }
+               }
+
                if (ecore_imf_context_filter_event(__pContext, ECORE_IMF_EVENT_KEY_DOWN, (Ecore_IMF_Event*)pKeyDown) == EINA_TRUE)
                {
                        free(pKeyDown);
@@ -1358,20 +1358,20 @@ _InputConnectionImpl::OnKeyReleased(const _Control& source, const _KeyInfo& keyI
        pKeyUp->compose = pEvent->compose;
        pKeyUp->timestamp = pEvent->timestamp;
 
+       const _Control* pControl = _ControlManager::GetInstance()->GetObject(__controlHandle);
+
+       if (&source == pControl)
+       {
        if(CheckUSBKeyboardStatus() && pKeyUp->string)//usb keyboard exist
        {
-               int key = (int)*pKeyUp->string;
-               if(IsFilteredKeyOnUSBMode(GetInputPanelStyle(), key))
+                       const char* key = const_cast<char*>(pKeyUp->string);
+                       if(FilterKeyOnUSBMode(GetInputPanelStyle(), key) == E_SUCCESS)
                {
                        free(pKeyUp);
                        return false;
                }
        }
 
-       const _Control* pControl = _ControlManager::GetInstance()->GetObject(__controlHandle);
-
-       if (&source == pControl)
-       {
                if (ecore_imf_context_filter_event(__pContext, ECORE_IMF_EVENT_KEY_UP, (Ecore_IMF_Event*)pKeyUp) == EINA_TRUE)
                {
                        free(pKeyUp);
@@ -1492,17 +1492,21 @@ _InputConnectionImpl::CheckUSBKeyboardStatus(void)
        return keyboardNumber;
 }
 
-bool
-_InputConnectionImpl::IsFilteredKeyOnUSBMode(InputPanelStyle style, int key)
+result
+_InputConnectionImpl::FilterKeyOnUSBMode(InputPanelStyle style, const char* key, bool commit)
 {
        if(!(style == INPUT_PANEL_STYLE_NUMBER_ONLY || style == INPUT_PANEL_STYLE_PHONE_NUMBER || style == INPUT_PANEL_STYLE_IP))
-               return false;
+       {
+               return E_INVALID_ARG;
+       }
 
-       int TempKey[20] = {0,};
-       const int keyOnNumOnlyStyle[10] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/};
-       const int keyOnPhoneNumStyle[13] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/,
+       SysTryReturn(NID_UI, key, E_INVALID_ARG, E_INVALID_ARG, "key is null");
+
+       char TempKey[20] = {0,};
+       const char keyOnNumOnlyStyle[10] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/};
+       const char keyOnPhoneNumStyle[13] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/,
                                                                        0x2a/***/, 0x2b/*+*/, 0x23/*#*/};
-       const int keyOnIPStyle[18] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/,
+       const char keyOnIPStyle[18] = { 0x30/*0*/, 0x31/*1*/, 0x32/*2*/, 0x33/*3*/, 0x34/*4*/, 0x35/*5*/, 0x36/*6*/, 0x37/*7*/, 0x38/*8*/, 0x39/*9*/,
                                                                        0x3a/*:*/, 0x2e/*.*/, 0x61/*a*/, 0x62/*b*/, 0x63/*c*/, 0x64/*d*/, 0x65/*e*/, 0x66/*f*/};
        bool isExist = false;
        int keyCount = 0;
@@ -1510,29 +1514,49 @@ _InputConnectionImpl::IsFilteredKeyOnUSBMode(InputPanelStyle style, int key)
        if(style == INPUT_PANEL_STYLE_NUMBER_ONLY)
        {
                keyCount = 10;
-               memcpy(TempKey, keyOnNumOnlyStyle, keyCount*sizeof(int));
+               memcpy(TempKey, keyOnNumOnlyStyle, keyCount*sizeof(char));
        }
        else if(style == INPUT_PANEL_STYLE_PHONE_NUMBER)
        {
                keyCount = 13;
-               memcpy(TempKey, keyOnPhoneNumStyle, keyCount*sizeof(int));
+               memcpy(TempKey, keyOnPhoneNumStyle, keyCount*sizeof(char));
        }
        else if(style == INPUT_PANEL_STYLE_IP)
        {
                keyCount = 18;
-               memcpy(TempKey, keyOnIPStyle, keyCount*sizeof(int));
+               memcpy(TempKey, keyOnIPStyle, keyCount*sizeof(char));
        }
 
-       if(!keyCount)
-               return false;
-
-       for(int i = 0; i < keyCount ; i++)
+       for (int i = 0; i < keyCount ; i++)
        {
-               if(TempKey[i] == key)
+               if(TempKey[i] == key[0])
+               {
                        isExist = true;
+                       break;
+               }
        }
 
-       return !isExist;
+       if (isExist == true && commit == true)
+       {
+               String commitText(key);
+               if (commitText.GetLength() > 1)
+               {
+                       return E_SUCCESS;
+               }
+               InputConnection* pInputConnection = GetInputConnection();
+               IInputConnectionEventListener* pListener = GetInputConnectionListener();
+               IInputConnectionEventListenerF* pListenerF = GetInputConnectionListenerF();
+               if (pListener)
+               {
+                       pListener->OnInputConnectionTextCommitted( *pInputConnection, commitText);
+               }
+               if (pListenerF)
+               {
+                       pListenerF->OnInputConnectionTextCommitted( *pInputConnection, commitText);
+               }
+       }
+
+       return E_SUCCESS;
 }
 
 void
index ef1fa1d..82eabf1 100644 (file)
@@ -110,7 +110,7 @@ private:
        void RemoveEcoreEventCallback(void);
        void RemoveEvasObjectEventCallback(void);
 
-       bool IsFilteredKeyOnUSBMode(InputPanelStyle style, int key);
+       result FilterKeyOnUSBMode(InputPanelStyle style, const char* key, bool commit = false);
 
 private:
        Ecore_IMF_Context* __pContext;
index e89d199..86d6acd 100755 (executable)
@@ -1820,8 +1820,10 @@ _EditPresenter::DrawTextForEntireFontSetting(Canvas& canvas)
                                __pTextObject->Compose();
                        }
                }
-
-               __pTextObject->SetFirstDisplayLineIndexFromTextIndex(0);
+               if (!(__pEdit->GetEditStyle() & EDIT_STYLE_PASSWORD))
+               {
+                       __pTextObject->SetFirstDisplayLineIndexFromTextIndex(0);
+               }
                __pTextObject->SetForegroundColor(__pEdit->GetTextColor(editStatus), 0, __pTextObject->GetTextLength());
                __pTextObject->SetBlock(false);
        }
@@ -6310,13 +6312,12 @@ _EditPresenter::ShowKeypad(bool focus)
                return E_SUCCESS;
        }
 
-       /*
        _ControlManager* pControlManager = _ControlManager::GetInstance();
 
        if (!pControlManager->IsFrameActivated())
        {
                return E_SUCCESS;
-       }*/
+       }
 
        CheckUSBKeyboardStatus();
 
@@ -8426,7 +8427,6 @@ _EditPresenter::OnPasswordTimerExpired(void)
        }
 
        ReplaceTextIntoPasswordHyphenString();
-       __isCursorChanged = true;
 
        __pEdit->Invalidate();
 
@@ -8443,6 +8443,7 @@ _EditPresenter::ReplaceTextIntoPasswordHyphenString(void)
                if (GetTextLength() > 0)
                {
                        ChangePasswordToEchoCharacter(__pTextBuffer, __echoChar);
+                       __isCursorChanged = true;
                }
        }
 
@@ -8461,6 +8462,7 @@ _EditPresenter::ChangePasswordToEchoCharacter(wchar_t* dspStrBuffer, wchar_t ech
                dspStrBuffer[i] = echoChar;
        }
        dspStrBuffer[bufferLength] = null;
+       __isCursorChanged = true;
 
        return r;
 }