//
// 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
//
* @brief This is the implementation file for AlbumNameEditorForm class.
*/
-#include <FApp.h>
+#include <FMedia.h>
+#include <FText.h>
+
#include "GlAlbumInfo.h"
-#include "GlAlbumNameEditorForm.h"
#include "GlAlbumListPresentationModel.h"
+#include "GlAlbumNameEditorForm.h"
#include "GlFileListPresentationModel.h"
+#include "GlFileMoveTimer.h"
+#include "GlProgressAnimation.h"
#include "GlResourceManager.h"
#include "GlTypes.h"
-#include "GlFileMoveTimer.h"
using namespace Tizen::App;
using namespace Tizen::Base;
using namespace Tizen::Base::Utility;
using namespace Tizen::Content;
using namespace Tizen::Graphics;
-using namespace Tizen::Media;
using namespace Tizen::Io;
+using namespace Tizen::Media;
using namespace Tizen::System;
+using namespace Tizen::Text;
using namespace Tizen::Ui;
using namespace Tizen::Ui::Controls;
using namespace Tizen::Ui::Scenes;
+
static const Rectangle RECT_NAME_EDIT_FIELD (0, 0, 720, 100);
static const unsigned int COLOR_NAME_EDIT_FIELD = Color32<255, 255, 255>::Value;
static const int ALBUM_MAX_LENGTH = 255;
-AlbumNameEditorForm::AlbumNameEditorForm()
-: __pNameEditField(null)
-, __folderIndex(0)
-, __albumNameEditorMode(ALBUM_NAME_EDITOR_MODE_RENAME)
-, __pMessageBox(null)
-, __pPresentationModel(null)
-, __pFilePresentationModel(null)
-, __pMoveIndexList(null)
-,__pFileMove(null)
+AlbumNameEditorForm::AlbumNameEditorForm(void)
+ : __pNameEditField(null)
+ , __folderIndex(0)
+ , __modalMsgBoxResult(0)
+ , __textLength(0)
+ , __mountState(false)
+ , __albumNameEditorMode(ALBUM_NAME_EDITOR_MODE_RENAME)
+ , __pMessageBox(null)
+ , __pMoveIndexList(null)
+ , __fileActionMode(FILE_ACTION_MOVE)
+ , __pFileMove(null)
+ , __pProgressAnim(null)
+ , __pPresentationModel(null)
+ , __pFilePresentationModel(null)
{
AppLogDebug("ENTER");
- __overlayMsg = false;
+ _overlayMsg = false;
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
-AlbumNameEditorForm::~AlbumNameEditorForm()
+AlbumNameEditorForm::~AlbumNameEditorForm(void)
{
- delete __pFileMove;
AppLogDebug("ENTER");
+ DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
+ delete __pFileMove;
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
AlbumNameEditorForm::Initialize(void)
{
AppLogDebug("ENTER");
- result r = Construct(FORM_STYLE_HEADER | FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
+ result r = Construct(FORM_STYLE_HEADER | FORM_STYLE_FOOTER | FORM_STYLE_NORMAL | FORM_STYLE_INDICATOR);
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return r;
AppLogDebug("ENTER");
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
__pFilePresentationModel = FileListPresentationModel::GetInstance();
+
+ DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
+ Header* pHeader = GetHeader();
+
+ pHeader->SetStyle(HEADER_STYLE_TITLE);
+
+ GetFooter()->SetBackButtonEnabled(true);
+ GetFooter()->SetBackButton();
+
+ FooterItem itemSave;
+ itemSave.Construct(IDA_BUTTON_CREATE_NAME_SAVE);
+ itemSave.SetText(ResourceManager::GetString(L"IDS_COM_OPT_SAVE"));
+
+ GetFooter()->AddItem(itemSave);
+ GetFooter()->AddActionEventListener(*this);
+ GetFooter()->Invalidate(true);
+
+ SetFormBackEventListener(this);
+ SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
+
+ __pNameEditField = new (std::nothrow) EditField();
+ __pNameEditField->Construct(RECT_NAME_EDIT_FIELD, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY,
+ EDIT_FIELD_TITLE_STYLE_NONE, true, ALBUM_MAX_LENGTH);
+ __pNameEditField->AddTextEventListener(*this);
+ __pNameEditField->SetColor(EDIT_STATUS_NORMAL, COLOR_NAME_EDIT_FIELD);
+ __pNameEditField->SetOverlayKeypadCommandButtonVisible(false);
+
+ AddControl(__pNameEditField);
+ __pNameEditField->AddActionEventListener(*this);
+
return E_SUCCESS;
}
void
AlbumNameEditorForm::OnTextValueChanged(const Control& source)
{
- AppLogDebug("ENTER");
- String inputString = __pNameEditField->GetText();
+ String currentInput;
+ String currentText;
+ String specialCharacters(L"/");
+ String byteCountForInput;
+ int byteCount = 0;
+ int inputLength = 0;
+ int tempLength = 255;
+ int textToCheck = 0;
+ MessageBox messageBox;
+ Utf8Encoding utf8;
+
+ FooterItemStatus currentStatus = FOOTER_ITEM_STATUS_NORMAL;
+
+ result r = E_SUCCESS;
+
+ if (__pNameEditField != null)
+ {
+ byteCountForInput = __pNameEditField->GetText();
+ r = utf8.GetByteCount(byteCountForInput, byteCount);
+ AppLogDebug("result is %s",GetErrorMessage(r));
+ AppLogDebug("Byte count is %d",byteCount);
+ }
- if (inputString.Contains(DIRECTORY_SEPARATOR) == true)
+ if (__pNameEditField != null)
{
- if (__pMessageBox == null)
+ currentText = __pNameEditField->GetText();
+ textToCheck = currentText.GetLength() - __textLength;
+ if (currentText.IsEmpty())
{
- __pMessageBox = new (std::nothrow) MessageBox();
- __pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS"),
- MSGBOX_STYLE_NONE, 3000);
- int modalResult = 0;
- __overlayMsg = true;
- __pMessageBox->ShowAndWait(modalResult);
- __overlayMsg = false;
- delete __pMessageBox;
- __pMessageBox = null;
+ if (GetFooter() != null)
+ {
+ GetFooter()->SetItemEnabled(0, false);
+ GetFooter()->Invalidate(true);
+ }
}
+ else
+ {
+ if (GetFooter() != null)
+ {
+ GetFooter()->GetItemStatus(0, currentStatus);
- __pNameEditField->SetText(__nameEditFieldTempText);
- __pNameEditField->SetFocus();
-
- return;
- }
-
- ByteBuffer* buffer = StringUtil::StringToUtf8N(inputString);
- int remaining = 0;
- if (buffer != null)
- {
- remaining = buffer->GetRemaining();
- }
+ if (currentStatus == FOOTER_ITEM_STATUS_DISABLED)
+ {
+ GetFooter()->SetItemEnabled(0,true);
+ GetFooter()->Invalidate(true);
+ }
+ }
+ }
- if (remaining >= ALBUM_MAX_LENGTH)
- {
- if (__pMessageBox == null)
+ if (currentText.StartsWith(".", 0))
{
- __pMessageBox = new (std::nothrow) MessageBox();
- __pMessageBox->Construct(L"",
- ResourceManager::GetString(L"IDS_COM_POP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED"),
- MSGBOX_STYLE_NONE, 3000);
- int modalResult = 0;
- __pMessageBox->ShowAndWait(modalResult);
- delete __pMessageBox;
- __pMessageBox = null;
- }
+ String invalidCharacterString;
+ String validString;
+ String msg = ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS");
+ CreateMessage(msg);
+ validString = __pNameEditField->GetText();
- __pNameEditField->SetText(__nameEditFieldTempText);
- __pNameEditField->SetFocus();
+ if (validString.GetLength() > 1)
+ {
+ validString.Remove(0,1);
+ __pNameEditField->SetText(validString);
+ }
+ else
+ {
+ __pNameEditField->SetText("");
- return;
- }
- __nameEditFieldTempText = inputString;
+ if (GetFooter() != null)
+ {
+ GetFooter()->SetItemEnabled(0, false);
+ GetFooter()->Invalidate(true);
+ }
+ }
+ __pNameEditField->ShowKeypad();
+ }
- inputString.Trim();
+ currentInput = __pNameEditField->GetText();
- Header* header = GetHeader();
- HeaderItemStatus itemStatus;
- header->GetItemStatus(0, itemStatus);
- if (inputString.GetLength() == 0)
- {
- if (itemStatus != HEADER_ITEM_STATUS_DISABLED)
+ if (currentInput.Contains(specialCharacters[0]))
{
- header->SetItemEnabled(0, false);
- header->RequestRedraw(true);
+ String msg = ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS");
+ CreateMessage(msg);
+ currentInput.Replace("/", "");
+ __pNameEditField->SetText(currentInput);
}
- }
- else
- {
- if (itemStatus == HEADER_ITEM_STATUS_DISABLED)
+
+ inputLength = byteCount;
+ if (inputLength >= tempLength)
{
- header->SetItemEnabled(0, true);
- header->RequestRedraw(true);
+ String maxCharacterString;
+ String currentInputCharacter;
+ int checkByteCount = 0;
+ int lengthOfFinalString = 0;
+ int currentCharacter = 0;
+
+ String msg = ResourceManager::GetString(L"IDS_COM_POP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED");
+ CreateMessage(msg);
+ currentText = __pNameEditField->GetText();
+
+ for (currentCharacter=0; checkByteCount < tempLength; currentCharacter++)
+ {
+ currentInputCharacter.Clear();
+ currentInputCharacter = currentText[currentCharacter];
+ r = utf8.GetByteCount(currentInputCharacter, byteCount);
+ if (r != E_SUCCESS)
+ {
+ break;
+ }
+ AppLogDebug("result of byte count is %s",GetErrorMessage(r));
+ checkByteCount = checkByteCount + byteCount;
+ lengthOfFinalString++;
+ }
+
+ r = __pNameEditField->GetText().SubString(0, lengthOfFinalString, currentInput);
+ AppLogDebug("current input is %S", currentInput.GetPointer());
+ r = __pNameEditField->SetText(currentInput);
+ __pNameEditField->ShowKeypad();
+ return;
}
+
+ r = utf8.GetByteCount(__pNameEditField->GetText(), byteCount);
+ __textLength = byteCount;
}
+
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void AlbumNameEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
{
Invalidate(true);
-
}
+
void AlbumNameEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
{
- __overlayMsg = false;
+ _overlayMsg = false;
if (res != COMPLETE_SUCCESS)
{
__pNameEditField->SetText(__nameEditFieldPreText);
}
void
-AlbumNameEditorForm::OnActionPerformed(const Control& source, int actionId)
+AlbumNameEditorForm::OnRenameAlbum(String& strOri)
{
- AppLogDebug("ENTER");
+ AppLogDebug("Rename Album");
+ String path;
+ int index = 0;
+ strOri.Reverse();
+ strOri.IndexOf(DIRECTORY_SEPARATOR, 0, index);
+ strOri.Reverse();
+ strOri.SubString(0, (strOri.GetLength() - index), path);
+ path.Append(__nameEditFieldText);
+
+ //Rename
+ result r = __pPresentationModel->RenameAlbum(strOri, path, this);
+
+ if (IsFailed(r))
+ {
+ AppLogDebug("Unable to rename Album %s", GetErrorMessage(r));
+ if (__pMessageBox == null)
+ {
+ __pMessageBox = new (std::nothrow) MessageBox();
+ if (r == E_FILE_ALREADY_EXIST)
+ {
+ __pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_MEDIABR_BODY_UNABLE_TO_RENAME_ALBUM_NAME_ALREADY_IN_USE_ABB"),
+ MSGBOX_STYLE_NONE, 3000);
+ }
+ else
+ {
+ __pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_MEDIABR_POP_UNABLE_TO_RENAME"),
+ MSGBOX_STYLE_NONE, 3000);
+ }
+ int modalResult = 0;
+ _overlayMsg = true;
+ __pMessageBox->ShowAndWait(modalResult);
+ _overlayMsg = false;
+ delete __pMessageBox;
+ __pMessageBox = null;
+ }
+ }
+ else
+ {
+ //Add a popup here
+ Rectangle clientRect= GetClientAreaBounds();
+ Rectangle rect(0, 0, clientRect.width, clientRect.height);
+ __pProgressAnim = new (std::nothrow) ProgressAnimation;
+ __pProgressAnim->Construct(rect);
+ AddControl(__pProgressAnim);
+ __pProgressAnim->SetShowState(true);
+ GetFooter()->SetEnabled(false);
+ __pProgressAnim->AnimationStart();
+ __pProgressAnim->Draw();
+ _overlayMsg = true;
+ }
+}
+
+void
+AlbumNameEditorForm::OnCreateAlbum(void)
+{
+ String path;
+ __pNameEditField->HideKeypad();
+ __pNameEditField->RequestRedraw();
+ path.Append(Tizen::System::Environment::GetMediaPath());
+ path.Append(__nameEditFieldText);
+
+ if (__previousSceneId != IDSCN_ALL_LIST_EDITOR && __previousSceneId != IDSCN_ALL_LIST_SELECTION)
+ {
+ Directory::Create(path, true);
+ }
+
+ __nameEditFieldPreText = __nameEditFieldText;
+
+ if (path.IsEmpty())
+ {
+ AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
+ delete __pMoveIndexList;
+ __pMoveIndexList = null;
+ return ;
+ }
+
+ if (__pMoveIndexList == null || __pMoveIndexList->GetCount() <= 0)
+ {
+ AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
+ delete __pMoveIndexList;
+ __pMoveIndexList = null;
+ return ;
+ }
+
+ delete __pFileMove;
+ GetMoveFileIndexList(path, __pMoveIndexList, __pFilePresentationModel);
+ __pFileMove = new (std::nothrow) FileMoveTimer(path, __pMoveIndexList, __pFilePresentationModel, this);
+ if (__fileActionMode == FILE_ACTION_COPY)
+ {
+ AppLogDebug("Rash: Setting to Copy in AlbumNameEditor");
+ __pFileMove->SetCopy();
+ }
+ else
+ {
+ __pFileMove->ClearCopy();
+ }
+ result r = __pFileMove->StartTimer();
+
+ if (IsFailed(r))
+ {
+ delete __pFileMove;
+ __pFileMove = null;
+ __pNameEditField->SetText(__nameEditFieldPreText);
+ __pNameEditField->HideKeypad();
+ __pNameEditField->Draw();
+ AppLogDebug("MoveToContentFileList content failed (%s)", GetErrorMessage(r));
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId));
+ }
+ else
+ {
+ AppLogDebug("MoveToContentFileList content in progress");
+ _overlayMsg = true;
+ __fileActionMode = FILE_ACTION_MOVE;
+ }
+}
+
+void AlbumNameEditorForm::OnAlbumRenameComplete(void)
+{
+ //Hide popup here..
+ __pProgressAnim->AnimationStop();
+ __pProgressAnim->SetShowState(false);
+ RemoveControl(__pProgressAnim);
+ _overlayMsg = false;
+ GetFooter()->SetEnabled(true);
SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoBackward((BackwardSceneTransition(IDSCN_ALBUM_LIST)));
+}
- String pPath;
- String strOri;
+void
+AlbumNameEditorForm::OnActionPerformed(const Control& source, int actionId)
+{
+ AppLogDebug("ENTER");
+ String path;
__nameEditFieldText = __pNameEditField->GetText();
if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_RENAME)
{
IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(__folderIndex));
- pPath = pAlbumInfo->GetDirectory(0);
- strOri = pPath;
+ path = pAlbumInfo->GetDirectory(0);
}
switch (actionId)
{
- case ACTION_ID_BUTTON_CREATE_NAME_DONE:
+ case IDA_BUTTON_CREATE_NAME_SAVE:
{
- __pNameEditField->HideKeypad();
- __pNameEditField->RequestRedraw();
- pPath.Append(Tizen::System::Environment::GetMediaPath());
- pPath.Append(__nameEditFieldText);
-
- if (__previousSceneId != IDSCN_ALL_LIST_EDITOR && __previousSceneId != IDSCN_ALL_LIST_SELECTION)
- {
- Directory::Create( pPath, true);
- }
+ __pNameEditField->SetEnabled(false);
- __nameEditFieldPreText = __nameEditFieldText;
- ArrayList argsList;
- argsList.Construct();
- argsList.Add(new (std::nothrow) String(pPath));
-
-
- if (pPath.IsEmpty())
+ if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE)
{
- AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
- delete __pMoveIndexList;
- __pMoveIndexList = null;
- return ;
+ OnCreateAlbum();
}
-
- if (__pMoveIndexList == null || __pMoveIndexList->GetCount() <= 0)
+ else if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_RENAME)
{
- AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
- delete __pMoveIndexList;
- __pMoveIndexList = null;
- return ;
- }
-
- delete __pFileMove;
- GetMoveFileIndexList(pPath, __pMoveIndexList, __pFilePresentationModel);
- __pFileMove = new FileMoveTimer(pPath, __pMoveIndexList,
- __pFilePresentationModel,
- this );
- result r = __pFileMove->StartTimer();
-
- if (IsFailed(r))
- {
- delete __pFileMove;
- __pFileMove = null;
- __pNameEditField->SetText(__nameEditFieldPreText);
- __pNameEditField->HideKeypad();
- __pNameEditField->Draw();
- pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId));
- }
- else
- {
- __overlayMsg = true;
+ String albumName = __pNameEditField->GetText();
+ if (__originalText.Equals(albumName , true))
+ {
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoBackward(BackwardSceneTransition());
+ }
+ else
+ {
+ OnRenameAlbum(path);
+ }
}
-
- AppLogDebug("MoveToContentFileList content failed (%s)", GetErrorMessage(r));
-
- break;
- }
- case ACTION_ID_BUTTON_CREATE_NAME_CANCEL:
- {
- __pNameEditField->SetText(__nameEditFieldPreText);
- __pNameEditField->HideKeypad();
- __pNameEditField->Draw();
- pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId));
break;
}
__pPresentationModel = AlbumListPresentationModel::GetInstance();
__previousSceneId = previousSceneId;
+ __pNameEditField->SetEnabled(true);
+ __pPresentationModel->AddContentEventListener(this);
+
+ if (pArgs != null)
+ {
+ Integer* pAlbumTypePtr = static_cast<Integer*>(pArgs->GetAt(ALBUM_FIRST_ELEMENT));
+ if (pAlbumTypePtr->ToInt() == ALBUM_CREATE)
+ {
+ AppLogDebug("ALBUM_NAME_EDITOR_MODE_CREATE");
+ __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_CREATE;
+ }
+ else if (pAlbumTypePtr->ToInt() == ALBUM_RENAME)
+ {
+ AppLogDebug("ALBUM_NAME_EDITOR_MODE_RENAME");
+ __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_RENAME;
+ }
+ pArgs->RemoveAt(ALBUM_FIRST_ELEMENT, true);
+ }
+
+ if (pArgs != null)
+ {
+ Integer* operationTypePtr = static_cast<Integer*>(pArgs->GetAt(ALBUM_FIRST_ELEMENT));
+ if (operationTypePtr->ToInt() == FILE_ACTION_MOVE)
+ {
+ AppLogDebug("Rash: FILE_MOVE_ACTION");
+ __fileActionMode = FILE_ACTION_MOVE;
+ }
+ else if (operationTypePtr->ToInt() == FILE_ACTION_COPY)
+ {
+ AppLogDebug("Rash: FILE_COPY_ACTION");
+ __fileActionMode = FILE_ACTION_COPY;
+ }
+ pArgs->RemoveAt(ALBUM_FIRST_ELEMENT, true);
+ }
+
if (previousSceneId == IDSCN_ALBUM_LIST_EDITOR)
{
if (pArgs != null)
AppLogDebug("[MOVE] previousSceneId = IDSCN_ALL_LIST_SELECTION");
}
- __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_CREATE;
__callerSceneId = previousSceneId;
}
else
{
- __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_RENAME;
__callerSceneId = EMPTY_SPACE;
}
if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE)
{
- Header* pHeader = GetHeader();
- AppAssert(pHeader);
- pHeader->SetStyle(HEADER_STYLE_BUTTON);
-
- HeaderItem doneItem;
- HeaderItem cancelItem;
- doneItem.Construct(ACTION_ID_BUTTON_CREATE_NAME_DONE);
- doneItem.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
- cancelItem.Construct(ACTION_ID_BUTTON_CREATE_NAME_CANCEL);
- cancelItem.SetText(ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
-
- pHeader->SetStyle(HEADER_STYLE_BUTTON);
- pHeader->AddItem(doneItem);
- pHeader->AddItem(cancelItem);
- pHeader->AddActionEventListener(*this);
- pHeader->SetItemEnabled(0, false);
-
- __pNameEditField = new (std::nothrow) EditField();
- __pNameEditField->Construct(RECT_NAME_EDIT_FIELD, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY,
- EDIT_FIELD_TITLE_STYLE_NONE, true, ALBUM_MAX_LENGTH);
- __pNameEditField->AddTextEventListener(*this);
- __pNameEditField->SetColor(EDIT_STATUS_NORMAL, COLOR_NAME_EDIT_FIELD);
-
- AddControl(*__pNameEditField);
- __pNameEditField->AddActionEventListener(*this);
-
__nameEditFieldText = EMPTY_SPACE;
__nameEditFieldPreText = EMPTY_SPACE;
__pNameEditField->SetText(__nameEditFieldText);
__nameEditFieldTempText = __nameEditFieldText;
-
- __pNameEditField->SetOverlayKeypadCommandButtonVisible(false);
+ __pNameEditField->ShowKeypad();
__pNameEditField->SetFocus();
+ GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"));
+ GetFooter()->SetItemEnabled(0, false);
+ GetFooter()->Invalidate(true);
}
else
{
- Header* pHeader = GetHeader();
- AppAssert(pHeader);
- pHeader->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_CHANGE_NAME"));
- pHeader->SetStyle(HEADER_STYLE_BUTTON);
-
- HeaderItem doneItem;
- HeaderItem cancelItem;
- doneItem.Construct(ACTION_ID_BUTTON_CREATE_NAME_DONE);
- doneItem.SetText(ResourceManager::GetString(L"IDS_COM_SK_DONE"));
- cancelItem.Construct(ACTION_ID_BUTTON_CREATE_NAME_CANCEL);
- cancelItem.SetText(ResourceManager::GetString(L"IDS_COM_POP_CANCEL"));
-
- pHeader->SetStyle(HEADER_STYLE_BUTTON);
- pHeader->AddItem(doneItem);
- pHeader->AddItem(cancelItem);
- pHeader->AddActionEventListener(*this);
-
- __pNameEditField = new (std::nothrow) EditField();
- __pNameEditField->Construct(RECT_NAME_EDIT_FIELD, EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_OVERLAY,
- EDIT_FIELD_TITLE_STYLE_NONE, true, ALBUM_MAX_LENGTH);
- __pNameEditField->AddTextEventListener(*this);
- __pNameEditField->SetColor(EDIT_STATUS_NORMAL, COLOR_NAME_EDIT_FIELD);
-
- AddControl(*__pNameEditField);
- __pNameEditField->AddActionEventListener(*this);
- String strName;
-
+ int byteCount = 0;
+ Utf8Encoding utf8;
IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(__folderIndex));
- strName = pAlbumInfo->GetAlbumName();
+ String strName = pAlbumInfo->GetAlbumName();
__nameEditFieldText = strName;
__nameEditFieldPreText = strName;
__pNameEditField->SetText(__nameEditFieldText);
-
+ __nameEditFieldTempText = __nameEditFieldText;
+ GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_RENAME"));
__pNameEditField->SetOverlayKeypadCommandButtonVisible(false);
+ __pNameEditField->ShowKeypad();
__pNameEditField->SetFocus();
+ __originalText = __pNameEditField->GetText();
+ utf8.GetByteCount(__nameEditFieldText, byteCount);
+ __textLength = byteCount;
+ GetFooter()->SetItemEnabled(0, true);
+ GetFooter()->Invalidate(true);
}
- if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE)
+ if (pArgs != NULL)
{
- __nameEditFieldText = EMPTY_SPACE;
- __nameEditFieldPreText = EMPTY_SPACE;
- __pNameEditField->SetText(__nameEditFieldText);
+ __pMoveIndexList = pArgs;
+ }
+
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
+void
+AlbumNameEditorForm::OnSceneDeactivated(const SceneId& currentSceneId,
+ const SceneId& nextSceneId)
+{
+ AppLogDebug("ENTER");
+ __pPresentationModel->RemoveContentEventListener(*this);
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
+void
+AlbumNameEditorForm::OnContentUpdated(void)
+{
+ AppLogDebug("ENTER");
+
+ if ( __mountState == false )
+ {
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
else
{
- IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
- AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(__folderIndex));
- if (pAlbumInfo != null)
- {
- String strName;
- strName = pAlbumInfo->GetAlbumName();
+ __mountState = false;
+ }
+}
- __nameEditFieldText = strName;
- __nameEditFieldPreText = strName;
- __pNameEditField->SetText(__nameEditFieldText);
+void
+AlbumNameEditorForm::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
+{
+ AppLogDebug("ENTER");
+
+ if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED)
+ {
+ if ( __pFileMove && __pFileMove->IsStarted() )
+ {
+ __pFileMove->Cancel();
+ delete __pFileMove;
+ __pFileMove = null;
}
+ __mountState = false;
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
-
- if( pArgs != NULL)
+ else
{
- __pMoveIndexList = pArgs;
+ __mountState = true;
}
-
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
void
-AlbumNameEditorForm::OnSceneDeactivated(const SceneId& currentSceneId,
- const SceneId& nextSceneId)
+AlbumNameEditorForm::CreateMessage(String& str)
{
- AppLogDebug("ENTER");
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+ if (__pMessageBox == null)
+ {
+ __pMessageBox = new(std::nothrow) MessageBox;
+
+ if (__pMessageBox != null)
+ {
+ __pMessageBox->Construct(L"", str, MSGBOX_STYLE_OK, 3000);
+ __pMessageBox->ShowAndWait(__modalMsgBoxResult);
+
+ delete __pMessageBox;
+ __pMessageBox = null;
+ __modalMsgBoxResult = 0;
+ }
+ }
}