#include "mf-ug-dlog.h"
#include "mf-ug-search.h"
+#include "mf-ug-util.h"
#include "mf-ug-search-internal.h"
int mf_ug_search_start(mf_search_handle handle,
const char **root_path,
unsigned int path_num,
- const char *needle,
+ char *needle,
mf_search_option option,
void *user_data,
mf_search_filter_cb func,
int category)
{
+ ugData *ugd = (ugData *)user_data;
+ ug_mf_retvm_if(ugd == NULL, MF_SEARCH_ERROR_INVAL_P, "ugd is NULL");
+
int ret = 0;
if (!handle) {
return MF_SEARCH_ERROR_INVAL_P;
if (!needle && !func) {
return MF_SEARCH_ERROR_INVAL_P;
}
+ if (ugd->ug_UiGadget.ug_iFilterMode == SHOW_BY_EXTENSION && ugd->ug_UiGadget.mime) {
+ ug_debug("Multiple needle search in haystack...");
+ char mul_ext[1024] = "";
+ strcpy(mul_ext, ugd->ug_UiGadget.file_ext[0]);
+ for (int i = 1; i < ugd->ug_UiGadget.ext_len; i++) {
+ strcat(mul_ext, ";");
+ strcat(mul_ext, ugd->ug_UiGadget.file_ext[i]);
+ if (g_strcmp0(ugd->ug_UiGadget.file_ext[i], "opml") == 0) {
+ ugd->ug_UiGadget.ug_iImportMode = 1;
+ }
+ }
+ needle = g_strdup(mul_ext);
+ }
+ ug_debug("needle is : [%s]", needle);
ret = _mf_ug_search_start((ms_handle_t *) handle, root_path, path_num, needle, option, user_data, func, category);
if (ret < 0) {
- ms_error("Fail to start search ");
+ ug_error("Fail to start search ");
}
return ret;
}
#include <errno.h>
#include <sys/time.h>
+#include <mime_type.h>
#include <media_content.h>
#include <Elementary.h>
#include <system_settings.h>
ugd->ug_UiGadget.ug_iFilterMode = SHOW_FOLDER_LIST;
} else if (!strncmp(mime_type, UG_FILE_MIME_TYPE_ALL, strlen(mime_type))) {
ugd->ug_UiGadget.ug_iFilterMode = SHOW_ALL_LIST;
+ } else {
+ ugd->ug_UiGadget.ug_iFilterMode = SHOW_BY_EXTENSION;
+ ugd->ug_UiGadget.mime = mime_type;
+ char **file_ext = NULL;
+ int arr_len = 0;
+ int ret = mime_type_get_file_extension(ugd->ug_UiGadget.mime, &file_ext, &arr_len);
+ ugd->ug_UiGadget.file_ext = file_ext;
+ ugd->ug_UiGadget.ext_len = arr_len;
+ if (ret == MIME_TYPE_ERROR_NONE) {
+ ug_debug("Various file extensions for mime_type %s are :", ugd->ug_UiGadget.mime);
+ for (int i = 0; i < arr_len; i++) {
+ ug_debug("[%s]", file_ext[i]);
+ }
+ ugd->ug_UiGadget.ug_pExtension = strdup(file_ext[0]);
+ if (g_strcmp0(file_ext[0], "opml") == 0) {
+ ugd->ug_UiGadget.ug_iImportMode = 1;
+ }
+ }
}
}
if (ugd->ug_UiGadget.ug_iFilterMode != SHOW_BY_EXTENSION) {
}
#endif
+static bool __mf_main_app_control_extra_data_cb(app_control_h app_control, const char *key, void *user_data)
+{
+ char *value = NULL;
+ app_control_get_extra_data(app_control, key, &value);
+ ug_debug("key: %s, value: %s", key, value);
+ UG_SAFE_FREE_CHAR(value);
+
+ return true;
+}
+
/******************************
** Prototype : __mf_ug_main_set_option_status
** Description : Samsung
char *mime_type = NULL;
char *title = NULL;
char *domain = NULL;
+ char *uri = NULL;
char *key[UG_OPTION_COUNT] = { "path", "select_type", "file_type",
"marked_mode", "default ringtone",
"view_mode", "title", "domain"
char *operation = NULL;
app_control_clone(&(ugd->service), app_control);
app_control_get_operation(app_control, &operation);
- ug_error("operation is [%s]", operation);
+ ug_debug("operation is [%s]", operation);
+ app_control_get_uri(app_control, &uri);
+ ug_debug("uri is [%s]", uri);
+ app_control_get_mime(app_control, &mime_type);
+ ug_debug("mime is [%s]", mime_type);
+ ug_debug(">>>>>>>>>>>>>>>>>>> Listing all app_control key-value pair <<<<<<<<<<<<<<<<<<<");
+ app_control_foreach_extra_data(app_control, __mf_main_app_control_extra_data_cb, NULL);
+ ug_debug(">>>>>>>>>>>>>>>>>>> End Listing all app_control key-value pair <<<<<<<<<<<<<<<<<<<");
app_control_get_extra_data(app_control, key[0], &path);
app_control_get_extra_data(app_control, key[1], &select_mode);
app_control_get_extra_data(app_control, key[2], &filter_mode);
app_control_get_extra_data(app_control, key[5], &view_mode);
app_control_get_extra_data(app_control, key[6], &title);
app_control_get_extra_data(app_control, key[7], &domain);
- app_control_get_mime(app_control, &mime_type);
SECURE_ERROR("path is [%s] select_mode is [%s] filter_mode is [%s] marked_mode is [%s] default_ringtone is [%s] view_mode is [%s] title is [%s] domain is [%s]",
path, select_mode, filter_mode, marked_mode, default_ringtone, view_mode, title, domain);
} else {
__mf_ug_main_set_select_mode(ugd, select_mode);
- ug_error("mime_type is [%s]", mime_type);
- if (mime_type) {
- __mf_ug_main_set_filter_by_mime(ugd, mime_type);
- } else {
- __mf_ug_main_set_filter_mode(ugd, filter_mode);
- }
-
#ifdef UG_OPERATION_SELECT_MODE
char *operation_select_mode = NULL;
app_control_get_extra_data(app_control, APP_CONTROL_DATA_SELECTION_MODE, &operation_select_mode);
app_control_get_extra_data(app_control, APP_CONTROL_DATA_TOTAL_COUNT, &number);
__mf_ug_main_set_max_len_option(ugd, number);
+ if (mime_type) {
+ ug_debug("Setting filter by mime_type [%s]", mime_type);
+ __mf_ug_main_set_filter_by_mime(ugd, mime_type);
+ ugd->ug_UiGadget.ug_iSelectMode = IMPORT_PATH_SELECT_MODE;
+ } else {
+ ug_debug("Setting filter by filter_mode [%s]", filter_mode);
+ __mf_ug_main_set_filter_mode(ugd, filter_mode);
+ }
+
+ if (mime_type) {
+ char *storage_path = NULL;
+ storage_path = strstr(uri, PHONE_FOLDER);
+ if (storage_path == NULL) {
+ storage_path = strstr(uri, MEMORY_FOLDER);
+ if (storage_path == NULL) {
+ path = NULL;
+ } else {
+ path = MEMORY_FOLDER;
+ }
+ } else {
+ path = PHONE_FOLDER;
+ }
+
+ if (path != NULL) {
+ ug_debug("Storage path is: %s", path);
+ ugd->ug_Status.ug_pPath = g_string_new(path);
+ if (ugd->ug_Status.ug_iViewType == mf_ug_view_root) {
+ ugd->ug_Status.ug_iViewType = mf_ug_view_normal;
+ mf_ug_navi_bar_create_default_view(ugd);
+ mf_ug_util_path_push(ugd->ug_Status.ug_pPath->str, ugd->ug_Status.ug_iViewType);
+ } else {
+ mf_ug_navi_bar_create_default_view(ugd);
+ mf_ug_util_path_push(ugd->ug_Status.ug_pPath->str, ugd->ug_Status.ug_iViewType);
+ }
+ }
+ }
+
UG_SAFE_FREE_CHAR(number);
UG_SAFE_FREE_CHAR(path);
UG_SAFE_FREE_CHAR(select_mode);