From 9887867434b277d8d539bf6d874868e769f5ff4b Mon Sep 17 00:00:00 2001 From: "jungmin76.park" Date: Thu, 31 Jan 2013 22:34:13 +0900 Subject: [PATCH] fix configurationAppControlAppId problem Change-Id: I6f93e245326ee6e6c7ba564875b64bcde143adfe Signed-off-by: jungmin76.park --- inc/FShellLiveboxProviderInfo.h | 11 ++--- src/FShellLiveboxManager.cpp | 2 +- src/FShellLiveboxPopupProvider.cpp | 2 +- src/FShellLiveboxProvider.cpp | 2 +- src/FShellLiveboxProviderInfo.cpp | 39 +++++------------ src/FShellLiveboxProviderManager.cpp | 2 +- src/FShellLiveboxSizeInfo.cpp | 2 +- src/FShellQuickPanelFrame.cpp | 2 +- src/FShell_LiveboxManagerImpl.cpp | 71 +++++++++++++++---------------- src/FShell_LiveboxProviderInfoImpl.cpp | 34 +++++++++++---- src/inc/FShell_LiveboxManagerIpcMessage.h | 1 + src/inc/FShell_LiveboxProviderInfoImpl.h | 31 +++----------- 12 files changed, 91 insertions(+), 108 deletions(-) diff --git a/inc/FShellLiveboxProviderInfo.h b/inc/FShellLiveboxProviderInfo.h index 85d344b..dccc57b 100644 --- a/inc/FShellLiveboxProviderInfo.h +++ b/inc/FShellLiveboxProviderInfo.h @@ -118,15 +118,16 @@ public: * LiveboxProviderInfo* pProviderInfo = LiveboxManager::GetInstance()->GetLiveboxProviderInfoN(appId, providerName); * if( !pProviderInfo->GetConfigurationAppControlAppId().IsEmpty ) * { - * AppControl* pAc = AppManager::FindAppControl(pProviderInfo->GetConfigurationAppControlAppId(), L"http://tizen.org/appcontrol/operation/livebox/configuration"); - - * HashMap map(SingleObjectDeletor); + * AppControl* pAc = AppManager::FindAppControlN(pProviderInfo->GetConfigurationAppControlAppId(), L"http://tizen.org/appcontrol/operation/livebox/configuration"); + * + * HashMap map(); * map.Construct(); * String key = L"ProviderName"; * String value = pProviderInfo->GetName(); * map.Add(&key, &value ); - - * pAc.Start(null, null, &map, null); + * + * pAc->Start(null, null, &map, null); + * delete pAc; * } * delete pProviderInfo; * @endcode diff --git a/src/FShellLiveboxManager.cpp b/src/FShellLiveboxManager.cpp index 7980203..ebbb016 100644 --- a/src/FShellLiveboxManager.cpp +++ b/src/FShellLiveboxManager.cpp @@ -65,7 +65,7 @@ LiveboxManager::GetInstance() static LiveboxManager* pLiveboxManager = null; if( pLiveboxManager == null) { - pLiveboxManager = new LiveboxManager; + pLiveboxManager = new (std::nothrow) LiveboxManager; SysTryReturn(NID_APP, pLiveboxManager, null, E_OUT_OF_MEMORY, "E_OUT_OF_MEMORY" ); result r = pLiveboxManager->Construct(); diff --git a/src/FShellLiveboxPopupProvider.cpp b/src/FShellLiveboxPopupProvider.cpp index a190606..fdf12d4 100644 --- a/src/FShellLiveboxPopupProvider.cpp +++ b/src/FShellLiveboxPopupProvider.cpp @@ -49,7 +49,7 @@ result LiveboxPopupProvider::Construct(const String& instanceId) { SysLog(NID_APP, ""); - __pLiveboxPopupProviderImpl = new _LiveboxPopupProviderImpl(instanceId); + __pLiveboxPopupProviderImpl = new (std::nothrow) _LiveboxPopupProviderImpl(instanceId); SysTryReturnResult(NID_APP, __pLiveboxPopupProviderImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); return E_SUCCESS; diff --git a/src/FShellLiveboxProvider.cpp b/src/FShellLiveboxProvider.cpp index 1a5ba01..34fbf5f 100644 --- a/src/FShellLiveboxProvider.cpp +++ b/src/FShellLiveboxProvider.cpp @@ -46,7 +46,7 @@ result LiveboxProvider::Construct(const String& instanceId) { SysLog(NID_APP, ""); - __pLiveboxProviderImpl = new _LiveboxProviderImpl(instanceId); + __pLiveboxProviderImpl = new (std::nothrow) _LiveboxProviderImpl(instanceId); SysTryReturnResult(NID_APP, __pLiveboxProviderImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); return E_SUCCESS; diff --git a/src/FShellLiveboxProviderInfo.cpp b/src/FShellLiveboxProviderInfo.cpp index 72ee55a..db8c2f0 100644 --- a/src/FShellLiveboxProviderInfo.cpp +++ b/src/FShellLiveboxProviderInfo.cpp @@ -43,41 +43,24 @@ namespace Tizen { namespace Shell LiveboxProviderInfo::LiveboxProviderInfo(const Tizen::App::AppId& appId, const Tizen::Base::String& name) { - String providerId; - if( appId.StartsWith("com.samsung", 0) == true)// for core livebox (plugin) - { - providerId = appId; - } - else - { - // for web - if (appId.IsEmpty()) - { - providerId.Format(128, L"%ls", name.GetPointer() ); - } - else - { - providerId.Format(128, L"%ls.%ls", appId.GetPointer(), name.GetPointer() ); - } - } - __pLiveboxProviderInfoImpl = new _LiveboxProviderInfoImpl(appId, name, providerId); + __pLiveboxProviderInfoImpl = new (std::nothrow) _LiveboxProviderInfoImpl(appId, name); } LiveboxProviderInfo::LiveboxProviderInfo(const LiveboxProviderInfo& rhs) { SysAssert(rhs.__pLiveboxProviderInfoImpl); - __pLiveboxProviderInfoImpl = new _LiveboxProviderInfoImpl(rhs.__pLiveboxProviderInfoImpl->__appId, rhs.__pLiveboxProviderInfoImpl->__name, rhs.__pLiveboxProviderInfoImpl->__providerId); + __pLiveboxProviderInfoImpl = new (std::nothrow) _LiveboxProviderInfoImpl(rhs.__pLiveboxProviderInfoImpl->__appId, rhs.__pLiveboxProviderInfoImpl->__name); } -/*LiveboxProviderInfo& -LiveboxProviderInfo::operator =(const LiveboxProviderInfo& rhs) -{ - __pLiveboxProviderInfoImpl->__appId = rhs.__pLiveboxProviderInfoImpl->__appId; - __pLiveboxProviderInfoImpl->__name = rhs.__pLiveboxProviderInfoImpl->__name; - __pLiveboxProviderInfoImpl->__providerId = rhs.__pLiveboxProviderInfoImpl->__providerId; - - return *this; -}*/ +//LiveboxProviderInfo& +//LiveboxProviderInfo::operator =(const LiveboxProviderInfo& rhs) +//{ +// __pLiveboxProviderInfoImpl->__appId = rhs.__pLiveboxProviderInfoImpl->__appId; +// __pLiveboxProviderInfoImpl->__name = rhs.__pLiveboxProviderInfoImpl->__name; +// __pLiveboxProviderInfoImpl->__providerId = rhs.__pLiveboxProviderInfoImpl->__providerId; +// +// return *this; +//} LiveboxProviderInfo::~LiveboxProviderInfo() { diff --git a/src/FShellLiveboxProviderManager.cpp b/src/FShellLiveboxProviderManager.cpp index 8639080..cc5f6f6 100644 --- a/src/FShellLiveboxProviderManager.cpp +++ b/src/FShellLiveboxProviderManager.cpp @@ -66,7 +66,7 @@ LiveboxProviderManager::GetInstance() static LiveboxProviderManager* pLiveboxManager = null; if( pLiveboxManager == null) { - pLiveboxManager = new LiveboxProviderManager; + pLiveboxManager = new (std::nothrow) LiveboxProviderManager; SysTryReturn(NID_APP, pLiveboxManager, null, E_OUT_OF_MEMORY, "E_OUT_OF_MEMORY" ); result r = pLiveboxManager->Construct(); diff --git a/src/FShellLiveboxSizeInfo.cpp b/src/FShellLiveboxSizeInfo.cpp index dbc9121..12c366a 100644 --- a/src/FShellLiveboxSizeInfo.cpp +++ b/src/FShellLiveboxSizeInfo.cpp @@ -39,7 +39,7 @@ namespace Tizen { namespace Shell LiveboxSizeInfo::LiveboxSizeInfo(Dimension size, const String& previewImagePath) { - __pLiveboxSizeInfoImpl = new _LiveboxSizeInfoImpl(size, previewImagePath); + __pLiveboxSizeInfoImpl = new (std::nothrow) _LiveboxSizeInfoImpl(size, previewImagePath); } LiveboxSizeInfo::LiveboxSizeInfo(const LiveboxSizeInfo& rhs) diff --git a/src/FShellQuickPanelFrame.cpp b/src/FShellQuickPanelFrame.cpp index 0475c80..ba9891a 100644 --- a/src/FShellQuickPanelFrame.cpp +++ b/src/FShellQuickPanelFrame.cpp @@ -76,7 +76,7 @@ QuickPanelFrame::Construct(const Tizen::Base::String& resourceId) SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); // Parse UiBuilder XML file - unique_ptr<_UiBuilder> pBuilder(new _UiBuilder()); + unique_ptr<_UiBuilder> pBuilder(new (std::nothrow) _UiBuilder()); SysTryReturn(NID_UI_CTRL, pBuilder, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); r = pBuilder->Construct(resourceId, this); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); diff --git a/src/FShell_LiveboxManagerImpl.cpp b/src/FShell_LiveboxManagerImpl.cpp index 7846b76..b14abbd 100644 --- a/src/FShell_LiveboxManagerImpl.cpp +++ b/src/FShell_LiveboxManagerImpl.cpp @@ -128,41 +128,39 @@ int GetLiveboxProviderInfoCallback(const char *packageId, const char *pProviderI } // c - style callback for shortcut_get_list -int GetConfigurableLiveboxInfosCallback(const char* pConfigurationAppControlAppId, const char* pIcon, const char* pDisplayName, const char* pExtraKey, const char* pExtraData, void* data) -{ -// SysLog(NID_APP, "pConfigurationAppControlAppId(%s), pDisplayName(%s)", pConfigurationAppControlAppId, pDisplayName); - - String configurationAppControlAppId(pConfigurationAppControlAppId); - IList* pLiveboxProviderInfos = static_cast(data); - SysTryReturn(NID_APP, pLiveboxProviderInfos, 0, E_SYSTEM, "[E_SYSTEM] system error."); - - for(int i = 0; i < pLiveboxProviderInfos->GetCount(); i ++ ) - { - LiveboxProviderInfo* pProviderInfo = (LiveboxProviderInfo*)pLiveboxProviderInfos->GetAt(i); - SysAssert(pProviderInfo); - - String shortcutPackageId; - configurationAppControlAppId.SubString(0, 10, shortcutPackageId); - - String liveboxPackageId; - pProviderInfo->GetAppId().SubString(0, 10, liveboxPackageId); - - if( shortcutPackageId == liveboxPackageId) - { - _LiveboxProviderInfoImpl::GetImpl(*pProviderInfo)->__configurationAppControlAppId = configurationAppControlAppId; - _LiveboxProviderInfoImpl::GetImpl(*pProviderInfo)->__displayName = pDisplayName; - SysLog(NID_APP, "pConfigurationAppControlAppId(%s), pDisplayName(%s), pExtraKey(%s), pExtraData(%s)", pConfigurationAppControlAppId, pDisplayName, pExtraKey, pExtraData); - break; - } - } - - return 0; -} +//int GetConfigurableLiveboxInfosCallback(const char* pConfigurationAppControlAppId, const char* pIcon, const char* pDisplayName, const char* pExtraKey, const char* pExtraData, void* data) +//{ +// String configurationAppControlAppId(pConfigurationAppControlAppId); +// IList* pLiveboxProviderInfos = static_cast(data); +// SysTryReturn(NID_APP, pLiveboxProviderInfos, 0, E_SYSTEM, "[E_SYSTEM] system error."); +// +// for(int i = 0; i < pLiveboxProviderInfos->GetCount(); i ++ ) +// { +// LiveboxProviderInfo* pProviderInfo = (LiveboxProviderInfo*)pLiveboxProviderInfos->GetAt(i); +// SysAssert(pProviderInfo); +// +// String shortcutPackageId; +// configurationAppControlAppId.SubString(0, 10, shortcutPackageId); +// +// String liveboxPackageId; +// pProviderInfo->GetAppId().SubString(0, 10, liveboxPackageId); +// +// if( shortcutPackageId == liveboxPackageId) +// { +// _LiveboxProviderInfoImpl::GetImpl(*pProviderInfo)->__configurationAppControlAppId = configurationAppControlAppId; +// _LiveboxProviderInfoImpl::GetImpl(*pProviderInfo)->__displayName = pDisplayName; +// SysLog(NID_APP, "pConfigurationAppControlAppId(%s), pDisplayName(%s), pExtraKey(%s), pExtraData(%s)", pConfigurationAppControlAppId, pDisplayName, pExtraKey, pExtraData); +// break; +// } +// } +// +// return 0; +//} Tizen::Base::Collection::IList* _LiveboxManagerImpl::GetLiveboxProviderInfoListN() { - std::unique_ptr pLiveboxProviders(new ArrayList()); + std::unique_ptr pLiveboxProviders(new (std::nothrow) ArrayList()); SysTryReturn(NID_APP, pLiveboxProviders.get(), null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory"); pLiveboxProviders->Construct(); @@ -174,12 +172,11 @@ _LiveboxManagerImpl::GetLiveboxProviderInfoListN() // SysTryReturn(NID_APP, ret >= 0, null, E_SYSTEM, "[E_SYSTEM] Failed to invoke livebox_service_get_pkglist, ret (%d)", ret); - ret = shortcut_get_list(null, GetConfigurableLiveboxInfosCallback, pLiveboxProviders.get()); - if (ret < 0) - { - SysLog(NID_APP, "Failed to invoke shortcut_get_list, ret (%d)", ret); - } -// SysTryReturn(NID_APP, ret >= 0, null, E_SYSTEM, "[E_SYSTEM] Failed to invoke shortcut_get_list, ret (%d)", ret); +// ret = shortcut_get_list(null, GetConfigurableLiveboxInfosCallback, pLiveboxProviders.get()); +// if (ret < 0) +// { +// SysLog(NID_APP, "Failed to invoke shortcut_get_list, ret (%d)", ret); +// } if (pLiveboxProviders->GetCount() <= 0) { diff --git a/src/FShell_LiveboxProviderInfoImpl.cpp b/src/FShell_LiveboxProviderInfoImpl.cpp index 062048d..f09dc4e 100644 --- a/src/FShell_LiveboxProviderInfoImpl.cpp +++ b/src/FShell_LiveboxProviderInfoImpl.cpp @@ -37,14 +37,32 @@ using namespace Tizen::Base::Collection; using namespace Tizen::Graphics; -_LiveboxProviderInfoImpl::_LiveboxProviderInfoImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& name, const Tizen::Base::String& providerId) +_LiveboxProviderInfoImpl::_LiveboxProviderInfoImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& name) + :__appId(appId) + ,__name(name) { - __appId = appId; - __name = name; - __providerId = providerId; + if( appId.StartsWith("com.samsung", 0) == true)// for core livebox (plugin) + { + __providerId = appId; + } + else + { + // for web + if (appId.IsEmpty()) + { + __providerId.Format(128, L"%ls", name.GetPointer() ); + } + else + { + __providerId.Format(128, L"%ls.%ls", appId.GetPointer(), name.GetPointer() ); + } + } - std::unique_ptr pPackageId(_StringConverter::CopyToCharArrayN(__providerId)); - __displayName = livebox_service_i18n_name(pPackageId.get(), null); + std::unique_ptr pProviderId(_StringConverter::CopyToCharArrayN(__providerId)); + __displayName = livebox_service_i18n_name(pProviderId.get(), null); + __configurationAppControlAppId = livebox_service_setup_appid(pProviderId.get()); + + SysLog(NID_APP, "%ls.%ls, displayName(%ls), configuration(%ls)", appId.GetPointer(), name.GetPointer(), __displayName.GetPointer(), __configurationAppControlAppId.GetPointer() ); } /*_LiveboxProviderInfoImpl::_LiveboxProviderInfoImpl(const _LiveboxProviderInfoImpl& rhs) @@ -117,7 +135,7 @@ _LiveboxProviderInfoImpl::GetSizeInfoListN() const SysTryReturn(NID_APP, supportedSizeCount > 0, null, E_INVALID_ARG, "[E_INVALID_ARG] There is no livebox of provider(%ls)",__providerId.GetPointer() ); - ArrayList* pSizes = new ArrayList; + ArrayList* pSizes = new (std::nothrow) ArrayList; pSizes->Construct(); Dimension size(0, 0); String previewImagePath; @@ -134,7 +152,7 @@ _LiveboxProviderInfoImpl::GetSizeInfoListN() const LiveboxProviderInfo* _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName) { - return new LiveboxProviderInfo(appId, providerName); + return new (std::nothrow) LiveboxProviderInfo(appId, providerName); } _LiveboxProviderInfoImpl* diff --git a/src/inc/FShell_LiveboxManagerIpcMessage.h b/src/inc/FShell_LiveboxManagerIpcMessage.h index 76442cf..436c488 100644 --- a/src/inc/FShell_LiveboxManagerIpcMessage.h +++ b/src/inc/FShell_LiveboxManagerIpcMessage.h @@ -33,6 +33,7 @@ // Message to service IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestUpdate, Tizen::Base::String, Tizen::Base::String, Tizen::Base::String, result) IPC_SYNC_MESSAGE_CONTROL2_1(LiveboxManager_RequestUpdateInstance, Tizen::Base::String, Tizen::Base::String, result) + IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSharedMemoryId, Tizen::Base::String, int, int, int) IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSharedMemoryIdForPD, Tizen::Base::String, int, int, int) IPC_SYNC_MESSAGE_CONTROL3_1(LiveboxManager_RequestSyncSharedMemory, Tizen::Base::String, int, int, result) diff --git a/src/inc/FShell_LiveboxProviderInfoImpl.h b/src/inc/FShell_LiveboxProviderInfoImpl.h index 51e2a5c..42c645d 100644 --- a/src/inc/FShell_LiveboxProviderInfoImpl.h +++ b/src/inc/FShell_LiveboxProviderInfoImpl.h @@ -16,19 +16,18 @@ // /** - * @file FShell_LiveboxInfoImpl.h + * @file FShell_LiveboxProviderInfoImpl.h * @brief This is the header file for the _LiveboxInfoImpl class. * * This header file contains the declarations of the _LiveboxInfoImpl class. */ -#ifndef _FSHELL_LIVEBOXINFOIMPL_H_ -#define _FSHELL_LIVEBOXINFOIMPL_H_ +#ifndef _FSHELL_INTERNAL_LIVEBOX_PROVIDER_INFO_IMPL_H_ +#define _FSHELL_INTERNAL_LIVEBOX_PROVIDER_INFO_IMPL_H_ #include #include #include -//#include namespace Tizen { namespace Shell { @@ -42,7 +41,7 @@ public: * * @since 2.1 */ - _LiveboxProviderInfoImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& name, const Tizen::Base::String& providerId); + _LiveboxProviderInfoImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& name); /** * This destructor overrides Tizen::Base::Object::~Object(). @@ -138,15 +137,14 @@ private: _LiveboxProviderInfoImpl& operator =(const _LiveboxProviderInfoImpl& rhs); public: - Tizen::Base::String __configurationAppControlAppId; //TODO:temporary public - Tizen::Base::String __displayName; //TODO:temporary public bool __isDefault;//TODO:temporary public private: Tizen::Base::String __appId; Tizen::Base::String __name; Tizen::Base::String __providerId; - + Tizen::Base::String __displayName; //TODO:temporary public + Tizen::Base::String __configurationAppControlAppId; //TODO:temporary public // Tizen::Base::String __iconPath; Tizen::Base::Collection::ArrayList __sizeInfos; @@ -155,20 +153,5 @@ private: // friend class _LiveboxManagerImpl; }; -/*class _LiveboxInfoImpl { -public: - _LiveboxInfoImpl(); - virtual ~_LiveboxInfoImpl(); - -// result Construct(const Tizen::App::AppId& appId, Tizen::Base::Collection::IListT& dimensions); - - const Tizen::App::AppId& GetAppId() const; - Tizen::Base::Collection::ArrayListT* GetSupprtedDimensionsN() const; - -private: - Tizen::App::AppId __appId; - Tizen::Base::Collection::ArrayListT __supportedDimensions; -};*/ - }} // Tizen::Shell -#endif /* _FSHELL_LIVEBOXINFOIMPL_H_ */ +#endif // _FSHELL_INTERNAL_LIVEBOX_PROVIDER_INFO_IMPL_H_ -- 2.7.4