From bf23c34b9774962da49e6e4d43370dc5be0ffa20 Mon Sep 17 00:00:00 2001 From: Hyunjee Kim Date: Wed, 13 Jan 2016 18:29:04 +0900 Subject: [PATCH] Apply feature of setting time(only year) Change-Id: Id473d056f6ce6762c4f1cf197c2ccfcb791085a5 Signed-off-by: Hyunjee Kim --- CMakeLists.txt | 1 + packaging/org.tizen.settings.spec | 1 + src/view/view_clock.c | 15 +++++++++++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0223607..b1db613 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ pkg_check_modules(PKGS REQUIRED capi-network-wifi tv-service dlog + alarm-service ) IF(NOT DEFINED PACKAGE_NAME) diff --git a/packaging/org.tizen.settings.spec b/packaging/org.tizen.settings.spec index 4312c25..494c18c 100644 --- a/packaging/org.tizen.settings.spec +++ b/packaging/org.tizen.settings.spec @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(capi-network-wifi) BuildRequires: pkgconfig(tv-service) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) +BuildRequires: pkgconfig(alarm-service) Requires(post): /usr/bin/vconftool %define _appdir /usr/apps/%{name} diff --git a/src/view/view_clock.c b/src/view/view_clock.c index 90a4bc7..3394bec 100644 --- a/src/view/view_clock.c +++ b/src/view/view_clock.c @@ -16,6 +16,8 @@ #include #include +#include +#include #include "viewmgr.h" #include "inputmgr.h" @@ -49,6 +51,7 @@ struct _priv { int *setup_type; Evas_Object *setup_type_popup; enum setup_type cur_type; + Evas_Object *year; }; enum input_handler_type { @@ -186,11 +189,18 @@ static void _setup_type_key_down_cb(int id, void *data, Evas *e, Evas_Object *ob static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, Evas_Event_Key_Down *ev) { + struct _priv *priv; + priv = data; + if (!obj || !ev) { _ERR("Invalid argument."); return; } + struct tm _tm_year; + elm_datetime_value_get(priv->year, &_tm_year); + time_t the_time = mktime(&_tm_year); + if (!strcmp(ev->keyname, KEY_ENTER)) { switch (id) { case INPUT_HANDLER_TYPE_BTN_CANCEL: @@ -198,7 +208,7 @@ static void _key_down_cb(int id, void *data, Evas *e, Evas_Object *obj, break; case INPUT_HANDLER_TYPE_BTN_DONE: - elm_object_signal_emit(data, "picker,action,value,set", ""); + alarmmgr_set_systime(the_time); viewmgr_pop_view(); break; @@ -281,7 +291,7 @@ static bool _add_clock_setting(struct _priv *priv) priv->clock_setup_btn = setup_btn; // item - year - Evas_Object *year; + Evas_Object *year = priv->year; year = elm_datetime_add(priv->base); elm_datetime_field_visible_set(year, ELM_DATETIME_HOUR, EINA_FALSE); elm_datetime_field_visible_set(year, ELM_DATETIME_MINUTE, EINA_FALSE); @@ -289,6 +299,7 @@ static bool _add_clock_setting(struct _priv *priv) elm_datetime_field_visible_set(year, ELM_DATETIME_MONTH, EINA_FALSE); elm_datetime_field_visible_set(year, ELM_DATETIME_DATE, EINA_FALSE); elm_object_part_content_set(priv->base, PART_MAIN_ITEM_DATE_YEAR, year); + priv->year = year; // item - month Evas_Object *month; -- 2.7.4