* @brief This is the implementation file for AlbumNameEditorForm class.
*/
-#include <FApp.h>
+#include <FMedia.h>
#include "GlAlbumInfo.h"
#include "GlAlbumListPresentationModel.h"
#include "GlAlbumNameEditorForm.h"
static const unsigned int COLOR_NAME_EDIT_FIELD = Color32<255, 255, 255>::Value;
static const int ALBUM_MAX_LENGTH = 255;
-AlbumNameEditorForm::AlbumNameEditorForm()
+AlbumNameEditorForm::AlbumNameEditorForm(void)
: __pNameEditField(null)
, __folderIndex(0)
, __albumNameEditorMode(ALBUM_NAME_EDITOR_MODE_RENAME)
, __pMessageBox(null)
, __pMoveIndexList(null)
- , __fileActionMode(FILE_MOVE_ACTION)
+ , __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");
GetFooter()->SetBackButton();
FooterItem itemSave;
- itemSave.Construct(ACTION_ID_BUTTON_CREATE_NAME_SAVE);
- itemSave.SetText(L"Save");
+ itemSave.Construct(IDA_BUTTON_CREATE_NAME_SAVE);
+ itemSave.SetText(ResourceManager::GetString(L"IDS_COM_OPT_SAVE"));
GetFooter()->AddItem(itemSave);
GetFooter()->AddActionEventListener(*this);
__pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS"),
MSGBOX_STYLE_NONE, 3000);
int modalResult = 0;
- __overlayMsg = true;
+ _overlayMsg = true;
__pMessageBox->ShowAndWait(modalResult);
- __overlayMsg = false;
+ _overlayMsg = false;
delete __pMessageBox;
__pMessageBox = null;
}
return;
}
- ByteBuffer* buffer = StringUtil::StringToUtf8N(inputString);
+ ByteBuffer* pBuffer = StringUtil::StringToUtf8N(inputString);
int remaining = 0;
- if (buffer != null)
+ if (pBuffer != null)
{
- remaining = buffer->GetRemaining();
+ remaining = pBuffer->GetRemaining();
}
if (remaining >= ALBUM_MAX_LENGTH)
void AlbumNameEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
{
- __overlayMsg = false;
+ _overlayMsg = false;
if (res != COMPLETE_SUCCESS)
{
__pNameEditField->SetText(__nameEditFieldPreText);
}
void
-AlbumNameEditorForm::OnRenameAlbum(const String& strOri)
+AlbumNameEditorForm::OnRenameAlbum(String& strOri)
{
AppLogDebug("Rename Album");
String path;
- path.Append(Tizen::System::Environment::GetMediaPath());
+ 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();
- __pMessageBox->Construct(L"", L"Unable to rename", MSGBOX_STYLE_NONE, 3000);
+ 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;
+ _overlayMsg = true;
__pMessageBox->ShowAndWait(modalResult);
- __overlayMsg = false;
+ _overlayMsg = false;
delete __pMessageBox;
__pMessageBox = null;
- SceneManager* pSceneManager = SceneManager::GetInstance();
- pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId));
}
}
else
{
- //Add a popup here..
+ //Add a popup here
Rectangle clientRect= GetClientAreaBounds();
- Rectangle rect(0,0,clientRect.width,clientRect.height);
+ 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;
+ _overlayMsg = true;
}
}
delete __pFileMove;
GetMoveFileIndexList(path, __pMoveIndexList, __pFilePresentationModel);
- __pFileMove = new FileMoveTimer(path, __pMoveIndexList, __pFilePresentationModel, this);
- if(__fileActionMode == FILE_COPY_ACTION)
+ __pFileMove = new (std::nothrow) FileMoveTimer(path, __pMoveIndexList, __pFilePresentationModel, this);
+ if (__fileActionMode == FILE_ACTION_COPY)
{
AppLogDebug("Rash: Setting to Copy in AlbumNameEditor");
__pFileMove->SetCopy();
else
{
AppLogDebug("MoveToContentFileList content in progress");
- __overlayMsg = true;
- __fileActionMode = FILE_MOVE_ACTION;
+ _overlayMsg = true;
+ __fileActionMode = FILE_ACTION_MOVE;
}
}
__pProgressAnim->AnimationStop();
__pProgressAnim->SetShowState(false);
RemoveControl(*__pProgressAnim);
- __overlayMsg = false;
+ _overlayMsg = false;
+ GetFooter()->SetEnabled(true);
SceneManager* pSceneManager = SceneManager::GetInstance();
pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
}
switch (actionId)
{
- case ACTION_ID_BUTTON_CREATE_NAME_SAVE:
+ case IDA_BUTTON_CREATE_NAME_SAVE:
{
if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE)
{
}
else if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_RENAME)
{
- OnRenameAlbum(path);
+ String albumName = __pNameEditField->GetText();
+ if (__originalText.Equals(albumName , true))
+ {
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoBackward(BackwardSceneTransition());
+ }
+ else
+ {
+ OnRenameAlbum(path);
+ }
}
break;
}
__pPresentationModel = AlbumListPresentationModel::GetInstance();
__previousSceneId = previousSceneId;
+ __pPresentationModel->AddContentEventListener(this);
+
if (pArgs != null)
{
- Integer* albumTypePtr = static_cast<Integer*>(pArgs->GetAt(ALBUM_FIRST_ELEMENT));
- if (albumTypePtr->ToInt() == ALBUM_CREATE)
+ 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 (albumTypePtr->ToInt() == ALBUM_RENAME)
+ else if (pAlbumTypePtr->ToInt() == ALBUM_RENAME)
{
AppLogDebug("ALBUM_NAME_EDITOR_MODE_RENAME");
__albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_RENAME;
if (pArgs != null)
{
Integer* operationTypePtr = static_cast<Integer*>(pArgs->GetAt(ALBUM_FIRST_ELEMENT));
- if (operationTypePtr->ToInt() == FILE_MOVE_ACTION)
+ if (operationTypePtr->ToInt() == FILE_ACTION_MOVE)
{
AppLogDebug("Rash: FILE_MOVE_ACTION");
- __fileActionMode = FILE_MOVE_ACTION;
+ __fileActionMode = FILE_ACTION_MOVE;
}
- else if (operationTypePtr->ToInt() == FILE_COPY_ACTION)
+ else if (operationTypePtr->ToInt() == FILE_ACTION_COPY)
{
AppLogDebug("Rash: FILE_COPY_ACTION");
- __fileActionMode = FILE_COPY_ACTION;
+ __fileActionMode = FILE_ACTION_COPY;
}
pArgs->RemoveAt(ALBUM_FIRST_ELEMENT, true);
}
__pNameEditField->SetText(__nameEditFieldText);
__nameEditFieldTempText = __nameEditFieldText;
__pNameEditField->SetFocus();
- GetHeader()->SetTitleText(L"Create album");
+
+ GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"));
GetFooter()->SetItemEnabled(0, false);
GetFooter()->Invalidate(true);
}
else
{
+
IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(__folderIndex));
__nameEditFieldText = strName;
__nameEditFieldPreText = strName;
__pNameEditField->SetText(__nameEditFieldText);
- GetHeader()->SetTitleText(L"Rename");
+ GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_RENAME"));
__pNameEditField->SetOverlayKeypadCommandButtonVisible(false);
__pNameEditField->SetFocus();
+ __originalText = __pNameEditField->GetText();
}
if (pArgs != NULL)
const SceneId& nextSceneId)
{
AppLogDebug("ENTER");
+ __pPresentationModel->RemoveContentEventListener(*this);
+ AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
+void
+AlbumNameEditorForm::OnContentUpdated(void)
+{
+ AppLogDebug("ENTER");
+
+ SceneManager* pSceneManager = SceneManager::GetInstance();
+ pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}