2 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * This file is part of the Manage Applications
5 * Written by Eunmi Son <eunmi.son@samsung.com>
8 * Janusz Kozerski <j.kozerski@samsung.com>
10 * PROPRIETARY/CONFIDENTIAL
12 * This software is the confidential and proprietary information of
13 * SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
14 * disclose such Confidential Information and shall use it only in
15 * accordance with the terms of the license agreement you entered
16 * into with SAMSUNG ELECTRONICS.
18 * SAMSUNG make no representations or warranties about the suitability
19 * of the software, either express or implied, including but not limited
20 * to the implied warranties of merchantability, fitness for a particular
21 * purpose, or non-infringement. SAMSUNG shall not be liable for any
22 * damages suffered by licensee as a result of using, modifying or
23 * distributing this software or its derivatives.
30 #include "certificates/certificate_util.h"
31 #include "certificates/certificates.h"
33 static void copy(char *source, char *dest);
35 static char *sd_dir_path = PATH_SDCARD;
36 //static char *sd_dir_path = PATH_CERT_WAC; // This path can be use for testing instead PATH_SDCARD
37 static char *user_dir_path = PATH_CERT_USER;
39 static struct ug_data *ad;
40 static struct ListElement *firstListElement;
41 static struct ListElement *lastListElement;
43 void user_search_cert_cb(void *data, Evas_Object *obj, void *event_info) {
45 ad = (struct ug_data *) data;
46 Evas_Object *list = NULL;
48 firstListElement = initList();
49 lastListElement = firstListElement;
51 list = elm_list_add(ad->win_main);
52 elm_list_mode_set(list, ELM_LIST_COMPRESS);
53 evas_object_smart_callback_add(list, "selected", list_clicked_cb, NULL);
55 if(make_list(ad, list, sd_dir_path, lastListElement, TO_INSTALL)){
56 Evas_Object *no_content = elm_layout_add(ad->win_main);
57 elm_layout_theme_set(no_content, "layout", "nocontents", "text");
58 elm_object_part_text_set(no_content, "elm.text", dgettext(PACKAGE, "IDS_COM_BODY_NO_CONTENTS"));
59 evas_object_size_hint_weight_set(no_content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
60 evas_object_show(no_content);
62 elm_naviframe_item_push(ad->navi_bar, dgettext(PACKAGE, "SEARCHED_CERTIFICATE"), NULL, NULL, no_content, NULL);
64 Elm_Object_Item *itm = NULL;
65 itm = elm_naviframe_item_push(ad->navi_bar, dgettext(PACKAGE, "SEARCHED_CERTIFICATE"), NULL, NULL, list, NULL);
67 Evas_Object *back = NULL;
68 back = elm_object_item_part_content_get(itm, "prev_btn");
69 evas_object_smart_callback_add(back, "clicked", back_cb, ad);
75 void install_cb(void *data, Evas_Object *obj, void *event_info) {
77 struct ListElement *listElement = (struct ListElement *) data;
78 char *file_name = listElement->name;
79 LOGD("%s", file_name);
82 sprintf(buf_src, "%s/%s", sd_dir_path, file_name);
83 sprintf(buf_dst, "%s/%s", user_dir_path, file_name);
84 LOGD("Start copying");
85 copy(buf_src, buf_dst);
88 deleteList(firstListElement);
91 elm_naviframe_item_pop(ad->navi_bar);
94 static void copy(char *source, char *dest) {
96 if (!source || !dest) {
97 LOGD("Null pointer to files");
102 result = asprintf(&command, "cp %s %s", source, dest);
103 if(command == NULL && result != -1){
104 LOGD("Error while allocating memory");
105 return; //Error while allocating memory
109 result = system(command);
110 LOGD("%s --- return %d", command, result);
113 LOGD("copy() - done");