#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));
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);
__pLabelSelectCnt->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
__pLabelSelectCnt->SetBackgroundColor(COLOR_COUNT_LABEL);
__pLabelSelectCnt->SetTextColor(Color(COLOR_SELECT_COUNT_FONT));
+ __pLabelSelectCnt->SetTextConfig(COUNT_LABEL_FONT_SIZE, LABEL_TEXT_STYLE_BOLD);
AddControl(*__pLabelSelectCnt);
}
else
}
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,
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;
}
}
result r = map->Construct();
if (r == E_SUCCESS)
{
- map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
- new (std::nothrow) String(__pPresentationModel->GetContentFilePath(index)));
- 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)));
+ map->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, map);
+ pApp->Terminate();
+ }
+ else
+ {
+ delete map;
+ }
}
else
{
+ delete pArrayList;
delete map;
}
}
}
}
}
+ SetButtonState();
+
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
const SceneId& currentSceneId, IList* pArgs)
{
AppLogDebug("ENTER");
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ __pFileListEditorForm = dynamic_cast<FileListEditorForm*>(pSceneManager->GetCurrentScene()->GetForm());
+
__pPresentationModel = FileListPresentationModel::GetInstance();
if (__pPresentationModel->GetAppControlMode() == APP_CONTROL_MODE_PICK)
}
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;
- }
-
- String combineText;
- String path;
- int loopCount = pIndexList->GetCount();
- for (int i = 0; i < loopCount; ++i)
- {
- path = __pPresentationModel->GetContentFilePath(i);
-
- if (path.EndsWith(CONTENT_EXT_PNG)
- || path.EndsWith(CONTENT_EXT_BMP)
- || path.EndsWith(CONTENT_EXT_JPG)
- || path.EndsWith(CONTENT_EXT_GIF)
- || path.EndsWith(CONTENT_EXT_TIF)
- || path.EndsWith(CONTENT_EXT_MP4)
- || path.EndsWith(CONTENT_EXT_3GP)
- || path.EndsWith(CONTENT_EXT_AVI)
- || path.EndsWith(CONTENT_EXT_RM)
- || path.EndsWith(CONTENT_EXT_WMV)
- || path.EndsWith(CONTENT_EXT_ASF)
- )
- {
- if (combineText.CompareTo(EMPTY_SPACE) != 0)
- {
- combineText.Append(L";");
- }
- combineText.Append(path);
- }
- }
-
- HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
- pDataList->Construct();
- pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_TYPE), new (std::nothrow) String(APPCONTROL_DATA_MMS));
- pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS), new (std::nothrow) String(combineText));
-
- __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_MESSAGE, APPCONTROL_OPERATION_ID_COMPOSE,
- 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;
- }
-
- String combineText;
- String path;
- int loopCount = pIndexList->GetCount();
- for (int i = 0; i < loopCount; ++i)
- {
- path = __pPresentationModel->GetContentFilePath(i);
-
- if (path.EndsWith(CONTENT_EXT_PNG)
- || path.EndsWith(CONTENT_EXT_BMP)
- || path.EndsWith(CONTENT_EXT_JPG)
- || path.EndsWith(CONTENT_EXT_GIF)
- || path.EndsWith(CONTENT_EXT_TIF)
- || path.EndsWith(CONTENT_EXT_MP4)
- || path.EndsWith(CONTENT_EXT_3GP)
- || path.EndsWith(CONTENT_EXT_AVI)
- || path.EndsWith(CONTENT_EXT_RM)
- || path.EndsWith(CONTENT_EXT_WMV)
- || path.EndsWith(CONTENT_EXT_ASF)
- )
- {
- if (combineText.CompareTo(EMPTY_SPACE) != 0)
- {
- combineText.Append(L";");
- }
- combineText.Append(path);
- }
- }
-
- HashMap* pDataList = new (std::nothrow) HashMap(SingleObjectDeleter);
- pDataList->Construct();
- pDataList->Add(new (std::nothrow) String(APPCONTROL_KEY_ATTACHMENTS),
- new (std::nothrow) String(combineText));
-
- __pPresentationModel->StartAppControl(APPCONTROL_PROVIDER_ID_EMAIL, APPCONTROL_OPERATION_ID_COMPOSE,
- 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;
}
- String combineText;
-
+ ArrayList* pArrayList = new (std::nothrow) ArrayList(SingleObjectDeleter);
+ pArrayList->Construct();
int loopCount = pIndexList->GetCount();
+ Integer* temp = null;
for (int i = 0; i < loopCount; ++i)
{
- combineText.Append(__pPresentationModel->GetContentFilePath(i));
- combineText.Append(L";");
+ temp = static_cast<Integer*>(pIndexList->GetAt(i));
+ pArrayList->Add(new (std::nothrow) String(__pPresentationModel->GetContentFilePath(temp->ToInt())));
}
HashMap* map = new (std::nothrow) HashMap(SingleObjectDeleter);
map->Construct();
- map->Add(new (std::nothrow) String(APPCONTROL_KEY_PATH),
- new (std::nothrow) String(combineText));
- map->Add(new (std::nothrow) String(APPCONTROL_KEY_DATA_SELECTED),
- new (std::nothrow) String(combineText));
+ map->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->Terminate();
}
+
+ delete pIndexList;
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
__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()));
+}