apply new API 'add_to_home_remove_shortcut'
[platform/framework/native/shell.git] / src / core / FShellShortcutManager.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);