* @brief This is the source file for FileUpdateTimer class.
*/
+#include <FIo.h>
+
#include "GlFileUpdateTimer.h"
#include "GlFileListPresentationModel.h"
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;
, __pContentManager(null)
{
__scanDirMap.Construct();
+ DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
}
FileUpdateTimer::~FileUpdateTimer(void)
{
+ AppLogDebug("ENTER");
+ DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
ScanDirectories();
delete __pUpdateIndexList;
delete __pContentManager;
+ AppLogDebug("EXIT");
}
IList *
FileUpdateTimer::TimerStart(void)
{
+ AppLogDebug("ENTER");
__pContentManager = new (std::nothrow) ContentManager();
__pContentManager->Construct();
IList* pCntIdList = __pFileUpdateManager->GetContentIdListAtIndexN(*__pUpdateIndexList);
+ AppLogDebug("EXIT");
return pCntIdList;
}
result
FileUpdateTimer::TimerExpired(const Object* contentId)
{
-
+ AppLogDebug("ENTER");
if (_actionId == FILE_ACTION_DELETE)
{
const ContentId* cntId = static_cast<const ContentId*>(contentId);
}
return r;
}
+ AppLogDebug("EXIT");
}
result
}
int
-FileUpdateTimer::GetDirScanCount() const
+FileUpdateTimer::GetDirScanCount()
{
+ 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();
}
+void
+FileUpdateTimer::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
+{
+ AppLogDebug("ENTER");
+ if (deviceType == DEVICE_TYPE_STORAGE_CARD && state == DEVICE_STORAGE_CARD_UNMOUNTED &&
+ _actionId == FILE_ACTION_DELETE)
+ {
+ 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");
+}
+
+void
+FileUpdateTimer::TimerCancel(int, enum FileActionCancelRes res)
+{
+ DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
+}
+void
+FileUpdateTimer::TimerComplete(int, enum FileActionCompleteRes res)
+{
+ DeviceManager::RemoveDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
+}