diff options
author | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 15:42:16 +0900 |
---|---|---|
committer | jk7744.park <jk7744.park@samsung.com> | 2015-10-24 15:42:16 +0900 |
commit | 2aa01f1ea98ff42e4bfef6da401eb19383f2f4ce (patch) | |
tree | 7eb4f13beea5ba0aae81b66d48630f87848a6435 /lib-phone/ph-dialer/src/PhDialerSpeeddialPopup.cpp | |
parent | 331d162934ac346a137b6a3a17074d948a3c6c41 (diff) | |
download | phone-contacts-2aa01f1ea98ff42e4bfef6da401eb19383f2f4ce.tar.gz phone-contacts-2aa01f1ea98ff42e4bfef6da401eb19383f2f4ce.tar.bz2 phone-contacts-2aa01f1ea98ff42e4bfef6da401eb19383f2f4ce.zip |
tizen 2.4 releasetizen_2.4_mobile_releasesubmit/tizen_2.4/20151028.062645accepted/tizen/2.4/mobile/20151029.041342accepted/tizen_2.4_mobile
Diffstat (limited to 'lib-phone/ph-dialer/src/PhDialerSpeeddialPopup.cpp')
-rw-r--r-- | lib-phone/ph-dialer/src/PhDialerSpeeddialPopup.cpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/lib-phone/ph-dialer/src/PhDialerSpeeddialPopup.cpp b/lib-phone/ph-dialer/src/PhDialerSpeeddialPopup.cpp new file mode 100644 index 0000000..83fbd52 --- /dev/null +++ b/lib-phone/ph-dialer/src/PhDialerSpeeddialPopup.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 + * + * 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 "PhDialerSpeeddialPopup.h" +#include "PhCommon.h" + +#include "ContactsDebug.h" +#include "ContactsAppControl.h" +#include "ContactsLocalization.h" + +#include <contacts.h> +#include <Elementary.h> +#include <notification.h> + +PhDialerSpeeddialPopup::PhDialerSpeeddialPopup(int speedNumber) + : m_SpeedNumber(speedNumber) +{ +} + +Evas_Object *PhDialerSpeeddialPopup::onCreate(Evas_Object* parent, void* param) +{ + setTextTranslatable(TEXT_DOMAIN); + setTitle("IDS_KPD_HEADER_ASSIGN_AS_SPEED_DIAL_NUMBER_ABB"); + setContent("IDS_KPD_POP_THERE_IS_NO_CONTACT_ASSIGNED_TO_THIS_SPEED_DIAL_NUMBER_TAP_OK_TO_ASSIGN_ONE_NOW"); + + using namespace std::placeholders; + addButton("IDS_LOGS_BUTTON_CANCEL_ABB3", nullptr); + addButton("IDS_PB_BUTTON_OK_ABB2", std::bind(&PhDialerSpeeddialPopup::onOkPressed, this, _1)); + return WPopup::onCreate(parent, param); +} + +void PhDialerSpeeddialPopup::onOkPressed(bool *destroyPopup) +{ + int err = launchContactPick(APP_CONTROL_DATA_SELECTION_MODE_SINGLE, + APP_CONTROL_DATA_TYPE_PHONE, + &PhDialerSpeeddialPopup::onPickResult, this); + WPRET_M(err != APP_CONTROL_ERROR_NONE, "launchContactPick() failed(0x%x)", err); + *destroyPopup = false; +} + +void PhDialerSpeeddialPopup::onPickResult(app_control_h request, app_control_h reply, + app_control_result_e result, void *data) +{ + PhDialerSpeeddialPopup *popup = (PhDialerSpeeddialPopup*) data; + + char **numberIds = 0; + int count = 0; + int err = app_control_get_extra_data_array(reply, APP_CONTROL_DATA_SELECTED, &numberIds, &count); + WPWARN(err != APP_CONTROL_ERROR_NONE, "app_control_get_extra_data() failed(0x%x)", err); + if (numberIds && numberIds[0]) { + int numberId = atoi(numberIds[0]); + if (numberId > 0) { + if (PhCommon::addSpeedDialNumber(popup->m_SpeedNumber, numberId)) { + notification_status_message_post(T_("IDS_KPD_TPOP_SPEED_DIAL_NUMBER_ASSIGNED")); + } else { + notification_status_message_post(T_("IDS_PB_POP_ALREADY_EXISTS_LC")); + } + } + } + + for (int i = 0; i < count; ++i) { + free(numberIds[i]); + } + free(numberIds); + + popup->destroy(); +} |