static inline int __cal_vcalendar_make_priority(cal_make_s *b, int v)
{
+ int prio = 0;
char tmp[2];
- snprintf(tmp, sizeof(tmp), "%d", v);
+
+ switch (v)
+ {
+ case CALENDAR_EVENT_PRIORITY_HIGH:
+ prio = 3; // one out of 1 ~ 4.
+ break;
+ case CALENDAR_EVENT_PRIORITY_NORMAL:
+ prio = 5;
+ break;
+ case CALENDAR_EVENT_PRIORITY_LOW:
+ prio = 7; // one out of 6 ~ 9.
+ break;
+ default:
+ prio = 0; // means none.
+ break;
+ }
+
+ snprintf(tmp, sizeof(tmp), "%d", prio);
__cal_vcalendar_make_printf(b, "PRIORITY:", tmp);
return CALENDAR_ERROR_NONE;
}
static int __cal_vcalendar_parse_priority(int type, calendar_list_h list, calendar_record_h record, char *prop, char *cont)
{
int ret;
+ int prio = 0;
char *p = (char *)cont;
p++;
return -1;
}
+ switch (atoi(p))
+ {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ prio = CALENDAR_TODO_PRIORITY_HIGH;
+ break;
+ case 5:
+ prio = CALENDAR_TODO_PRIORITY_NORMAL;
+ break;
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ prio = CALENDAR_TODO_PRIORITY_LOW;
+ break;
+ default:
+ prio = CALENDAR_TODO_PRIORITY_NONE;
+ break;
+ }
+
switch (type)
{
case CALENDAR_BOOK_TYPE_EVENT:
- ret = _cal_record_set_int(record, _calendar_event.priority, atoi(p));
+
+ ret = _cal_record_set_int(record, _calendar_event.priority, prio);
break;
case CALENDAR_BOOK_TYPE_TODO:
- ret = _cal_record_set_int(record, _calendar_todo.priority, atoi(p));
+ ret = _cal_record_set_int(record, _calendar_todo.priority, prio);
break;
}
return CALENDAR_ERROR_NONE;
*/
typedef enum
{
- CALENDAR_EVENT_PRIORITY_LOW = 0, /**< Low priority */
- CALENDAR_EVENT_PRIORITY_NORMAL, /**< Normal priority */
- CALENDAR_EVENT_PRIORITY_HIGH /**< High priority */
+ CALENDAR_EVENT_PRIORITY_NONE = 0x01, /**< Priority none */
+ CALENDAR_EVENT_PRIORITY_LOW = 0x08, /**< Low priority */
+ CALENDAR_EVENT_PRIORITY_NORMAL = 0x04, /**< Normal priority */
+ CALENDAR_EVENT_PRIORITY_HIGH = 0x02, /**< High priority */
} calendar_event_priority_e;
/**