APPLY_RSA
[apps/home/ug-memo-efl.git] / src / ug-detail.c
index 234c47b..a9439f4 100644 (file)
@@ -1,18 +1,20 @@
 /*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  * 
-  * Licensed under the Flora License, Version 1.0 (the "License");
-  * you may not use this file except in compliance with the License.
-  * You may obtain a copy of the License at
-  * 
-  *     http://www.tizenopensource.org/license
-  * 
-  * Unless required by applicable law or agreed to in writing, software
-  * distributed under the License is distributed on an "AS IS" BASIS,
-  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  * See the License for the specific language governing permissions and
-  * limitations under the License.
-  */
+*
+* Copyright 2012  Samsung Electronics Co., Ltd
+*
+* Licensed under the Flora License, Version 1.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*    http://www.tizenopensource.org/license
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*/
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -27,6 +29,7 @@
 #include <memo-genlist.h>
 #include <memo-assist.h>
 #include <memo_ug.h>
+#include <memo_autolink.h>
 #include <memo-efl.h>
 
 typedef struct __detail_view_t {
@@ -74,26 +77,34 @@ static void _create_detail_layout(detail_view_t *dv)
         edje_object_part_text_set(_EDJ(dv->body_main), "elm.text.date", ugd->buf);
         /* content */
         if(md->has_doodle) {
-            snprintf(ugd->buf, MEMO_BUFFER_SIZE, DOODLEDIR"/%d.png", (int)md->id);
+            snprintf(ugd->buf, MEMO_BUFFER_SIZE, "/opt/apps/org.tizen.memo/data/doodle/%d.png", (int)md->id);
             content = elm_swallowed_icon(dv->body_main, "elm.swallow.content", ugd->buf);
         } else {
             char buf[MEMO_BUFFER_SIZE];
-            Evas_Object *sc = NULL;
-            sc = elm_swallowed_scroller(dv->body_main, "elm.swallow.content");
+            GString *text =
+                autolink_add_anchor(elm_entry_utf8_to_markup
+                        (md->content));
             unsigned char *color = (unsigned char *)&md->font_color;
             snprintf(buf, MEMO_BUFFER_SIZE,
                 "<font_size=%d><color=#%02x%02x%02x>",
                 md->font_size, color[2], color[1], color[0]);
-            content = elm_entry_create(dv->body_main, buf);
-            elm_entry_entry_insert(content, elm_entry_utf8_to_markup(md->content));
-            dv->content = strdup(elm_entry_entry_get(content));
+            g_string_prepend(text, buf);
+
+            Evas_Object *sc = NULL;
+            sc = elm_swallowed_scroller(dv->body_main, "elm.swallow.content");
+            content = elm_entry_create(dv->body_main, text->str);
+            dv->content = strdup(text->str);
+            evas_object_smart_callback_add(content, "anchor,clicked", autolink_anchor_clicked_cb, ug_get_parent_layout(ugd->ug));
             evas_object_size_hint_weight_set(content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
             evas_object_size_hint_align_set(content, EVAS_HINT_FILL, EVAS_HINT_EXPAND);
             elm_entry_editable_set(content, EINA_FALSE);
-           elm_entry_autocapital_type_set(content, ELM_AUTOCAPITAL_TYPE_SENTENCE);
+            elm_entry_autocapital_type_set(content, ELM_AUTOCAPITAL_TYPE_SENTENCE);
             elm_object_content_set(sc, content);
             dv->entry = content;
             evas_object_render_flush_hook(dv->entry, _on_entry_resize, dv);
+
+            g_string_free(text, TRUE);
+
             edje_object_signal_emit(_EDJ(dv->body_main), "sig_text_mode", "");
         }
         memo_free_data(md);
@@ -106,17 +117,18 @@ static void _create_detail_layout(detail_view_t *dv)
     elm_object_item_part_content_set(navi_it, "controlbar", ctrl_bar);
 }
 
-void *memo_load_detail_view(ug_data_t *ugd, bundle *data)
+void *memo_load_detail_view(ug_data_t *ugd, service_h service)
 {
     detail_view_t *dv = SMALLOC(detail_view_t);
     RETVIF(dv == NULL, NULL);
     dv->ugd = ugd;
 
     /* init */
-    const char *str;
-    str = bundle_get_val(data, "index");
+    char *str = NULL;;
+    service_get_extra_data(service, "index", &str);
     if (str != NULL) {
         dv->index = atoi(str);
+       SFREE(str);
     } else {
         SFREE(dv);
         return NULL;