Arrange code
[apps/osp/Gallery.git] / src / GlFileListEditorForm.cpp
index 0d87e07..94052ac 100644 (file)
@@ -79,12 +79,22 @@ FileListEditorForm::~FileListEditorForm(void)
        AppLogDebug("ENTER");
        if (__pContentDirectoryList != null)
        {
+               __pContentDirectoryList->RemoveAll(true);
                delete __pContentDirectoryList;
+               __pContentDirectoryList = null;
+       }
+
+       if (__pPopUp != null)
+       {
+               delete __pPopUp;
+               __pPopUp = null;
        }
 
        if (__pContentDirectoryNameList != null)
        {
+               __pContentDirectoryNameList->RemoveAll(true);
                delete __pContentDirectoryNameList;
+               __pContentDirectoryNameList = null;
        }
        delete __pFileMove;
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
@@ -270,6 +280,7 @@ FileListEditorForm::InitializeFooter(void)
 
                if (__pContentDirectoryNameList != null)
                {
+                       __pContentDirectoryNameList->RemoveAll(true);
                        delete __pContentDirectoryNameList;
                        __pContentDirectoryNameList = null;
                }
@@ -351,14 +362,15 @@ FileListEditorForm::OnActionPerformed(const Control& source, int actionId)
 
        case IDA_FOOTER_SHARE:
        {
-               if ( __pShareContextMenu != NULL)
+               if (__pShareContextMenu != NULL)
                {
                        delete __pShareContextMenu;
                        __pShareContextMenu = null;
                }
 
                __pShareContextMenu = new (std::nothrow) ContextMenu();
-               __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height), CONTEXT_MENU_STYLE_LIST , CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
+               __pShareContextMenu->Construct(Point(GetClientAreaBounds().width/3 + 15, GetClientAreaBounds().height),
+                               CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD);
                __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_MESSAGE"),
                                IDA_CONTEXT_MENU_SHARE_MESSAGE);
                __pShareContextMenu->AddItem(ResourceManager::GetString(L"IDS_COM_BODY_EMAIL"),
@@ -927,9 +939,19 @@ FileListEditorForm::RefreshFolderList(void)
 
        if (__pContentDirectoryList != null)
        {
+               __pContentDirectoryList->RemoveAll(true);
                delete __pContentDirectoryList;
+               __pContentDirectoryList = null;
        }
        __pContentDirectoryList = contentDirectory.GetContentDirectoryPathListN(SORT_ORDER_NONE);
+
+       if (__pContentDirectoryNameList != NULL)
+       {
+               __pContentDirectoryNameList->RemoveAll(true);
+               delete __pContentDirectoryNameList;
+               __pContentDirectoryNameList = null;
+       }
+
        __pContentDirectoryNameList = new (std::nothrow) ArrayList(SingleObjectDeleter);
        String* pDirPath = null;
        String* pDirName = null;
@@ -943,7 +965,7 @@ FileListEditorForm::RefreshFolderList(void)
                pDirPath = static_cast<String*>(__pContentDirectoryList->GetAt(i));
                pDirName = new (std::nothrow) String(GetDirecotyNameFromFullPath(*pDirPath));
 
-               if ( *pDirPath == mediaPath)
+               if (*pDirPath == mediaPath)
                {
                        *pDirName = ResourceManager::GetString(L"IDS_MEDIABR_POP_NO_NAME");
                        __pContentDirectoryNameList->Add(pDirName);
@@ -964,7 +986,7 @@ FileListEditorForm::RefreshFolderList(void)
                {
                        pDirName = static_cast<String*>(__pContentDirectoryNameList->GetAt(i));
 
-                       if ( *pDirName != __pPresentationModel->GetCurrentAlbumName())
+                       if (*pDirName != __pPresentationModel->GetCurrentAlbumName())
                        {
                                __pOptionMenu->AddItem(*(new (std::nothrow) String(*pDirName)),
                                                IDA_CONTEXTMENU_EDITOR_MOVE_ALBUM_ARRAY_START + i);
@@ -1010,7 +1032,7 @@ FileListEditorForm::OnFormBackRequested(Form& source)
                }
                else if (pSceneManager->GetCurrentSceneId() == IDSCN_ALL_LIST_SELECTION)
                {
-                       if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
+                       if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true)
                        {
                                __pShareContextMenu->SetShowState(false);
                        }
@@ -1028,8 +1050,6 @@ FileListEditorForm::OnFormBackRequested(Form& source)
 
                                        pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALL_LIST_EDITOR, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
                                                        SCENE_HISTORY_OPTION_ADD_HISTORY, SCENE_DESTROY_OPTION_DESTROY), pList);
-
-
                                }
                        }
                }
@@ -1081,6 +1101,7 @@ FileListEditorForm::SetFooterButtonsState(const bool enableState)
 void
 FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
 {
+       AppLogDebug("ENTER");
        SceneManager* pSceneManager = SceneManager::GetInstance();
        pSceneManager->GetCurrentScene();
 
@@ -1116,6 +1137,7 @@ FileListEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen
                        pEditorPanel->ChangeOrientation();
                }
        }
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 }
 
 bool
@@ -1129,7 +1151,9 @@ FileListEditorForm::OnKeyReleased(Control& source, const Tizen::Ui::KeyEventInfo
                __pDeletePopup->SetShowState(false);
                __pDeletePopup->Invalidate(true);
        }
-       return true;
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+
+       return false;
 }
 
 result
@@ -1275,16 +1299,16 @@ FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
                }
        }
 
-       if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true )
+       if (__pShareContextMenu != null && __pShareContextMenu->GetShowState() == true)
        {
                __pShareContextMenu->SetShowState(false);
        }
 
-       if ( checkedCount > 0)
+       if (checkedCount > 0)
        {
-               if ( __pOptionMenu == null )
+               if (__pOptionMenu == null)
                {
-                       return ;
+                       return;
                }
 
                __pOptionMenu->RemoveAllItems();
@@ -1304,6 +1328,5 @@ FileListEditorForm::OnFormMenuRequested (Tizen::Ui::Controls::Form &source)
 
                __pOptionMenu->SetShowState(true);
                __pOptionMenu->Show();
-
        }
 }