* The %ILiveboxAddRequestListener interface defines a listener for a Livebox viewer(eg, Home screen, Lock screen) that receives request to add Livebox
*/
class _OSP_EXPORT_ ILiveboxAddRequestListener
- : public Tizen::Base::Runtime::IEventListener
+ : virtual public Tizen::Base::Runtime::IEventListener
{
public:
/**
* @see LiveboxManager::AddLivebox()
*/
virtual void OnLiveboxAddRequested(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& text, const Tizen::Base::String& userInfo) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxAddReqeustListener_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxAddReqeustListener_Reserved2(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral,
+ // security-related, and consistency-related issues in the application.
+ //
+ // @since 2.1
+ //
+ virtual void ILiveboxAddReqeustListener_Reserved3(void) {}
+
};
}} // Tizen::Shell
Tizen::Base::Collection::IList* GetLiveboxProviderInfoListN();
/**
- * Gets a list of installed LiveboxProviderInfo
+ * Gets a LiveboxProviderInfo of the specified Livebox provider.
*
* @since 2.1
*
LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
/**
+ * Gets the LiveboxProviderInfo of default Livebox provider in the package.
+ *
+ * @since 2.1
+ *
+ * @param[in] packageId The Id of the packageId that contains Livebox provider
+ * @return A pointer to the LiveboxProviderInfo of the default LiveboxProvider@n
+ * else @c null if there is no default Livebox provider or an error occurs
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_APP_NOT_INSTALLED The application is not installed.
+ * @exception E_SYSTEM The method cannot proceed due to a severe system error.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ */
+ LiveboxProviderInfo* GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId);
+
+ /**
* Sets a Livebox request listener. @n
* The listener gets notified when the request is recieved. @n
* To unset the listener, pass a @c null value to the pListener parameter.
/**
* @file FShellLiveboxProviderManager.h
- * @brief This is the header file for the %LiveboxManager class.
+ * @brief This is the header file for the %LiveboxProviderManager class.
*
* This header file contains the declarations of the %LiveboxProviderManager class.
*/
*
* @final This class is not intended for extension.
*
- * The %LiveboxManager class manages all the Livebox providers.
+ * The %LiveboxProviderManager class manages all the Livebox providers.
* The livebox manager manages static and run time Livebox information.
*/
class _OSP_EXPORT_ LiveboxProviderManager
*
* @since 2.1
*
- * @return A pointer to the %LiveboxManager instance, @n
+ * @return A pointer to the %LiveboxProviderManager instance, @n
* else @c null if it fails
*/
static LiveboxProviderManager* GetInstance();
LiveboxProviderInfo*
LiveboxManager::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
{
- // TODO : set configurationAppcontrolAppId
return __pLiveboxManagerImpl->GetLiveboxProviderInfoN(appId, providerName);
}
+LiveboxProviderInfo*
+LiveboxManager::GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId)
+{
+ return __pLiveboxManagerImpl->GetDefaultLiveboxProviderInfoN(packageId);
+}
+
result
LiveboxManager::SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener)
{
__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()
{
delete __pLiveboxProviderInfoImpl;
return __pLiveboxProviderInfoImpl->GetSizeInfoListN();
}
+bool
+LiveboxProviderInfo::IsDefault() const
+{
+ SysAssert(__pLiveboxProviderInfoImpl);
+ return __pLiveboxProviderInfoImpl->IsDefault();
+}
+
}} // Tizen::Shell
#include <FApp.h>
#include <FGrpDimension.h>
#include <FApp_AppImpl.h>
+#include <FBase_StringConverter.h>
#include <FShellLiveboxProviderInfo.h>
#include <FShellLiveboxProvider.h>
livebox_service_fini();
}
-
_LiveboxManagerImpl*
_LiveboxManagerImpl::GetInstance()
{
String providerId(pProviderId);
String appId;
- String name;
+ String providerName;
- if( providerId.StartsWith("com.samsung", 0) == true)// for core livebox (plugin)
- {
- appId = providerId;
- name = L"";
- }
- else
- {
- _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, appId, name);
- }
+ _LiveboxManagerImpl::ExtractAppIdAndProviderName(providerId, appId, providerName);
- LiveboxProviderInfo* pInfo = _LiveboxManagerImpl::GetInstance()->GetLiveboxProviderInfoN(appId, name);
+ LiveboxProviderInfo* pInfo = _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(appId, providerName, is_prime);
+// _LiveboxProviderInfoImpl::GetImpl(*pInfo)->__isDefault = is_prime;
pLiveboxProviderInfos->Add(*pInfo);
- _LiveboxProviderInfoImpl::GetImpl(*pInfo)->__isDefault = is_prime;
return 0;
}
-// 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)
-//{
-// String configurationAppControlAppId(pConfigurationAppControlAppId);
-// IList* pLiveboxProviderInfos = static_cast<IList*>(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()
{
SysLog(NID_APP, "Failed to invoke livebox_service_get_pkglist, ret (%d)", ret);
}
-// 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);
-// }
-
if (pLiveboxProviders->GetCount() <= 0)
{
return null;
return _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(appId, providerName);
}
+const int PROVIDER_NAME_MAX = 256;
+char __tempDefaultProviderResult[PROVIDER_NAME_MAX];
+
+// c style callback for livebox_service_get_pkglist
+int GetDefaultLiveboxProviderInfoCallback(const char *packageId, const char *pProviderId, int is_prime, void *data)
+{
+ SysLog(NID_APP, "%s, %s", packageId, pProviderId);
+ char* pInputProviderId = static_cast<char*>(data);
+ SysTryReturn(NID_APP, pInputProviderId, 0, E_SYSTEM, "[E_SYSTEM] system error.");
+
+ if( strncmp(packageId, pInputProviderId, PROVIDER_NAME_MAX) == 0)
+ {
+ strncpy(__tempDefaultProviderResult, pProviderId, PROVIDER_NAME_MAX);
+ return -1;
+ }
+
+ return 0;
+}
+
+LiveboxProviderInfo*
+_LiveboxManagerImpl::GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId)
+{
+ memset(__tempDefaultProviderResult, 0, sizeof(__tempDefaultProviderResult));
+
+ LiveboxProviderInfo* pInfo = null;
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+
+ int ret = livebox_service_get_pkglist(GetDefaultLiveboxProviderInfoCallback, pPackageId.get());
+ if (ret < 0)
+ {
+ SysLog(NID_APP, "Failed to invoke livebox_service_get_pkglist, ret (%d)", ret);
+ }
+ String defaultProvider(__tempDefaultProviderResult);
+ if( !defaultProvider.IsEmpty())
+ {
+ String appId;
+ String providerName;
+ _LiveboxManagerImpl::ExtractAppIdAndProviderName(__tempDefaultProviderResult, appId, providerName);
+
+ pInfo = _LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(appId, providerName, true);
+// _LiveboxProviderInfoImpl::GetImpl(*pInfo)->__isDefault = true;
+ }
+ return pInfo;
+}
+
+
+bool __isDefault;
+// c style callback for livebox_service_get_pkglist
+int IsLiveboxProviderDefaultInfoCallback(const char *packageId, const char *pProviderId, int is_prime, void *data)
+{
+ __isDefault = false;
+ SysLog(NID_APP, "%s, %s", packageId, pProviderId);
+ char* pInputProviderId = static_cast<char*>(data);
+ SysTryReturn(NID_APP, pInputProviderId, 0, E_SYSTEM, "[E_SYSTEM] system error.");
+
+ if( strncmp(packageId, pInputProviderId, 256) == 0)
+ {
+ __isDefault = is_prime;
+ return -1;
+ }
+
+ return 0;
+}
+
+bool
+_LiveboxManagerImpl::IsLiveboxProviderDefault(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
+{
+ __isDefault = false;
+
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(_LiveboxManagerImpl::MakeProviderName(appId, providerName)));
+
+ int ret = livebox_service_get_pkglist(IsLiveboxProviderDefaultInfoCallback, pPackageId.get());
+ if (ret < 0)
+ {
+ SysLog(NID_APP, "Failed to invoke livebox_service_get_pkglist, ret (%d)", ret);
+ }
+
+ return __isDefault;
+}
// c - style callback for shortcut_set_request_cb
int LiveboxRequestEventHandler(const char* providerId, const char* text, int type, const char* content_info, const char* icon, int pid, double period, void *data)
result
_LiveboxManagerImpl::ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName)
{
- int index = 0;
+ if( providerId.StartsWith("com.samsung", 0) == true)// for core livebox (plugin)
+ {
+ appId = providerId;
+ providerName = L"";
+ }
+ else
+ {
+ int index = 0;
- providerId.IndexOf(".", 11, index);
- providerId.SubString(0, index, appId);
- providerId.SubString(index+1, providerName);
+ providerId.IndexOf(".", 11, index);
+ providerId.SubString(0, index, appId);
+ providerId.SubString(index+1, providerName);
+ }
return E_SUCCESS;
}
+String
+_LiveboxManagerImpl::MakeProviderName(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName)
+{
+ String providerId;
+
+ if( appId.StartsWith("com.samsung", 0) == true)// for core livebox (plugin)
+ {
+ // or providerName.IsEmpty()
+ providerId = appId;
+ }
+ else
+ {
+ // for web
+ if (appId.IsEmpty())
+ {
+ providerId.Format(128, L"%ls", providerName.GetPointer() );
+ }
+ else
+ {
+ providerId.Format(128, L"%ls.%ls", appId.GetPointer(), providerName.GetPointer() );
+ }
+ }
+
+ return providerId;
+}
+
}} // Tizen::Shell
#include <FBase_StringConverter.h>
#include <FShellLiveboxProviderInfo.h>
#include <FShellLiveboxSizeInfo.h>
+#include "FShell_LiveboxManagerImpl.h"
#include "FShell_LiveboxProviderInfoImpl.h"
#include "FShell_LiveboxSizeInfoImpl.h"
_LiveboxProviderInfoImpl::_LiveboxProviderInfoImpl(const Tizen::App::AppId& appId, const Tizen::Base::String& name)
:__appId(appId)
,__name(name)
+ ,__isDefault(false)
{
- 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() );
- }
- }
+ __providerId = _LiveboxManagerImpl::MakeProviderName(appId, name);
std::unique_ptr<char[]> pProviderId(_StringConverter::CopyToCharArrayN(__providerId));
__displayName = livebox_service_i18n_name(pProviderId.get(), null);
return __configurationAppControlAppId;
}
+bool
+_LiveboxProviderInfoImpl::IsDefault() const
+{
+ return __isDefault;
+}
+
Tizen::Base::Collection::IList*
_LiveboxProviderInfoImpl::GetSizeInfoListN() const
{
return new (std::nothrow) LiveboxProviderInfo(appId, providerName);
}
+LiveboxProviderInfo*
+_LiveboxProviderInfoImpl::GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, bool isDefault)
+{
+ LiveboxProviderInfo* pInfo = new (std::nothrow) LiveboxProviderInfo(appId, providerName);
+ SysTryReturn(NID_APP, pInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Failed to allocate memory for LiveboxProviderInfo." );
+
+ _LiveboxProviderInfoImpl::GetImpl(*pInfo)->__isDefault = isDefault;
+
+ return pInfo;
+}
+
_LiveboxProviderInfoImpl*
_LiveboxProviderInfoImpl::GetImpl(const LiveboxProviderInfo& liveboxProviderInfo)
{
}
else*/
{
- return _LiveboxManagerProxy::GetInstance()->RequestUpdate(appId, providerName, argument);
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestUpdate(appId, providerName, argument);
}
}
}
else
{
- return _LiveboxManagerProxy::GetInstance()->RequestUpdateInstance(instanceId, argument);
+ _LiveboxManagerProxy* pProxy = _LiveboxManagerProxy::GetInstance();
+ SysTryReturnResult(NID_APP, pProxy, E_SYSTEM, "Failed to get proxy instance!");
+
+ return pProxy->RequestUpdateInstance(instanceId, argument);
}
return E_SUCCESS;
__appId = appId;
__providerName = providerName;
- if (__providerName.IsEmpty())
+ // todo : _LiveboxManagerImpl::MakeProviderName
+ if (providerName.IsEmpty())
{
__liveboxId = __appId;
}
else
{
- if (__appId.IsEmpty())
+ if (appId.IsEmpty())
{
- __liveboxId = __providerName;
+ __liveboxId = providerName;
}
else
{
- __liveboxId = __appId + L"." + __providerName;
+ __liveboxId = appId + L"." + providerName;
}
}
// API impl
Tizen::Base::Collection::IList* GetLiveboxProviderInfoListN();
LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+ LiveboxProviderInfo* GetDefaultLiveboxProviderInfoN(const Tizen::App::PackageId& packageId);
result SetLiveboxAddRequestListener(ILiveboxAddRequestListener* pListener);
// internal
ILiveboxAddRequestListener* GetAddRequestListener();
+ static bool IsLiveboxProviderDefault(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);// temp
// helper
static result ExtractAppIdAndProviderName(const Tizen::Base::String& providerId, Tizen::App::AppId& appId, Tizen::Base::String& providerName);
+ static Tizen::Base::String MakeProviderName(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
private:
_LiveboxManagerImpl();
Tizen::Base::String GetConfigurationAppControlAppId() const;
+ bool IsDefault() const;
+
/**
* Gets a list of LiveboxSizeInfo of the Livebox
*
// internal
static LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName);
+ static LiveboxProviderInfo* GetLiveboxProviderInfoN(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, bool isDefault);
static _LiveboxProviderInfoImpl* GetImpl(const LiveboxProviderInfo& liveboxProviderInfo);
*/
_LiveboxProviderInfoImpl& operator =(const _LiveboxProviderInfoImpl& rhs);
-public:
- bool __isDefault;//TODO:temporary public
-
private:
Tizen::Base::String __appId;
Tizen::Base::String __name;
+ bool __isDefault;
Tizen::Base::String __providerId;
Tizen::Base::String __displayName; //TODO:temporary public
Tizen::Base::String __configurationAppControlAppId; //TODO:temporary public