2 * Copyright (c) 2000-2012 Samsung Electronics Co., Ltd All Rights Reserved
4 * This file is part of the ug-memo-efl
5 * Written by Zhibin Zhou <zhibin.zhou@samsung.com>, Canjiang Lu <canjiang.lu@samsung.com>,
6 * Feng Li <feng.li@samsung.com>
8 * PROPRIETARY/CONFIDENTIAL
10 * This software is the confidential and proprietary information of
11 * SAMSUNG ELECTRONICS ("Confidential Information").
12 * You shall not disclose such Confidential Information and shall
13 * use it only in accordance with the terms of the license agreement
14 * you entered into with SAMSUNG ELECTRONICS. SAMSUNG make no
15 * representations or warranties about the suitability
16 * of the software, either express or implied, including but not
17 * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
18 * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
19 * a result of using, modifying or distributing this software or its derivatives.
24 #include <unicode/ustring.h>
25 #include <unicode/utypes.h>
26 #include <unicode/udat.h>
27 #include <unicode/udatpg.h>
28 #include <iniparser.h>
29 #include <dictionary.h>
30 #include <vconf-keys.h>
33 #include <extended-elm.h>
34 #include <supplement.h>
35 #include <memo-assist.h>
36 #include <appcore-common.h>
38 #define ICU_TIME_BUFFER 256
39 static UDateFormat* dfmt = NULL;
42 * memo_get_doodle_title
55 char *memo_get_doodle_title()
57 memo_data_list_t *l = NULL;
58 memo_data_list_t *t = NULL;
59 char buf[MEMO_BUFFER_SIZE];
62 l = memo_get_all_data_list();
63 for (t = l; t != NULL; t = t->next) {
64 if (t->md.has_doodle) {
65 d = atoi(t->md.content + strlen(DOODLE_TITLE_PREFIX));
70 snprintf(buf, MEMO_BUFFER_SIZE, "%s%04d", DOODLE_TITLE_PREFIX, i);
71 memo_free_data_list(l);
77 UErrorCode status = U_ZERO_ERROR;
79 UChar ubuf[ICU_TIME_BUFFER];
80 UChar bestPattern[ICU_TIME_BUFFER];
81 UDateTimePatternGenerator *generator;
82 enum appcore_time_format timeformat;
83 char *timezone_id = NULL;
84 UChar utimezone_id[256] = {0,};
86 /* reset timezone according to vconf */
87 timezone_id = vconf_get_str(VCONFKEY_SETAPPL_TIMEZONE_ID);
88 u_uastrcpy(utimezone_id, timezone_id);
90 ucal_setDefaultTimeZone(utimezone_id , &status);
92 uloc_setDefault(getenv("LC_TIME"), &status); /* ICU API to set default locale */
93 locale = uloc_getDefault();
95 appcore_get_timeformat(&timeformat);
96 if (timeformat==APPCORE_TIME_FORMAT_24) {
98 u_strFromUTF8(ubuf, MEMO_BUFFER_SIZE, NULL, "dMMMyyHHmm", -1, &status);
100 /* 14 May 09 03:37 PM */
101 u_strFromUTF8(ubuf, MEMO_BUFFER_SIZE, NULL, "dMMMyyhhmma", -1, &status);
104 generator = udatpg_open(locale, &status);
105 udatpg_getBestPattern(generator, ubuf, u_strlen(ubuf), bestPattern, ICU_TIME_BUFFER, &status);
106 udatpg_close(generator);
111 dfmt = udat_open(UDAT_IGNORE, UDAT_IGNORE, locale, NULL, -1, bestPattern, -1, &status);
119 * @param [in] buf buffer used to store formated time
121 * @param [in] len length of buf
123 * @param [in] time actual time
134 void memo_time_format(char *buf, int len, time_t time)
136 UErrorCode status = U_ZERO_ERROR;
137 UChar ubuf[ICU_TIME_BUFFER];
142 udat_format(dfmt, (UDate)time*1000, ubuf, ICU_TIME_BUFFER, NULL, &status);
143 u_strToUTF8(buf, len, NULL, ubuf, -1, &status);
146 time_t memo_get_binary_release_date()
148 struct tm time = {0};
150 dictionary *about_dic = iniparser_load("/etc/info.ini");
152 RETVIF(about_dic==NULL, 0);
153 date = iniparser_getstr(about_dic, "Build:Date");
154 strptime(date, "%Y.%m.%d", &time);
155 iniparser_freedict(about_dic);
156 return timelocal(&time);
159 void memo_com_dummy_cb(void *data, const char *msg, void *event)
161 LOGD("msg : %s\n", msg);
164 void memo_navigator_pop(Evas_Object *navi)
166 Elm_Object_Item *top_it = elm_naviframe_top_item_get(navi);
167 Evas_Object *eo = elm_object_item_content_get(top_it);
168 Evas_Object *prev_eo = evas_object_data_get(eo, "previous_obj");
169 if(prev_eo == NULL) { /* exit when view stack is empty */
172 Evas_Smart_Cb cb = evas_object_data_get(prev_eo, "update_cb");
174 void *cb_data = evas_object_data_get(prev_eo, "update_data");
175 cb(cb_data, NULL, NULL);
177 elm_naviframe_item_pop(navi);
180 Elm_Object_Item *memo_naviframe_item_push(Evas_Object *obj, const char *title_label,
181 Evas_Object *prev_btn, Evas_Object *next_btn, Evas_Object *content, const char *item_style)
183 Elm_Object_Item *top_it = elm_naviframe_top_item_get(obj);
184 if (top_it != NULL) {
185 Evas_Object *eo = elm_object_item_content_get(top_it);
187 evas_object_data_set(content, "previous_obj", eo);
191 return elm_naviframe_item_push(obj, title_label, prev_btn, next_btn, content, item_style);
194 Evas_Object *memo_controlbar_add(Evas_Object *parent)
196 Evas_Object *toolbar = elm_toolbar_add(parent);
197 elm_toolbar_shrink_mode_set(toolbar, ELM_TOOLBAR_SHRINK_EXPAND);
198 elm_toolbar_homogeneous_set(toolbar, EINA_FALSE);