//
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
#include "GlImageListEditorPanel.h"
#include "GlResourceManager.h"
#include "GlTypes.h"
-#include "GlFileDeleteTimer.h"
+#include "GlFileUpdateTimer.h"
#include "GlFileListEditorForm.h"
using namespace Tizen::App;
using namespace Tizen::Ui::Scenes;
static const int H_SELECTALL_REGION = 112;
-static const unsigned int COLOR_SELECTALL_REGION = Color32<0x2A, 0x36, 0x4A>::Value;
+static const int COUNT_LABEL_FONT_SIZE = 33;
static const unsigned int COLOR_COUNT_LABEL = Color32<68, 68, 68>::Value;
static const unsigned int COLOR_SELECT_COUNT_FONT = Color32<255, 255, 255>::Value;
static const Color COLOR_THUMBNAIL_DIM (Color::GetColor(COLOR_ID_BLACK));
static const Rectangle RECT_INITIAL (0, 0, 10, 10);
ImageListEditorPanel::ImageListEditorPanel(void)
- : __pContentIconListView(null)
+ : __itemCount(0)
+ , __pContentIconListView(null)
, __pCheckButton(null)
, __pLabelSelectCnt(null)
- , __itemCount(0)
, __pPresentationModel(null)
- , __pFileDelete(null)
+ , __pFileListEditorForm(null)
{
AppLogDebug("ENTER");
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
ImageListEditorPanel::~ImageListEditorPanel(void)
{
AppLogDebug("ENTER");
- delete __pFileDelete;
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
- if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
+ if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
{
__pContentIconListView = new (std::nothrow) IconListView();
if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
{
- __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height),
+ __pContentIconListView->Construct(Rectangle(0, 0, clientAreaBounds.width, clientAreaBounds.height - H_COUNT_LABEL),
DIMENSION_DEFAULT_THUMBNAIL, ICON_LIST_VIEW_STYLE_MARK,
ICON_LIST_VIEW_SCROLL_DIRECTION_VERTICAL);
Bitmap* pBitmapEmpty = ResourceManager::GetBitmapN(IDB_LISTVIEW_EMPTY);
__pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
__pContentIconListView->AddIconListViewItemEventListener(*this);
__pContentIconListView->SetTouchAnimationEnabled(false);
- AddControl(*__pContentIconListView);
+ AddControl(__pContentIconListView);
__pContentIconListView->SetShowState(true);
__pLabelSelectCnt = new (std::nothrow) Label();
- __pLabelSelectCnt->Construct(Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL,
+ __pLabelSelectCnt->Construct(Rectangle(0, clientAreaBounds.height - H_COUNT_LABEL,
clientAreaBounds.width, H_COUNT_LABEL), ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
__pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
__pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
__pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
__pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
- AddControl(*__pLabelSelectCnt);
+ __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
+ AddControl(__pLabelSelectCnt);
}
else
{
__pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
__pContentIconListView->AddIconListViewItemEventListener(*this);
__pContentIconListView->SetTouchAnimationEnabled(false);
- AddControl(*__pContentIconListView);
+ AddControl(__pContentIconListView);
__pContentIconListView->SetShowState(true);
}
}
else
{
- Panel* pCheckPanel = new (std::nothrow) Panel();
- pCheckPanel->Construct(Rectangle(0, 0, clientAreaBounds.width, H_SELECTALL_REGION));
- pCheckPanel->SetBackgroundColor(COLOR_SELECTALL_REGION);
- __pCheckButton = new (std::nothrow) CheckButton();
- __pCheckButton->Construct(pCheckPanel->GetBounds(), CHECK_BUTTON_STYLE_MARK, BACKGROUND_STYLE_DEFAULT,
- false, ResourceManager::GetString(L"IDS_COM_BODY_SELECT_ALL"));
- __pCheckButton->SetActionId(ACTION_ID_SELECTALL_CHECKED, ACTION_ID_SELECTALL_UNCHECKED);
- __pCheckButton->AddActionEventListener(*this);
- pCheckPanel->AddControl(*__pCheckButton);
- AddControl(*pCheckPanel);
-
__pContentIconListView = new (std::nothrow) IconListView();
__pContentIconListView->Construct(Rectangle(0, H_SELECTALL_REGION, clientAreaBounds.width,
clientAreaBounds.height - H_SELECTALL_REGION), DIMENSION_DEFAULT_THUMBNAIL,
__pContentIconListView->SetCheckBoxPosition(ICON_LIST_VIEW_CHECK_BOX_POSITION_TOP_RIGHT);
__pContentIconListView->AddIconListViewItemEventListener(*this);
__pContentIconListView->SetTouchAnimationEnabled(false);
- AddControl(*__pContentIconListView);
+ AddControl(__pContentIconListView);
__pContentIconListView->SetShowState(true);
__pLabelSelectCnt = new (std::nothrow) Label();
__pLabelSelectCnt->Construct(
- Rectangle(0, clientAreaBounds.height-H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
+ Rectangle(0, clientAreaBounds.height - H_COUNT_LABEL, clientAreaBounds.width, H_COUNT_LABEL),
ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED"));
__pLabelSelectCnt->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
__pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
__pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
__pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
- AddControl(*__pLabelSelectCnt);
+ AddControl(__pLabelSelectCnt);
}
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return E_SUCCESS;
}
-void
-ImageListEditorPanel::UpdatePanelContent()
-{
- AppLogDebug("ENTER");
- SceneManager* pSceneManager = SceneManager::GetInstance();
- pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-}
-
-void
-ImageListEditorPanel::OnActionPerformed(const Control& source, int actionId)
-{
- AppLogDebug("ENTER");
- SceneManager* pSceneManager = SceneManager::GetInstance();
- AppAssert(pSceneManager);
-
- switch (actionId)
- {
- case ACTION_ID_SELECTALL_CHECKED:
- {
- int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
- for (int i = 0; i < loopCount; ++i)
- {
- if (__pContentIconListView->IsItemChecked(i) == false)
- {
- __pContentIconListView->SetItemChecked(i,true);
- __pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
- }
- }
-
- int checkedCount = GetItemCheckedCount();
- String strTmp;
- if (checkedCount == 0)
- {
- strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
- }
- else if (checkedCount == 1)
- {
- strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
- }
- else
- {
- strTmp.Format(LENGTH_COUNT_LABEL,
- ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
- }
-
- __pLabelSelectCnt->SetText(strTmp);
- __pLabelSelectCnt->RequestRedraw(true);
- break;
- }
- case ACTION_ID_SELECTALL_UNCHECKED:
- {
- int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
- for (int i = 0; i < loopCount; ++i)
- {
- if (__pContentIconListView->IsItemChecked(i) == true)
- {
- __pContentIconListView->SetItemChecked(i,false);
- }
- }
- int checkedCount = GetItemCheckedCount();
- String strTmp;
- if (checkedCount == 0)
- {
- strTmp = ResourceManager::GetString(L"IDS_ST_POP_NO_ITEMS_SELECTED");
- }
- else if (checkedCount == 1)
- {
- strTmp = ResourceManager::GetString(L"IDS_VR_POP_1_ITEM_SELECTED");
- }
- else
- {
- strTmp.Format(LENGTH_COUNT_LABEL,
- ResourceManager::GetString(L"IDS_VR_POP_PD_ITEMS_SELECTED").GetPointer(), checkedCount);
- }
-
- __pLabelSelectCnt->SetText(strTmp);
- __pLabelSelectCnt->RequestRedraw(true);
- __pContentIconListView->UpdateList();
- break;
- }
- default:
- {
- break;
- }
- }
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-}
-
int
ImageListEditorPanel::GetItemCount(void)
{
else
{
AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
-
+ delete pIconListviewItem;
+ delete pItemText;
return null;
}
}
if (status == ICON_LIST_VIEW_ITEM_CHECKED || status == ICON_LIST_VIEW_ITEM_UNCHECKED)
{
- if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
+ if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
{
if (__pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_MULTIPLE)
{
}
}
- if ( __pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK
+ if ( __pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK
&& __pPresentationModel->GetAppControlSelectionMode() == APPCONTROL_SELECTION_MODE_SINGLE)
{
if (status == ICON_LIST_VIEW_ITEM_SELECTED)
{
- HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
- result r = map->Construct();
+ HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter);
+ result r = pMap->Construct();
if (r == E_SUCCESS)
{
- map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
- new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
+ ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+ r = pArrayList->Construct();
- GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
- if (pApp != null)
+ if (r == E_SUCCESS)
{
- pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
- pApp->Terminate();
+ pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
+ pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList);
+
+ GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
+ if (pApp != null)
+ {
+ pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap);
+ pApp->Terminate();
+ }
+ else
+ {
+ delete pMap;
+ }
}
else
{
- delete map;
+ delete pArrayList;
+ delete pMap;
}
}
else
{
- delete map;
+ delete pMap;
}
}
}
+ SetButtonState();
+
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
const SceneId& currentSceneId, IList* pArgs)
{
AppLogDebug("ENTER");
+
+ ChangeOrientation();
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ __pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
+
__pPresentationModel = FileListPresentationModel::GetInstance();
- if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
+ if (__pPresentationModel->GetAppControlMode() == APPCONTROL_MODE_PICK)
{
if (currentSceneId == IDSCN_IMAGE_LIST_EDITOR)
{
}
IList*
-ImageListEditorPanel::GetItemCheckedIndexList(void) const
+ImageListEditorPanel::GetItemCheckedIndexListN(void) const
{
AppLogDebug("ENTER");
IList* pList = new (std::nothrow) ArrayList(SingleObjectDeleter);
if (__pContentIconListView != null)
{
int loopCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
+ AppLogDebug("ENTER loopCount(%d)", loopCount);
for (int i = 0; i < loopCount; ++i)
{
if (__pContentIconListView->IsItemChecked(i))
{
pIndex = new (std::nothrow) Integer(i);
+ AppLogDebug("ENTER loopCount(%d)", loopCount);
+ AppLogDebug("ENTER loopCount(%d)", pIndex->ToInt());
pList->Add(pIndex);
}
}
return pList;
}
-void
-ImageListEditorPanel::OnRequestDelete(void)
-{
- AppLogDebug("ENTER");
- IList* pIndexList = GetItemCheckedIndexList();
-
- if (pIndexList == null || pIndexList->GetCount() <= 0 || __pPresentationModel == null)
- {
- delete pIndexList;
- AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
-
- return;
- }
- //TODO To test this properly, seems like OnRequestDelete is unused
- delete __pFileDelete;
- __pFileDelete = new FileDeleteTimer(pIndexList, __pPresentationModel, this);
- result r = __pFileDelete->StartTimer();
-
- if (IsFailed(r))
- {
- delete __pFileDelete;
- __pFileDelete = null;
- return ;
- }
-
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-}
-
void ImageListEditorPanel::OnFileOpInvalidate(enum FileActionMode actionId)
{
SceneManager* pSceneManager = SceneManager::GetInstance();
void ImageListEditorPanel::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
{
- if (actionId == FILE_DELETE_ACTION)
- {
- //Do nothing
- }
- else if (actionId == FILE_MOVE_ACTION)
- {
- }
-}
-
-void
-ImageListEditorPanel::OnRequestMessage(void)
-{
- AppLogDebug("ENTER");
- IList* pIndexList = GetItemCheckedIndexList();
- if (pIndexList->GetCount() <= 0)
- {
- AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
- return;
- }
-
- ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
- pArrayList->Construct();
- int loopCount = pIndexList->GetCount();
-
- for (int i = 0; i < loopCount; ++i)
- {
- pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i)));
- }
-
- HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
- pDataList->Construct();
- pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
-
- __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
- new (std::nothrow) String(APPCONTROL_URI_MMS_TO), null, pDataList, null);
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-}
-
-void
-ImageListEditorPanel::OnRequestEmail(void)
-{
- AppLogDebug("ENTER");
- IList* pIndexList = GetItemCheckedIndexList();
- if (pIndexList->GetCount() <= 0)
- {
- AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
-
- return;
- }
-
- ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
- pArrayList->Construct();
- int loopCount = pIndexList->GetCount();
-
- for (int i = 0; i < loopCount; ++i)
- {
- pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i)));
- }
-
- HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
- pDataList->Construct();
- pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH), (Object*)pArrayList);
-
- __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
- new (std::nothrow) String(APPCONTROL_URI_MAIL_TO), null, pDataList, null);
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-}
-
-void
-ImageListEditorPanel::OnRequestMoveTo(String& destDirectory)
-{
- AppLogDebug("ENTER");
- if (&destDirectory == null || destDirectory.IsEmpty())
- {
- AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
- return;
- }
-
- IList* pIndexList = GetItemCheckedIndexList();
- if (pIndexList == null || pIndexList->GetCount() <= 0)
- {
- AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
- return;
- }
-
- result r = __pPresentationModel->MoveToContentFileList(*pIndexList, destDirectory);
- delete pIndexList;
- TryReturn(r == E_SUCCESS, , "Failed on OnRequestDeleteAction");
-
- __pPresentationModel->RefreshCurrentAlbumContentInfoList(CONTENT_TYPE_ALL);
- __itemCount = __pPresentationModel->GetCurrentAlbumContentInfoCount();
- __pContentIconListView->UpdateList();
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
ImageListEditorPanel::OnRequestAppExitWithMultipleSelectionAppControlResult(void)
{
AppLogDebug("ENTER");
- IList* pIndexList = GetItemCheckedIndexList();
+ IList* pIndexList = GetItemCheckedIndexListN();
if (pIndexList->GetCount() <= 0)
{
+ delete pIndexList;
AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
return;
}
ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
pArrayList->Construct();
int loopCount = pIndexList->GetCount();
-
+ Integer* pTemp = null;
for (int i = 0; i < loopCount; ++i)
{
- pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(i)));
+ pTemp = static_cast<Integer*>(pIndexList->GetAt(i));
+ pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(pTemp->ToInt())));
}
- HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
- map->Construct();
- map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), (Object*)pArrayList);
+ HashMap* pMap = new (std::nothrow) HashMap(SingleObjectDeleter);
+ pMap->Construct();
+ pMap->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED), pArrayList);
GalleryApp* pApp = dynamic_cast<GalleryApp*>(UiApp::GetInstance());
if (pApp != null)
{
- pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, map);
+ pApp->SendAppControlResult(APP_CTRL_RESULT_SUCCEEDED, pMap);
pApp->Terminate();
}
+
+ delete pIndexList;
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
-ImageListEditorPanel::SelectAllPressed(void)
+ImageListEditorPanel::OnSelectAllPressed(void)
{
bool needToSelectAll = true;
int checkedCount = GetItemCheckedCount();
if (needToSelectAll == true)
{
- for (int i = 0 ; i < totalFileCount; ++i)
+ for (int i = 0; i < totalFileCount; ++i)
{
if (__pContentIconListView->IsItemChecked(i) == false)
{
- __pContentIconListView->SetItemChecked(i,true);
+ __pContentIconListView->SetItemChecked(i, true);
__pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
}
+ __pFileListEditorForm->SetFooterButtonsState(true);
}
}
else
{
- for (int i = 0 ; i < totalFileCount; ++i)
+ for (int i = 0; i < totalFileCount; ++i)
{
if (__pContentIconListView->IsItemChecked(i) == true)
{
__pContentIconListView->SetItemChecked(i, false);
__pContentIconListView->RefreshList(i, LIST_REFRESH_TYPE_ITEM_MODIFY);
}
+ __pFileListEditorForm->SetFooterButtonsState(false);
}
}
__pLabelSelectCnt->SetText(tempString);
__pLabelSelectCnt->RequestRedraw(true);
}
+
+void
+ImageListEditorPanel::SetButtonState(void)
+{
+ AppLogDebug("ENTER");
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ TryReturnVoid(pSceneManager != null, "[%s] fail to get SceneManager.", GetErrorMessage(GetLastResult()));
+
+ if (GetItemCheckedCount() > 0)
+ {
+ AppLogDebug("BUTTONSTATE : Request Enable");
+ __pFileListEditorForm->SetFooterButtonsState(true);
+ }
+ else
+ {
+ AppLogDebug("BUTTONSTATE : Request disable");
+ __pFileListEditorForm->SetFooterButtonsState(false);
+ }
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
+void
+ImageListEditorPanel::ChangeOrientation(void)
+{
+ AppLogDebug("ENTER");
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ const Form* pForm = dynamic_cast<Form*>(pSceneManager->GetCurrentScene()->GetForm());
+ TryReturn(pForm != null, , "[%s] fail to get the form.", GetErrorMessage(GetLastResult()));
+
+ Rectangle clientAreaBounds = pForm->GetClientAreaBounds();
+ SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
+ __pContentIconListView->SetBounds(0, 0, clientAreaBounds.width, clientAreaBounds.height);
+}