From: HeeJu Kang Date: Thu, 14 Mar 2013 14:04:33 +0000 (+0900) Subject: Apply ACR X-Git-Tag: accepted/tizen_2.1/20130425.034720~82^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3e70658ba50fc117141ac06344f4608e4a70cff0;p=platform%2Fframework%2Fnative%2Fshell.git Apply ACR Change-Id: Ida9b5696e694b5010a62f78571de87db717e52bb Signed-off-by: HeeJu Kang --- diff --git a/inc/FShellIAppWidgetViewEventListener.h b/inc/FShellIAppWidgetViewEventListener.h new file mode 100644 index 0000000..121f69a --- /dev/null +++ b/inc/FShellIAppWidgetViewEventListener.h @@ -0,0 +1,108 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShellIAppWidgetViewEventListener.h + * @brief This is the header file for the %IAppWidgetViewEventListener interface. + * + * This header file contains the declarations of the %IAppWidgetViewEventListener interface. + */ + +#ifndef _FSHELL_IAPP_WIDGET_VIEW_EVENT_LISTENER_H_ +#define _FSHELL_IAPP_WIDGET_VIEW_EVENT_LISTENER_H_ + +#include + +namespace Tizen { namespace Shell +{ + +class LiveboxView; + +/* + * @interface IAppWidgetViewEventListener + * @brief This interface defines a listener for the AppWidgetView that receives AppWidgetProvider removed event. + * + * @since 2.1 + * + * The %IAppWidgetViewEventListener interface defines a listener for the AppWidgetView that receives AppWidgetProvider removed event. + */ +class _OSP_EXPORT_ IAppWidgetViewEventListener + : public Tizen::Base::Runtime::IEventListener +{ +public: + /* + * This polymorphic destructor should be overridden if required. + * This way, the destructors of the derived classes are called when the destructor of this interface is called. + * + * @since 2.1 + */ + virtual ~IAppWidgetViewEventListener(void) {} + + /* + * Called when a LiveboxProvider instance is about to be removed. @n + * + * @since 2.1 + * + * @param[in] liveboxView The source of the event + */ + virtual void OnAppWidgetProviderRemoved(LiveboxView& liveboxView) = 0; + +protected: + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // Following method is reserved and may change its name at any time without prior notice. + // + virtual void IAppWidgetViewEventListener_Reserved1(void) {} + + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // Following method is reserved and may change its name at any time without prior notice. + // + virtual void IAppWidgetViewEventListener_Reserved2(void) {} + + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // Following method is reserved and may change its name at any time without prior notice. + // + virtual void IAppWidgetViewEventListener_Reserved3(void) {} + + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // Following method is reserved and may change its name at any time without prior notice. + // + virtual void IAppWidgetViewEventListener_Reserved4(void) {} + + // + // This method is for internal use only. Using this method can cause behavioral, security-related, + // and consistency-related issues in the application. + // + // Following method is reserved and may change its name at any time without prior notice. + // + virtual void IAppWidgetViewEventListener_Reserved5(void) {} +}; + +}} // Tizen::Shell + +#endif /* _FSHELL_IAPP_WIDGET_VIEW_EVENT_LISTENER_H_ */ diff --git a/inc/FShellLiveboxView.h b/inc/FShellLiveboxView.h index c728581..eb84701 100644 --- a/inc/FShellLiveboxView.h +++ b/inc/FShellLiveboxView.h @@ -36,6 +36,9 @@ class String; namespace Tizen { namespace Shell { +class IAppWidgetViewEventListener; +class LiveboxProviderInfo; + /** * @class LiveboxView * @brief This class provides the view control for a LiveboxViewer. @@ -98,6 +101,47 @@ public: */ result Construct(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const Tizen::Base::String& userInfo); + /* + * Gets a LiveboxProviderInfo of the specified Livebox provider. + * + * @since 2.1 + * + * @return A pointer to the LiveboxProviderInfo of the specified LiveboxProvider@n + * else @c null if an error occurs + * @exception E_SUCCESS The method is successful. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_OBJ_NOT_FOUND The specified Livebox provider is not found. + * @remarks The specific error code can be accessed using the GetLastResult() method. + */ + LiveboxProviderInfo* GetAppWidgetProviderInfoN(void) const; + + /* + * Adds an IAppWidgetViewEventListener instance. @n + * + * @since 2.1 + * @return An error code + * @param[in] listener The listener to add @n + * The listener must be allocated at heap, not stack. + * @exception E_SUCCESS The method is successful. + * @exception E_OBJ_ALREADY_EXIST The listener has already been added. + * @see RemoveAppWidgetViewEventListener() + */ + result AddAppWidgetViewEventListener(IAppWidgetViewEventListener& listener); + + /* + * Removes an IAppWidgetViewEventListener instance. @n + * The removed listener cannot listen to the events when they are fired. + * + * @since 2.1 + * @return An error code + * @param[in] listener The listener to remove @n + * The listener should be referring to previously allocated instance which is passed as an argument to AddAppWidgetViewEventListener(). + * @exception E_SUCCESS The method is successful. + * @exception E_OBJ_NOT_FOUND The specified listener cannot be found. + * @see AddAppWidgetViewEventListener() + */ + result RemoveAppWidgetViewEventListener(IAppWidgetViewEventListener& listener); + protected: // // This method is for internal use only. Using this method can cause behavioral, security-related, diff --git a/src/FShellLiveboxView.cpp b/src/FShellLiveboxView.cpp index 7c17b3c..55f32b0 100644 --- a/src/FShellLiveboxView.cpp +++ b/src/FShellLiveboxView.cpp @@ -69,4 +69,41 @@ LiveboxView::Construct(const AppId& appId, const String& providerName, const Flo return r; } +LiveboxProviderInfo* +LiveboxView::GetAppWidgetProviderInfoN(void) const +{ + const _LiveboxViewImpl* pImpl = _LiveboxViewImpl::GetInstance(*this); + SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); + + LiveboxProviderInfo* pProviderInfo = pImpl->GetAppWidgetProviderInfoN(); + result r = GetLastResult(); + SysTryReturn(NID_UI_CTRL, pProviderInfo, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + return pProviderInfo; +} + +result +LiveboxView::AddAppWidgetViewEventListener(IAppWidgetViewEventListener& listener) +{ + _LiveboxViewImpl* pImpl = _LiveboxViewImpl::GetInstance(*this); + SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); + + result r = pImpl->AddAppWidgetViewEventListener(listener); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + return r; +} + +result +LiveboxView::RemoveAppWidgetViewEventListener(IAppWidgetViewEventListener& listener) +{ + _LiveboxViewImpl* pImpl = _LiveboxViewImpl::GetInstance(*this); + SysAssertf(pImpl != null, "Not yet constructed. Construct() should be called before use."); + + result r = pImpl->RemoveAppWidgetViewEventListener(listener); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + + return r; +} + }} // Tizen::Shell diff --git a/src/FShell_IAppWidgetViewEventListener.h b/src/FShell_IAppWidgetViewEventListener.h new file mode 100644 index 0000000..a0bb55f --- /dev/null +++ b/src/FShell_IAppWidgetViewEventListener.h @@ -0,0 +1,67 @@ +// +// Open Service Platform +// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://floralicense.org/license/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +/** + * @file FShell_IAppWidgetViewEventListener.h + * @brief This is the header file for the %_IAppWidgetViewEventListener interface. + * + * This header file contains the declarations of the %_IAppWidgetViewEventListener interface. + */ + +#ifndef _FSHELL_INTERNAL_IAPP_WIDGET_VIEW_EVENT_LISTENER_H_ +#define _FSHELL_INTERNAL_IAPP_WIDGET_VIEW_EVENT_LISTENER_H_ + +#include + +namespace Tizen { namespace Shell +{ + +class _LiveboxView; + +/* + * @interface _IAppWidgetViewEventListener + * @brief This interface defines a listener for the AppWidgetView that receives AppWidgetProvider removed event. + * + * @since 2.1 + * + * The %_IAppWidgetViewEventListener interface defines a listener for the AppWidgetView that receives AppWidgetProvider removed event. + */ +class _OSP_EXPORT_ _IAppWidgetViewEventListener + : public Tizen::Base::Runtime::IEventListener +{ +public: + /* + * This polymorphic destructor should be overridden if required. + * This way, the destructors of the derived classes are called when the destructor of this interface is called. + * + * @since 2.1 + */ + virtual ~_IAppWidgetViewEventListener(void) {} + + /* + * Called when a LiveboxProvider instance is about to be removed. @n + * + * @since 2.1 + * + * @param[in] liveboxView The source of the event + */ + virtual void OnAppWidgetProviderRemoved(_LiveboxView& liveboxView) = 0; +}; + +}} // Tizen::Shell + +#endif /* _FSHELL_INTERNAL_IAPP_WIDGET_VIEW_EVENT_LISTENER_H_ */ diff --git a/src/FShell_ILiveboxPopupViewEventListener.h b/src/FShell_ILiveboxPopupViewEventListener.h index 4236e9c..aec68c9 100644 --- a/src/FShell_ILiveboxPopupViewEventListener.h +++ b/src/FShell_ILiveboxPopupViewEventListener.h @@ -37,7 +37,7 @@ namespace Tizen { namespace Shell * software keypad related events. */ class _ILiveboxPopupViewEventListener - : virtual public Tizen::Base::Runtime::IEventListener + : public Tizen::Base::Runtime::IEventListener { public: /** diff --git a/src/FShell_LiveboxView.cpp b/src/FShell_LiveboxView.cpp old mode 100755 new mode 100644 index 9b4627d..2d60def --- a/src/FShell_LiveboxView.cpp +++ b/src/FShell_LiveboxView.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,8 @@ #include #include #include "FUi_TouchFlickGestureDetector.h" +#include "FShell_IAppWidgetViewEventListener.h" +#include "FShell_LiveboxManagerImpl.h" #include "FShell_LiveboxView.h" #include "FShell_LiveboxViewPresenter.h" #include "FShell_LiveboxPopupView.h" @@ -45,6 +48,7 @@ using namespace std; using namespace Tizen::App; using namespace Tizen::Base; +using namespace Tizen::Base::Collection; using namespace Tizen::Graphics; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; @@ -63,6 +67,7 @@ _LiveboxView::_LiveboxView(void) , __resizeFromRemote(false) , __updated(false) , __pixmap(-1) + , __pAppWidgetViewEventListenerList(new (std::nothrow) LinkedListT<_IAppWidgetViewEventListener*>) { __pLiveboxViewManager = _LiveboxViewManager::GetInstance(); SysTryReturnVoidResult(NID_UI_CTRL, __pLiveboxViewManager, E_SYSTEM, "[E_SYSTEM] A system error occurred."); @@ -155,6 +160,36 @@ _LiveboxView::Initialize(const AppId& appId, const Tizen::Base::String& provider return r; } +LiveboxProviderInfo* +_LiveboxView::GetAppWidgetProviderInfoN(void) const +{ + LiveboxProviderInfo* pProviderInfo = _LiveboxManagerImpl::GetInstance()->GetLiveboxProviderInfoN(GetAppId(), GetProviderName()); + result r = GetLastResult(); + SysTryReturn(NID_UI_CTRL, pProviderInfo, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + return pProviderInfo; +} + +result +_LiveboxView::AddAppWidgetViewEventListener(_IAppWidgetViewEventListener& listener) +{ + bool exist = __pAppWidgetViewEventListenerList->Contains(&listener); + SysTryReturn(NID_UI_CTRL, exist, E_OBJ_ALREADY_EXIST, E_OBJ_ALREADY_EXIST, "[%s] Propagating.", GetErrorMessage(E_OBJ_ALREADY_EXIST)); + + __pAppWidgetViewEventListenerList->Add(&listener); + + return E_SUCCESS; +} + +result +_LiveboxView::RemoveAppWidgetViewEventListener(_IAppWidgetViewEventListener& listener) +{ + result r = __pAppWidgetViewEventListenerList->Remove(&listener); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] Propagating.", GetErrorMessage(E_OBJ_NOT_FOUND)); + + return E_SUCCESS; +} + _LiveboxPopupView* _LiveboxView::GetLiveboxPopup(void) const { @@ -173,6 +208,12 @@ _LiveboxView::GetLiveboxId(void) const return __pLiveboxViewPresenter->GetLiveboxId(); } +String +_LiveboxView::GetProviderName(void) const +{ + return __pLiveboxViewPresenter->GetProviderName(); +} + Bitmap* _LiveboxView::GetAppIconBitmap(void) const { diff --git a/src/FShell_LiveboxView.h b/src/FShell_LiveboxView.h index baf8332..478c3d9 100644 --- a/src/FShell_LiveboxView.h +++ b/src/FShell_LiveboxView.h @@ -28,6 +28,7 @@ #include #include #include +#include #include "FUi_Control.h" #include "FUi_ITouchFlickGestureEventListener.h" #include "FUiAnim_VisualElement.h" @@ -52,7 +53,8 @@ class _TouchFlickGestureDetector; namespace Tizen { namespace Shell { - +class LiveboxProviderInfo; +class _IAppWidgetViewEventListener; class _LiveboxViewPresenter; class _LiveboxPopupView; @@ -71,9 +73,13 @@ public: virtual ~_LiveboxView(void); result Initialize(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const Tizen::Base::String& userInfo); + LiveboxProviderInfo* GetAppWidgetProviderInfoN(void) const; + result AddAppWidgetViewEventListener(_IAppWidgetViewEventListener& listener); + result RemoveAppWidgetViewEventListener(_IAppWidgetViewEventListener& listener); _LiveboxPopupView* GetLiveboxPopup(void) const; Tizen::Base::String GetAppId(void) const; Tizen::Base::String GetLiveboxId(void) const; + Tizen::Base::String GetProviderName(void) const; Tizen::Graphics::Bitmap* GetAppIconBitmap(void) const; Tizen::Graphics::Bitmap* GetBitmap(void) const; bool IsUpdated(void) const; @@ -154,6 +160,7 @@ private: } }; std::unique_ptr __pPixmapEventHandler; + std::unique_ptr > __pAppWidgetViewEventListenerList; }; // _LiveboxView }} // Tizen::Shell diff --git a/src/FShell_LiveboxViewImpl.cpp b/src/FShell_LiveboxViewImpl.cpp index 31480b5..85dab91 100644 --- a/src/FShell_LiveboxViewImpl.cpp +++ b/src/FShell_LiveboxViewImpl.cpp @@ -17,14 +17,18 @@ #include #include +#include +#include #include #include #include +#include #include "FShell_LiveboxViewImpl.h" using namespace std; using namespace Tizen::App; using namespace Tizen::Base; +using namespace Tizen::Base::Collection; using namespace Tizen::Graphics; namespace Tizen { namespace Shell @@ -62,11 +66,13 @@ _LiveboxViewImpl::CreateLiveboxViewImplN(LiveboxView& liveBoxView) _LiveboxViewImpl::_LiveboxViewImpl(LiveboxView* pPublic, _LiveboxView* pCore) : _ContainerImpl(pPublic, pCore) + , __pAppWidgetViewEventListenerList(new (std::nothrow) LinkedListT) { } _LiveboxViewImpl::~_LiveboxViewImpl(void) { + GetCore().RemoveAppWidgetViewEventListener(*this); } const char* @@ -99,13 +105,64 @@ _LiveboxViewImpl::GetCore(void) return static_cast<_LiveboxView&>(_ControlImpl::GetCore()); } +void +_LiveboxViewImpl::OnAppWidgetProviderRemoved(_LiveboxView& liveboxView) +{ + unique_ptr > pEnumerator(__pAppWidgetViewEventListenerList->GetEnumeratorN()); + if (pEnumerator) + { + while (pEnumerator->MoveNext() == E_SUCCESS) + { + IAppWidgetViewEventListener* pListener = null; + pEnumerator->GetCurrent(pListener); + + if (pListener) + { + pListener->OnAppWidgetProviderRemoved(GetPublic()); + } + } + } +} + result _LiveboxViewImpl::Initialize(const AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const String& userInfo) { result r = GetCore().Initialize(appId, providerName, rect, userInfo); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); + r = GetCore().AddAppWidgetViewEventListener(*this); + return r; } +LiveboxProviderInfo* +_LiveboxViewImpl::GetAppWidgetProviderInfoN(void) const +{ + LiveboxProviderInfo* pProviderInfo = GetCore().GetAppWidgetProviderInfoN(); + result r = GetLastResult(); + SysTryReturn(NID_UI_CTRL, pProviderInfo, null, r, "[%s] Propagating.", GetErrorMessage(r)); + + return pProviderInfo; +} + +result +_LiveboxViewImpl::AddAppWidgetViewEventListener(IAppWidgetViewEventListener& listener) +{ + bool exist = __pAppWidgetViewEventListenerList->Contains(&listener); + SysTryReturn(NID_UI_CTRL, exist, E_OBJ_ALREADY_EXIST, E_OBJ_ALREADY_EXIST, "[%s] Propagating.", GetErrorMessage(E_OBJ_ALREADY_EXIST)); + + __pAppWidgetViewEventListenerList->Add(&listener); + + return E_SUCCESS; +} + +result +_LiveboxViewImpl::RemoveAppWidgetViewEventListener(IAppWidgetViewEventListener& listener) +{ + result r = __pAppWidgetViewEventListenerList->Remove(&listener); + SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] Propagating.", GetErrorMessage(E_OBJ_NOT_FOUND)); + + return E_SUCCESS; +} + }} // Tizen::Shell diff --git a/src/FShell_LiveboxViewImpl.h b/src/FShell_LiveboxViewImpl.h index 66b6c6b..a9d8c08 100644 --- a/src/FShell_LiveboxViewImpl.h +++ b/src/FShell_LiveboxViewImpl.h @@ -17,9 +17,11 @@ #ifndef _FSHELL_INTERNAL_LIVEBOX_VIEW_IMPL_H_ #define _FSHELL_INTERNAL_LIVEBOX_VIEW_IMPL_H_ +#include #include #include #include "FUi_ContainerImpl.h" +#include "FShell_IAppWidgetViewEventListener.h" #include "FShell_LiveboxView.h" namespace Tizen { namespace Base @@ -38,6 +40,7 @@ namespace Tizen { namespace Shell class _LiveboxViewImpl : public Tizen::Ui::_ContainerImpl + , public _IAppWidgetViewEventListener { public: static _LiveboxViewImpl* CreateLiveboxViewImplN(LiveboxView& liveBoxView); @@ -53,6 +56,9 @@ public: virtual _LiveboxView& GetCore(void); result Initialize(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Graphics::FloatRectangle& rect, const Tizen::Base::String& userInfo); + LiveboxProviderInfo* GetAppWidgetProviderInfoN(void) const; + result AddAppWidgetViewEventListener(IAppWidgetViewEventListener& listener); + result RemoveAppWidgetViewEventListener(IAppWidgetViewEventListener& listener); protected: _LiveboxViewImpl(LiveboxView* pPublic, _LiveboxView* pCore); @@ -60,6 +66,11 @@ protected: private: _LiveboxViewImpl(const _LiveboxViewImpl& rhs); _LiveboxViewImpl& operator =(const _LiveboxViewImpl& rhs); + + virtual void OnAppWidgetProviderRemoved(_LiveboxView& liveboxView); + +private: + std::unique_ptr > __pAppWidgetViewEventListenerList; }; // _LiveboxViewImpl }} // Tizen::Shell diff --git a/src/FShell_LiveboxViewModel.cpp b/src/FShell_LiveboxViewModel.cpp index 7a430de..de33db2 100644 --- a/src/FShell_LiveboxViewModel.cpp +++ b/src/FShell_LiveboxViewModel.cpp @@ -89,7 +89,7 @@ _LiveboxViewModel::GetLiveboxId(void) const return __liveboxId; } -Tizen::Base::String +String _LiveboxViewModel::GetProviderName(void) const { return __providerName; diff --git a/src/FShell_LiveboxViewPresenter.cpp b/src/FShell_LiveboxViewPresenter.cpp index 710aedc..9bea087 100644 --- a/src/FShell_LiveboxViewPresenter.cpp +++ b/src/FShell_LiveboxViewPresenter.cpp @@ -93,6 +93,11 @@ _LiveboxViewPresenter::GetLiveboxId(void) const return __pLiveboxViewModel->GetLiveboxId(); } +String +_LiveboxViewPresenter::GetProviderName(void) const +{ + return __pLiveboxViewModel->GetProviderName(); +} String _LiveboxViewPresenter::GetDisplayName(void) const diff --git a/src/FShell_LiveboxViewPresenter.h b/src/FShell_LiveboxViewPresenter.h index 28c5df7..fd9a80e 100644 --- a/src/FShell_LiveboxViewPresenter.h +++ b/src/FShell_LiveboxViewPresenter.h @@ -53,6 +53,7 @@ public: result Initialize(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName); Tizen::App::AppId GetAppId(void) const; Tizen::Base::String GetLiveboxId(void) const; + Tizen::Base::String GetProviderName(void) const; Tizen::Base::String GetDisplayName(void) const; Tizen::Base::String GetAppIconPath(void) const;