TizenRefApp-7368 Event title isn't copied to clipboard 75/92175/2
authorNataliia Sydorchuk <n.sydorchuk@samsung.com>
Fri, 21 Oct 2016 10:33:58 +0000 (13:33 +0300)
committerNataliia Sydorchuk <n.sydorchuk@samsung.com>
Fri, 21 Oct 2016 10:33:58 +0000 (13:33 +0300)
Change-Id: Ib15cf27956519482ab9d915c468b4a1b84def982
Signed-off-by: Nataliia Sydorchuk <n.sydorchuk@samsung.com>
main-app/res/edje/inc/CalDialogDetailSummaryItem.edc
main-app/src/detail/CalDetailView.cpp
main-app/src/detail/CalDialogDetailSummaryItem.cpp
main-app/src/detail/CalDialogDetailSummaryItem.h

index ea7b34f..8620150 100644 (file)
  *
  */
 
-#define DETAIL_SUMMARY_COLORBAR_HEIGHT 120
-#define DETAIL_SUMMARY_COLORBAR_WIDTH 8
-#define DETAIL_SUMMARY_ITEM_LEFT_RIGHT_PADDING 25
-#define DETAIL_ICON_TITLE_PADDINGS 18 90
-#define DETAIL_ICON_HEIGHT 98
-#define DETAIL_SUMMARY_ITEM_PADDING_TOP_SIZE 33
-#define DETAIL_SUMMARY_ITEM_PADDING_BOTTOM_SIZE 33
+#define DETAIL_SUMMARY_H 120
+#define DETAIL_SUMMARY_COLORBAR_W 8
+#define DETAIL_SUMMARY_COLORBAR_R 24
+#define DETAIL_ICON_WH 98
+#define DETAIL_ICON_R 18
 
 #define DEFAULT_THUMBNAIL_BG_96 "Contacts/contacts_caller_id_default_bg_02.png"
 
-
 #define RESOURCE_IMAGE_WITH_MASK(GROUP_NAME, MASK_PATH, SWALLOW_PART_NAME) \
     group { \
         name: GROUP_NAME; \
         } \
     }
 
-
 group {
-    name: "elm/genlist/item/CalDialogDetailSummaryPlain/default";
-    alias: "elm/genlist/item_compress/CalDialogDetailSummaryPlain/default";
-    alias: "elm/genlist/tree/CalDialogDetailSummaryPlain/default";
-    alias: "elm/genlist/tree_compress/CalDialogDetailSummaryPlain/default";
-    data.item: "contents" "elm.details.color elm.details.entry";
+    name: "elm/genlist/item/CalDialogDetailSummary/default";
+    alias: "elm/genlist/item_compress/CalDialogDetailSummary/default";
+    alias: "elm/genlist/tree/CalDialogDetailSummary/default";
+    alias: "elm/genlist/tree_compress/CalDialogDetailSummary/default";
 
     data.item: "banded_bg_area" "elm.swallow.bg";
     data.item: "banded_bg_color" "255 255 255 255";
+    data.item: "contents" "elm.details.color elm.details.icon";
+    data.item: "texts" "elm.text.multiline";
+    data.item: "states" "elm.details.icon";
 
     parts {
-    part { name: "elm.swallow.bg";
-        type: SWALLOW;
-        scale: 1;
-        description { state: "default" 0.0;
-        }
-    }
-
         LIST_PART_BG
+        GENLIST_PART_BASE_SIZE(DETAIL_SUMMARY_H)
 
-        GENLIST_PART_BASE_SIZE(DETAIL_SUMMARY_COLORBAR_HEIGHT)
-        PART_LIST_PADDINGS(DETAIL_SUMMARY_ITEM_LEFT_RIGHT_PADDING,DETAIL_SUMMARY_ITEM_LEFT_RIGHT_PADDING,
-            DETAIL_SUMMARY_ITEM_PADDING_TOP_SIZE, DETAIL_SUMMARY_ITEM_PADDING_BOTTOM_SIZE)
-
-        part {
-            name: "elm.details.color";
-            type: SWALLOW;
-            description {
-                state: "default" 0.0;
-                min: DETAIL_SUMMARY_COLORBAR_WIDTH DETAIL_SUMMARY_COLORBAR_HEIGHT;
-                max: DETAIL_SUMMARY_COLORBAR_WIDTH -1;
+        swallow { "elm.swallow.bg"; }
+        swallow { "elm.details.color"; scale;
+            desc { "default";
+                min: DETAIL_SUMMARY_COLORBAR_W 0;
                 align: 0.0 0.5;
-                fixed: 1 1;
-                rel1 { relative: 0.0 0.0; to: "bg"; }
-                rel2 { relative: 0.0 1.0; to: "bg"; }
+                rel1.relative: 0.0 0.0;
+                rel2.relative: 0.0 1.0;
             }
         }
-        part {
-            name: "elm.details.entry";
-            type: SWALLOW;
-            description {
-                state: "default" 0.0;
-                rel1 { relative: 1 1;  to_x: "elm.padding.left"; to_y: "elm.padding.top"; }
-                rel2 { relative: 0 0;  to_x: "elm.padding.right"; to_y: "elm.padding.bottom"; }
+        spacer { "elm.details.color.spacer"; scale;
+            desc { "default";
+                min: DETAIL_SUMMARY_COLORBAR_R 0;
                 align: 0.0 0.5;
+                rel1 { relative: 1.0 0.0; to_x: "elm.details.color"; }
+                rel2 { relative: 1.0 1.0; to_x: "elm.details.color"; }
             }
         }
-    }
-}
-group {
-    name: "elm/genlist/item/CalDialogDetailSummaryIcon/default";
-    alias: "elm/genlist/item_compress/CalDialogDetailSummaryIcon/default";
-    alias: "elm/genlist/tree/CalDialogDetailSummaryIcon/default";
-    alias: "elm/genlist/tree_compress/CalDialogDetailSummaryIcon/default";
-
-    data.item: "contents" "elm.details.color elm.details.icon elm.details.entry";
-
-    data.item: "banded_bg_area" "elm.swallow.bg";
-    data.item: "banded_bg_color" "255 255 255 255";
-
-    parts {
-    part { name: "elm.swallow.bg";
-        type: SWALLOW;
-        scale: 1;
-        description { state: "default" 0.0;
+        swallow { "elm.details.icon"; scale;
+            desc { "default";
+                align: 0.0 0.5;
+                rel1 { relative: 1.0 0.0; to_x: "elm.details.color.spacer"; }
+                rel2 { relative: 1.0 1.0; to_x: "elm.details.color.spacer"; }
+            }
+            desc { "visible";
+                inherit: "default";
+                min: DETAIL_ICON_WH 0;
+            }
         }
-    }
-        LIST_PART_BG
-
-        GENLIST_PART_BASE_SIZE(DETAIL_SUMMARY_COLORBAR_HEIGHT)
-        PART_LIST_PADDINGS(DETAIL_SUMMARY_ITEM_LEFT_RIGHT_PADDING, DETAIL_SUMMARY_ITEM_LEFT_RIGHT_PADDING,
-            DETAIL_SUMMARY_ITEM_PADDING_TOP_SIZE, DETAIL_SUMMARY_ITEM_PADDING_BOTTOM_SIZE)
-
-        PART(SWALLOW, "elm.details.color",
-            DSC_FROM_L("default" 0.0,
-                min: DETAIL_SUMMARY_COLORBAR_WIDTH DETAIL_SUMMARY_COLORBAR_HEIGHT;
-                max: DETAIL_SUMMARY_COLORBAR_WIDTH -1;
-                fixed: 1 1;
-            )
-        )
-
-        PART(SPACER, "elm.details.color.spacer",
-            DSC_L("default" 0.0, "elm.details.color",
-                min: DETAIL_ICON_TITLE_PADDINGS;
-            )
-        )
-
-        PART(SWALLOW, "elm.details.icon",
-            DSC_L("default" 0.0, "elm.details.color.spacer",
-                min: DETAIL_ICON_HEIGHT DETAIL_ICON_HEIGHT;
-            )
-        )
-
-        PART(SPACER, "elm.details.entry.spacer",
-            DSC_L("default" 0.0, "elm.details.icon",
-                min: DETAIL_ICON_TITLE_PADDINGS;
-            )
-        )
-
-        PART(SWALLOW, "elm.details.entry",
-            DSC_LRTB("default" 0.0, "elm.details.entry.spacer", "elm.padding.right", "elm.padding.top", "elm.padding.bottom",
-                min: DETAIL_ICON_TITLE_PADDINGS;
+        spacer { "elm.details.icon.spacer"; scale;
+            desc { "default";
                 align: 0.0 0.5;
-            )
-        )
+                rel1 { relative: 1.0 0.0; to_x: "elm.details.icon"; }
+                rel2 { relative: 1.0 1.0; to_x: "elm.details.icon"; }
+            }
+            desc { "visible";
+                inherit: "default";
+                min: DETAIL_ICON_R 0;
+            }
+        }
+        textblock { "elm.text.multiline"; scale;
+            desc { "default";
+                align: 0.0 0.5;
+                rel1 { relative: 1.0 0.0; to_x: "elm.details.icon.spacer"; }
+                rel2 { relative: 1.0 1.0; }
+                text.style: "list_text_multiline_main";
+            }
+        }
+    }
+    programs {
+        program {
+            signal: "elm,state,elm.details.icon,active";
+            source: "elm";
+            action: STATE_SET "visible" 0.0;
+            target: "elm.details.icon";
+            target: "elm.details.icon.spacer";
+        }
+        program {
+            signal: "elm,state,elm.details.icon,passive";
+            source: "elm";
+            action: STATE_SET "default" 0.0;
+            target: "elm.details.icon";
+            target: "elm.details.icon.spacer";
+        }
+         LIST_PROGRAM_SOUND
     }
 }
 
index 6ad8b12..5b5df4c 100644 (file)
@@ -263,9 +263,6 @@ void CalDetailView::__update()
        __title = new CalDialogDetailSummaryItem(__workingCopy->getBookId(),
                        personId, summary.c_str(), image.c_str());
        Elm_Object_Item *item = __dialog->add(__title);
-       if (item) {
-               elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
-       }
 
        // Event Time
        __time = new CalDialogDetailEventTimeItem(__workingCopy);
index ae8a8b1..762a56a 100644 (file)
@@ -25,6 +25,8 @@
 #include "CalPath.h"
 
 #define CONTACT_LENGTH 16
+#define TEXT_BUFFER_SIZE 128
+#define TAG_BACKING "<backing=on><backing_color=#00ddff99>"
 
 CalDialogDetailSummaryItem::CalDialogDetailSummaryItem(
                int bookId, int personId, const char *summary, const char *image) :
@@ -36,21 +38,6 @@ CalDialogDetailSummaryItem::~CalDialogDetailSummaryItem()
 {
 }
 
-Evas_Object *CalDialogDetailSummaryItem::__createTitleEntry(Evas_Object *obj)
-{
-       Evas_Object *entry = elm_entry_add(obj);
-       evas_object_size_hint_weight_set(entry, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       evas_object_size_hint_align_set(entry, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       elm_entry_single_line_set(entry, EINA_TRUE);
-       elm_entry_scrollable_set(entry, EINA_TRUE);
-       elm_entry_editable_set(entry, EINA_FALSE);
-       elm_entry_context_menu_disabled_set(entry, EINA_FALSE);
-       elm_entry_entry_set(entry, __summary.c_str());
-       evas_object_show(entry);
-
-       return entry;
-}
-
 Evas_Object *CalDialogDetailSummaryItem::__createIcon(Evas_Object *obj)
 {
        Evas_Object *layout = elm_layout_add(obj);
@@ -101,35 +88,73 @@ Evas_Object *CalDialogDetailSummaryItem::__createIcon(Evas_Object *obj)
 Elm_Genlist_Item_Class *CalDialogDetailSummaryItem::getItemClassStatic()
 {
        static Elm_Genlist_Item_Class itc = {}; // Implicitly 0-init in C++
-       if(__bookId == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID) {
-               itc.item_style = "CalDialogDetailSummaryIcon";
-       } else {
-               itc.item_style = "CalDialogDetailSummaryPlain";
-       }
+       itc.item_style = "CalDialogDetailSummary";
+       itc.func.text_get = getText;
+       itc.func.content_get = getContent;
+       itc.func.state_get = getState;
+
+       return &itc;
+}
 
-       itc.func.text_get = [](void *data, Evas_Object *obj, const char *part)->char* {
+char *CalDialogDetailSummaryItem::getText(void *data, Evas_Object *obj, const char *part)
+{
+       if (!data) {
                return NULL;
-       };
-       itc.func.content_get = [](void *data, Evas_Object *obj, const char *part)->Evas_Object* {
-               CalDialogDetailSummaryItem *item = (CalDialogDetailSummaryItem*)data;
-               if (!strcmp(part, "elm.details.color")) {
-                       int r,g,b,a;
-                       CalBookManager& calBookManager = CalBookManager::getInstance();
-                       std::shared_ptr<CalBook> calBook = calBookManager.getBook(item->__bookId);
-                       if(calBook) {
-                               calBook->getColor(r,g,b,a);
-                               Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(obj));
-                               evas_object_color_set(rect, r, g, b, a);
-
-                               return rect;
-                       }
-               } else if(!strcmp(part, "elm.details.entry")) {
-                       return item->__createTitleEntry(obj);
-               } else if(!strcmp(part, "elm.details.icon")) {
-                       return item->__createIcon(obj);
+       }
+       CalDialogDetailSummaryItem *item = (CalDialogDetailSummaryItem*)data;
+
+       if(!strcmp(part, "elm.text.multiline")) {
+               if (item->isSelecting()) {
+                       char buffer[TEXT_BUFFER_SIZE];
+                       snprintf(buffer, sizeof(buffer), TAG_BACKING "%s", item->__summary.c_str());
+                       return strdup(buffer);
                }
+               return strdup(item->__summary.c_str());
+       }
+
+       return NULL;
+}
 
+Evas_Object *CalDialogDetailSummaryItem::getContent(void *data, Evas_Object *obj, const char *part)
+{
+       if (!data) {
                return NULL;
-       };
-       return &itc;
+       }
+       CalDialogDetailSummaryItem *item = (CalDialogDetailSummaryItem*)data;
+
+       if (!strcmp(part, "elm.details.color")) {
+               int r,g,b,a;
+               CalBookManager &calBookManager = CalBookManager::getInstance();
+               std::shared_ptr<CalBook> calBook = calBookManager.getBook(item->__bookId);
+               if(calBook) {
+                       calBook->getColor(r,g,b,a);
+                       Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(obj));
+                       evas_object_color_set(rect, r, g, b, a);
+
+                       return rect;
+               }
+       } else if(!strcmp(part, "elm.details.icon")) {
+               return item->__createIcon(obj);
+       }
+
+       return NULL;
+}
+
+Eina_Bool CalDialogDetailSummaryItem::getState(void *data, Evas_Object *obj, const char *part)
+{
+       if (!data) {
+               return EINA_FALSE;
+       }
+       CalDialogDetailSummaryItem *item = (CalDialogDetailSummaryItem*)data;
+
+       if (!strcmp(part, "elm.details.icon")) {
+               return item->__bookId == DEFAULT_BIRTHDAY_CALENDAR_BOOK_ID;
+       }
+
+       return EINA_FALSE;
+}
+
+void CalDialogDetailSummaryItem::onCopySelected()
+{
+       CalDialogDetailCopyableItem::copyText(__summary.c_str());
 }
index 2fbad93..05c3db9 100644 (file)
 #ifndef _CAL_DIALOG_DETAIL_SUMMARY_ITEM_H_
 #define _CAL_DIALOG_DETAIL_SUMMARY_ITEM_H_
 
-#include "CalDialogControl.h"
+#include "CalDialogDetailCopyableItem.h"
 #include <string>
 
 /**
  * @brief Calendar dialog detail summary item.
  *
- * @see CalDialogControl::Item
+ * @see CalDialogDetailCopyableItem
  */
-class CalDialogDetailSummaryItem : public CalDialogControl::Item
+class CalDialogDetailSummaryItem : public CalDialogDetailCopyableItem
 {
 public:
        /**
@@ -42,8 +42,13 @@ public:
 
 private:
        WDISABLE_COPY_AND_ASSIGN(CalDialogDetailSummaryItem);
-       virtual Elm_Genlist_Item_Class *getItemClassStatic();
-       Evas_Object *__createTitleEntry(Evas_Object *obj);
+       virtual Elm_Genlist_Item_Class *getItemClassStatic() override;
+       virtual void onCopySelected() override;
+
+       static char *getText(void *data, Evas_Object *obj, const char *part);
+       static Evas_Object *getContent(void *data, Evas_Object *obj, const char *part);
+       static Eina_Bool getState(void *data, Evas_Object *obj, const char *part);
+
        Evas_Object *__createIcon(Evas_Object *obj);
 
        int __bookId;