Add new api to set default app Drafts/for/tizen drafts/for/tizen
authorMyungki Lee <mk5004.lee@samsung.com>
Mon, 15 Feb 2016 08:26:47 +0000 (17:26 +0900)
committerMyungki Lee <mk5004.lee@samsung.com>
Mon, 15 Feb 2016 08:26:47 +0000 (17:26 +0900)
Change-Id: I4817da7afaf042182333f3aec045eb7da64ed988
Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
app_control/app_control.c
include/app_control.h

index 6771118ba3fb5603513ebd9351ca41512bbc1b11..f12a3f3ace00323eccf95b266442fc03f6ee11b8 100644 (file)
@@ -591,6 +591,34 @@ int app_control_get_launch_mode(app_control_h app_control,
        return APP_CONTROL_ERROR_NONE;
 }
 
+int app_control_set_defapp(app_control_h app_control, const char *defapp)
+{
+       int ret;
+       const char *op;
+       const char *mime_type;
+       const char *uri;
+
+       if (app_control == NULL || defapp == NULL)
+               app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       /* get op */
+       op = appsvc_get_operation(app_control->data);
+       if (op == NULL)
+               app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       /* get mime_type */
+       mime_type = appsvc_get_mime(app_control->data);
+
+       /* get uri */
+       uri = appsvc_get_uri(app_control->data);
+
+       ret = aul_svc_set_defapp(op, mime_type, uri, defapp);
+       if (ret < 0)
+               app_control_error(APP_CONTROL_ERROR_IO_ERROR, __FUNCTION__, NULL);
+
+       return APP_CONTROL_ERROR_NONE;
+}
+
 static void __update_launch_pid(int launched_pid, void *data)
 {
        app_control_h app_control;
index 2de89a60dfdffdc54081a67bdab58d8ae5cda85c..adb21c4b5403deec89bf31906e0368a0e2a84b7f 100644 (file)
@@ -1078,6 +1078,23 @@ int app_control_get_launch_mode(app_control_h app_control,
  * @see #APP_CONTROL_RESULT_APP_STARTED
  */
 int app_control_enable_app_started_result_event(app_control_h app_control);
+
+/**
+ * @brief Set the default application(package name) associated with op, uri and mime-type.
+ *
+ * @since_tizen 3.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/systemsettings.admin
+ * @param[in] app_control The app_control handle
+ * @param[in] defapp    default application
+ *
+ * @return 0 on success, otherwise a negative error value
+ * @retval #APP_CONTROL_ERROR_NONE Successful
+ * @retval #APP_CONTROL_ERROR_IO_ERROR IO error
+ * @retval #APP_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ */
+int app_control_set_defapp(app_control_h app_control, const char *defapp);
 /**
  * @}
  */