Changed code for Poup Focus using Hardware key
authorchitta.rs <chitta.rs@samsung.com>
Thu, 4 Jul 2013 06:04:11 +0000 (11:34 +0530)
committerchitta.rs <chitta.rs@samsung.com>
Thu, 4 Jul 2013 07:50:25 +0000 (13:20 +0530)
Change-Id: Ibb85ee53bc4f235ea839dad155f368d580899bdb

inc/MfSearchForm.h
inc/MfTypes.h
src/MfBaseForm.cpp
src/MfBaseItemProvider.cpp
src/MfCreateFolderForm.cpp
src/MfSearchForm.cpp
src/MfSearchPresentationModel.cpp
src/MfSubBaseFileManageForm.cpp
src/MfSubBaseFolderEntryForm.cpp
src/MfSubFolderMoveCopy.cpp
src/MfTypes.cpp

index 12e531b..288a5e6 100644 (file)
@@ -142,6 +142,7 @@ private:
 \r
        result CreateDeleteConfirmationPopup(void);\r
        result CreateFileProgressingPopup(void);\r
+       result CreateSearchPopup(void);\r
        void DeleteFile(Tizen::Base::String& filePath);\r
        void HideDeleteConfirmationPopup(void);\r
        void HideFileProgressingPopup(void);\r
index 0ebf81d..a3d0232 100644 (file)
@@ -74,7 +74,7 @@ static const int ID_FILE_RENAME_COMPLETE = 110;
 
 //Sizes of Arrays
 static const int ID_IMAGE_TYPE_SIZE = 14;
-static const int ID_AUDIO_TYPE_SIZE = 14;
+static const int ID_AUDIO_TYPE_SIZE = 16;
 static const int ID_VIDEO_TYPE_SIZE = 22;
 static const int ID_CONTACT_TYPE_SIZE = 2;
 static const int ID_MAX_TEXT_ITEMS = 10;
index 8ca2dd5..c5da2c5 100644 (file)
@@ -232,23 +232,23 @@ BaseForm::OnSettingValueChanged(SettingKey settingKey)
 bool
 BaseForm::OnKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 bool
 BaseForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 bool
 BaseForm::OnPreviewKeyPressed(Control& source, const KeyEventInfo& keyEventInfo)
 {
-       return true;
+       return false;
 }
 
 bool
 BaseForm::OnPreviewKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
 {
-       return true;
+       return false;
 }
index 2c0cf72..562294d 100644 (file)
@@ -69,8 +69,6 @@ BaseItemProvider::Construct(void)
        pAppResource->GetString(L"IDS_MF_SK_DETAILS", detailButtonText);
        pAppResource->GetString(L"IDS_MF_BODY_RENAME_ABB", renameButtonText);
        pAppResource->GetString(L"IDS_MF_SK3_DELETE", deleteButtonText);
-       pAppResource->GetString(L"IDS_MF_OPT_SHOW_FILE_EXTENSION", __showExtension);
-       pAppResource->GetString(L"IDS_MF_OPT_HIDE_FILE_EXTENSION_ABB", __hideExtension);
        __extensionKeyName = fileExtenstionKeyName;
 
        __pDummyImage = pAppResource->GetBitmapN(IDB_DUMMY_IMG, BITMAP_PIXEL_FORMAT_ARGB8888);
@@ -559,7 +557,7 @@ BaseItemProvider::CreateDetailedListViewItem(int listItemIndex, int listItemWidt
 
        //Assign the filename to the one retrieved from __fileNames.
        filename = pFileDetails->GetFileName();
-       if (fileExtension == __showExtension && !pFileDetails->IsDirectory())
+       if (fileExtension == showExtensionKeyValue && !pFileDetails->IsDirectory())
        {
                if (!pFileDetails->GetFileExtension().IsEmpty())
                {
index cbed964..df3e912 100644 (file)
@@ -1152,9 +1152,10 @@ CreateFolderForm::CreateFileProgressingPopup(void)
        }
 
        _pFileProgressingPopup = new (std::nothrow) Popup();
-       _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
        if (_pFileProgressingPopup != null)
        {
+               _pFileProgressingPopup->Construct(L"IDL_FILE_PROGRESSING_POPUP");
+
                _pFileProgressingPopup->SetPropagatedKeyEventListener(this);
 
                _pFileProgressingCancelButton = static_cast< Button* >(_pFileProgressingPopup->GetControl(L"IDC_CANCEL_BUTTON", true));
@@ -1386,5 +1387,5 @@ CreateFolderForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInf
                        __pFileManager->ForceStopWorkerThread();
                }
        }
-       return true;
+       return false;
 }
index b4f45cd..bdd8bf0 100644 (file)
@@ -208,28 +208,8 @@ SearchForm::OnInitializing(void)
        TryCatch(__pFolderEntryPM != null, , "Content Manager not found!");
        __pFolderEntryPM->Construct();
 
-       __pSearchPopup = new (std::nothrow) Popup();
-       TryCatch(__pSearchPopup != null, , "Failed to allocate memory to __pSearchPopup");
-
-       r = __pSearchPopup->Construct(L"IDL_SEARCH_POPUP");
-       TryCatch(r == E_SUCCESS, , "failed to construct __pPopUpPanel");
-
-       __pSearchPopup->SetPropagatedKeyEventListener(this);
-
-       __pLabelSearching = static_cast<Label*> (__pSearchPopup->GetControl(L"IDC_LABEL_SEARCHING"));
-       TryCatch(__pLabelSearching != null, , "Failed to get __pLabelSearching");
-
-       __pFolderLabel = static_cast<Label*> (__pSearchPopup->GetControl(L"IDC_LABEL_FOLDER"));
-       TryCatch(__pFolderLabel != null, r = GetLastResult(), "Failed to get __pFolderLabel");
-
-       __pCancelSearch = static_cast<Button*> (__pSearchPopup->GetControl(L"IDC_BUTTON_CANCEL"));
-       TryCatch(__pCancelSearch != null, , "Failed to get __pCancelSearch");
-
-       __pCancelSearch->SetActionId(IDA_BTN_POPUP_SEARCH_CANCEL);
-       __pCancelSearch->AddActionEventListener(*this);
-
-       __pSearchPopup->SetShowState(false);
-
+       r = CreateSearchPopup();
+       TryCatch(r == E_SUCCESS, , "Failed to Create SearchPopup:%s", GetErrorMessage(r));
 
        __listViewRectangle.SetBounds(X_DEFAULT, H_SEARCH_BAR, GetClientAreaBounds().width, GetClientAreaBounds().height - H_SEARCH_BAR);
 
@@ -298,6 +278,43 @@ CATCH:
 }
 
 result
+SearchForm::CreateSearchPopup(void)
+{
+       result r = E_FAILURE;
+
+       __pSearchPopup = new (std::nothrow) Popup();
+       TryCatch(__pSearchPopup != null, r = GetLastResult(), "Failed to allocate memory to __pSearchPopup");
+
+       r = __pSearchPopup->Construct(L"IDL_SEARCH_POPUP");
+       TryCatch(r == E_SUCCESS, , "failed to construct __pPopUpPanel");
+
+       __pSearchPopup->SetPropagatedKeyEventListener(this);
+
+       __pLabelSearching = static_cast<Label*> (__pSearchPopup->GetControl(L"IDC_LABEL_SEARCHING"));
+       TryCatch(__pLabelSearching != null, r = GetLastResult(), "Failed to get __pLabelSearching");
+
+       __pFolderLabel = static_cast<Label*> (__pSearchPopup->GetControl(L"IDC_LABEL_FOLDER"));
+       TryCatch(__pFolderLabel != null, r = GetLastResult(), "Failed to get __pFolderLabel");
+
+       __pCancelSearch = static_cast<Button*> (__pSearchPopup->GetControl(L"IDC_BUTTON_CANCEL"));
+       TryCatch(__pCancelSearch != null, r = GetLastResult(), "Failed to get __pCancelSearch");
+
+       __pCancelSearch->SetActionId(IDA_BTN_POPUP_SEARCH_CANCEL);
+       __pCancelSearch->AddActionEventListener(*this);
+
+       __pSearchPopup->SetShowState(false);
+
+       return r;
+
+CATCH:
+       if (__pSearchPopup != null)
+       {
+               delete __pSearchPopup;
+               __pSearchPopup = null;
+       }
+       return r;
+}
+result
 SearchForm::OnTerminating(void)
 {
        result r = E_SUCCESS;
@@ -895,7 +912,7 @@ SearchForm::DeleteItem(int index, ListItemBase* pItem, int itemWidth)
 void
 SearchForm::OnKeypadActionPerformed(Tizen::Ui::Control& source, Tizen::Ui::KeypadAction keypadAction)
 {
-       AppLogDebug("Enter:SearchForm::OnKeypadActionPerformed");
+       AppLogDebug("Enter:SearchForm::OnKeypadActionPerformed:%S", __searchText.GetPointer());
        int modalResult = 0;
        String emptySearchString;
 
@@ -966,8 +983,6 @@ SearchForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId)
                __searchBarMode = SEARCH_BAR_MODE_NORMAL;
                __pSearchBar->SetMode(__searchBarMode);
                __pSearchBar->HideKeypad();
-
-               __pSearchPopup->SetShowState(false);
                __pSearchBar->SetEnabled(true);
                __pSearchBar->SetText(__searchText);
 
@@ -1000,11 +1015,13 @@ void
 SearchForm::OnTextValueChangeCanceled(const Tizen::Ui::Control& source)
 {
        AppLogDebug("ENTER::SearchForm::OnTextValueChangeCanceled");
-       if (__pSearchPopup->GetShowState() == true)
+       if (__pSearchPopup != null && __pSearchPopup->GetShowState() == true)
        {
                __pSearchPopup->SetShowState(false);
-               __pSearchBar->SetEnabled(true);
+               delete __pSearchPopup;
+               __pSearchPopup = null;
        }
+       __pSearchBar->SetEnabled(true);
 }
 
 void
@@ -1052,6 +1069,8 @@ SearchForm::OnSearchBarModeChanged(Tizen::Ui::Controls::SearchBar& source, Tizen
                                if (__pSearchPopup != null)
                                {
                                        __pSearchPopup->SetShowState(false);
+                                       delete __pSearchPopup;
+                                       __pSearchPopup = null;
                                }
                        }
                }
@@ -1072,7 +1091,7 @@ SearchForm::OnAppControlCompleteResponseReceived(const Tizen::App::AppId& appId,
 void
 SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
 {
-       AppLogDebug("ENTER::SearchForm::GetCurrentFileControl");
+       AppLogDebug("ENTER::SearchForm::OnNotificationReceived");
        result r = E_FAILURE;
        Integer* pEventType = null;
        DirectoryEntry* pResultDirEntry = null;
@@ -1081,17 +1100,18 @@ SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
        bool cacheKeyStatus = false;
        String cachePath;
 
-       TryCatch(pArgs != null, , "SearchForm::GetCurrentFileControl::pArg is null");
+       TryCatch(pArgs != null, , "SearchForm::OnNotificationReceived::pArg is null");
 
        pEventType = static_cast< Integer* >(pArgs->GetAt(0));
-       TryCatch(pEventType != null, , "SearchForm::GetCurrentFileControl::pArg is null");
+       TryCatch(pEventType != null, , "SearchForm::OnNotificationReceived::pArg is null");
 
        switch (pEventType->ToInt())
        {
        case ID_FOLDER_SEARCH_STARTED:
        {
+               AppLogDebug("ENTER::SearchForm::OnNotificationReceived:ID_FOLDER_SEARCH_STARTED");
                String* pFolderSearchResult = (String*) pArgs->GetAt(1);
-               TryCatch(pFolderSearchResult != null, , "SearchForm::GetCurrentFileControl::folderSearchResult is null");
+               TryCatch(pFolderSearchResult != null, , "SearchForm::OnNotificationReceived::folderSearchResult is null");
 
                String defMediaPath(L"/opt/usr/media");
                String defSdCardPath(L"/opt/storage/sdcard");
@@ -1119,9 +1139,17 @@ SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
 
        case ID_SEARCH_COMPLETED:
        {
+               AppLogDebug("ENTER::SearchForm::OnNotificationReceived:ID_SEARCH_COMPLETED");
+
                __isSearchCompleted = true;
 
-               __pSearchPopup->SetShowState(false);
+               if (__pSearchPopup != null)
+               {
+                       __pSearchPopup->SetShowState(false);
+                       delete __pSearchPopup;
+                       __pSearchPopup = null;
+               }
+
                __pSearchBar->SetEnabled(true);
 
                if (__pSearchBar->GetMode() == SEARCH_BAR_MODE_INPUT)
@@ -1144,6 +1172,8 @@ SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
 
        case ID_SEARCH_RESULT_FOUND:
        {
+               AppLogDebug("ENTER::SearchForm::OnNotificationReceived:ID_SEARCH_RESULT_FOUND");
+
                __isSearchCompleted = false;
                __searchItemIndex++;
                __itemCount++;
@@ -1167,6 +1197,8 @@ SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
 
        case FILE_MANAGING_RESULT_DELETING_SUCCESS:
        {
+               AppLogDebug("ENTER::SearchForm::OnNotificationReceived:FILE_MANAGING_RESULT_DELETING_SUCCESS");
+
                HideFileProgressingPopup();
                pCacheList = CacheManager::GetInstance()->GetCacheHashMap();
 
@@ -1187,7 +1219,8 @@ SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
                                        CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
                                }
                        }
-                       __pSearchedContentList->RemoveAt(__selectedItemIndexForDelete, true);
+                       if (pCurrentEntry->IsDirectory() == false)
+                               __pSearchedContentList->RemoveAt(__selectedItemIndexForDelete, true);
                }
                else
                {
@@ -1206,11 +1239,19 @@ SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
                                        CacheManager::GetInstance()->RemoveCacheEntry(cachePath);
                                }
                        }
-                       __pContentListFromLastView->RemoveAt(__selectedItemIndexForDelete, false);
+                       if (pCurrentEntry->IsDirectory() == false)
+                               __pContentListFromLastView->RemoveAt(__selectedItemIndexForDelete, false);
+               }
+               if (pCurrentEntry->IsDirectory() == true)
+               {
+                       SceneManager::GetInstance()->GoBackward(BackwardSceneTransition());
                }
-               if (__pListView != null)
+               else
                {
-                       __pListView->UpdateList();
+                       if (__pListView != null)
+                       {
+                               __pListView->UpdateList();
+                       }
                }
        }
        break;
@@ -1223,12 +1264,12 @@ SearchForm::OnNotificationReceived(Tizen::Base::Collection::ArrayList* pArgs)
        delete pArgs;
        pArgs = null;
 
-       AppLogDebug("EXIT::SearchForm::GetCurrentFileControl");
+       AppLogDebug("EXIT::SearchForm::OnNotificationReceived");
        return;
 
 CATCH:
 
-       AppLogDebug("EXIT::SearchForm::GetCurrentFileControl");
+       AppLogDebug("EXIT::SearchForm::OnNotificationReceived");
        return;
 }
 
@@ -1728,6 +1769,7 @@ SearchForm::StartSearch(void)
        String searchtext;
        String folderToSearch;
        String topLevelPath;
+       result r = E_FAILURE;
 
        //Hide keypad of Search bar
        __pSearchBar->HideKeypad();
@@ -1735,6 +1777,11 @@ SearchForm::StartSearch(void)
        __pSearchBar->SetEnabled(false);
        __pSearchBar->SetMode(__searchBarMode);
 
+       if (__pSearchPopup == null)
+       {
+               r = CreateSearchPopup();
+               TryReturn(r == E_SUCCESS, , "Failed to create Search Popup");
+       }
        //Show Popup if Application is in FOREGROUND
        if ( Application::GetInstance()->GetAppUiState() == APP_UI_STATE_FOREGROUND)
        {
@@ -1988,7 +2035,13 @@ SearchForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEventInfo)
                        __pSearchBar->SetMode(__searchBarMode);
                        __pSearchBar->HideKeypad();
 
-                       __pSearchPopup->SetShowState(false);
+                       if (__pSearchPopup != null)
+                       {
+                               __pSearchPopup->SetShowState(false);
+                               delete __pSearchPopup;
+                               __pSearchPopup = null;
+                       }
+
                        __pSearchBar->SetEnabled(true);
                        __pSearchBar->SetText(__searchText);
                }
index b42f6b0..e7043ce 100644 (file)
@@ -268,12 +268,12 @@ SearchPresentationModel::Search(void)
                        {
                                String deviceSateSdCard;
                                String defaultSDCardPath;
+                               String*         pSdCardPath = null;
                                DeviceManager::GetState(StorageCard, deviceSateSdCard);
 
                                if (deviceSateSdCard == sdCardStatusMounted &&
                                        pCurrentDirectoryPath->CompareTo(BasePresentationModel::GetMediaPath()) ==0)
                                {
-                                       String*         pSdCardPath = null;
                                        String defSdCardPath(BasePresentationModel::GetSdCardPath());
                                        pSdCardPath = new (std::nothrow) String(defSdCardPath);
                                        __isSDCardSearchedAlready = true;
@@ -282,7 +282,7 @@ SearchPresentationModel::Search(void)
                                        TryCatch(r == E_SUCCESS, ,"push failed");
                                }
                                delete pCurrentDirectoryPath;
-                               pCurrentDirectoryPath = null;
+                               pCurrentDirectoryPath = pSdCardPath;
                        }
                        else
                        {
index 3a4574e..19acf27 100644 (file)
@@ -1949,5 +1949,5 @@ SubBaseFileManageForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEve
                        }
                }
        }
-       return true;
+       return false;
 }
index 7f5c7c4..d43f870 100644 (file)
@@ -2507,5 +2507,5 @@ SubBaseFolderEntryForm::OnKeyReleased(Control& source, const KeyEventInfo& keyEv
                        _pFileManager->ForceStopWorkerThread();
                }
        }
-       return true;
+       return false;
 }
index 6bcba33..2bd844c 100644 (file)
@@ -1723,6 +1723,6 @@ SubFolderMoveCopy::OnKeyReleased(Control& source, const KeyEventInfo& keyEventIn
 
        }
 
-       return true;
+       return false;
 }
 
index a6cec5f..1ff53ed 100644 (file)
@@ -333,8 +333,8 @@ const Tizen::Base::String typeImage[ID_IMAGE_TYPE_SIZE] =
 
 const Tizen::Base::String typeAudio[ID_AUDIO_TYPE_SIZE] =
 {
-       "mp3", "aac", "amr", "mid", "midi", "wav", "m4a",
-       "MP3", "AAC", "AMR", "MID", "MIDI", "WAV", "M4A"
+       "mp3", "aac", "amr", "mid", "midi", "wav", "m4a", "wma",
+       "MP3", "AAC", "AMR", "MID", "MIDI", "WAV", "M4A", "WMA"
 };
 
 const Tizen::Base::String typeVideo[ID_VIDEO_TYPE_SIZE] =