upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:01:24 +0000 (17:01 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 08:01:24 +0000 (17:01 +0900)
16 files changed:
debian/changelog
include/calendar-svc-provider.h
packaging/libslp-calendar.spec
schema/schema.sql
src/cals-alarm.c
src/cals-db.c
src/cals-provider.c
src/cals-recurrence-utils.c
src/cals-schedule.c
src/cals-sqlite.c
src/cals-sqlite.h
src/cals-struct.c
src/cals-typedef.h
src/cals-tz-utils.c
src/cals-tz-utils.h
src/cals-utils.c

index a6484dc40720050383e780d0f2fbaaedfa6f4201..009b1551e5773669c3cdde4fdad13776735ebe0f 100644 (file)
@@ -4,12 +4,4 @@ libslp-calendar (0.1.12-16) unstable; urgency=low
   * Git: pkgs/l/libslp-calendar
   * Tag: libslp-calendar_0.1.12-16
 
- -- Taeho Kang <taeho84.kang@samsung.com>  Tue, 28 Feb 2012 00:16:13 +0900
-
-libslp-calendar (0.1.12-15) unstable; urgency=low
-
-  * release
-  * Git: pkgs/l/libslp-calendar
-  * Tag: libslp-calendar_0.1.12-15
-
- -- Youngjae Shin <yj99.shin@samsung.com>  Wed, 01 Feb 2012 10:16:13 +0900
+ -- Jeesun Kim <iamjs.kim@samsung.com>  Tue, 21 Feb 2012 10:00:00 +0900
\ No newline at end of file
index 29093010abafe2e8a8a7c31e22ba8a8ada57e10f..6120395beed0d0d5388e25e83402d286c01a8fc0 100755 (executable)
@@ -110,6 +110,16 @@ typedef enum
        CAL_REPEAT_EVERY_YEAR_DAY,    /**< Repeats every year's month week days *//* same with CAL_REPEAT_EVERY_YEAR, but week_flag="1000000"~"0000001", day_date=0, sun_moon=0, week_start=0 */
 } cal_repeat_term_t;
 
+/**
+ * This enumeration defines Repeat term.
+ */
+typedef enum
+{
+       CALS_REPEAT_UNTIL_TYPE_NONE = 0,  /**< Repeat endlessly */
+       CALS_REPEAT_UNTIL_TYPE_DATETIME,  /**< Repeat until the date-time which the CAL_VALUE_GMT_REPEAT_END_DATE indicates */
+       CALS_REPEAT_UNTIL_TYPE_COUNT,     /**< Repeat number of times, which the CAL_VALUE_INT_REPEAT_OCCURRENCES indicates */
+} cal_repeat_until_type_t;
+
 /**
  * This enumeration defines sync status.
  */
@@ -280,6 +290,18 @@ typedef enum
        CALS_CALENDAR_TYPE_TODO = 1<<1,
 } cals_calendar_store_type;
 
+/**
+ * This enumeration defines calendar sensitivity.
+ * (related with CAL_VALUE_INT_SENSITIVITY)
+ */
+typedef enum
+{
+       CALS_SENSITIVITY_PUBLIC = 0x0,
+       CALS_SENSITIVITY_PRIVATE,
+       CALS_SENSITIVITY_CONFIDENTIAL,
+} cals_sensitivity_t;
+
+
 /**
  * @}
  */
@@ -372,50 +394,51 @@ typedef enum
  * brief
  *             calendar_svc_value_xxx()'s argument
  */
-#define CAL_VALUE_INT_INDEX                              "id"                                  /**< Record index */
+#define CAL_VALUE_INT_INDEX                              "id"                                  /**< Record index */
 #define CAL_VALUE_INT_ACCOUNT_ID                         "account_id"                  /**< account id */
-#define CAL_VALUE_INT_TYPE                               "type"                                /**< Calendar component type */
-#define CAL_VALUE_INT_CATEGORY                           "category"                    /**< Category of schedule #cal_sch_category_t */
-#define CAL_VALUE_TXT_SUMMARY                            "summary"                             /**< Summary, appointment, task: subject, birthday:Name */
-#define CAL_VALUE_TXT_DESCRIPTION                        "description"                 /**< Description,appointment, task: description, anniversary,holiday:occasion*/
-#define CAL_VALUE_TXT_LOCATION                                   "location"                            /**< Location */
-#define CAL_VALUE_INT_ALL_DAY_EVENT                      "all_day_event"               /**< All day event flag */
-#define CAL_VALUE_GMT_START_DATE_TIME            "start_date_time"             /**< schedule:start time, anniv,holiday,birthday,memo,todo: date */
-#define CAL_VALUE_GMT_END_DATE_TIME                      "end_date_time"               /**< end time */
-#define CAL_VALUE_INT_REPEAT_TERM                        "repeat_item"                 /**< Repeat term */
-#define CAL_VALUE_INT_REPEAT_INTERVAL            "repeat_interval"             /**< Interval of repeat term */
-#define CAL_VALUE_INT_REPEAT_OCCURRENCES         "repeat_occurrences"    /**< occurrences of repeat */
-#define CAL_VALUE_GMT_REPEAT_END_DATE            "repeat_end_date"             /**< End date for repeat */
-#define CAL_VALUE_INT_SUN_MOON                           "sun_moon"                            /**< Using sun or lunar calendar */
-#define CAL_VALUE_INT_WEEK_START                         "week_start"                  /**< Start day of a week */
-#define CAL_VALUE_TXT_WEEK_FLAG                                  "week_flag"                   /**< 1001000(sun,wed) Indicate which day is select in a week */
-#define CAL_VALUE_INT_DAY_DATE                           "day_date"                            /**< 0- for weekday(sun,mon,etc.), 1- for specific day(1,2.. Etc) */
-#define CAL_VALUE_GMT_LAST_MODIFIED_TIME         "last_modified_time"  /**< for PC Sync */
-#define CAL_VALUE_INT_MISSED                             "missed"                                /**< Miss alarm flag */
-#define CAL_VALUE_INT_TASK_STATUS                        "task_status"                 /**< current task status #cals_status_t */
-#define CAL_VALUE_INT_PRIORITY                           "priority"                            /**< Priority */
-#define CAL_VALUE_INT_TIMEZONE                           "timezone"                            /**< deprecated - timezone of task */
-#define CAL_VALUE_INT_FILE_ID                            "file_id"                             /**< file id for attach or alarm tone*/
-#define CAL_VALUE_INT_CONTACT_ID                         "contact_id"                  /**< contact id for birthday in contact list */
-#define CAL_VALUE_INT_BUSY_STATUS                        "busy_status"                 /**< ACS, G : Flag of busy or not */
-#define CAL_VALUE_INT_SENSITIVITY                        "sensitivity"                 /**< ACS, G : The sensitivity of the task item (normal, presonal, private, confidential). */
-#define CAL_VALUE_TXT_UID                                        "uid"                                   /**< ACS, G : Unique ID of the meeting item */
-#define CAL_VALUE_INT_CALENDAR_TYPE                      "calendar_type"               /**< ACS, G : Type(all,phone,google) of calendar */
-#define CAL_VALUE_TXT_ORGANIZER_NAME             "organizer_name"              /**< ACS, G : Name of organizer(author) */
-#define CAL_VALUE_TXT_ORGANIZER_EMAIL            "organizer_email"             /**< ACS, G : Email of organizer */
-#define CAL_VALUE_INT_MEETING_STATUS             "meeting_status"              /**< ACS, G : The status of the meeting. */
-#define CAL_VALUE_TXT_GCAL_ID                            "gcal_id"                             /**< G : Server id of calendar */
-#define CAL_VALUE_INT_DELETED                            "deleted"                             /**< G : Flag for deleted */
-#define CAL_VALUE_TXT_UPDATED                            "updated"                             /**< G : Updated time stamp */
-#define CAL_VALUE_INT_LOCATION_TYPE                      "location_type"               /**< G : Location type */
-#define CAL_VALUE_TXT_LOCATION_SUMMARY           "location_summary"    /**< G : A simple string value that can be used as a representation of this location */
-#define CAL_VALUE_TXT_ETAG                                       "etag"                                        /**< G : ETAG of this event */
-#define CAL_VALUE_INT_CALENDAR_ID                        "calendar_id"                 /**< G : id to map from calendar table */
-#define CAL_VALUE_INT_SYNC_STATUS                        "sync_status"                 /**< G : Indication for event entry whether added/ modified/ deleted */
-#define CAL_VALUE_TXT_EDIT_URL                           "edit_uri"            /**< G : EditUri for google calendar */
-#define CAL_VALUE_TXT_GEDERID                            "gevent_id"                           /**< G : Server id of an event */
-#define CAL_VALUE_INT_DST                                        "dst"                                   /**< dst of event */
-#define CAL_VALUE_INT_ORIGINAL_EVENT_ID                  "original_event_id" /**< original event id for recurrency exception */
+#define CAL_VALUE_INT_TYPE                               "type"                                /**< Calendar component type */
+#define CAL_VALUE_INT_CATEGORY                   "category"                    /**< Category of schedule #cal_sch_category_t */
+#define CAL_VALUE_TXT_SUMMARY                            "summary"                             /**< Summary, appointment, task: subject, birthday:Name */
+#define CAL_VALUE_TXT_DESCRIPTION                        "description"                 /**< Description,appointment, task: description, anniversary,holiday:occasion*/
+#define CAL_VALUE_TXT_LOCATION                           "location"                            /**< Location */
+#define CAL_VALUE_INT_ALL_DAY_EVENT                      "all_day_event"               /**< All day event flag */
+#define CAL_VALUE_GMT_START_DATE_TIME            "start_date_time"             /**< schedule:start time, anniv,holiday,birthday,memo,todo: date */
+#define CAL_VALUE_GMT_END_DATE_TIME                      "end_date_time"               /**< end time */
+#define CAL_VALUE_INT_REPEAT_TERM                        "repeat_item"                 /**< Repeat term */
+#define CAL_VALUE_INT_REPEAT_INTERVAL            "repeat_interval"             /**< Interval of repeat term */
+#define CAL_VALUE_INT_REPEAT_UNTIL_TYPE                  "repeat_until_type"   /**< Repeat until type */
+#define CAL_VALUE_INT_REPEAT_OCCURRENCES         "repeat_occurrences"    /**< occurrences of repeat */
+#define CAL_VALUE_GMT_REPEAT_END_DATE            "repeat_end_date"             /**< End date for repeat */
+#define CAL_VALUE_INT_SUN_MOON                           "sun_moon"                            /**< Using sun or lunar calendar */
+#define CAL_VALUE_INT_WEEK_START                         "week_start"                  /**< Start day of a week */
+#define CAL_VALUE_TXT_WEEK_FLAG                                  "week_flag"                   /**< 1001000(sun,wed) Indicate which day is select in a week */
+#define CAL_VALUE_INT_DAY_DATE                           "day_date"                            /**< 0- for weekday(sun,mon,etc.), 1- for specific day(1,2.. Etc) */
+#define CAL_VALUE_GMT_LAST_MODIFIED_TIME         "last_modified_time"  /**< for PC Sync */
+#define CAL_VALUE_INT_MISSED                             "missed"                                /**< Miss alarm flag */
+#define CAL_VALUE_INT_TASK_STATUS                        "task_status"                 /**< current task status #cals_status_t */
+#define CAL_VALUE_INT_PRIORITY                           "priority"                            /**< Priority */
+#define CAL_VALUE_INT_TIMEZONE                           "timezone"                            /**< deprecated - timezone of task */
+#define CAL_VALUE_INT_FILE_ID                            "file_id"                             /**< file id for attach or alarm tone*/
+#define CAL_VALUE_INT_CONTACT_ID                         "contact_id"                  /**< contact id for birthday in contact list */
+#define CAL_VALUE_INT_BUSY_STATUS                        "busy_status"                 /**< ACS, G : Flag of busy or not */
+#define CAL_VALUE_INT_SENSITIVITY                        "sensitivity"                 /**< iCal:CLASS #cals_sensitivity_t */
+#define CAL_VALUE_TXT_UID                                        "uid"                                   /**< ACS, G : Unique ID of the meeting item */
+#define CAL_VALUE_INT_CALENDAR_TYPE                      "calendar_type"               /**< ACS, G : Type(all,phone,google) of calendar */
+#define CAL_VALUE_TXT_ORGANIZER_NAME             "organizer_name"              /**< ACS, G : Name of organizer(author) */
+#define CAL_VALUE_TXT_ORGANIZER_EMAIL            "organizer_email"             /**< ACS, G : Email of organizer */
+#define CAL_VALUE_INT_MEETING_STATUS             "meeting_status"              /**< ACS, G : The status of the meeting. */
+#define CAL_VALUE_TXT_GCAL_ID                            "gcal_id"                             /**< G : Server id of calendar */
+#define CAL_VALUE_INT_DELETED                            "deleted"                             /**< G : Flag for deleted */
+#define CAL_VALUE_TXT_UPDATED                            "updated"                             /**< G : Updated time stamp */
+#define CAL_VALUE_INT_LOCATION_TYPE                      "location_type"               /**< G : Location type */
+#define CAL_VALUE_TXT_LOCATION_SUMMARY           "location_summary"    /**< G : A simple string value that can be used as a representation of this location */
+#define CAL_VALUE_TXT_ETAG                                       "etag"                                        /**< G : ETAG of this event */
+#define CAL_VALUE_INT_CALENDAR_ID                        "calendar_id"                 /**< G : id to map from calendar table */
+#define CAL_VALUE_INT_SYNC_STATUS                        "sync_status"                 /**< G : Indication for event entry whether added/ modified/ deleted */
+#define CAL_VALUE_TXT_EDIT_URL                           "edit_uri"    /**< G : EditUri for google calendar */
+#define CAL_VALUE_TXT_GEDERID                            "gevent_id"                           /**< G : Server id of an event */
+#define CAL_VALUE_INT_DST                                        "dst"                                   /**< dst of event */
+#define CAL_VALUE_INT_ORIGINAL_EVENT_ID                  "original_event_id" /**< original event id for recurrency exception */
 #define CAL_VALUE_INT_CALENDAR_INDEX      "calendar_index"   /**< specific calendar id - will be remove */
 #define CAL_VALUE_DBL_LATITUDE         "latitude"      /**< latitude */
 #define CAL_VALUE_DBL_LONGITUDE        "longitude"     /**< longitude */
@@ -2741,14 +2764,6 @@ int calendar_svc_struct_set_time(cal_struct* record, const char *field,int timez
  */
 time_t calendar_svc_struct_get_time(cal_struct* record, const char *field, int timezone_flag);
 
-/**
- * @fn void calendar_svc_util_get_local_tz_info(char **lock_city_name,char **lock_tz_path,char** lock_tz_offset,char **local_city_name,char **local_tz_path,char **local_tz_offset);
-       get timezone information by setting value
- * @deprecated it will be deprecated.
- */
-void calendar_svc_util_get_local_tz_info(char **lock_city_name,char **lock_tz_path,char** lock_tz_offset,
-                                                                                       char **local_city_name,char **local_tz_path,char **local_tz_offset);
-
 /**
  * @fn int calendar_svc_find_event_list(int account_id,const char* search_type,const void* search_value, cal_iter **iter);
  * This function get records from database by search param,it is convenient for user to get records according to some condition.
@@ -2848,14 +2863,17 @@ int calendar_svc_search_list(int account_id,int calendar_id,const char *data_typ
 }
 #endif
 
+/**
+ * deprecated
+ */
 typedef enum
 {
-        CAL_STATUS_FREE = 0,               /**< deprecated */
-        CAL_STATUS_TENTATIVE,             /**< deprecated */
-        CAL_STATUS_BUSY,                     /**< deprecated */
-        CAL_STATUS_OUROFOFFICE,           /**< deprecated */
-        CAL_STATUS_CONFIRM,               /**< deprecated */
-        CAL_STATUS_DENIED,                /**< deprecated */
+       CAL_STATUS_FREE = 0,               /**< deprecated */
+       CAL_STATUS_TENTATIVE,             /**< deprecated */
+       CAL_STATUS_BUSY,                     /**< deprecated */
+       CAL_STATUS_OUROFOFFICE,           /**< deprecated */
+       CAL_STATUS_CONFIRM,               /**< deprecated */
+       CAL_STATUS_DENIED,                /**< deprecated */
 } cal_status_type_t;
 
 #endif /* __CALENDAR_SVC_H__ */
index bfe13f24a47830ed4d73b9173a11b52b24a16f8f..b420b4ca060a333094dd550dae988339769b1256 100644 (file)
@@ -1,24 +1,21 @@
-Name:      libslp-calendar
+Name:       libslp-calendar
 Summary:    DB library for calendar
 Version:    0.1.12
-Release:    1
+Release:    29
 Group:      System/Libraries
-License:    Apache-2.0
+License:    Apache 2.0
 Source0:    %{name}-%{version}.tar.gz
 Requires(post): /sbin/ldconfig
+Requires(post): /usr/bin/sqlite3
 Requires(postun): /sbin/ldconfig
 
 BuildRequires: cmake
 BuildRequires: pkgconfig(db-util)
-BuildRequires: pkgconfig(dbus-glib-1)
-BuildRequires: pkgconfig(gconf-2.0)
-BuildRequires: pkgconfig(gmodule-2.0)
-BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(dlog)
-BuildRequires: pkgconfig(heynoti)
+BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(alarm-service)
-BuildRequires: pkgconfig(aul)
-Requires(post): /usr/bin/sqlite3
 
 %description
 DB library for calendar
@@ -27,6 +24,7 @@ DB library for calendar
 Summary:    DB library for calendar
 Group:      Development/Libraries
 Requires:   %{name} = %{version}-%{release}
+Requires:   pkgconfig(alarm-service)
 
 %description devel
 DB library for calendar (developement files)
@@ -47,29 +45,37 @@ make %{?jobs:-j%jobs}
 
 %post
 /sbin/ldconfig
+mkdir -p /opt/dbspace
+if [ -f /opt/dbspace/.calendar-svc.db ]
+then
+        echo "calendar-svc.db exist"
+else
+               calendar-svc-initdb
+fi
 
-/usr/bin/calendar-svc-initdb
-
-chown root:root /usr/lib/libcalendar-service.so.*
-chown :6003 /opt/data/calendar-svc/.CALENDAR_SVC_*
 chown :6003 /opt/dbspace/.calendar-svc.db
 chown :6003 /opt/dbspace/.calendar-svc.db-journal
+chown :6003 /opt/data/calendar-svc/.CALENDAR_SVC_*
 
 chmod 660 /opt/dbspace/.calendar-svc.db
 chmod 660 /opt/dbspace/.calendar-svc.db-journal
 chmod 660 /opt/data/calendar-svc/.CALENDAR_SVC_*
 
-
 %postun -p /sbin/ldconfig
 
 
 %files
-/usr/lib/lib*.so.*
-/usr/bin/calendar-svc-initdb
-/opt/data/calendar-svc/.*
+%defattr(-,root,root,-)
+%{_bindir}/calendar-svc-initdb
+%{_libdir}/libcalendar-service.so.*
+/opt/data/calendar-svc/.CALENDAR_SVC_CALENDAR_CHANGED
+/opt/data/calendar-svc/.CALENDAR_SVC_EVENT_CHANGED
+/opt/data/calendar-svc/.CALENDAR_SVC_TODO_CHANGED
 
 %files devel
-/usr/lib/pkgconfig/*.pc
-/usr/include/calendar/*.h
-/usr/include/calendar-svc/*.h
-/usr/lib/lib*.so
+%defattr(-,root,root,-)
+%{_includedir}/calendar-svc/*.h
+%{_includedir}/calendar/*.h
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/calendar.pc
+%{_libdir}/pkgconfig/calendar-service.pc
index c8b4960d3d2255b8682584379b687dd539453b24..0bc861e06ccd03ad4d4447f7709f883fe4db7a7d 100755 (executable)
@@ -30,6 +30,7 @@ start_date_time INTEGER,
 end_date_time INTEGER,
 repeat_item INTEGER,
 repeat_interval INTEGER,
+repeat_until_type INTEGER,
 repeat_occurrences INTEGER,
 repeat_end_date INTEGER,
 sun_moon INTEGER,
index 6f5486ce0469ec0407d8853df5ef49c094bd371e..a9547c329eebe01a30dffebe131cb3f1f1e9220a 100755 (executable)
@@ -28,7 +28,7 @@
 #include "cals-utils.h"
 #include "cals-alarm.h"
 
-#define PKG_CALENDAR_APP "org.tizen.calendar"
+#define PKG_CALENDAR_APP "org.tizen.efl-calendar"
 
 int cals_alarm_remove(int type, int related_id)
 {
@@ -128,10 +128,10 @@ static inline int _cals_alarm_add(const int event_id, cal_alarm_info_t *alarm_in
        retvm_if(NULL == stmt, CAL_ERR_DB_FAILED, "cals_query_prepare() Failed");
 
        if (alarm_info->alarm_tone)
-               cals_stmt_bind_text(stmt, 0, alarm_info->alarm_tone);
+               cals_stmt_bind_text(stmt, 1, alarm_info->alarm_tone);
 
        if (alarm_info->alarm_description)
-               cals_stmt_bind_text(stmt, 1, alarm_info->alarm_description);
+               cals_stmt_bind_text(stmt, 2, alarm_info->alarm_description);
 
        rc = cals_stmt_step(stmt);
        if (CAL_SUCCESS != rc) {
index 414cdd7cda6ef8ad71963b728b4438a0bb175811..c2f9b4539a556ca793343fa010cb2b72c96a1e0a 100755 (executable)
@@ -902,6 +902,7 @@ int cal_db_service_get_month_event(int account_id, time_t startdate, time_t endd
                                "st.end_date_time, "\
                                "st.repeat_item, "\
                                "st.repeat_interval, "\
+                               "st.repeat_until_type, "\
                                "st.repeat_occurrences, "\
                                "st.repeat_end_date, "\
                                "st.week_start, "\
index a4f5ba360258841c7456d18b0b6b17fba71340eb..c987e37c0fba248b798fa3ea8409d13585bc6a1f 100755 (executable)
@@ -783,36 +783,43 @@ API int calendar_svc_search_list(int account_id,int calendar_id,const char *data
 {
        CALS_FN_CALL;
        sqlite3_stmt *stmt = NULL;
-       char sql_value[CALS_SQL_MIN_LEN] = {0};
+       char sql_value[CALS_SQL_MAX_LEN] = {0};
        int rc = 0;
-       char condition_value[1024] = {0};
+       char condition_value[CALS_SQL_MAX_LEN] = {0};
+       char search_str[CALS_SQL_MAX_LEN] = {0};
        cal_value_type_t value_type = 0;
-       retex_if(NULL == data_type,,"Invalid parameter.\n");
-       retex_if(NULL == iter,,"Invalid parameter.\n");
-       retex_if(0 > calendar_id,,"Invalid parameter.\n");
+
+       retv_if(NULL == data_type, CAL_ERR_FAIL);
+       retv_if(NULL == search_type, CAL_ERR_FAIL);
+       retv_if(NULL == search_value, CAL_ERR_FAIL);
+       retv_if(CALS_SQL_MIN_LEN < strlen(search_value), CAL_ERR_FAIL);
+       retv_if(NULL == iter, CAL_ERR_FAIL);
+       retv_if(calendar_id < 0, CAL_ERR_FAIL);
 
        *iter = calloc(1, sizeof(cal_iter));
        retvm_if(NULL == *iter, CAL_ERR_OUT_OF_MEMORY, "calloc() Failed(%d)", errno);
 
-       value_type = __calendar_svc_get_type(CAL_STRUCT_TYPE_SCHEDULE,search_type);
+       value_type = __calendar_svc_get_type(CAL_STRUCT_TYPE_SCHEDULE, search_type);
 
        switch(value_type)
        {
        case VALUE_TYPE_TEXT:
 
                retex_if(search_value == NULL,,"search_value is NULL");
+               cals_escape_like_pattern(search_value, search_str, sizeof(search_str));
+               DBG("%s %s", search_value, search_str);
 
                if(ALL_VISIBILITY_ACCOUNT == account_id)
                {
-                       sprintf(condition_value,"where st.type=%d and upper(%s) like upper('%%%s%%')",CAL_EVENT_SCHEDULE_TYPE, search_type, (char*)search_value);
+                       sprintf(condition_value,"where st.type=%d and upper(%s) like upper('%%%s%%') ESCAPE '\\'",CAL_EVENT_SCHEDULE_TYPE, search_type, search_str);
                }
                else if(0 != account_id)
                {
-                       sprintf(condition_value,"where st.type=%d and upper(%s) like upper('%%%s%%') and account_id = %d",CAL_EVENT_SCHEDULE_TYPE, search_type, (char*)search_value, account_id);
+                       sprintf(condition_value,"where st.type=%d and upper(%s) like upper('%%%s%%') ESCAPE '\\'and account_id = %d",CAL_EVENT_SCHEDULE_TYPE, search_type, search_str, account_id);
                }
                else
                {
-                       sprintf(condition_value,"where st.type=%d and upper(%s) like upper('%%%s%%') ",CAL_EVENT_SCHEDULE_TYPE, search_type, (char*)search_value);
+                       sprintf(condition_value,"where st.type=%d and upper(%s) like upper('%%%s%%') ESCAPE '\\'",CAL_EVENT_SCHEDULE_TYPE, search_type, search_str);
                }
                break;
        case VALUE_TYPE_INT:
@@ -845,13 +852,13 @@ API int calendar_svc_search_list(int account_id,int calendar_id,const char *data
                        sprintf(sql_value,"select st.id,st.summary,st.location,st.all_day_event,st.start_date_time,st.end_date_time,st.repeat_item,st.week_start,st.week_flag,st.calendar_id "
                                        "from schedule_table as st, calendar_table as ct %s "
                                        "and ct.visibility = 1 and st.calendar_id = ct.rowid and "
-                                       "st.is_deleted = 0 order by st.summary limit %d,%d;",condition_value,offset,count);
+                                       "st.is_deleted = 0 order by st.summary limit %d,%d ;",condition_value,offset,count);
                }
                else
                {
 
                        sprintf(sql_value,"select st.id,st.summary,st.location,st.all_day_event,st.start_date_time,st.end_date_time,st.repeat_item,st.week_start,st.week_flag,st.calendar_id "\
-                                       "from schedule_table as st %s and is_deleted = 0 order by st.summary limit %d,%d;",condition_value,offset,count);
+                                       "from schedule_table as st %s and is_deleted = 0 order by st.summary limit %d,%d ;",condition_value,offset,count);
                }
 
                (*iter)->i_type = CAL_STRUCT_TYPE_SCHEDULE_LIST;
@@ -1159,42 +1166,49 @@ API int calendar_svc_find_event_list(int account_id,const char *search_type,cons
 
                if(ALL_VISIBILITY_ACCOUNT == account_id)
                {
-                       sprintf(sql_value,"SELECT * FROM %s WHERE %s like upper('%%%s%%') AND is_deleted = 0;",
-                               CALS_TABLE_SCHEDULE, search_type, (char*)search_value);
+                       sprintf(sql_value,
+                                       "SELECT * FROM %s WHERE %s like upper('%%%s%%') AND is_deleted = 0 ORDER BY start_date_time;",
+                                       CALS_TABLE_SCHEDULE, search_type, (char*)search_value);
                }
                else if(0 != account_id)
                {
-                       sprintf(sql_value,"SELECT * FROM %s WHERE %s like upper('%%%s%%') AND is_deleted = 0 and account_id = %d;",
-                               CALS_TABLE_SCHEDULE, search_type, (char*)search_value, account_id);
+                       sprintf(sql_value,
+                                       "SELECT * FROM %s WHERE %s like upper('%%%s%%') AND is_deleted = 0 and account_id = %d ORDER BY start_date_time;",
+                                       CALS_TABLE_SCHEDULE, search_type, (char*)search_value, account_id);
                }
                else
                {
-                       sprintf(sql_value,"SELECT * FROM %s WHERE %s like upper('%%%s%%') AND is_deleted = 0;",
-                               CALS_TABLE_SCHEDULE, search_type, (char*)search_value);
+                       sprintf(sql_value,
+                                       "SELECT * FROM %s WHERE %s like upper('%%%s%%') AND is_deleted = 0 ORDER BY start_date_time;",
+                                       CALS_TABLE_SCHEDULE, search_type, (char*)search_value);
                }
                break;
        case VALUE_TYPE_INT:
                if(ALL_VISIBILITY_ACCOUNT == account_id)
                {
-                       sprintf(sql_value,"SELECT * FROM %s WHERE %s = %d AND is_deleted = 0;",
-                               CALS_TABLE_SCHEDULE, search_type,(int)search_value);
+                       sprintf(sql_value,
+                                       "SELECT * FROM %s WHERE %s = %d AND is_deleted = 0 ORDER BY start_date_time;",
+                                       CALS_TABLE_SCHEDULE, search_type,(int)search_value);
                }
                else if(0 != account_id)
                {
-                       sprintf(sql_value,"SELECT * FROM %s WHERE %s = %d AND is_deleted = 0 AND account_id = %d;",
-                               CALS_TABLE_SCHEDULE, search_type, (int)search_value, account_id);
+                       sprintf(sql_value,
+                                       "SELECT * FROM %s WHERE %s = %d AND is_deleted = 0 AND account_id = %d ORDER BY start_date_time;",
+                                       CALS_TABLE_SCHEDULE, search_type, (int)search_value, account_id);
                }
                else
                {
-                       sprintf(sql_value,"SELECT * FROM %s WHERE %s = %d AND is_deleted = 0;",
-                               CALS_TABLE_SCHEDULE, search_type, (int)search_value);
+                       sprintf(sql_value,
+                                       "SELECT * FROM %s WHERE %s = %d AND is_deleted = 0 ORDER BY start_date_time;",
+                                       CALS_TABLE_SCHEDULE, search_type, (int)search_value);
                }
                break;
        case VALUE_TYPE_USER:
                if (0 == strcmp(CAL_VALUE_INT_ALARMS_ID, search_type)) {
                        ret = cals_alarm_get_event_id((int)search_value);
-                       sprintf(sql_value,"SELECT * FROM %s WHERE id = %d AND is_deleted = 0",
-                               CALS_TABLE_SCHEDULE, ret);
+                       sprintf(sql_value,
+                                       "SELECT * FROM %s WHERE id = %d AND is_deleted = 0 ORDER BY start_date_time",
+                                       CALS_TABLE_SCHEDULE, ret);
                        break;
                }
        case VALUE_TYPE_TIME:
@@ -1406,15 +1420,23 @@ static inline int __calendar_svc_find_calendar_list(int account_id,int calendar_
        {
        case VALUE_TYPE_TEXT:
                if(account_id)
-                       sprintf(sql_value,"select rowid,* from calendar_table where %s like '%%%s%%' and is_deleted = 0 and account_id = %d;", search_type, (char*)search_value, account_id);
+                       sprintf(sql_value,
+                                       "select rowid,* from calendar_table where %s like '%%%s%%' and is_deleted = 0 and account_id = %d ORDER BY start_date_time;",
+                                       search_type, (char*)search_value, account_id);
                else
-                       sprintf(sql_value,"select rowid,* from calendar_table where %s like '%%%s%%' and is_deleted = 0;", search_type, (char*)search_value);
+                       sprintf(sql_value,
+                                       "select rowid,* from calendar_table where %s like '%%%s%%' and is_deleted = 0 ORDER BY start_date_time;",
+                                       search_type, (char*)search_value);
                break;
        case VALUE_TYPE_INT:
                if(account_id)
-                       sprintf(sql_value,"select rowid,* from calendar_table where %s = %d and is_deleted = 0 and account_id = %d;", search_type, (int)search_value, account_id);
+                       sprintf(sql_value,
+                                       "select rowid,* from calendar_table where %s = %d and is_deleted = 0 and account_id = %d ORDER BY start_date_time;",
+                                       search_type, (int)search_value, account_id);
                else
-                       sprintf(sql_value,"select rowid,* from calendar_table where %s = %d and is_deleted = 0;", search_type, (int)search_value);
+                       sprintf(sql_value,
+                                       "select rowid,* from calendar_table where %s = %d and is_deleted = 0 ORDER BY start_date_time;",
+                                       search_type, (int)search_value);
                break;
        case VALUE_TYPE_TIME:
        case VALUE_TYPE_DOUBLE:
@@ -2650,157 +2672,6 @@ int calendar_svc_util_set_calendar_timezone(const char *tzname)
        return CAL_SUCCESS;
 }
 
-bool cal_svc_util_get_timezone_info(char *city,char **tz_path,char**offset)
-{
-       int left = 0;
-       int right = sizeof(time_zone_array)/sizeof(Time_Zone) -1;
-       int index = 0;
-       int result = 0;
-       int max_count = right;
-
-
-       while(true)
-       {
-               index = ( left + right ) / 2;
-
-               result = strcmp(time_zone_array[index].city, city);
-
-               if(result == 0)
-               {
-                       *tz_path = strdup(time_zone_array[index].tz_path);
-                       *offset = strdup(time_zone_array[index].gmt);
-                       //DBG("%s,%s,%s,%s",*tz_path,*offset,time_zone_array[index].tz_path,time_zone_array[index].gmt);
-                       break;
-               }
-               else if(result < 0)
-                       left = index+1;
-               else
-                       right = index-1;
-
-               if(left <0 || left >max_count)
-                       goto error;
-               if(right <0 || right >max_count)
-                       goto error;
-               if(left > right)
-                       goto error;
-
-       }
-
-       if(*tz_path == NULL)
-               return false;
-       else
-               return true;
-error:
-       *tz_path = NULL;
-       *offset = NULL;
-       return false;
-}
-
-
-bool cal_svc_util_get_timezone_info_by_tz_path(char *tz_path,char **city_name,char**offset)
-{
-       int left = 0;
-       int right = sizeof(tz_path_array)/sizeof(Time_Zone) -1;
-       int index = 0;
-       int result = 0;
-       int max_count = right;
-
-
-       while(true)
-       {
-               index = ( left + right ) / 2;
-
-               result = strcmp(tz_path_array[index].tz_path, tz_path);
-
-               if(result == 0)
-               {
-                       *city_name = strdup(tz_path_array[index].city);
-                       *offset = strdup(tz_path_array[index].gmt);
-                       //DBG("%s,%s,%s,%s",*tz_path,*offset,time_zone_array[index].tz_path,time_zone_array[index].gmt);
-                       break;
-               }
-               else if(result < 0)
-                       left = index+1;
-               else
-                       right = index-1;
-
-               if(left <0 || left >max_count)
-                       goto error;
-               if(right <0 || right >max_count)
-                       goto error;
-               if(left > right)
-                       goto error;
-
-       }
-
-       if(*city_name == NULL)
-               return false;
-       else
-               return true;
-error:
-       *city_name = NULL;
-       *offset = NULL;
-       return false;
-}
-
-void calendar_svc_util_get_city_info(char *tz_path, char**city_name, char**tz_offset)
-{
-       bool r = false;
-       if(tz_path == NULL || city_name==NULL || tz_offset == NULL)
-               return;
-
-       r = cal_svc_util_get_timezone_info_by_tz_path(tz_path,city_name,tz_offset);
-       if(r){
-               ERR("%s,%s,%s",tz_path,*city_name,*tz_offset);
-       }
-}
-
-
-API void calendar_svc_util_get_local_tz_info(char **lock_city_name,char **lock_tz_path,char** lock_tz_offset,
-               char **local_city_name,char **local_tz_path,char **local_tz_offset)
-{
-       int lock_on = 0;
-       bool r = false;
-       clock_t start_time=0,end_time = 0;
-       start_time = CAL_PROFILE_GET_TIME();
-
-       vconf_get_int("db/calendar/timezone_on_off",&lock_on);
-
-       if(lock_on)
-       {
-               *lock_city_name = vconf_get_str("db/calendar/timezone");
-               r = cal_svc_util_get_timezone_info(*lock_city_name,lock_tz_path,lock_tz_offset);
-
-               if(r){
-                       ERR("%s,%s,%s",*lock_city_name,*lock_tz_path,*lock_tz_offset);
-               }
-       }
-       else
-       {
-               *lock_city_name = NULL;
-               *lock_tz_path = NULL;
-               *lock_tz_offset = NULL;
-       }
-
-       if(*local_tz_path)
-       {
-               r = cal_svc_util_get_timezone_info_by_tz_path(*local_tz_path,local_city_name,local_tz_offset);
-       }
-       else
-       {
-               *local_city_name = vconf_get_str(VCONFKEY_SETAPPL_CITYNAME_INDEX_INT);
-               cal_svc_util_get_timezone_info(*local_city_name,local_tz_path,local_tz_offset);
-       }
-
-       if(r){
-               ERR("%s,%s,%s",*local_city_name,*local_tz_path,*local_tz_offset);
-       }
-
-       end_time = CAL_PROFILE_GET_TIME();
-       CAL_PROFILE_PRINT(start_time,end_time);
-
-}
-
 
 /* hidden api */
 API int calendar_svc_get_month_event_list (int account_id, time_t startdate, time_t enddate,int is_repeat, cal_iter **iter)
@@ -2910,7 +2781,6 @@ static inline void __set_day_flag(struct tm*stm,struct tm*etm,struct tm*estm,str
        for(i=start_day-1;i<end_day;i++)
        {
                day_flag[i]++;
-               //DBG("day_flag[%d]=%d\n",i,day_flag[i]);
        }
 }
 
@@ -2976,8 +2846,10 @@ API int calendar_svc_get_month_event_check (int account_id, time_t startdate, ti
 
        while (calendar_svc_iter_next(it) == CAL_SUCCESS) {
                rc = calendar_svc_iter_get_month_info(it,true, &cs);
-               if (rc != CAL_SUCCESS || cs == NULL)
+               if (rc != CAL_SUCCESS || cs == NULL) {
+                       ERR("calendar_svc_iter_get_month_info return %d", rc);
                        break;
+               }
 
                memset(&lstm,0x00,sizeof(struct tm));
                memset(&letm,0x00,sizeof(struct tm));
@@ -2985,7 +2857,6 @@ API int calendar_svc_get_month_event_check (int account_id, time_t startdate, ti
                while (calendar_svc_util_next_valid_event_tm(cs,
                                        &stm, &etm, &lstm, &letm) == CAL_SUCCESS) {
                        __set_day_flag(&stm,&etm,&lstm,&letm,day_flag);
-
                }
                calendar_svc_struct_free(&cs);
        }
index 8e45921615ad49bbfd3c46b8500712f644897744..d0b877780fc510222f2419a6fbd9f9fec3fd436b 100755 (executable)
@@ -169,43 +169,6 @@ void cal_service_set_day_of_week(struct tm* tm)
        tm->tm_wday = days%7;
 }
 
-/*
-/// just refer
-void __cal_service_convert_datetime_to_tm(struct tm *date,struct tm *tm)
-{
-tm->tm_year = date->date.tm_year-BENCHMARK_YEAR;
-tm->tm_mon = date->date.month-1;
-tm->tm_mday = date->date.tm_mday;
-tm->tm_wday = date->date.wday;
-tm->tm_hour = date->time.hours;
-tm->tm_min = date->time.minutes;
-tm->tm_sec = date->time.seconds;
-}
-
-void __cal_service_convert_tm_to_datetime(struct tm *tm,struct tm *date)
-{
-date->date.tm_year =tm->tm_year+BENCHMARK_YEAR;
-date->date.month = tm->tm_mon+1;
-date->date.tm_mday = tm->tm_mday;
-date->date.wday =tm->tm_wday;
-date->time.hours = tm->tm_hour;
-date->time.minutes = tm->tm_min;
-date->time.seconds = tm->tm_sec;
-}
-
-
-bool
-cal_db_service_adjust_time(struct tm* pDateTime, long adjustment)
-{
-time_t base_time = cals_mktime(pDateTime);
-
-base_time = base_time+adjustment;
-memcpy(pDateTime,cals_tmtime(&base_time),sizeof(struct tm));
-
-return true;
-}
-*/
-
 
 bool cal_is_used_dst_timezone(cal_sch_full_t *sch_record)
 {
@@ -215,28 +178,14 @@ bool cal_is_used_dst_timezone(cal_sch_full_t *sch_record)
 
 void cal_svc_set_tz_base_info(int year)
 {
-       char *tz_name = NULL;
-       char * lock_city_name= NULL;
-       char * lock_tz_path= NULL;
-       char * lock_tz_offset= NULL;
-       char * local_city_name= NULL;
-       char * local_tz_path= NULL;
-       char * local_tz_offset= NULL;
-
-       //temp(test code)
-       //local_tz_path=strdup("Asia/Seoul");
-
-       calendar_svc_util_get_local_tz_info(&lock_city_name,&lock_tz_path,&lock_tz_offset,&local_city_name,&local_tz_path,&local_tz_offset);
-
-
-       if(lock_tz_path)
-               tz_name = lock_tz_path;
-       else if(local_tz_path)
-               tz_name = local_tz_path;
-       else
-               tz_name = "localtime";
+       char *tz_name;
 
+       tz_name = cals_tzutil_get_tz_path();
 
+       if (!tz_name) {
+               ERR("cals_tzutil_get_tz_path failed");
+               return;
+       }
 
        if(cal_svc_tm_value.is_initialize == FALSE || year != cal_svc_tm_value.start_local_dst_date_time.tm_year)
        {
@@ -249,13 +198,9 @@ void cal_svc_set_tz_base_info(int year)
                strncpy(cal_svc_tm_value.local_tz_name,tz_name, sizeof(cal_svc_tm_value.local_tz_name));
        }
 
+       free(tz_name);
 
-       CAL_FREE(lock_city_name);
-       CAL_FREE(lock_tz_path);
-       CAL_FREE(lock_tz_offset);
-       CAL_FREE(local_city_name);
-       CAL_FREE(local_tz_path);
-       CAL_FREE(local_tz_offset);
+       return;
 }
 
 bool cal_get_dst_info_time(cal_date_param_t *cal_date_param,const cal_sch_full_t *sch_record)
index 32bf7f4790bdb1f25793463e5ed8b374f318638c..bfaf228bc57266221a55550db92ec4eccc26ae70 100755 (executable)
@@ -99,7 +99,7 @@ static inline int _cals_insert_schedule(cal_sch_full_t *record)
                        "account_id, type, category, "
                        "summary, description, location, all_day_event, "
                        "start_date_time, end_date_time, repeat_item, repeat_interval, "
-                       "repeat_occurrences, repeat_end_date, sun_moon, week_start, "
+                       "repeat_until_type, repeat_occurrences, repeat_end_date, sun_moon, week_start, "
                        "week_flag, day_date, last_modified_time, missed, "
                        "task_status, priority, timezone, file_id, "
                        "contact_id, busy_status, sensitivity, uid, "
@@ -114,7 +114,7 @@ static inline int _cals_insert_schedule(cal_sch_full_t *record)
                        "%d, %d, %d, "
                        "?, ?, ?, %d, "
                        "%ld, %ld, %d, %d, "
-                       "%d, %ld, %d, %d, "
+                       "%d, %d, %ld, %d, %d, "
                        "?, %d, %ld, %d, "
                        "%d, %d, %d, %d, "
                        "%d, %d, %d, ?, "
@@ -129,7 +129,7 @@ static inline int _cals_insert_schedule(cal_sch_full_t *record)
                        record->account_id, record->cal_type, record->sch_category,
                        record->all_day_event,
                        conv_start_time, conv_end_time, record->repeat_term, record->repeat_interval,
-                       record->repeat_occurrences, conv_repeat_end_time, record->sun_moon, record->week_start,
+                       record->repeat_until_type, record->repeat_occurrences, conv_repeat_end_time, record->sun_moon, record->week_start,
                        record->day_date,       (long int)conv_last_modified_time, record->missed,
                        record->task_status,    record->priority,       record->timezone, record->file_id,
                        record->contact_id, record->busy_status, record->sensitivity,
@@ -284,9 +284,9 @@ static inline int _cals_sch_check_validity(cal_sch_full_t *sch_record)
        if(sch_record->cal_type != CAL_EVENT_SCHEDULE_TYPE)
                return CAL_SUCCESS;
 
-       if((sch_record->repeat_term != CAL_REPEAT_NONE) &&
+       if((sch_record->repeat_term != CAL_REPEAT_NONE) && ((
                (sch_record->repeat_occurrences) != 0 &&
-               (sch_record->repeat_end_date.tm_year == BASE_TIME_YEAR))
+               (sch_record->repeat_end_date.tm_year == BASE_TIME_YEAR)) || (sch_record->repeat_until_type == CALS_REPEAT_UNTIL_TYPE_NONE)))
        {
                cal_db_service_set_repeat_end_date(sch_record);
        }
@@ -626,6 +626,7 @@ static inline int _cals_update_schedule(const int index, cal_sch_full_t *current
                        "end_date_time = %ld,"
                        "repeat_item = %d,"
                        "repeat_interval = %d,"
+                       "repeat_until_type = %d,"
                        "repeat_occurrences = %d,"
                        "repeat_end_date = %ld,"
                        "sun_moon = %d,"
@@ -677,6 +678,7 @@ static inline int _cals_update_schedule(const int index, cal_sch_full_t *current
                (long int)conv_end_time,
                current_record->repeat_term,
                current_record->repeat_interval,
+               current_record->repeat_until_type,
                current_record->repeat_occurrences,
                (long int)conv_repeat_end_time,
                current_record->sun_moon,
@@ -795,10 +797,8 @@ int cals_update_schedule(const int index, cal_sch_full_t *sch_record)
 
        sch_record->missed = 0;
 
-       if((sch_record->repeat_occurrences) != 0 && (sch_record->repeat_end_date.tm_year == BASE_TIME_YEAR))
-       {
-               cal_db_service_set_repeat_end_date(sch_record);
-       }
+       ret = _cals_sch_check_validity(sch_record);
+       retvm_if(CAL_SUCCESS != ret, ret, "_cals_sch_check_validity() is Failed(%d)", ret);
 
        ret = _cals_update_schedule(index, sch_record);
        retvm_if(CAL_SUCCESS != ret, ret, "_cals_update_schedule() Failed(%d)", ret);
@@ -1243,6 +1243,11 @@ int cals_stmt_get_filted_schedule(sqlite3_stmt *stmt,
                start = result;
        }
 
+       if((result = strstr(start, CAL_VALUE_INT_REPEAT_UNTIL_TYPE))) {
+               sch_record->repeat_until_type = sqlite3_column_int(stmt, count++);
+               start = result;
+       }
+
        if((result = strstr(start, CAL_VALUE_INT_REPEAT_OCCURRENCES))) {
                sch_record->repeat_occurrences = sqlite3_column_int(stmt, count++);
                start = result;
@@ -1505,6 +1510,7 @@ void cals_stmt_get_full_schedule(sqlite3_stmt *stmt,cal_sch_full_t *sch_record,
 
        sch_record->repeat_term = sqlite3_column_int(stmt, count++);
        sch_record->repeat_interval = sqlite3_column_int(stmt, count++);
+       sch_record->repeat_until_type = sqlite3_column_int(stmt, count++);
        sch_record->repeat_occurrences = sqlite3_column_int(stmt, count++);
 
        tmp_time = sqlite3_column_int(stmt, count++);
index b25361e62ffba2805239b4731f2e505c49eb684b..2bf91e2ab718c0e7f08c5b6d4edc105b7054f259 100755 (executable)
@@ -155,3 +155,30 @@ int cals_stmt_step(sqlite3_stmt *stmt)
        }
        return ret;
 }
+
+
+int cals_escape_like_pattern(const char *src, char * const dest, int dest_size)
+{
+       int s_pos=0, d_pos=0;
+
+       if (NULL == src) {
+               ERR("The parameter(src) is NULL");
+               dest[d_pos] = '\0';
+               return 0;
+       }
+
+       while (src[s_pos] != 0) {
+               if (dest_size == d_pos - 1)
+                       break;
+               if ('%' == src[s_pos] || '_' == src[s_pos]) {
+                       dest[d_pos++] = '\\';
+               }
+               dest[d_pos++] = src[s_pos++];
+       }
+
+       dest[d_pos] = '\0';
+
+       return d_pos;
+}
+
+
index 7cbe0222a1988421a664e18bf3a2589331e4d277..c99e8820dfc08b35bbb1e0bbe0995d770b3c2895 100755 (executable)
@@ -39,4 +39,6 @@ static inline int cals_stmt_bind_text(sqlite3_stmt *stmt, int pos, const char *s
        return sqlite3_bind_text(stmt, pos, str, strlen(str), SQLITE_STATIC);
 }
 
+int cals_escape_like_pattern(const char *src, char *dest, int dest_size);
+
 #endif /* __CALENDAR_SVC_SQLITE_H__ */
index 5866bde1a0c2def73a3768157f4883cbdf6cd17c..673537ff3bf1b09cc4b44f6fb2bff8dde3a68133 100755 (executable)
@@ -79,6 +79,7 @@ int cals_init_full_record(cal_sch_full_t *sch_full_record)
 
        sch_full_record->index = CAL_INVALID_INDEX;
        sch_full_record->repeat_term = CAL_REPEAT_NONE;
+       sch_full_record->repeat_until_type = CALS_REPEAT_UNTIL_TYPE_NONE;
        sch_full_record->day_date = 1;
        sch_full_record->timezone = -1;
        sch_full_record->contact_id = CAL_INVALID_INDEX;
@@ -438,6 +439,10 @@ API int calendar_svc_struct_get_int(cal_struct *event, const char *field)
                {
                        return sch_rec->repeat_interval;
                }
+               else if(0 == strcmp(field,CAL_VALUE_INT_REPEAT_UNTIL_TYPE))
+               {
+                       return sch_rec->repeat_until_type;
+               }
                else if(0 == strcmp(field,CAL_VALUE_INT_REPEAT_OCCURRENCES))
                {
                        return sch_rec->repeat_occurrences;
@@ -903,6 +908,10 @@ API int calendar_svc_struct_set_int (cal_struct *event, const char *field, int i
                {
                        sch_rec->repeat_interval = intval;
                }
+               else if(0 == strcmp(field,CAL_VALUE_INT_REPEAT_UNTIL_TYPE))
+               {
+                       sch_rec->repeat_until_type = intval;
+               }
                else if(0 == strcmp(field,CAL_VALUE_INT_REPEAT_OCCURRENCES))
                {
                        sch_rec->repeat_occurrences = intval;
index d4a73f168fe56c14382d66207c3623e5a0cf5acf..f2bf03b273eed3bb7e36e62bc78e7e172562b0dc 100755 (executable)
@@ -324,6 +324,7 @@ typedef struct
        GList *alarm_list;
        cal_repeat_term_t repeat_term;          /**< Repeat term */
        int repeat_interval;    /**< Interval of repeat term */
+       int repeat_until_type;  /**< repeat until type */
        int repeat_occurrences; /**< occurrences of repeat */
        struct tm repeat_end_date;      /**< End date for repeat */
        cal_date_type_t sun_moon;                       /**< Using sun or lunar calendar */
@@ -394,6 +395,7 @@ typedef struct
 
        cal_repeat_term_t repeat_term;          /**< Repeat term */
        int repeat_interval;    /**< Interval of repeat term */
+       int repeat_until_type;  /**< Repeat until type */
        struct tm repeat_end_date;      /**< End date for repeat */
        cal_date_type_t sun_moon;                       /**< Using sun or lunar calendar */
        cal_starting_day_type_t week_start;                     /**< Start day of a week */
index 80b994ccad2454c71e8b548c54f92c4a67267f36..62f7fbfde533fd2f9a57e1333934a5d72b548634 100755 (executable)
@@ -18,6 +18,8 @@
  */
 #include <time.h>
 #include <sys/types.h>
+#include <vconf.h>
+#include <stdlib.h>
 
 #include "cals-internal.h"
 #include "cals-tz-utils.h"
@@ -50,4 +52,78 @@ struct tm* cals_tmtime_r(time_t *ttTime, struct tm *tmTime)
        return pTmTime;
 }
 
+static bool _get_tz_path(const char *city, char **tz_path)
+{
+       int left = 0;
+       int right = sizeof(time_zone_array)/sizeof(Time_Zone) -1;
+       int index = 0;
+       int result = 0;
+       int max_count = right;
+
+
+       while(true)
+       {
+               index = ( left + right ) / 2;
+
+               result = strcmp(time_zone_array[index].city, city);
+
+               if(result == 0)
+               {
+                       *tz_path = strdup(time_zone_array[index].tz_path);
+               }
+               else if(result < 0)
+                       left = index+1;
+               else
+                       right = index-1;
+
+               if(left <0 || left >max_count)
+                       goto error;
+               if(right <0 || right >max_count)
+                       goto error;
+               if(left > right)
+                       goto error;
+
+       }
+
+       if(*tz_path == NULL)
+               return false;
+       else
+               return true;
+error:
+       *tz_path = NULL;
+       return false;
+}
+
+
+char *cals_tzutil_get_tz_path(void)
+{
+       int lock_on;
+       char *tz_path;
+       char *city;
+       bool ret;
+
+       tz_path = NULL;
+       lock_on = 0;
+
+       vconf_get_int("db/calendar/timezone_on_off", &lock_on);
+
+       if (lock_on) {
+               tz_path = vconf_get_str("db/calendar/timezone_path");
+               return tz_path;
+       }
+
+       city = vconf_get_str(VCONFKEY_SETAPPL_CITYNAME_INDEX_INT);
+
+       if (!city)
+               return NULL;
+
+       ret = _get_tz_path(city, &tz_path);
+       free(city);
+
+       if (ret)
+               return tz_path;
+
+       return strdup("localtime");
+}
+
 
index ee90672b7b4fa82cfcaabee9a1536e3e827de0e2..7bd5b39540bfa3708bf87ec4c0b89727d589edea 100755 (executable)
@@ -662,5 +662,6 @@ static const Time_Zone tz_path_array[] =
 time_t cals_mktime(struct tm *date_time);
 struct tm *cals_tmtime(time_t *sec);
 struct tm* cals_tmtime_r(time_t *ttTime, struct tm *tmTime);
+char *cals_tzutil_get_tz_path(void);
 
 #endif /* __CALENDAR_SVC_TZ_UTILS_H__ */
index b1fe7a6fec357f26a41620d8da1764a46453a20d..69e48babf8f3be7b9c70edcfeb67ddcecf73e3de 100755 (executable)
@@ -426,6 +426,7 @@ bool cal_db_service_convert_stmt_to_month_field_record(sqlite3_stmt *stmt,int is
        {
                sch_record->repeat_term = sqlite3_column_int(stmt, i++);
                sch_record->repeat_interval = sqlite3_column_int(stmt, i++);
+               sch_record->repeat_until_type = sqlite3_column_int(stmt, i++);
                sch_record->repeat_occurrences = sqlite3_column_int(stmt, i++);
                temp = sqlite3_column_int(stmt, i++);
                cal_db_service_copy_struct_tm((struct tm*)cals_tmtime(&temp),&(sch_record->repeat_end_date));