Nabi issue 46564 fix
[apps/osp/Gallery.git] / src / GlAlbumNameEditorForm.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                GlAlbumNameEditorForm.cpp
19  * @brief               This is the implementation file for AlbumNameEditorForm class.
20  */
21
22 #include <FMedia.h>
23 #include <FText.h>
24
25 #include "GlAlbumInfo.h"
26 #include "GlAlbumListPresentationModel.h"
27 #include "GlAlbumNameEditorForm.h"
28 #include "GlFileListPresentationModel.h"
29 #include "GlFileMoveTimer.h"
30 #include "GlProgressAnimation.h"
31 #include "GlResourceManager.h"
32 #include "GlTypes.h"
33
34 using namespace Tizen::App;
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::Base::Runtime;
38 using namespace Tizen::Base::Utility;
39 using namespace Tizen::Content;
40 using namespace Tizen::Graphics;
41 using namespace Tizen::Io;
42 using namespace Tizen::Media;
43 using namespace Tizen::System;
44 using namespace Tizen::Text;
45 using namespace Tizen::Ui;
46 using namespace Tizen::Ui::Controls;
47 using namespace Tizen::Ui::Scenes;
48
49 static const unsigned int COLOR_NAME_EDIT_FIELD = Color32<255, 255, 255>::Value;
50
51 AlbumNameEditorForm::AlbumNameEditorForm(void)
52         : __pNameEditField(null)
53         , __folderIndex(0)
54         , __modalMsgBoxResult(0)
55         , __textLength(0)
56         , __mountState(false)
57         , __albumNameEditorMode(ALBUM_NAME_EDITOR_MODE_RENAME)
58         , __pMessageBox(null)
59         , __pMoveIndexList(null)
60         , __fileActionMode(FILE_ACTION_MOVE)
61         , __pFileMove(null)
62         , __pProgressAnim(null)
63         , __pPresentationModel(null)
64         , __pFilePresentationModel(null)
65 {
66         AppLogDebug("ENTER");
67         _overlayMsg = false;
68         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
69 }
70
71 AlbumNameEditorForm::~AlbumNameEditorForm(void)
72 {
73         AppLogDebug("ENTER");
74         DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
75         delete __pFileMove;
76         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
77 }
78
79 result
80 AlbumNameEditorForm::Initialize(void)
81 {
82         AppLogDebug("ENTER");
83         result r = Construct(L"IDL_FORM_ALBUM_NAME_EDITOR");
84         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
85
86         return r;
87 }
88
89 result
90 AlbumNameEditorForm::OnInitializing(void)
91 {
92         AppLogDebug("ENTER");
93         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
94         __pFilePresentationModel = FileListPresentationModel::GetInstance();
95
96         SetOrientation(ORIENTATION_AUTOMATIC);
97                 AddOrientationEventListener(*this);
98
99         DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
100         Header* pHeader = GetHeader();
101
102         pHeader->SetStyle(HEADER_STYLE_TITLE);
103
104         FooterItem itemSave;
105         itemSave.Construct(IDA_BUTTON_CREATE_NAME_SAVE);
106         itemSave.SetText(ResourceManager::GetString(L"IDS_COM_OPT_SAVE"));
107
108         GetFooter()->AddItem(itemSave);
109         GetFooter()->AddActionEventListener(*this);
110         GetFooter()->Invalidate(true);
111
112         SetFormBackEventListener(this);
113         SetActionBarsVisible(FORM_ACTION_BAR_FOOTER, true);
114
115         __pNameEditField = static_cast<EditField*>(GetControl(L"IDC_EDITFIELD_NAME"));
116         __pNameEditField->AddTextEventListener(*this);
117         __pNameEditField->SetColor(EDIT_STATUS_NORMAL, COLOR_NAME_EDIT_FIELD);
118         __pNameEditField->SetOverlayKeypadCommandButtonVisible(false);
119         __pNameEditField->AddActionEventListener(*this);
120
121         return E_SUCCESS;
122 }
123
124 void
125 AlbumNameEditorForm::OnTextValueChanged(const Control& source)
126 {
127         String currentInput;
128         String currentText;
129         String specialCharacters(L"/");
130         String byteCountForInput;
131         int byteCount = 0;
132         int inputLength = 0;
133         int tempLength = 255;
134         int textToCheck = 0;
135         MessageBox messageBox;
136         Utf8Encoding utf8;
137
138         FooterItemStatus currentStatus = FOOTER_ITEM_STATUS_NORMAL;
139
140         result r = E_SUCCESS;
141
142         if (__pNameEditField != null)
143         {
144                 byteCountForInput = __pNameEditField->GetText();
145                 r = utf8.GetByteCount(byteCountForInput, byteCount);
146                 AppLogDebug("result is %s",GetErrorMessage(r));
147                 AppLogDebug("Byte count is %d",byteCount);
148         }
149
150         if (__pNameEditField != null)
151         {
152                 currentText = __pNameEditField->GetText();
153                 textToCheck = currentText.GetLength() - __textLength;
154                 if (currentText.IsEmpty())
155                 {
156                         if (GetFooter() != null)
157                         {
158                                 GetFooter()->SetItemEnabled(0, false);
159                                 GetFooter()->Invalidate(true);
160                         }
161                 }
162                 else
163                 {
164                         if (GetFooter() != null)
165                         {
166                                 GetFooter()->GetItemStatus(0, currentStatus);
167
168                                 if (currentStatus == FOOTER_ITEM_STATUS_DISABLED)
169                                 {
170                                         GetFooter()->SetItemEnabled(0,true);
171                                         GetFooter()->Invalidate(true);
172                                 }
173                         }
174                 }
175
176                 if (currentText.StartsWith(".", 0))
177                 {
178                         String invalidCharacterString;
179                         String validString;
180                         String msg = ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS");
181                         CreateMessage(msg);
182                         validString = __pNameEditField->GetText();
183
184                         if (validString.GetLength() > 1)
185                         {
186                                 validString.Remove(0,1);
187                                 __pNameEditField->SetText(validString);
188                         }
189                         else
190                         {
191                                 __pNameEditField->SetText("");
192
193                                 if (GetFooter() != null)
194                                 {
195                                         GetFooter()->SetItemEnabled(0, false);
196                                         GetFooter()->Invalidate(true);
197                                 }
198                         }
199                         __pNameEditField->ShowKeypad();
200                 }
201
202                 currentInput = __pNameEditField->GetText();
203
204                 if (currentInput.Contains(specialCharacters[0]))
205                 {
206                         String msg = ResourceManager::GetString(L"IDS_COM_POP_INVALID_CHARACTERS");
207                         CreateMessage(msg);
208                         currentInput.Replace("/", "");
209                         __pNameEditField->SetText(currentInput);
210                 }
211
212                 inputLength = byteCount;
213                 if (inputLength  >= tempLength)
214                 {
215                         String maxCharacterString;
216                         String currentInputCharacter;
217                         int checkByteCount = 0;
218                         int lengthOfFinalString = 0;
219                         int currentCharacter = 0;
220
221                         String msg = ResourceManager::GetString(L"IDS_COM_POP_MAXIMUM_NUMBER_OF_CHARACTERS_REACHED");
222                         CreateMessage(msg);
223                         currentText = __pNameEditField->GetText();
224
225                         for (currentCharacter=0; checkByteCount < tempLength; ++currentCharacter)
226                         {
227                                 currentInputCharacter.Clear();
228                                 currentInputCharacter = currentText[currentCharacter];
229                                 r = utf8.GetByteCount(currentInputCharacter, byteCount);
230                                 if (r != E_SUCCESS)
231                                 {
232                                         break;
233                                 }
234                                 AppLogDebug("result of byte count is %s",GetErrorMessage(r));
235                                 checkByteCount = checkByteCount + byteCount;
236
237                                 if (checkByteCount < tempLength)
238                                 {
239                                         ++lengthOfFinalString;
240                                 }
241                         }
242
243                         r = __pNameEditField->GetText().SubString(0, lengthOfFinalString, currentInput);
244                         AppLogDebug("current input is %S", currentInput.GetPointer());
245                         r = __pNameEditField->SetText(currentInput);
246                         __pNameEditField->ShowKeypad();
247                         return;
248                 }
249
250                 r = utf8.GetByteCount(__pNameEditField->GetText(), byteCount);
251                 __textLength = byteCount;
252         }
253
254         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
255 }
256
257 void
258 AlbumNameEditorForm::OnTextValueChangeCanceled(const Control& source)
259 {
260         AppLogDebug("ENTER");
261         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
262 }
263
264 result
265 AlbumNameEditorForm::OnTerminating(void)
266 {
267         AppLogDebug("ENTER");
268         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
269
270         return E_SUCCESS;
271 }
272
273 void AlbumNameEditorForm::OnFileOpInvalidate(enum FileActionMode actionId)
274 {
275         Invalidate(true);
276 }
277
278 void AlbumNameEditorForm::OnFileOpComplete(enum FileActionMode actionId, enum FileActionCompleteRes res)
279 {
280         _overlayMsg = false;
281         if (res != COMPLETE_SUCCESS)
282         {
283                 __pNameEditField->SetText(__nameEditFieldPreText);
284                 __pNameEditField->HideKeypad();
285                 __pNameEditField->Draw();
286                 SceneManager* pSceneManager = SceneManager::GetInstance();
287                 pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId));
288         }
289 }
290
291 void
292 AlbumNameEditorForm::OnRenameAlbum(String& strOri)
293 {
294         AppLogDebug("Rename Album");
295         String path;
296         int index = 0;
297         strOri.Reverse();
298         strOri.IndexOf(DIRECTORY_SEPARATOR, 0, index);
299         strOri.Reverse();
300         strOri.SubString(0, (strOri.GetLength() - index), path);
301         path.Append(__nameEditFieldText);
302
303         //Rename
304         result r = __pPresentationModel->RenameAlbum(strOri, path, this);
305
306         if (IsFailed(r))
307         {
308                 AppLogDebug("Unable to rename Album %s", GetErrorMessage(r));
309                 if (__pMessageBox == null)
310                 {
311                         __pMessageBox = new (std::nothrow) MessageBox();
312                         if (r == E_FILE_ALREADY_EXIST)
313                         {
314                                 __pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_MEDIABR_BODY_UNABLE_TO_RENAME_ALBUM_NAME_ALREADY_IN_USE_ABB"),
315                                                           MSGBOX_STYLE_NONE, 3000);
316
317                         }
318                         else
319                         {
320                                 __pMessageBox->Construct(L"", ResourceManager::GetString(L"IDS_MEDIABR_POP_UNABLE_TO_RENAME"),
321                                                           MSGBOX_STYLE_NONE, 3000);
322                         }
323                         int modalResult = 0;
324                         _overlayMsg = true;
325                         __pMessageBox->ShowAndWait(modalResult);
326                         _overlayMsg = false;
327                         delete __pMessageBox;
328                         __pMessageBox = null;
329                         __pNameEditField->SetEnabled(true);
330                         __pNameEditField->ShowKeypad();
331                 }
332         }
333         else
334         {
335                 //Add a popup here
336                 Rectangle clientRect = Form::GetBounds();
337                 Rectangle rect(0, 0, clientRect.width, clientRect.height);
338                 __pProgressAnim = new (std::nothrow) ProgressAnimation;
339                 __pProgressAnim->Construct(rect);
340                 AddControl(__pProgressAnim);
341                 __pProgressAnim->SetShowState(true);
342                 GetFooter()->SetEnabled(false);
343                 __pProgressAnim->AnimationStart();
344                 __pProgressAnim->Draw();
345                 _overlayMsg = true;
346         }
347 }
348
349 void
350 AlbumNameEditorForm::OnCreateAlbum(void)
351 {
352         String path;
353         __pNameEditField->HideKeypad();
354         __pNameEditField->RequestRedraw();
355         path.Append(Tizen::System::Environment::GetMediaPath());
356         path.Append(__nameEditFieldText);
357
358         if (__previousSceneId != IDSCN_ALL_LIST_EDITOR && __previousSceneId != IDSCN_ALL_LIST_SELECTION)
359         {
360                 Directory::Create(path, true);
361         }
362
363         __nameEditFieldPreText = __nameEditFieldText;
364
365         if (path.IsEmpty())
366         {
367                 AppLogDebug("EXIT 1(%s)", GetErrorMessage(GetLastResult()));
368                 delete __pMoveIndexList;
369                 __pMoveIndexList = null;
370                 return;
371         }
372
373         if (__pMoveIndexList == null || __pMoveIndexList->GetCount() <= 0)
374         {
375                 AppLogDebug("EXIT 2(%s)", GetErrorMessage(GetLastResult()));
376                 delete __pMoveIndexList;
377                 __pMoveIndexList = null;
378                 return;
379         }
380
381         delete __pFileMove;
382         GetMoveFileIndexList(path, __pMoveIndexList, __pFilePresentationModel);
383         __pFileMove = new (std::nothrow) FileMoveTimer(path, __pMoveIndexList, __pFilePresentationModel, this);
384         if (__fileActionMode == FILE_ACTION_COPY)
385         {
386                 AppLogDebug("Rash: Setting to Copy in AlbumNameEditor");
387                 __pFileMove->SetCopy();
388         }
389         else
390         {
391                 __pFileMove->ClearCopy();
392         }
393         result r = __pFileMove->StartTimer();
394
395         if (IsFailed(r))
396         {
397                 delete __pFileMove;
398                 __pFileMove = null;
399                 __pNameEditField->SetText(__nameEditFieldPreText);
400                 __pNameEditField->HideKeypad();
401                 __pNameEditField->Draw();
402                 AppLogDebug("MoveToContentFileList content failed (%s)", GetErrorMessage(r));
403                 SceneManager* pSceneManager = SceneManager::GetInstance();
404                 pSceneManager->GoBackward(BackwardSceneTransition(__callerSceneId));
405         }
406         else
407         {
408                 AppLogDebug("MoveToContentFileList content in progress");
409                 _overlayMsg = true;
410                 __fileActionMode = FILE_ACTION_MOVE;
411         }
412 }
413
414 void AlbumNameEditorForm::OnAlbumRenameComplete(void)
415 {
416         //Hide popup here..
417         __pProgressAnim->AnimationStop();
418         __pProgressAnim->SetShowState(false);
419         RemoveControl(__pProgressAnim);
420         _overlayMsg = false;
421         GetFooter()->SetEnabled(true);
422         SceneManager* pSceneManager = SceneManager::GetInstance();
423         pSceneManager->GoBackward((BackwardSceneTransition(IDSCN_ALBUM_LIST)));
424 }
425
426 void
427 AlbumNameEditorForm::OnActionPerformed(const Control& source, int actionId)
428 {
429         AppLogDebug("ENTER");
430         String path;
431         __nameEditFieldText = __pNameEditField->GetText();
432
433         if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_RENAME)
434         {
435                 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
436                 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(__folderIndex));
437                 path = pAlbumInfo->GetDirectory(0);
438         }
439
440         switch (actionId)
441         {
442         case IDA_BUTTON_CREATE_NAME_SAVE:
443         {
444                 __pNameEditField->SetEnabled(false);
445                 GetFooter()->SetItemEnabled(0, false);
446
447                 if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE)
448                 {
449                         OnCreateAlbum();
450                 }
451                 else if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_RENAME)
452                 {
453                         String albumName = __pNameEditField->GetText();
454                         if (__originalText.Equals(albumName, true))
455                         {
456                                 SceneManager* pSceneManager = SceneManager::GetInstance();
457                                 pSceneManager->GoBackward(BackwardSceneTransition());
458                         }
459                         else
460                         {
461                                 OnRenameAlbum(path);
462                         }
463                 }
464                 break;
465         }
466
467         default:
468                 break;
469         }
470         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
471 }
472
473 void
474 AlbumNameEditorForm::OnFormBackRequested(Form& source)
475 {
476         AppLogDebug("ENTER");
477         if (__pProgressAnim != null)
478         {
479                 if (__pProgressAnim->GetShowState())
480                 {
481                         return;
482                 }
483         }
484
485         if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE)
486         {
487                 SceneManager* pSceneManager = SceneManager::GetInstance();
488                 pSceneManager->GoForward(ForwardSceneTransition(__callerSceneId));
489         }
490         else
491         {
492                 SceneManager* pSceneManager = SceneManager::GetInstance();
493                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST_EDITOR));
494         }
495         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
496 }
497
498 void
499 AlbumNameEditorForm::OnSceneActivatedN(const SceneId& previousSceneId,
500                 const SceneId& currentSceneId, IList* pArgs)
501 {
502         AppLogDebug("ENTER");
503         __pPresentationModel = AlbumListPresentationModel::GetInstance();
504         __previousSceneId = previousSceneId;
505
506         __pNameEditField->SetEnabled(true);
507         __pPresentationModel->AddContentEventListener(this);
508
509         if (pArgs != null)
510         {
511                 Integer* pAlbumTypePtr = static_cast<Integer*>(pArgs->GetAt(ALBUM_FIRST_ELEMENT));
512                 if (pAlbumTypePtr->ToInt() == ALBUM_CREATE)
513                 {
514                         AppLogDebug("ALBUM_NAME_EDITOR_MODE_CREATE");
515                         __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_CREATE;
516                 }
517                 else if (pAlbumTypePtr->ToInt() == ALBUM_RENAME)
518                 {
519                         AppLogDebug("ALBUM_NAME_EDITOR_MODE_RENAME");
520                         __albumNameEditorMode = ALBUM_NAME_EDITOR_MODE_RENAME;
521                 }
522                 pArgs->RemoveAt(ALBUM_FIRST_ELEMENT, true);
523         }
524
525         if (pArgs != null)
526         {
527                 Integer* operationTypePtr = static_cast<Integer*>(pArgs->GetAt(ALBUM_FIRST_ELEMENT));
528                 if (operationTypePtr->ToInt() == FILE_ACTION_MOVE)
529                 {
530                         AppLogDebug("Rash: FILE_MOVE_ACTION");
531                         __fileActionMode = FILE_ACTION_MOVE;
532                 }
533                 else if (operationTypePtr->ToInt() == FILE_ACTION_COPY)
534                 {
535                         AppLogDebug("Rash: FILE_COPY_ACTION");
536                         __fileActionMode = FILE_ACTION_COPY;
537                 }
538                 pArgs->RemoveAt(ALBUM_FIRST_ELEMENT, true);
539         }
540
541         if (previousSceneId == IDSCN_ALBUM_LIST_EDITOR)
542         {
543                 if (pArgs != null)
544                 {
545                         IEnumerator* pEnum = pArgs->GetEnumeratorN();
546                         if (pEnum->MoveNext() == E_SUCCESS)
547                         {
548                                 Integer *index = static_cast<Integer*>(pEnum->GetCurrent());
549                                 if (index != null)
550                                 {
551                                         __folderIndex = index->ToInt();
552                                 }
553                         }
554                         delete pEnum;
555                         delete pArgs;
556                         pArgs = NULL;
557                 }
558         }
559
560         if (previousSceneId == IDSCN_ALL_LIST_EDITOR
561                         || previousSceneId == IDSCN_IMAGE_LIST_EDITOR
562                         || previousSceneId == IDSCN_VIDEO_LIST_EDITOR
563                         || previousSceneId == IDSCN_ALL_LIST_SELECTION)
564         {
565                 if (previousSceneId == IDSCN_ALL_LIST_EDITOR)
566                 {
567                         AppLogDebug("[MOVE] previousSceneId = IDSCN_ALL_LIST_EDITOR");
568                 }
569                 else if (previousSceneId == IDSCN_ALL_LIST_SELECTION)
570                 {
571                         AppLogDebug("[MOVE] previousSceneId = IDSCN_ALL_LIST_SELECTION");
572                 }
573
574                 __callerSceneId = previousSceneId;
575         }
576         else
577         {
578                 __callerSceneId = EMPTY_SPACE;
579         }
580
581         if (__albumNameEditorMode == ALBUM_NAME_EDITOR_MODE_CREATE)
582         {
583                 __nameEditFieldText = EMPTY_SPACE;
584                 __nameEditFieldPreText = EMPTY_SPACE;
585                 __pNameEditField->SetText(__nameEditFieldText);
586                 __nameEditFieldTempText = __nameEditFieldText;
587                 __pNameEditField->ShowKeypad();
588                 __pNameEditField->SetFocus();
589
590                 GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_MEDIABR_OPT_CREATE_ALBUM"));
591                 GetFooter()->SetItemEnabled(0, false);
592                 GetFooter()->Invalidate(true);
593         }
594         else
595         {
596                 int byteCount = 0;
597                 Utf8Encoding utf8;
598                 IList* pAlbumInfoList = __pPresentationModel->GetAlbumInfoList();
599                 AlbumInfo* pAlbumInfo = static_cast<AlbumInfo*>(pAlbumInfoList->GetAt(__folderIndex));
600
601                 String strName = pAlbumInfo->GetAlbumName();
602                 __nameEditFieldText = strName;
603                 __nameEditFieldPreText = strName;
604                 __pNameEditField->SetText(__nameEditFieldText);
605                 __nameEditFieldTempText = __nameEditFieldText;
606                 GetHeader()->SetTitleText(ResourceManager::GetString(L"IDS_COM_BODY_RENAME"));
607                 __pNameEditField->SetOverlayKeypadCommandButtonVisible(false);
608                 __pNameEditField->ShowKeypad();
609                 __pNameEditField->SetFocus();
610                 __originalText = __pNameEditField->GetText();
611                 utf8.GetByteCount(__nameEditFieldText, byteCount);
612                 __textLength = byteCount;
613                 GetFooter()->SetItemEnabled(0, true);
614                 GetFooter()->Invalidate(true);
615         }
616
617         if (pArgs != NULL)
618         {
619                 __pMoveIndexList = pArgs;
620         }
621
622         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
623 }
624
625 void
626 AlbumNameEditorForm::OnSceneDeactivated(const SceneId& currentSceneId,
627                 const SceneId& nextSceneId)
628 {
629         AppLogDebug("ENTER");
630         __pPresentationModel->RemoveContentEventListener(*this);
631         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
632 }
633
634 void
635 AlbumNameEditorForm::OnContentUpdated(void)
636 {
637         AppLogDebug("ENTER");
638
639         if (__mountState == false)
640         {
641                 SceneManager* pSceneManager = SceneManager::GetInstance();
642                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
643                 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
644         }
645         else
646         {
647                 __mountState = false;
648         }
649 }
650
651 void
652 AlbumNameEditorForm::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
653 {
654         AppLogDebug("ENTER");
655
656         if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED)
657         {
658                 if (__pFileMove && __pFileMove->IsStarted())
659                 {
660                         __pFileMove->Cancel();
661                         delete __pFileMove;
662                         __pFileMove = null;
663                 }
664                 __mountState = false;
665                 SceneManager* pSceneManager = SceneManager::GetInstance();
666                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST));
667                 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
668         }
669         else
670         {
671                 __mountState = true;
672         }
673         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
674 }
675
676 void
677 AlbumNameEditorForm::CreateMessage(String& str)
678 {
679         if (__pMessageBox == null)
680         {
681                 __pMessageBox = new(std::nothrow) MessageBox;
682
683                 if (__pMessageBox != null)
684                 {
685                         __pMessageBox->Construct(L"", str, MSGBOX_STYLE_OK, 3000);
686                         __pMessageBox->ShowAndWait(__modalMsgBoxResult);
687
688                         delete __pMessageBox;
689                         __pMessageBox = null;
690                         __modalMsgBoxResult = 0;
691                 }
692         }
693 }
694
695 void
696 AlbumNameEditorForm::OnOrientationChanged(const Tizen::Ui::Control &source, Tizen::Ui::OrientationStatus orientationStatus)
697 {
698         if (__pProgressAnim != null)
699         {
700                 __pProgressAnim->ChangeOrientation(Form::GetBounds());
701                 __pProgressAnim->Invalidate(true);
702         }
703 }