2.0 alpha
[apps/core/preloaded/calendar.git] / include / cld.h
index 88618ef..6937ecb 100755 (executable)
   */
 
 
-
-
-
-
 #ifndef __CALENDAR_H__
 #define __CALENDAR_H__
 
 #include <Elementary.h>
-#include "cld-log.h"
-#include "cld-utils.h"
+#include <contacts-svc.h>
+#include <ui-gadget.h>
 #include "cal-svc.h"
 #include "acct-svc.h"
+#include "cld-log.h"
+#include "cld-utils.h"
+
+#define CAL_QUICKADD_LONG_PRESS_TIME 0.5
 
 #if !defined(CALENDAR_RING)
 #define CALENDAR_RING "calendar-ring"
 #endif
 
 #if !defined(CALENDAR_PACKAGE)
-#  define CALENDAR_PACKAGE "efl-calendar"
+#  define CALENDAR_PACKAGE "calendar"
+#endif
+
+#if !defined(RESDIR)
+#  define RESDIR "/opt/apps/org.tizen."CALENDAR_PACKAGE"/res/"
 #endif
 
 #if !defined(LOCALEDIR)
-#  define LOCALEDIR "/opt/apps/org.tizen.efl-calendar/res/locale"
+#  define LOCALEDIR "/opt/apps/org.tizen."CALENDAR_PACKAGE"/res/locale"
 #endif
 
 #if !defined(VCALENDAR_DATA_LEN)
 #define VCALENDAR_DATA_LEN 3000
 #endif
 
+#if !defined(EMAIL_LINK_FLAG)
+#define EMAIL_LINK_FLAG "#email_viewer_link#"
+#endif
+
+#define CAL_CBAR_ICON_DELETE RESDIR"/icons/T01_controlbar_icon_delete.png"
+#define CAL_CBAR_ICON_CREAT RESDIR"/icons/01_controlbar_icon_create.png"
+#define CAL_CBAR_ICON_SHARE RESDIR"/icons/T01_controlbar_icon_share02.png"
+#define CAL_CBAR_ICON_EDIT RESDIR"/icons/T01_controlbar_icon_edit.png"
+#define CAL_CBAR_ICON_TODAY RESDIR"/icons/01_controlbar_icon_today.png"
+#define CAL_CBAR_ICON_VIEW RESDIR"/icons/01_controlbar_icon_View.png"
+#define CAL_CBAR_ICON_CALENDARS RESDIR"/icons/01_controlbar_icon_calendars.png"
+#define CAL_EVENT_LIST_ICON_ALARM RESDIR"/icons/P01_event_list_icon_alarm.png"
+#define CAL_EVENT_LIST_ICON_PRIORITY RESDIR"/icons/P01_event_list_icon_priority.png"
+#define CAL_EVENT_LIST_ICON_REPEAT RESDIR"/icons/P01_event_list_icon_reapeat.png"
+#define CAL_EVENT_LIST_ICON_REMINDER RESDIR"/icons/P01_event_list_icon_reminder.png"
+#define CAL_EVENT_LIST_ICON_FACEBOOK RESDIR"/icons/P01_event_list_icon_facebook.png"
+#define CAL_TASK_EVENT_HIGH_ICON  RESDIR"/icons/P01_Task_event.png"
+#define CAL_TASK_EVENT_UNCOMPLETED_ICON  RESDIR"/icons/P01_Task_event_completion.png"
+#define CAL_TASK_EVENT_COMPLETED_ICON RESDIR"/icons/P01_Task_event_completion_press.png"
+
+#define CAL_APPCONTROL_ITEM_TYPE "itemType"
+#define CAL_APPCONTROL_ITEM_TYPE_EVENT "event"
+#define CAL_APPCONTROL_ITEM_TYPE_TODO "todo"
+#define CAL_APPCONTROL_ITEM_TYPE_VCS "vcs"
+#define CAL_APPCONTROL_EVENT_ID "eventId"
+#define CAL_APPCONTROL_TODO_ID "todoId"
+#define CAL_APPCONTROL_VCS_PATH "path"
+
 enum cld_view {
        CV_UNKNOWN = 0,
        CV_YEAR,
        CV_MONTH,
+       CV_WEEK,
        CV_DAY,
        CV_LIST,
+       CV_TODO,
        CV_EDIT,
        CV_DETAIL,
+       CV_NOTI,
 };
 
 typedef enum ug_type {
@@ -66,10 +101,48 @@ typedef enum ug_type {
        UG_MAX,
 }ug_type;
 
+typedef enum {
+       ITEM_TYPE_UNKNOWN = 0,
+       ITEM_TYPE_EVENT,
+       ITEM_TYPE_TODO,
+       ITEM_TYPE_VCS,
+       ITEM_TYPE_MAX
+}cal_appcontrol_item_type;
+
+typedef struct {
+       struct tm stm;
+       struct tm etm;
+       char *stitle;
+       const Evas_Object *entry; //for title
+       bool is_hold_press;
+       Evas_Object *title;
+       Evas_Object *start_time;
+       Evas_Object *end_time;
+       Ecore_Timer *hold_timer;
+       Evas_Object *popup;
+}cal_quick_add;
+
+typedef struct
+{
+       int contact_id;
+       char *contact_image;
+       char *name;
+
+       char *email;
+       int email_id;
+
+       char *number;
+
+       int status;
+       int role;
+       int response;
+
+       Eina_Bool is_deleted;
+}cal_participant;
+
 typedef struct appdata
 {
        Evas_Object *win;                       //window
-       Evas_Object *alarm_window;      //window for alarm view.
        Evas_Coord win_w;                               //width of window
        Evas_Coord win_h;                                       //height of window
        Evas_Object *base;                      //base layout
@@ -96,23 +169,30 @@ typedef struct appdata
        int wday_start;                 //0~6, since sunday
 
        int cid;                                        //calendar id. for detail, edit view
-       struct tmnode* tm;              //for repeat event
+       struct tm tm_start;             //for detail, edit view
+       struct tm tm_end;                       //for detail, edit view
+
        int acct_id;                            //this variable always have ALL_VISIBLE_ACCOUT == -2
 
        Elm_Object_Item *bt_new;        //button for "Create event" in controlbar
        Elm_Object_Item *bt_delete; //button for "Delete" in controlbar
+       Elm_Object_Item *bt_view; //button for "View" in controlbar
+       Elm_Object_Item *bt_today; //button for "Today" in controlbar
        Elm_Object_Item *today_item;    // scroll to top item of today in list view.
+       cals_todo_list_order_t todo_sort_type;
 
        int notifd;                             //for heynoti
-       cal_struct* ical;                               //for vcard raw data used in calendar viewer.
+
        Eina_Bool is_aul;                       //to check wheather launching with AUL
        Elm_Object_Item* content;               //pop all aul content & jump to calendar content.
 
        Eina_Bool edit_special_one;     //to remove this, cal_edit_create_view should have 1 more parameter.
        Eina_Bool is_weekly;                    //check whethere monthly tab is for weekly or not.
 
-       struct ui_gadget *ug;           //can access to ui_gadget* from ug_data
+       ui_gadget_h ug;         //can access to ui_gadget* from ug_data
        ug_type u_type;                 //ug type
+       cal_appcontrol_item_type item_type;                     //request item type for appcontrol
+       cal_struct* ical;                               //for vcard raw data used in calendar viewer.
 
        int tm_year;                            //It would be better, if these are changed to struct tm. to save event with specific time
        int tm_mon;                             //It would be better, if these are changed to struct tm. to save event with specific time
@@ -128,8 +208,55 @@ typedef struct appdata
        int mail_id;                            //for email sharing feature
        char *src_box;                  //for email sharing feature
 
-       Evas_Object *tabbar;
+       Evas_Coord h_cur;
+
+       Eina_Bool is_display_complete_todo;
+
+       int is_display_weeknumber;
+
+       Eina_Bool is_landscape_mode;
+
+       int calendar_facebook_id;
 }ug_data;
 
+static inline void cal_main_set_cs(struct appdata *ad, cal_struct *cs)
+{
+       c_ret_if(!ad);
+       c_ret_if(!cs);
+
+       ad->cid = CALENDAR_SVC_STRUCT_GET_INT(cs, CAL_VALUE_INT_INDEX);
+
+       if (CALENDAR_SVC_IS_ALLDAY_EVENT(cs)) {
+
+               ad->tm_start.tm_year = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_YEAR) - 1900;
+               ad->tm_start.tm_mon = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MONTH) - 1;
+               ad->tm_start.tm_mday = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MDAY);
+
+               ad->tm_end.tm_year = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTEND_YEAR) - 1900;
+               ad->tm_end.tm_mon = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTEND_MONTH) - 1;
+               ad->tm_end.tm_mday = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTEND_MDAY);
+
+       } else {
+
+               cal_util_convert_lli_to_tm(NULL, CALENDAR_SVC_STRUCT_GET_LLI(cs, CALS_VALUE_LLI_DTSTART_UTIME), &ad->tm_start);
+               cal_util_convert_lli_to_tm(NULL, CALENDAR_SVC_STRUCT_GET_LLI(cs, CALS_VALUE_LLI_DTEND_UTIME), &ad->tm_end);
+       }
+}
+
+static inline void cal_main_set_cs_tm(struct tm *tm, cal_struct *cs)
+{
+       c_ret_if(!tm);
+       c_ret_if(!cs);
+
+       if (CALENDAR_SVC_IS_ALLDAY_EVENT(cs)) {
+               tm->tm_year = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_YEAR) - 1900;
+               tm->tm_mon = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MONTH) - 1;
+               tm->tm_mday = CALENDAR_SVC_STRUCT_GET_INT(cs, CALS_VALUE_INT_DTSTART_MDAY);
+
+       } else {
+               cal_util_convert_lli_to_tm(NULL, CALENDAR_SVC_STRUCT_GET_LLI(cs, CALS_VALUE_LLI_DTSTART_UTIME), tm);
+       }
+}
+
 #endif /* __CALENDAR_H__ */