From: Tomasz Iwanek Date: Tue, 16 Apr 2013 09:57:50 +0000 (+0200) Subject: Popup removal X-Git-Tag: accepted/tizen_2.1/20130425.023916~5^2~17 X-Git-Url: http://review.tizen.org/git/?p=framework%2Fweb%2Fwrt-installer.git;a=commitdiff_plain;h=69ba08a84d02efabc8abfd25bfe2ec96e20240fd Popup removal [Issue#] N/A [Feature] Popups not needed [Cause] N/A [Solution] N/A [Verification] Build repo. Run installation for myfiles app. Installation should not involves popups. Test successfully installation and some invalid widget. Change-Id: I1c7d64a0d6ca8f302ec89e9c75be5ec8eed2786e --- diff --git a/CMakeLists.txt b/CMakeLists.txt index fdb5f18..b9bb8b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,20 +95,6 @@ SET(TARGET_INSTALLER_STATIC "wrt-installer_static") SET(TARGET_INSTALLER "wrt-installer") SET(TARGET_BACKEND_LIB "wgt") -ADD_CUSTOM_COMMAND( - OUTPUT ${PROJECT_SOURCE_DIR}/data/widget_install_popup.edj - COMMAND edje_cc - ARGS ${PROJECT_SOURCE_DIR}/data/widget_install_popup.edc - ${PROJECT_SOURCE_DIR}/data/widget_install_popup.edj - DEPENDS ${PROJECT_SOURCE_DIR}/data/widget_install_popup.edc - ) -ADD_CUSTOM_TARGET(widget_install_popup ALL DEPENDS - ${PROJECT_SOURCE_DIR}/data/widget_install_popup.edj - ) -INSTALL(FILES ${PROJECT_SOURCE_DIR}/data/widget_install_popup.edj - DESTINATION share/edje/wrt - ) - ############################# subdirectories ################################## ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(etc) diff --git a/data/widget_install_popup.edc b/data/widget_install_popup.edc deleted file mode 100755 index 2440f9f..0000000 --- a/data/widget_install_popup.edc +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (c) 2011 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. - */ - -collections { - group { - name: "popup"; - parts{ - part { - name: "pad_t"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - min: 0 90; - fixed: 0 1; - visible: 0; - color: 19 222 249 255; - align: 0.0 0.0; - rel1 { - relative: 1.0 0.0; to_x: "pad_l"; - } - rel2 { - relative: 0.0 0.0; to_x: "pad_r"; - } - } - } - part { - name: "pad_l"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - min: 10 300; - fixed: 1 0; - visible: 0; - color: 255 255 255 255; - align: 0.0 0.0; - rel1 { - relative: 0.0 0.0; - } - rel2 { - relative: 0.0 1.0; - } - } - } - part { - name: "pad_r"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - min: 10 300; - fixed: 1 0; - visible: 0; - color: 255 255 255 255; - align: 1.0 0.0; - rel1 { - relative: 1.0 0.0; - } - rel2 { - relative: 1.0 1.0; - } - } - } - part { - name: "elm.swallow.label"; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - align: 0.5 0.0; - visible: 1; - min: 10 100; - fixed: 1 1; - color: 19 222 249 255; - rel1 { - relative: 0.0 0.0; to: "pad_t"; - } - rel2 { - relative: 1.0 1.0; to: "pad_t"; - } - } - } - part { - name: "elm.swallow.separator"; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - align: 0.5 0.5; - visible: 0; - min: 600 10; - fixed: 1 1; - color: 19 222 249 255; - rel1 { - relative: 0.5 1.0; to: "pad_t"; - } - rel2 { - relative: 0.5 0.0; to: "pad_b"; - } - } - } - part { - name: "elm.swallow.scroller"; - type: SWALLOW; - scale: 1; - description { - state: "default" 0.0; - min: 550 160; - align: 0.5 0.5; - fixed: 1 1; - visible: 1; - color : 92 93 94 95; - rel1 { - relative: 0.5 1.0; to: "elm.swallow.separator"; - } - rel2 { - relative: 0.5 1.0; to: "pad_b"; - } - } - } - part { - name: "pad_b"; - type: RECT; - scale: 1; - description { - state: "default" 0.0; - fixed: 1 1; - visible: 0; - align: 0.0 1.0; - color: 250 189 18 255; - min: 0 170; - rel1 { - relative: 1.0 1.0; to_x: "pad_l"; - } - rel2 { - relative: 0.0 1.0; to_x: "pad_r"; - } - } - } - } - } -} diff --git a/packaging/wrt-installer.spec b/packaging/wrt-installer.spec index acc1167..62994a3 100644 --- a/packaging/wrt-installer.spec +++ b/packaging/wrt-installer.spec @@ -108,7 +108,6 @@ mkdir -p /opt/share/icons/default/small %attr(775,root,root) %{_initddir}/wrt_preinstall_widgets.sh %{_sysconfdir}/rc.d/rc3.d/S48lwrt_preinstall_widgets.sh %{_sysconfdir}/rc.d/rc5.d/S48lwrt_preinstall_widgets.sh -%attr(644,root,root) %{_datadir}/edje/wrt/* /usr/etc/package-manager/backendlib/libwgt.so %{_datadir}/license/%{name} %{_libdir}/systemd/user/tizen-mobile-session.target.wants/wrt-preinstall-widgets.service diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc9962c..994b6ce 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,7 +81,6 @@ SET(INSTALLER_SOURCES ${INSTALLER_JOBS}/widget_install/task_prepare_reinstall.cpp ${INSTALLER_JOBS}/widget_install/wac_security.cpp ${INSTALLER_JOBS}/widget_install/widget_update_info.cpp - ${INSTALLER_JOBS}/widget_install/widget_install_popup.cpp ${INSTALLER_JOBS}/widget_uninstall/job_widget_uninstall.cpp ${INSTALLER_JOBS}/widget_uninstall/task_check.cpp ${INSTALLER_JOBS}/widget_uninstall/task_remove_files.cpp diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp index 264ee96..4705fcb 100644 --- a/src/jobs/widget_install/task_certify.cpp +++ b/src/jobs/widget_install/task_certify.cpp @@ -126,7 +126,6 @@ namespace Jobs { namespace WidgetInstall { TaskCertify::TaskCertify(InstallerContext &inCont) : DPL::TaskDecl(this), - WidgetInstallPopup(inCont), m_contextData(inCont) { AddStep(&TaskCertify::stepSignature); @@ -134,17 +133,6 @@ TaskCertify::TaskCertify(InstallerContext &inCont) : if (true == m_contextData.isUpdateMode) { AddStep(&TaskCertify::stepVerifyUpdate); } - - // Block until fixed popup issues - if (!GlobalSettings::PopupsTestModeEnabled() - && !m_installContext.m_quiet && !isTizenWebApp()) - { - AddStep(&TaskCertify::stepWarningPopup); - AddStep(&TaskCertify::stepWarningPopupAnswer); - AddStep(&TaskCertify::stepAuthorInfoPopup); - AddStep(&TaskCertify::stepAuthorInfoPopupAnswer); - AddStep(&TaskCertify::StepDeletePopupWin); - } AddStep(&TaskCertify::stepFinalize); } @@ -251,7 +239,7 @@ void TaskCertify::stepSignature() WrtSignatureValidator::AppType appType = WrtSignatureValidator::WAC20; - if (m_installContext.widgetConfig.webAppType == + if (m_contextData.widgetConfig.webAppType == APP_TYPE_TIZENWEBAPP) { appType = WrtSignatureValidator::TIZEN; @@ -322,99 +310,6 @@ void TaskCertify::stepSignature() "Widget Signature checked"); } -void TaskCertify::createInstallPopup(PopupType type, const std::string &label) -{ - m_contextData.job->Pause(); - if (m_popup) { - destroyPopup(); - } - bool ret = createPopup(); - if (ret) { - loadPopup(type, label); - showPopup(); - } -} -void TaskCertify::StepDeletePopupWin() -{ - destroyPopup(); -} - -void TaskCertify::stepWarningPopup() -{ - LogInfo("Step:: <>"); - // SP-2151: If widget is not recognized (OCSP status of any of certificates - // it is signed with is not recognized) WRT must notify user that - // widget cannot be installed as a trusted application, and let the - // user decide whether it should be installed as an untrusted - // application. - if (!m_contextData.wacSecurity.isDistributorSigned()) { - std::string label = UNTRUSTED_WIDGET + - LABEL_NEW_LINE_2 + - QUESTION; - createInstallPopup(PopupType::WIDGET_UNRECOGNIZED, label); - } -} - -std::string TaskCertify::createAuthorWidgetInfo() const -{ - std::string authorInfo; - if (m_contextData.wacSecurity.isRecognized()) { - //authorInfo += _("IDS_IM_WIDGET_RECOGNISED"); - authorInfo += _("WIDGET RECOGNISED"); - } else { - //authorInfo += _("IDS_IM_WIDGET_UNRECOGNISED"); - authorInfo += _("WIDGET UNRECOGNISED"); - } - - authorInfo += LABEL_NEW_LINE_2; - ValidationCore::CertificatePtr authorCert = - m_contextData.wacSecurity.getAuthorCertificatePtr(); - if (!!authorCert) { - DPL::Optional < DPL::String > organizationName = - authorCert->getOrganizationName(); - - //authorInfo += _("IDS_IM_WIDGET_AUTHOR_ORGANIZATION_NAME"); - authorInfo += _("AUTHOR ORGANIZATION NAME"); - authorInfo += LABEL_NEW_LINE; - - if (!organizationName.IsNull()) { - authorInfo += DPL::ToUTF8String(*organizationName); - } else { - //authorInfo += _("IDS_IM_WIDGET_ORGANIZATION_UNKNOWN"); - authorInfo += _("WIDGET ORGANIZATION UNKNOWN"); - } - - authorInfo += LABEL_NEW_LINE_2; - - DPL::Optional < DPL::String > countryName = - authorCert->getCountryName(); - - //authorInfo += _("IDS_IM_WIDGET_COUNTRY_NAME"); - authorInfo += _("WIDGET COUNTRY NAME"); - authorInfo += LABEL_NEW_LINE; - - if (!countryName.IsNull()) { - authorInfo += DPL::ToUTF8String(*countryName); - } else { - //authorInfo += _("IDS_IM_WIDGET_COUNTRY_UNKNOWN"); - authorInfo += _("WIDGET COUNTRY UNKNOWN"); - } - } else { - authorInfo += - //_("IDS_IM_WIDGET_DOES_NOT_CONTAIN_RECOGNIZED_AUTHOR_SIGNATURE"); - _("Widget does not contain recognized author signature"); - } - return authorInfo; -} - -void TaskCertify::stepAuthorInfoPopup() -{ - LogInfo("Step:: <>"); - std::string label - = createAuthorWidgetInfo() + LABEL_NEW_LINE_2 + QUESTION; - createInstallPopup(PopupType::WIDGET_AUTHOR_INFO, label); -} - void TaskCertify::stepFinalize() { LogInfo("Step: <>"); @@ -424,34 +319,10 @@ void TaskCertify::stepFinalize() "Widget Certification Check Finished"); } -void TaskCertify::stepWarningPopupAnswer() -{ - LogInfo("Step: <>"); - if (false == m_contextData.wacSecurity.isDistributorSigned() && - WRT_POPUP_BUTTON_CANCEL == m_installCancel) - { - LogWarning("User does not agreed to install unsigned widgets!"); - m_installCancel = WRT_POPUP_BUTTON; - destroyPopup(); - ThrowMsg(Exceptions::NotAllowed, "Widget not allowed"); - } -} - -void TaskCertify::stepAuthorInfoPopupAnswer() -{ - LogInfo("Step: <>"); - if (WRT_POPUP_BUTTON_CANCEL == m_installCancel) { - LogWarning("User does not agreed to install widget!"); - m_installCancel = WRT_POPUP_BUTTON; - destroyPopup(); - ThrowMsg(Exceptions::NotAllowed, "Widget not allowed"); - } -} - bool TaskCertify::isTizenWebApp() const { bool ret = FALSE; - if (m_installContext.widgetConfig.webAppType.appType + if (m_contextData.widgetConfig.webAppType.appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) { ret = TRUE; @@ -466,7 +337,7 @@ void TaskCertify::stepVerifyUpdate() CertificatePtr newCertificate = m_contextData.wacSecurity.getAuthorCertificatePtr(); CertificatePtr oldCertificate = - getOldAuthorSignerCertificate(m_installContext.widgetConfig.tzAppid); + getOldAuthorSignerCertificate(m_contextData.widgetConfig.tzAppid); if (!!newCertificate && !!oldCertificate) { if (0 != newCertificate->getBase64().compare(oldCertificate->getBase64())) { diff --git a/src/jobs/widget_install/task_certify.h b/src/jobs/widget_install/task_certify.h index 06e9610..6c42853 100644 --- a/src/jobs/widget_install/task_certify.h +++ b/src/jobs/widget_install/task_certify.h @@ -28,7 +28,6 @@ //WRT INCLUDES #include -#include class InstallerContext; @@ -39,8 +38,7 @@ class SignatureData; namespace Jobs { namespace WidgetInstall { class TaskCertify : - public DPL::TaskDecl, - public WidgetInstallPopup + public DPL::TaskDecl { public: TaskCertify(InstallerContext &inCont); @@ -52,19 +50,11 @@ class TaskCertify : //steps void stepSignature(); void stepVerifyUpdate(); - void stepWarningPopup(); - void stepAuthorInfoPopup(); - void stepWarningPopupAnswer(); - void stepAuthorInfoPopupAnswer(); - void StepDeletePopupWin(); void stepFinalize(); - void createInstallPopup(PopupType type, const std::string &label); void processDistributorSignature(const ValidationCore::SignatureData &data); void processAuthorSignature(const ValidationCore::SignatureData &data); - std::string createAuthorWidgetInfo() const; - bool isTizenWebApp() const; }; } //namespace WidgetInstall diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index d7c3640..1328f07 100644 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -68,7 +68,6 @@ void InstallerTaskWidgetPopupData::PopupData::addWidgetInfo( TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) : DPL::TaskDecl(this), - WidgetInstallPopup(installContext), m_installContext(installContext) { AddStep(&TaskWidgetConfig::StepProcessConfigurationFile); @@ -79,16 +78,6 @@ TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) : AddStep(&TaskWidgetConfig::ProcessWidgetInstalledPath); AddStep(&TaskWidgetConfig::StepVerifyFeatures); AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo); - - if (!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet) { - AddStep( - &TaskWidgetConfig:: - StepCancelWidgetInstallationAfterVerifyFeatures); - AddStep(&TaskWidgetConfig::StepShowWidgetInfo); - AddStep(&TaskWidgetConfig::StepCancelWidgetInstallation); - AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion); - AddStep(&TaskWidgetConfig::StepDeletePopupWin); - } } void TaskWidgetConfig::StepProcessConfigurationFile() @@ -371,81 +360,16 @@ void TaskWidgetConfig::ProcessWidgetInstalledPath() m_installContext.locations->getPackageInstallationDir()); } -void TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures() -{ - LogDebug("StepCancelWidgetInstallationAfterVerifyFeatures"); - if (InfoPopupButton::WRT_POPUP_BUTTON_CANCEL == m_installCancel) { - m_installCancel = WRT_POPUP_BUTTON; - destroyPopup(); - ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Widget not allowed"); - } -} - -void TaskWidgetConfig::StepCancelWidgetInstallation() -{ - if (InfoPopupButton::WRT_POPUP_BUTTON_CANCEL == m_installCancel) { - m_installCancel = WRT_POPUP_BUTTON; - destroyPopup(); - ThrowMsg(Exceptions::NotAllowed, "Widget not allowed"); - } -} - -void TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion() -{ - if (InfoPopupButton::WRT_POPUP_BUTTON_CANCEL == m_installCancel) { - m_installCancel = WRT_POPUP_BUTTON; - destroyPopup(); - ThrowMsg(Exceptions::NotAllowed, "WRT version incompatible."); - } -} - -void TaskWidgetConfig::createInstallPopup(PopupType type, - const std::string &label) -{ - m_installContext.job->Pause(); - if (m_popup) { - destroyPopup(); - } - - bool ret = createPopup(); - if (ret) { - loadPopup(type, label); - showPopup(); - } -} - -void TaskWidgetConfig::StepDeletePopupWin() -{ - destroyPopup(); -} - -void TaskWidgetConfig::StepShowWidgetInfo() -{ - if (!m_popupData.widgetInfo.empty()) { - std::string label = DPL::ToUTF8String(m_popupData.widgetInfo); - createInstallPopup(PopupType::WIDGET_FEATURE_INFO, label); - m_installContext.job->UpdateProgress( - InstallerContext::INSTALL_WIDGET_CONFIG2, - "Show Widget Info Finished"); - } -} - void TaskWidgetConfig::StepCheckMinVersionInfo() { if (!isMinVersionCompatible( m_installContext.widgetConfig.webAppType.appType, m_installContext.widgetConfig.minVersion)) { - if (!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet) { - LogDebug("Platform version to low - launching"); - std::string label = WIDGET_NOT_COMPATIBLE + QUESTION; - createInstallPopup(PopupType::WIDGET_MIN_VERSION, label); - } else { - LogError( - "Platform version lower than required -> cancelling installation"); - ThrowMsg(Exceptions::NotAllowed, - "Platform version does not meet requirements"); - } + LogError( + "Platform version lower than required -> cancelling installation"); + ThrowMsg(Exceptions::NotAllowed, + "Platform version does not meet requirements"); } m_installContext.job->UpdateProgress( diff --git a/src/jobs/widget_install/task_widget_config.h b/src/jobs/widget_install/task_widget_config.h index fdaf1e9..e67ddb2 100644 --- a/src/jobs/widget_install/task_widget_config.h +++ b/src/jobs/widget_install/task_widget_config.h @@ -34,7 +34,6 @@ #include #include -#include class InstallerContext; @@ -49,8 +48,7 @@ struct PopupData } // InstalllerTaskWidgetPopupData class TaskWidgetConfig : - public DPL::TaskDecl, - public WidgetInstallPopup + public DPL::TaskDecl { private: class Exception @@ -81,17 +79,11 @@ class TaskWidgetConfig : void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon); void ProcessWidgetInstalledPath(); void StepVerifyFeatures(); - void StepShowWidgetInfo(); void StepCheckMinVersionInfo(); template void StepCancelInstallation(); - void StepDeletePopupWin(); - void StepCancelWidgetInstallationAfterVerifyFeatures(); - void StepCancelWidgetInstallation(); - void StepCancelWidgetInstallationAfterMinVersion(); - void createInstallPopup(PopupType type, const std::string &label); DPL::String createAuthorWidgetInfo() const; bool isFeatureAllowed( WrtDB::AppType appType, DPL::String featureName); diff --git a/src/jobs/widget_install/widget_install_popup.cpp b/src/jobs/widget_install/widget_install_popup.cpp deleted file mode 100644 index bfb6b9f..0000000 --- a/src/jobs/widget_install/widget_install_popup.cpp +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2011 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. - */ -/* - * @file widget_install_popup.cpp - * @author lke01.lee (lke01.lee@samsung.com) - * @version 1.0 - * @brief Implementation file for installer popup - */ -#include -#include -#include -#include -#include - -namespace { -const char * const EDJFILE = "/usr/share/edje/wrt/widget_install_popup.edj"; -const char * const EDJGROUP = "widget_install_popup"; -const char * const TITLE_TEXT = "title,text"; -const char * const name = "WidgetInstallPopup"; -const char * const FEATURE_TITLE = "Widget Feature Info"; -const char * const INFO_TITLE = "Widget Info"; -const char * const INSTALLATION_FAILURE = "Installation failure"; -const char * const INFO_LEFT_BUTTON = "OK"; -const char * const INFO_RIGHT_BUTTON = "CANCEL "; -const char * const WARNING_TITLE = "Widget Warning"; -const char * const WARNING_LEFT_BUTTON = "YES"; -const char * const WARNING_RIGHT_BUTTON = "NO"; -const char * const QUESTION = - "Widget use Device API below.
Do you want to install?"; -} - -namespace Jobs { -namespace WidgetInstall { -WidgetInstallPopup::WidgetInstallPopup(InstallerContext &installContext) : - m_win(NULL), - m_popup(NULL), - m_installContext(installContext), - m_installCancel(WRT_POPUP_BUTTON) -{ - LogDebug("InstallPopup"); -} - -WidgetInstallPopup::~WidgetInstallPopup() -{ - LogDebug("~InstallPopup"); -} - -bool WidgetInstallPopup::addWin(const char *name) -{ - int w, h; - m_win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC); - if (!m_win) { - LogError("addWin failed"); - return false; - } - - elm_win_alpha_set(m_win, EINA_TRUE); - elm_win_title_set(m_win, name); - elm_win_borderless_set(m_win, EINA_TRUE); - elm_win_raise(m_win); - - ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); - evas_object_resize(m_win, w, h); - return true; -} - -bool WidgetInstallPopup::addPopup() -{ - m_popup = elm_popup_add(m_win); - if (!m_popup) { - return false; - } - - evas_object_size_hint_align_set(m_popup, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(m_popup, - EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - return true; -} - -void WidgetInstallPopup::addTitle(PopupType type) -{ - switch (type) { - case PopupType::WIDGET_FEATURE_INFO: - elm_object_part_text_set(m_popup, TITLE_TEXT, FEATURE_TITLE); - break; - case PopupType::WIDGET_AUTHOR_INFO: - elm_object_part_text_set(m_popup, TITLE_TEXT, INFO_TITLE); - break; - case PopupType::WIDGET_MIN_VERSION: - case PopupType::WIDGET_UNRECOGNIZED: - elm_object_part_text_set(m_popup, TITLE_TEXT, WARNING_TITLE); - break; - case PopupType::WIDGET_WRONG_FEATURE_INFO: - elm_object_part_text_set(m_popup, TITLE_TEXT, INSTALLATION_FAILURE); - break; - default: - break; - } -} - -void WidgetInstallPopup::addScrollLabel(const std::string &str) -{ - Evas_Object *ly = elm_layout_add(m_popup); - if (!ly) { - LogError(" install popup layout add failed"); - return; - } - elm_layout_file_set(ly, EDJFILE, "popup"); - evas_object_size_hint_align_set(ly, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_show(ly); - elm_object_content_set(m_popup, ly); - - Evas_Object *question_label = elm_label_add(m_popup); - if (!question_label) { - return; - } - evas_object_size_hint_align_set(question_label, - EVAS_HINT_FILL, - EVAS_HINT_FILL); - evas_object_size_hint_weight_set(question_label, - EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(question_label); - elm_object_text_set(question_label, QUESTION); - elm_object_part_content_set(ly, "elm.swallow.label", question_label); - - Evas_Object *scroller = elm_scroller_add(m_popup); - if (!scroller) { - return; - } - evas_object_size_hint_align_set(scroller, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_size_hint_weight_set(scroller, - EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_scroller_bounce_set(scroller, EINA_TRUE, EINA_TRUE); - elm_scroller_policy_set(scroller, - ELM_SCROLLER_POLICY_AUTO, - ELM_SCROLLER_POLICY_AUTO); - - elm_object_part_content_set(ly, "elm.swallow.scroller", scroller); - evas_object_show(scroller); - - Evas_Object *feature_label = elm_label_add(m_popup); - if (!feature_label) { - return; - } - evas_object_size_hint_align_set(feature_label, - EVAS_HINT_FILL, - EVAS_HINT_FILL); - evas_object_size_hint_weight_set(feature_label, - EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - evas_object_show(feature_label); - elm_object_text_set(feature_label, str.c_str()); - elm_object_content_set(scroller, feature_label); -} - -void WidgetInstallPopup::addContent(PopupType type, const std::string &str) -{ - switch (type) { - case PopupType::WIDGET_FEATURE_INFO: - addScrollLabel(str); - break; - default: - elm_object_part_text_set(m_popup, "default", str.c_str()); - break; - } -} - -void WidgetInstallPopup::addButton(PopupType type) -{ - Evas_Object *lbutton = elm_button_add(m_popup); - Evas_Object *rbutton = elm_button_add(m_popup); - if (!lbutton || !rbutton) { - return; - } - - switch (type) { - case PopupType::WIDGET_WRONG_FEATURE_INFO: - elm_object_text_set(lbutton, INFO_LEFT_BUTTON); - elm_object_part_content_set(m_popup, "button1", lbutton); - evas_object_smart_callback_add(lbutton, - "clicked", - userCancelCallback, - this); - return; - case PopupType::WIDGET_FEATURE_INFO: - elm_object_text_set(lbutton, INFO_LEFT_BUTTON); - elm_object_text_set(rbutton, INFO_RIGHT_BUTTON); - break; - default: - elm_object_text_set(lbutton, WARNING_LEFT_BUTTON); - elm_object_text_set(rbutton, WARNING_RIGHT_BUTTON); - break; - } - - elm_object_part_content_set(m_popup, "button1", lbutton); - evas_object_smart_callback_add(lbutton, - "clicked", - userPermitCallback, - this); - elm_object_part_content_set(m_popup, "button2", rbutton); - evas_object_smart_callback_add(rbutton, - "clicked", - userCancelCallback, - this); -} - -bool WidgetInstallPopup::createPopup() -{ - bool ret = addWin(name); - if (!ret) { - return false; - } - evas_object_show(m_win); - - ret = addPopup(); - if (!ret) { - evas_object_del(m_win); - m_win = NULL; - return false; - } - - return true; -} - -void WidgetInstallPopup::destroyPopup() -{ - if (m_win) { - evas_object_del(m_win); - m_win = NULL; - m_popup = NULL; - } -} - -void WidgetInstallPopup::loadPopup(PopupType type, const std::string &label) -{ - addTitle(type); - addContent(type, label); - addButton(type); -} - -void WidgetInstallPopup::showPopup() -{ - evas_object_show(m_popup); -} - -void WidgetInstallPopup::userPermitCallback(void * data, - Evas_Object */*obj*/, - void */*event_info*/) -{ - WidgetInstallPopup *This = static_cast(data); - This->m_installCancel = WRT_POPUP_BUTTON_OK; - This->m_installContext.job->Resume(); -} - -void WidgetInstallPopup::userCancelCallback(void *data, - Evas_Object */*obj*/, - void */*event_info*/) -{ - WidgetInstallPopup *This = static_cast(data); - This->m_installCancel = WRT_POPUP_BUTTON_CANCEL; - This->m_installContext.job->Resume(); -} -} -} - diff --git a/src/jobs/widget_install/widget_install_popup.h b/src/jobs/widget_install/widget_install_popup.h deleted file mode 100644 index bbbe851..0000000 --- a/src/jobs/widget_install/widget_install_popup.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2011 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. - */ -/* - * @file widget_install_popup.h - * @author lke01.lee (lke01.lee@samsung.com) - * @version 1.0 - * @brief Implementation file for installer popup - */ - -#ifndef WIDGET_INSTALL_POPUP_H -#define WIDGET_INSTALL_POPUP_H - -#include -#include -#include - -class InstallerContext; - -namespace Jobs { -namespace WidgetInstall { -enum PopupType { - WIDGET_INSTALL_POPUP = 0, - WIDGET_FEATURE_INFO, //sp-2390 - WIDGET_WRONG_FEATURE_INFO, //sp-3240 - WIDGET_AUTHOR_INFO, - WIDGET_MIN_VERSION, //sp-3240 - WIDGET_UNRECOGNIZED -}; - -enum InfoPopupButton -{ - WRT_POPUP_BUTTON = 0, - WRT_POPUP_BUTTON_OK, - WRT_POPUP_BUTTON_CANCEL -}; - -class WidgetInstallPopup -{ - public: - explicit WidgetInstallPopup(InstallerContext &installContext); - virtual ~WidgetInstallPopup(); - - bool createPopup(); - void destroyPopup(); - void loadPopup(PopupType type, const std::string &label); - void showPopup(); - bool addWin(const char *name); - bool addPopup(); - void addTitle(PopupType type); - void addScrollLabel(const std::string &str); - void addContent(PopupType type, const std::string &str); - void addButton(PopupType type); - - static void userPermitCallback(void *data, - Evas_Object *obj, - void *event_info); - static void userCancelCallback(void *data, - Evas_Object *obj, - void *event_info); - - protected: - Evas_Object *m_win; - Evas_Object *m_popup; - InstallerContext &m_installContext; - int m_installCancel; -}; -} -} -#endif - diff --git a/src/wrt-installer/wrt-installer.cpp b/src/wrt-installer/wrt-installer.cpp index 1184580..0a12e5d 100644 --- a/src/wrt-installer/wrt-installer.cpp +++ b/src/wrt-installer/wrt-installer.cpp @@ -88,7 +88,6 @@ WrtInstaller::WrtInstaller(int argc, char **argv) : m_returnStatus(-1), m_installByPkgmgr(false), m_quiet(true), - m_popup(NULL), m_startupPluginInstallation(false) { Touch(); @@ -109,95 +108,6 @@ int WrtInstaller::getReturnStatus() const } } -WrtInstaller::InstallerPopup::InstallerPopup() : - m_win(NULL), - m_popup(NULL), - m_progressbar(NULL) -{} - -WrtInstaller::InstallerPopup::~InstallerPopup() -{ - LogDebug("App Finished"); -} - -void WrtInstaller::InstallerPopup::init() -{ - LogDebug("Window Init"); - - if (m_win == NULL) { - // create window - m_win = createWin("wrt-installer"); - - // create popup - m_popup = elm_popup_add(m_win); - - // create progressbar - m_progressbar = elm_progressbar_add(m_popup); - elm_object_style_set(m_progressbar, "list_progress"); - elm_progressbar_horizontal_set(m_progressbar, EINA_TRUE); - evas_object_size_hint_align_set(m_progressbar, EVAS_HINT_FILL, - EVAS_HINT_FILL); - evas_object_size_hint_weight_set(m_progressbar, EVAS_HINT_EXPAND, - EVAS_HINT_EXPAND); - elm_object_content_set(m_popup, m_progressbar); - elm_progressbar_value_set(m_progressbar, 0.0); - evas_object_show(m_progressbar); - - evas_object_show(m_popup); - evas_object_show(m_win); - } -} - -Evas_Object* WrtInstaller::InstallerPopup::createWin(const char *name) -{ - Evas_Object *win; - win = elm_win_add(NULL, name, ELM_WIN_DIALOG_BASIC); - - int w, h; - if (!win) { - return NULL; - } - - elm_win_alpha_set(win, EINA_TRUE); - elm_win_title_set(win, name); - elm_win_borderless_set(win, EINA_TRUE); - elm_win_raise(win); - - ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h); - evas_object_resize(win, w, h); - return win; -} - -void WrtInstaller::InstallerPopup::showPopup(void* userdata, - const DPL::String& pkgMsg, - ShowResultCallback callback) -{ - Evas_Object *btn; - - LogDebug("Result Popup Created"); - evas_object_del(m_popup); - m_popup = NULL; - - m_popup = elm_popup_add(m_win); - if (!m_popup) { - return; - } - - btn = elm_button_add(m_popup); - if (!btn) { - evas_object_del(m_popup); - return; - } - elm_object_text_set(btn, "OK"); - evas_object_smart_callback_add(btn, "clicked", callback, userdata); - elm_object_part_content_set(m_popup, "button1", btn); - elm_object_part_text_set(m_popup, "title,text", "RESULT"); - elm_object_text_set(m_popup, DPL::ToUTF8String(pkgMsg).c_str()); - - evas_object_show(m_popup); - evas_object_show(m_win); -} - void WrtInstaller::OnStop() { LogInfo("Stopping Dummy Client"); @@ -363,7 +273,6 @@ void WrtInstaller::OnTerminate() if (m_initialized) { wrt_installer_shutdown(); } - delete m_popup; } void WrtInstaller::showHelpAndQuit() @@ -646,11 +555,6 @@ void WrtInstaller::staticWrtInitCallback(WrtErrStatus status, This->m_initialized = true; This->m_returnStatus = 0; - if (This->popupsEnabled()) { - This->m_popup = new InstallerPopup; - This->m_popup->init(); - } - This->DPL::Event::ControllerEventHandler ::PostEvent(WRTInstallerNS::NextStepEvent()); } else { @@ -688,13 +592,8 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, LogError("Step failed"); This->m_returnStatus = -1; - if (This->popupsEnabled()) { - resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_FAILURE); - This->m_popup->showPopup(This, resultMsg, failResultCallback); - } else { - This->DPL::Event::ControllerEventHandler - ::PostEvent(WRTInstallerNS::QuitEvent()); - } + This->DPL::Event::ControllerEventHandler + ::PostEvent(WRTInstallerNS::QuitEvent()); switch (status) { case WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND: @@ -888,13 +787,9 @@ void WrtInstaller::staticWrtStatusCallback(std::string tizenId, This->m_returnStatus = 0; resultMsg += L" : " + DPL::FromUTF8String(PKGMGR_END_SUCCESS); - if (This->popupsEnabled()) { - This->m_popup->showPopup(This, resultMsg, showResultCallback); - } else { - This->DPL::Event::ControllerEventHandler - ::PostEvent(WRTInstallerNS::NextStepEvent()); - } + This->DPL::Event::ControllerEventHandler + ::PostEvent(WRTInstallerNS::NextStepEvent()); } } @@ -927,24 +822,9 @@ void WrtInstaller::staticWrtPluginInstallationCallback(WrtErrStatus status, LogInfo("Failed to remove installation lock"); } - if (This->popupsEnabled()) { - This->m_popup->init(); - elm_progressbar_value_set(This->m_popup->m_progressbar, 100.0); - evas_object_show(This->m_popup->m_popup); - } - This->DPL::Event::ControllerEventHandler ::PostEvent(WRTInstallerNS::NextStepEvent()); } else { - if (This->popupsEnabled()) { - This->m_popup->init(); - float percent = - (This->m_totalPlugins - - This->m_numPluginsToInstall) / (float)This->m_totalPlugins; - elm_progressbar_value_set(This->m_popup->m_progressbar, percent); - evas_object_show(This->m_popup->m_popup); - } - This->DPL::Event::ControllerEventHandler:: PostEvent( @@ -992,31 +872,19 @@ void WrtInstaller::staticWrtPluginInstallProgressCb(float percent, void WrtInstaller::staticWrtInstallProgressCallback(float percent, const char* description, - void* userdata) + void* /*userdata*/) { - WrtInstaller *This = static_cast(userdata); + //WrtInstaller *This = static_cast(userdata); LogInfo(" progress: " << percent << " description: " << description); - - if (This->popupsEnabled()) { - This->m_popup->init(); - elm_progressbar_value_set(This->m_popup->m_progressbar, percent / 100.0); - evas_object_show(This->m_popup->m_popup); - } } void WrtInstaller::staticWrtUninstallProgressCallback(float percent, const char* description, - void* userdata) + void* /*userdata*/) { - WrtInstaller *This = static_cast(userdata); + //WrtInstaller *This = static_cast(userdata); LogInfo(" progress: " << percent << " description: " << description); - - if (This->popupsEnabled()) { - This->m_popup->init(); - elm_progressbar_value_set(This->m_popup->m_progressbar, percent / 100.0); - evas_object_show(This->m_popup->m_popup); - } } void WrtInstaller::showResultCallback(void *data, Evas_Object* /*obj*/, @@ -1058,11 +926,6 @@ void WrtInstaller::installNewPlugins() AddStep(&WrtInstaller::installPluginsStep); } -bool WrtInstaller::popupsEnabled() const -{ - return !m_quiet && !GlobalSettings::PopupsTestModeEnabled(); -} - int main(int argc, char *argv[]) { UNHANDLED_EXCEPTION_HANDLER_BEGIN diff --git a/src/wrt-installer/wrt-installer.h b/src/wrt-installer/wrt-installer.h index 890f42d..9cd0173 100644 --- a/src/wrt-installer/wrt-installer.h +++ b/src/wrt-installer/wrt-installer.h @@ -60,22 +60,6 @@ class WrtInstaller : int getReturnStatus() const; - class InstallerPopup - { - public: - InstallerPopup(); - virtual ~InstallerPopup(); - - void init(); - Evas_Object* createWin(const char* name); - void showPopup(void* userdata, const DPL::String& pkgMsg, - ShowResultCallback callback); - - Evas_Object* m_win; - Evas_Object* m_popup; - Evas_Object* m_progressbar; - }; - protected: virtual void OnStop(); virtual void OnCreate(); @@ -137,10 +121,9 @@ class WrtInstaller : int m_returnStatus; bool m_installByPkgmgr; bool m_quiet; - InstallerPopup *m_popup; bool m_startupPluginInstallation; typedef std::list PluginPathList; DPL::Optional m_pluginsPaths; }; -#endif // WRT_INSTALLER_H \ No newline at end of file +#endif // WRT_INSTALLER_H