Adapt MMC event
authorHyukSoon Choi <hs619.choi@samsung.com>
Mon, 18 Mar 2013 12:58:44 +0000 (21:58 +0900)
committerHyukSoon Choi <hs619.choi@samsung.com>
Mon, 18 Mar 2013 12:58:44 +0000 (21:58 +0900)
Change-Id: I6b6634aaa49f5034335dc4e531cd05967df3bf60
Signed-off-by: HyukSoon Choi <hs619.choi@samsung.com>
inc/IvImageViewerApp.h
inc/IvTypes.h
src/IvImageViewerApp.cpp
src/IvTypes.cpp

index 0f0b4ad..e3ec078 100644 (file)
@@ -29,6 +29,7 @@
 class ImageViewerApp
        : public Tizen::App::UiApp
        , public Tizen::App::IAppControlProviderEventListener
 class ImageViewerApp
        : public Tizen::App::UiApp
        , public Tizen::App::IAppControlProviderEventListener
+       , public Tizen::System::IDeviceEventListener
        , public Tizen::System::ISettingEventListener
 {
 public:
        , public Tizen::System::ISettingEventListener
 {
 public:
@@ -50,6 +51,8 @@ public:
                        const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType,
                        const Tizen::Base::Collection::IMap* pExtraData);
 
                        const Tizen::Base::String* pUriData, const Tizen::Base::String* pMimeType,
                        const Tizen::Base::Collection::IMap* pExtraData);
 
+       virtual void OnDeviceStateChanged(Tizen::System::DeviceType deviceType, const Tizen::Base::String& state);
+
        virtual void OnSettingChanged(Tizen::Base::String& key);
 
        void SetFrameEnabled(bool enabled);
        virtual void OnSettingChanged(Tizen::Base::String& key);
 
        void SetFrameEnabled(bool enabled);
index 3d8b353..4efeaeb 100644 (file)
@@ -176,4 +176,7 @@ extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_MUSIC;
 extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE;
 extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE;
 
 extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE;
 extern const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE;
 
+extern const wchar_t* DEVICE_STORAGE_CARD_MOUNTED;
+extern const wchar_t* DEVICE_STORAGE_CARD_UNMOUNTED;
+
 #endif /* _IV_TYPES_H_ */
 #endif /* _IV_TYPES_H_ */
index ae71192..2293c0a 100644 (file)
@@ -103,6 +103,7 @@ ImageViewerApp::OnAppInitialized(void)
        pMainFrame->Construct();
        AddFrame(*pMainFrame);
 
        pMainFrame->Construct();
        AddFrame(*pMainFrame);
 
+       DeviceManager::AddDeviceEventListener(DEVICE_TYPE_STORAGE_CARD, *this);
        SettingInfo::AddSettingEventListener(*this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
        SettingInfo::AddSettingEventListener(*this);
        AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
 
@@ -215,6 +216,18 @@ ImageViewerApp::OnAppControlRequestReceived(RequestId reqId, const String& opera
 }
 
 void
 }
 
 void
+ImageViewerApp::OnDeviceStateChanged(DeviceType deviceType, const Tizen::Base::String& state)
+{
+       AppLogDebug("ENTER");
+       if (deviceType == DEVICE_TYPE_STORAGE_CARD
+                       && (state == DEVICE_STORAGE_CARD_MOUNTED || state == DEVICE_STORAGE_CARD_UNMOUNTED))
+       {
+               UiApp::GetInstance()->Terminate();
+       }
+       AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
+}
+
+void
 ImageViewerApp::OnSettingChanged(String& key)
 {
        AppLogDebug("ENTER");
 ImageViewerApp::OnSettingChanged(String& key)
 {
        AppLogDebug("ENTER");
index e8ad056..3f2ac5a 100644 (file)
@@ -127,3 +127,6 @@ const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_TRANSITION_EFFECT = L"TRANSITIO
 const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_MUSIC = L"MUSIC_VALUE";
 const wchar_t* ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE = L"REPEAT_VALUE";
 const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE = L"SHUFFLE_VALUE";
 const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SLIDESHOW_MUSIC = L"MUSIC_VALUE";
 const wchar_t* ENTRY_NAME_IMAGE_VIEWER_REPEAT_VALUE = L"REPEAT_VALUE";
 const wchar_t* ENTRY_NAME_IMAGE_VIEWER_SHUFFLE_VALUE = L"SHUFFLE_VALUE";
+
+const wchar_t* DEVICE_STORAGE_CARD_MOUNTED = L"Mounted";
+const wchar_t* DEVICE_STORAGE_CARD_UNMOUNTED = L"Unmounted";