using namespace Tizen::Base::Utility;
using namespace Tizen::Content;
using namespace Tizen::Io;
+using namespace Tizen::System;
using namespace Tizen::Ui;
using namespace Tizen::Ui::Controls;
using namespace Tizen::Ui::Scenes;
, __scanDirMap(SingleObjectDeleter)
, __pContentManager(null)
{
+ AppLogDebug("ENTER");
__scanDirMap.Construct();
+ DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
+ AppLogDebug("EXIT");
}
FileMoveTimer::~FileMoveTimer(void)
{
AppLogDebug("ENTER");
+ DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
ScanDirectories();
delete __pMoveIndexList;
delete __pContentManager;
}
if (File::IsFileExist(__moveToDir) == false)
{
- Directory::Create(__moveToDir, true);
+ result r = Directory::Create(__moveToDir, true);
+ AppLog("The directory create result is 2(%s)", GetErrorMessage(r));
+
+ if ( r == E_STORAGE_FULL)
+ {
+ return null;
+ }
+
}
- __scanDirMap.Add(new String(__moveToDir), new Integer(0));
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
IList* pCntIdList = __pPresentationModel->GetContentIdListAtIndexN(*__pMoveIndexList);
return pCntIdList;
__scanDirMap.Add(new String(dirPath), new Integer(0));
}
}
+ if (!__scanDirMap.ContainsKey(__moveToDir))
+ {
+ __scanDirMap.Add(new String(__moveToDir), new Integer(0));
+ }
}
return r;
}
FileMoveTimer::TimerCancel(int, enum FileActionCancelRes res)
{
AppLogDebug("ENTER");
+ DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
if (res == CANCEL_USER || (res == CANCEL_SYS_ERROR && GetMovedCount() > 0) )
{
String albumName = __pPresentationModel->ConvertToAlbumName(__moveToDir);
}
int
-FileMoveTimer::GetDirScanCount() const
+FileMoveTimer::GetDirScanCount()
{
AppLogDebug("ENTER");
+ IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN();
+ String* pKey = null;
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pKey = static_cast< String* > (pMapEnum->GetKey());
+ if (File::IsFileExist(*pKey) == false)
+ {
+ __scanDirMap.Remove(*pKey);
+ }
+ }
+ delete pMapEnum;
return __scanDirMap.GetCount();
}
FileMoveTimer::TimerComplete(int, enum FileActionCompleteRes res)
{
AppLogDebug("ENTER");
+ DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
String albumName = __pPresentationModel->ConvertToAlbumName(__moveToDir);
if (albumName != EMPTY_SPACE)
{
__isCopyOperation = false;
}
+
+
+void
+FileMoveTimer::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
+{
+ AppLogDebug("ENTER");
+ if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED)
+ {
+ String sdcPath = Environment::GetExternalStoragePath();
+ IMapEnumerator* pMapEnum = __scanDirMap.GetMapEnumeratorN();
+ String* pKey = null;
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pKey = static_cast< String* > (pMapEnum->GetKey());
+ if (pKey->StartsWith(sdcPath, 0))
+ {
+ __scanDirMap.Remove(*pKey);
+ }
+ }
+ delete pMapEnum;
+ }
+ AppLogDebug("EXIT");
+}