summaryrefslogtreecommitdiff
path: root/phone
diff options
context:
space:
mode:
authorSunggoo Kim <sung.goo.kim@samsung.com>2012-08-21 18:17:42 +0900
committerSunggoo Kim <sung.goo.kim@samsung.com>2012-08-21 18:17:42 +0900
commit41b2478dc578156bb904201f8f6e2d9d35c26f9f (patch)
tree88f4757f2e2bf498b67889f0901bf9f0fcb13057 /phone
parente9d80f84b140bb86fe9e7bc025ec1de25f6b1cad (diff)
downloadphone-contacts-41b2478dc578156bb904201f8f6e2d9d35c26f9f.tar.gz
phone-contacts-41b2478dc578156bb904201f8f6e2d9d35c26f9f.tar.bz2
phone-contacts-41b2478dc578156bb904201f8f6e2d9d35c26f9f.zip
migration
Diffstat (limited to 'phone')
-rw-r--r--phone/CMakeLists.txt11
-rw-r--r--phone/icon_phone.pngbin0 -> 7878 bytes
-rwxr-xr-xphone/org.tizen.phone.xml31
-rwxr-xr-xphone/phone.c229
4 files changed, 271 insertions, 0 deletions
diff --git a/phone/CMakeLists.txt b/phone/CMakeLists.txt
new file mode 100644
index 0000000..041b3b7
--- /dev/null
+++ b/phone/CMakeLists.txt
@@ -0,0 +1,11 @@
+SET(SRCS phone.c)
+
+ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${EXTRA_CFLAGS} -fpie")
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/lib/include)
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} common ug-phone-tabui-efl "-pie")
+
+INSTALL(FILES ${CMAKE_BINARY_DIR}/phone/org.tizen.phone.xml DESTINATION "/usr/share/packages")
+INSTALL(FILES icon_phone.png DESTINATION "/usr/share/icons/default/small" RENAME "org.tizen.phone.png")
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${BINDIR})
+
diff --git a/phone/icon_phone.png b/phone/icon_phone.png
new file mode 100644
index 0000000..d66d58b
--- /dev/null
+++ b/phone/icon_phone.png
Binary files differ
diff --git a/phone/org.tizen.phone.xml b/phone/org.tizen.phone.xml
new file mode 100755
index 0000000..50597e8
--- /dev/null
+++ b/phone/org.tizen.phone.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.phone" version="0.1.1" install-location="internal-only">
+ <label>Phone</label>
+ <author email="ps.jeong@samsung.com" href="www.samsung.com">bongsu Jeong</author>
+ <description>Phone Application</description>
+ <ui-application appid="org.tizen.phone" exec="/usr/apps/org.tizen.phone/bin/phone tab phone" nodisplay="false" multiple="false" type="capp" taskmanage="true">
+ <icon>org.tizen.phone.png</icon>
+ <label>Phone</label>
+ <label xml:lang="ko_KR">전화</label>
+ <label xml:lang="de_DE">Telefon</label>
+ <label xml:lang="en_GB">Phone</label>
+ <label xml:lang="en_US">Phone</label>
+ <label xml:lang="es_ES">Phone</label>
+ <label xml:lang="fr_FR">Phone</label>
+ <label xml:lang="it_IT">Telef.</label>
+ <label xml:lang="ja_JP">電話</label>
+ <label xml:lang="nl_NL">Telefoon</label>
+ <label xml:lang="pt_PT">Telef.</label>
+ <label xml:lang="ru_RU">Телефон</label>
+ <label xml:lang="tr_TR">Telefon</label>
+ <label xml:lang="zh_CN">手机</label>
+ <label xml:lang="zh_HK">電話</label>
+ <label xml:lang="zh_TW">電話</label>
+
+ <application-service>
+ <operation name="http://tizen.org/appsvc/operation/dial" />
+ <mime name="tel" />
+ </application-service>
+
+ </ui-application>
+</manifest>
diff --git a/phone/phone.c b/phone/phone.c
new file mode 100755
index 0000000..f56fcce
--- /dev/null
+++ b/phone/phone.c
@@ -0,0 +1,229 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <ui-gadget.h>
+#include <contacts-svc.h>
+#include <app.h>
+
+#include "phone.h"
+#include "ph-front.h"
+
+struct phone_data
+{
+ Evas_Object *win;
+ ph_phoneui_data *phoneui_d;
+ /* add more variables here */
+};
+
+static void phapp_win_del(void *data, Evas_Object *obj, void *event)
+{
+ elm_exit();
+}
+
+static Evas_Object* phapp_create_win(const char *name)
+{
+ Evas_Object *eo;
+ int w, h;
+
+ elm_config_preferred_engine_set("opengl_x11");//temporary code due to S1-6700
+ eo = elm_win_add(NULL, name, ELM_WIN_BASIC);
+ if (eo) {
+ elm_win_title_set(eo, name);
+ elm_win_borderless_set(eo, EINA_TRUE);
+ evas_object_smart_callback_add(eo, "delete,request", phapp_win_del, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(eo, w, h);
+ elm_win_indicator_mode_set(eo, ELM_WIN_INDICATOR_SHOW);
+ }
+
+ return eo;
+}
+
+static void phapp_region_changed(void *data)
+{
+ PH_FN_CALL;
+ ph_phoneui_data *phoneui_d = data;
+ phone_front_view_region_changed(phoneui_d);
+ ug_send_event(UG_EVENT_REGION_CHANGE);
+ return;
+}
+
+static int phapp_open(void *data)
+{
+ PH_FN_CALL;
+ struct phone_data *ad = data;
+ ph_phoneui_data *phoneui_d = ad->phoneui_d;
+ if (TRUE == phone_front_view_show_call_app(phoneui_d))
+ return -1;
+ return 0;
+}
+
+static bool phapp_create(void *data)
+{
+ PH_FN_CALL;
+ int ret;
+ Evas_Object *win;
+ struct phone_data *ad = data;
+
+ /* create window */
+ win = phapp_create_win(PACKAGE);
+ p_retvm_if(NULL == win, -1, "phapp_create_win() Failed");
+ ad->win = win;
+ evas_object_show(win);
+
+ bindtextdomain(PACKAGE, LOCALEDIR);
+
+ ret = contacts_svc_connect();
+ if (CTS_SUCCESS != ret) {
+ Evas_Object *popup;
+ ERR("contacts_svc_connect() Failed(%d)", ret);
+ popup = elm_popup_add(win);
+ evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(popup);
+ elm_object_text_set(popup, T_(PH_GET_TEXT_BASIC, PHTEXT_INITIALIZING));
+ elm_popup_timeout_set(popup, 1.5);
+ evas_object_smart_callback_add(popup, "timeout", phapp_win_del, NULL);
+ return true;
+ }
+
+ UG_INIT_EFL(ad->win, UG_OPT_INDICATOR_ENABLE);
+ ad->phoneui_d = phone_front_view_create(ad->win);
+
+ appcore_set_open_cb(phapp_open, data);
+
+ return true;
+}
+
+static void phapp_terminate(void *data)
+{
+ PH_FN_CALL;
+ struct phone_data *ad = data;
+ if (NULL != ad->win)
+ evas_object_del(ad->win);
+ ug_destroy_all();
+ contacts_svc_disconnect();
+ return;
+}
+
+static void phapp_pause(void *data)
+{
+ PH_FN_CALL;
+ struct phone_data *ad = data;
+ phone_front_view_pause(ad->phoneui_d);
+ ug_pause();
+ return;
+}
+
+static void phapp_resume(void *data)
+{
+ PH_FN_CALL;
+ // update missed log info
+ struct phone_data *ad = data;
+ phone_front_view_resume(ad->phoneui_d);
+ ug_resume();
+ return;
+}
+
+static void phapp_service(service_h service, void *data)
+{
+ PH_FN_CALL;
+ struct phone_data *ad = data;
+ ph_phoneui_data *phoneui_d;
+ char* val = NULL;
+ int ret;
+
+ p_retm_if(NULL == ad || NULL == ad->phoneui_d, "data is null");
+ phoneui_d = ad->phoneui_d;
+
+ ret = service_get_operation(service, &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_operation is failed(%d)", ret);
+
+ if (val && 0 == strcmp(val, SERVICE_OPERATION_DIAL)) {
+ free(val);
+ val = NULL;
+ ret = service_get_uri(service, &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_uri is failed(%d)", ret);
+ if (val && 0 == strncmp(val, "tel:", 4)) {
+ phone_front_view_reset(phoneui_d, PH_VIEW_DIALER, PH_FRONT_DIALER_WITH_NUM, service);
+ free(val);
+ }
+ return;
+ }
+
+ // missed_call : show log main view, from idle_lock, quickpanel
+ ret = service_get_extra_data(service, "logs", &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+ if (val && 0 == strcmp(val, "missed_call")) {
+ phone_front_view_reset(phoneui_d, PH_VIEW_LOG, PH_FRONT_LOG_MISSED, NULL);
+ free(val);
+ return;
+ }
+
+ ret = service_get_extra_data(service, "launch_type", &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+
+ if (val && *val) {
+ if (0 == strcmp(val, "log"))
+ phone_front_view_reset(phoneui_d, PH_VIEW_LOG, -1, NULL);
+ else if (0 == strcmp(val, "favorite"))
+ phone_front_view_reset(phoneui_d, PH_VIEW_FAVORITE, -1, NULL);
+ else if (0 == strcmp(val, "dialer")) {
+ if (phone_front_view_show_call_app(phoneui_d)) {
+ if(phoneui_d->select_tab < PH_VIEW_DIALER)
+ elm_exit();
+ }
+ else
+ phone_front_view_reset(phoneui_d, PH_VIEW_DIALER, -1, NULL);
+ }
+ free(val);
+ return;
+ }
+
+ ret = service_get_extra_data(service, "tab", &val);
+ p_warn_if(SERVICE_ERROR_NONE != ret, "service_get_extra_data is failed(%d)", ret);
+ if (val && *val) {
+ if (!strcmp(val, "dialer")) {
+ phone_front_view_reset(phoneui_d, PH_VIEW_DIALER, -1, NULL);
+ free(val);
+ return;
+ }
+ }
+
+ elm_win_lower(phoneui_d->win);
+ return;
+}
+
+API int main(int argc, char *argv[])
+{
+ struct phone_data ad = {0};
+ app_event_callback_s event_callback = {0,};
+
+ event_callback.create = phapp_create;
+ event_callback.terminate = phapp_terminate;
+ event_callback.pause = phapp_pause;
+ event_callback.resume = phapp_resume;
+ event_callback.service = phapp_service;
+ event_callback.low_memory = NULL;
+ event_callback.low_battery = NULL;
+ event_callback.region_format_changed = phapp_region_changed;
+ event_callback.language_changed = NULL;
+ event_callback.device_orientation = NULL;
+
+ return app_efl_main(&argc, &argv, &event_callback, &ad);
+}
+