apply new API 'add_to_home_remove_shortcut'
authorjungmin76.park <jungmin76.park@samsung.com>
Mon, 1 Apr 2013 06:25:57 +0000 (15:25 +0900)
committerjungmin76.park <jungmin76.park@samsung.com>
Mon, 1 Apr 2013 06:25:57 +0000 (15:25 +0900)
Change-Id: I39c2fa825eda426748e5e1e6fa84ef76ba690417
Signed-off-by: jungmin76.park <jungmin76.park@samsung.com>
src/core/FShellShortcutManager.cpp
src/core/FShell_ShortcutManagerImpl.cpp

index 062f468..fd2b6e1 100644 (file)
@@ -80,18 +80,12 @@ ShortcutManager::AddShortcut(const AppId& appId, const String& displayName, cons
        result r = _AccessController::CheckUserPrivilege(_PRV_SHORTCUT_INSTALL);
        SysTryReturnResult(NID_SHELL, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
 
-       if( allowDuplication )
-       {
-               SysLog(NID_SHELL, "This feature(allowDuplication) is not yet implemented!");
-       }
-
        std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
        std::unique_ptr<char[]> pIcon(_StringConverter::CopyToCharArrayN(iconFilePath));
        std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(displayName));
        std::unique_ptr<char[]> pUriData(_StringConverter::CopyToCharArrayN(uriData));
-
        int type = (uriData.IsEmpty())? LAUNCH_BY_PACKAGE : LAUNCH_BY_URI;
-       //int ret = add_to_home_shortcut(pAppId.get(), pName.get(), type, pUriData.get(), pIcon.get(), NULL, this);
+
        int ret = add_to_home_shortcut(pAppId.get(), pName.get(), type, pUriData.get(), pIcon.get(), allowDuplication, NULL, this);
        SysTryReturnResult(NID_SHELL, ret == 0, E_SYSTEM, "Failed to add_to_home_shortcut");
 
@@ -99,6 +93,21 @@ ShortcutManager::AddShortcut(const AppId& appId, const String& displayName, cons
 }
 
 result
+ShortcutManager::RemoveShortcut(const Tizen::App::AppId& appId, const Tizen::Base::String& displayName)
+{
+       result r = _AccessController::CheckUserPrivilege(_PRV_SHORTCUT_INSTALL);
+       SysTryReturnResult(NID_SHELL, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method.");
+
+       std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId));
+       std::unique_ptr<char[]> pName(_StringConverter::CopyToCharArrayN(displayName));
+
+       int ret = add_to_home_remove_shortcut(pAppId.get(), pName.get(), "", null, this);
+       SysTryReturnResult(NID_SHELL, ret == 0, E_SYSTEM, "Failed to add_to_home_remove_shortcut");
+
+       return E_SUCCESS;
+}
+
+result
 ShortcutManager::AddShortcutRequestListener(IShortcutRequestListener& listener)
 {
        return __pShortcutManagerImpl->AddShortcutRequestListener(listener);
index ef6344a..95e7cba 100644 (file)
@@ -80,7 +80,14 @@ int ShortcutRequestEventHandlerCB(const char* appId, const char* text, int type,
                pListenerList->GetAt(i, pListener);
                if( pListener != null)
                {
-                       pListener->OnShortcutAddRequested(appId, text, icon, content_info);
+                       if( type == SHORTCUT_REMOVE)
+                       {
+                               pListener->OnShortcutRemoveRequested(appId, text);
+                       }
+                       else
+                       {
+                               pListener->OnShortcutAddRequested(appId, text, icon, content_info);
+                       }
                }
        }
 
@@ -95,7 +102,7 @@ int ShortcutRequestEventReceiverCB(const char* appId, const char* text, int type
 
        if( type == SHORTCUT_PACKAGE
                || type == SHORTCUT_DATA
-               || type == SHORTCUT_DATA)
+               || type == SHORTCUT_REMOVE)
        {
                ShortcutRequestEventHandlerCB(appId, text, type, content_info, icon, pid, period, allowDuplication, data);
        }