(void)app_control_get_extra_data(service, "default_substitution",
&ad->default_substitution);
-
(void)app_control_get_extra_data_array(service, APP_CONTROL_DATA_SELECTED, &paths, &paths_len);
if (paths_len > 0) {
- ad->appctl_file_path = strdup(paths[0]);
+ ad->appctl_file_path = strndup(paths[0], PATH_MAX);
} else {
ad->appctl_file_path = strdup("");
}
paths = NULL;
paths_len = 0;
(void)app_control_get_extra_data_array(service, APP_CONTROL_DATA_PATH, &paths, &paths_len);
+ ad->appctl_dir_path = NULL;
if (paths_len > 0) {
- ad->appctl_dir_path = strdup(paths[0]);
- } else {
- ad->appctl_dir_path = strdup("");
+
+ /* This is the situation when someone has chosen one of
+ * the default paths as extension path. In this case we
+ * can't list directory twice. */
+ ad->appctl_dir_path = strndup(paths[0], PATH_MAX);
+ if (!strncmp(paths[0], RINGTONE_DIR_PATH, PATH_MAX) ||
+ !strncmp(paths[0], RINGTONE_DIR_PATH_1, PATH_MAX)) {
+ ad->show_notification = false;
+ free(ad->appctl_dir_path);
+ ad->appctl_dir_path = NULL;
+ SETTING_TRACE("Caller has selected "\
+ "ringtone path as extension path");
+ }
+
+ if (!strncmp(paths[0], ALERT_DIR_PATH, PATH_MAX) ||
+ !strncmp(paths[0], ALERT_DIR_PATH_1, PATH_MAX)) {
+ ad->show_notification = true;
+ free(ad->appctl_dir_path);
+ ad->appctl_dir_path = NULL;
+ SETTING_TRACE("Caller has selected "\
+ "notification path as extension path");
+ }
}
free(paths);
- if (!ad->appctl_dir_path || strnlen(ad->appctl_dir_path, PATH_MAX) == 0)
- SETTING_TRACE("dir path is NULL, setting only defaults will be shown %s", _TZ_SYS_SHARE"/settings/Ringtones");
+ if (!ad->appctl_dir_path || strnlen(ad->appctl_dir_path, PATH_MAX) == 0) {
+ if (!ad->show_notification) {
+ SETTING_TRACE("custom dir path is NULL, only setting "\
+ "defaults will be shown %s",
+ _TZ_SYS_SHARE"/settings/Ringtones");
+ } else {
+ SETTING_TRACE("custom dir path is NULL, only setting "\
+ "defaults will be shown %s",
+ _TZ_SYS_SHARE"/settings/Alerts");
+ }
+ }
- if (!ad->appctl_file_path || strnlen(ad->appctl_file_path, PATH_MAX))
- SETTING_TRACE("selected path is NULL, setting to default ring tone");
+ if (!ad->appctl_file_path || strnlen(ad->appctl_file_path, PATH_MAX)) {
+ if (!ad->show_notification) {
+ SETTING_TRACE("custom selected path is NULL, "\
+ "setting to default ring tone");
+ } else {
+ SETTING_TRACE("custom selected path is NULL, "\
+ "setting to default notification tone");
+ }
+ }
SETTING_TRACE("caller is settings app: %d %s", ad->caller_is_settings_app, caller_id);
- SETTING_TRACE("dir path: %s", ad->appctl_dir_path);
- SETTING_TRACE("current file path: %s", ad->appctl_file_path);
+ SETTING_TRACE("custom dir path: %s", ad->appctl_dir_path);
+ SETTING_TRACE("custom selected file path: %s", ad->appctl_file_path);
if (ad->default_substitution)
- SETTING_TRACE("Default file path will be set to %s",
+ SETTING_TRACE("Default Item file path will be set to %s",
ad->default_substitution);
free(caller_id);