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)
+++ /dev/null
-/*
- * 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";
- }
- }
- }
- }
- }
-}
-#git:framework/web/wrt-installer wrt-installer 0.1.29
+#git:framework/web/wrt-installer wrt-installer 0.1.30
Name: wrt-installer
Summary: Installer for tizen Webruntime
-Version: 0.1.29
+Version: 0.1.30
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
%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
${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
if (dlHandle == NULL) {
LogError(
"Failed to load plugin: " << filename <<
- ". Reason: " << dlerror());
+ ". Reason: " << (dlerror() != NULL ? dlerror() : "unknown"));
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
bool JobWidgetInstall::DecryptDRMWidget(std::string /*widgetPath*/,
std::string /*destPath*/)
{
- /* TODO */
+ /* TODO */
return false;
}
} //namespace WidgetInstall
namespace WidgetInstall {
TaskCertify::TaskCertify(InstallerContext &inCont) :
DPL::TaskDecl<TaskCertify>(this),
- WidgetInstallPopup(inCont),
m_contextData(inCont)
{
AddStep(&TaskCertify::stepSignature);
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);
}
WrtSignatureValidator::AppType appType =
WrtSignatureValidator::WAC20;
- if (m_installContext.widgetConfig.webAppType ==
+ if (m_contextData.widgetConfig.webAppType ==
APP_TYPE_TIZENWEBAPP)
{
appType = WrtSignatureValidator::TIZEN;
"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:: <<Warning Popup>>");
- // 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:: <<Author Popup Information>>");
- std::string label
- = createAuthorWidgetInfo() + LABEL_NEW_LINE_2 + QUESTION;
- createInstallPopup(PopupType::WIDGET_AUTHOR_INFO, label);
-}
-
void TaskCertify::stepFinalize()
{
LogInfo("Step: <<CERTYFYING DONE>>");
"Widget Certification Check Finished");
}
-void TaskCertify::stepWarningPopupAnswer()
-{
- LogInfo("Step: <<Warning Popup Answer>>");
- 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: <<Author Info Popup Answer>>");
- 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;
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())) {
//WRT INCLUDES
#include <dpl/task.h>
-#include <widget_install/widget_install_popup.h>
class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
class TaskCertify :
- public DPL::TaskDecl<TaskCertify>,
- public WidgetInstallPopup
+ public DPL::TaskDecl<TaskCertify>
{
public:
TaskCertify(InstallerContext &inCont);
//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
TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
DPL::TaskDecl<TaskWidgetConfig>(this),
- WidgetInstallPopup(installContext),
m_installContext(installContext)
{
AddStep(&TaskWidgetConfig::StepProcessConfigurationFile);
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()
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(
#include <dpl/wrt-dao-ro/global_config.h>
#include <wrt_common_types.h>
-#include <widget_install/widget_install_popup.h>
class InstallerContext;
} // InstalllerTaskWidgetPopupData
class TaskWidgetConfig :
- public DPL::TaskDecl<TaskWidgetConfig>,
- public WidgetInstallPopup
+ public DPL::TaskDecl<TaskWidgetConfig>
{
private:
class Exception
void ProcessIcon(const WrtDB::ConfigParserData::Icon& icon);
void ProcessWidgetInstalledPath();
void StepVerifyFeatures();
- void StepShowWidgetInfo();
void StepCheckMinVersionInfo();
template <typename Ex, const char* Msg>
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);
+++ /dev/null
-/*
- * 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 <dpl/log/log.h>
-#include <widget_install/job_widget_install.h>
-#include <widget_install/widget_install_errors.h>
-#include <widget_install/widget_install_context.h>
-#include <widget_install_popup.h>
-
-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. <br>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<WidgetInstallPopup *>(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<WidgetInstallPopup *>(data);
- This->m_installCancel = WRT_POPUP_BUTTON_CANCEL;
- This->m_installContext.job->Resume();
-}
-}
-}
-
+++ /dev/null
-/*
- * 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 <Evas.h>
-#include <Ecore_X.h>
-#include <Elementary.h>
-
-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
-
#ifdef WRT_SMACK_ENABLED
try {
WrtDB::WidgetDAOReadOnly dao(m_context.widgetConfig.tzAppid);
- TizenAppId tzAppid = dao.getTizenAppId();
+ TizenAppId tzAppid = dao.getTzAppId();
int result = handle_access_control_conf_forWAC(
DPL::ToUTF8String(tzAppid).c_str(),
NULL,
if (!configInfo.tizenAppId.IsNull()) {
strncpy(pkg_detail_info->pkg_name,
DPL::ToUTF8String(*configInfo.tizenAppId).c_str(),
- PKG_NAME_STRING_LEN_MAX);
+ PKG_NAME_STRING_LEN_MAX - 1);
}
if (!configInfo.version.IsNull()) {
strncpy(pkg_detail_info->version,
if (!configInfo.tizenMinVersionRequired.IsNull()) {
strncpy(pkg_detail_info->min_platform_version,
DPL::ToUTF8String(*configInfo.tizenMinVersionRequired).c_str(),
- PKG_VERSION_STRING_LEN_MAX);
+ PKG_VERSION_STRING_LEN_MAX - 1);
}
if (!configInfo.authorName.IsNull()) {
m_returnStatus(-1),
m_installByPkgmgr(false),
m_quiet(true),
- m_popup(NULL),
m_startupPluginInstallation(false)
{
Touch();
}
}
-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");
if (m_initialized) {
wrt_installer_shutdown();
}
- delete m_popup;
}
void WrtInstaller::showHelpAndQuit()
This->m_initialized = true;
This->m_returnStatus = 0;
- if (This->popupsEnabled()) {
- This->m_popup = new InstallerPopup;
- This->m_popup->init();
- }
-
This->DPL::Event::ControllerEventHandler<WRTInstallerNS::NextStepEvent>
::PostEvent(WRTInstallerNS::NextStepEvent());
} else {
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<WRTInstallerNS::QuitEvent>
- ::PostEvent(WRTInstallerNS::QuitEvent());
- }
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::QuitEvent>
+ ::PostEvent(WRTInstallerNS::QuitEvent());
switch (status) {
case WRT_INSTALLER_ERROR_PACKAGE_NOT_FOUND:
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<WRTInstallerNS::
- NextStepEvent>
- ::PostEvent(WRTInstallerNS::NextStepEvent());
- }
+ This->DPL::Event::ControllerEventHandler<WRTInstallerNS::
+ NextStepEvent>
+ ::PostEvent(WRTInstallerNS::NextStepEvent());
}
}
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<WRTInstallerNS::NextStepEvent>
::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<WRTInstallerNS::
InstallPluginEvent>::
PostEvent(
void WrtInstaller::staticWrtInstallProgressCallback(float percent,
const char* description,
- void* userdata)
+ void* /*userdata*/)
{
- WrtInstaller *This = static_cast<WrtInstaller*>(userdata);
+ //WrtInstaller *This = static_cast<WrtInstaller*>(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<WrtInstaller*>(userdata);
+ //WrtInstaller *This = static_cast<WrtInstaller*>(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*/,
AddStep(&WrtInstaller::installPluginsStep);
}
-bool WrtInstaller::popupsEnabled() const
-{
- return !m_quiet && !GlobalSettings::PopupsTestModeEnabled();
-}
-
int main(int argc, char *argv[])
{
UNHANDLED_EXCEPTION_HANDLER_BEGIN
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();
int m_returnStatus;
bool m_installByPkgmgr;
bool m_quiet;
- InstallerPopup *m_popup;
bool m_startupPluginInstallation;
typedef std::list<std::string> PluginPathList;
DPL::Optional<PluginPathList> m_pluginsPaths;
};
-#endif // WRT_INSTALLER_H
\ No newline at end of file
+#endif // WRT_INSTALLER_H