From 59313acbc69954d39bd3af19a7ba80a681aa0920 Mon Sep 17 00:00:00 2001 From: Yunchan Cho Date: Fri, 25 Jan 2013 21:34:50 +0900 Subject: [PATCH] Add mouse-event of and type of [Issue#] N/A [Problem] wrt-installer doesn't support mouse-event of and type of [Cause] N/A [Solution] Two fields for this are added to config parser struct Change-Id: I46c2997453e38a206ebc2dc91710686a5b579d04 --- packaging/wrt-installer.spec | 1 + src/CMakeLists.txt | 1 + src/configuration_parser/widget_parser.cpp | 7 +++++- src/jobs/widget_install/manifest.cpp | 10 ++++++-- src/jobs/widget_install/manifest.h | 1 + src/jobs/widget_install/task_database.cpp | 33 ++++++++++++++++++++++++++ src/jobs/widget_install/task_database.h | 1 + src/jobs/widget_install/task_manifest_file.cpp | 20 +++++++++------- src/jobs/widget_uninstall/task_db_update.cpp | 16 ++++++++++++- src/jobs/widget_uninstall/task_db_update.h | 1 + 10 files changed, 79 insertions(+), 12 deletions(-) diff --git a/packaging/wrt-installer.spec b/packaging/wrt-installer.spec index f077297..02573c4 100644 --- a/packaging/wrt-installer.spec +++ b/packaging/wrt-installer.spec @@ -38,6 +38,7 @@ BuildRequires: pkgconfig(dpl-encryption) BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(drm-service-core-intel) BuildRequires: pkgconfig(app2sd) +BuildRequires: pkgconfig(web-provider-svc) Requires: xmlsec1 %description diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c07dbab..75d2d4b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -123,6 +123,7 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP wrt-plugins-types pkgmgr-installer pkgmgr-parser + web-provider-svc REQUIRED ) diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index f46fdc0..c7da02b 100755 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -2009,6 +2009,8 @@ class LiveboxParser : public ElementParser if (m_properNamespace) { if (attribute.name == L"src") m_box.m_boxSrc = attribute.value; + if (attribute.name == L"mouse-event") + m_box.m_boxMouseEvent = attribute.value; } } @@ -2079,6 +2081,8 @@ class LiveboxParser : public ElementParser m_autoLaunch = attribute.value; } else if (attribute.name == L"update-period") { m_updatePeriod = attribute.value; + } else if (attribute.name == L"type") { + m_type = attribute.value; } } } @@ -2102,6 +2106,7 @@ class LiveboxParser : public ElementParser m_livebox.m_primary = m_primary; m_livebox.m_autoLaunch = m_autoLaunch; m_livebox.m_updatePeriod = m_updatePeriod; + m_livebox.m_type = m_type; m_data.m_livebox.push_back(m_livebox); } @@ -2136,8 +2141,8 @@ class LiveboxParser : public ElementParser DPL::String m_primary; DPL::String m_autoLaunch; DPL::String m_updatePeriod; + DPL::String m_type; bool m_properNamespace; - }; diff --git a/src/jobs/widget_install/manifest.cpp b/src/jobs/widget_install/manifest.cpp index 98adb96..0c369d9 100755 --- a/src/jobs/widget_install/manifest.cpp +++ b/src/jobs/widget_install/manifest.cpp @@ -340,10 +340,13 @@ void LiveBox::serialize(xmlTextWriterPtr writer) endElement(writer); } - if(!this->box.boxSrc.empty() && !this->box.boxSize.empty()) + if(!this->box.boxSrc.empty() && + !this->box.boxMouseEvent.empty() && + !this->box.boxSize.empty()) { startElement(writer, "box"); writeAttribute(writer, "type", "buffer"); + writeAttribute(writer, "mouse_event", this->box.boxMouseEvent); FOREACH(m, this->box.boxSize) { @@ -361,7 +364,10 @@ void LiveBox::serialize(xmlTextWriterPtr writer) endElement(writer); - if(!this->box.pdSrc.empty() && ! this->box.pdWidth.empty() && ! this->box.pdHeight.empty()) { + if(!this->box.pdSrc.empty() && + !this->box.pdWidth.empty() && + !this->box.pdHeight.empty()) + { startElement(writer, "pd"); writeAttribute(writer, "type", "buffer"); diff --git a/src/jobs/widget_install/manifest.h b/src/jobs/widget_install/manifest.h index ac469d2..d09c057 100755 --- a/src/jobs/widget_install/manifest.h +++ b/src/jobs/widget_install/manifest.h @@ -231,6 +231,7 @@ typedef std::list> boxSizeType; struct BoxInfo { NcnameType boxSrc; + NcnameType boxMouseEvent; boxSizeType boxSize; NcnameType pdSrc; NcnameType pdWidth; diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp index 8ba08cf..de38c5f 100644 --- a/src/jobs/widget_install/task_database.cpp +++ b/src/jobs/widget_install/task_database.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -57,6 +58,7 @@ TaskDatabase::TaskDatabase(InstallerContext& context) : AddStep(&TaskDatabase::StepAceDBInsert); AddStep(&TaskDatabase::StepRemoveExternalFiles); AddStep(&TaskDatabase::StepCreateVconf); + AddStep(&TaskDatabase::StepLiveboxDBInsert); AddAbortStep(&TaskDatabase::StepAbortDBInsert); } @@ -264,5 +266,36 @@ void TaskDatabase::StepAbortDBInsert() ace_unregister_widget(static_cast(m_handle)); } +void TaskDatabase::StepLiveboxDBInsert() +{ + if (m_context.widgetConfig.configInfo.m_livebox.size() <= 0) { + return; + } + + std::string tizenId = DPL::ToUTF8String(m_context.widgetConfig.tzAppid); + + for (auto it = m_context.widgetConfig.configInfo.m_livebox.begin(); + it != m_context.widgetConfig.configInfo.m_livebox.end(); ++it) + { + std::string boxId = DPL::ToUTF8String((**it).m_liveboxId); + std::string boxType; + if ((**it).m_type == L"") { + boxType = web_provider_info_get_default_type(); + } else { + boxType = DPL::ToUTF8String((**it).m_type); + } + LogInfo("livebox id: " << boxId); + LogInfo("livebox type: " << boxType); + + int ret = + web_provider_info_insert_box_type( + boxId.c_str(), tizenId.c_str(), boxType.c_str()); + + if (ret < 0) { + LogDebug("failed to set type of livebox: " << boxId); + } + } +} + } //namespace WidgetInstall } //namespace Jobs diff --git a/src/jobs/widget_install/task_database.h b/src/jobs/widget_install/task_database.h index f2098bc..5b2c154 100644 --- a/src/jobs/widget_install/task_database.h +++ b/src/jobs/widget_install/task_database.h @@ -49,6 +49,7 @@ class TaskDatabase: void StepAceDBInsert(); void StepRemoveExternalFiles(); void StepCreateVconf(); + void StepLiveboxDBInsert(); void StepAbortDBInsert(); diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index 660c39a..67a4f4e 100755 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -837,22 +837,22 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest) LogInfo("setLiveBoxInfo"); LiveBoxInfo liveBox; DPL::Optional ConfigInfo = *it; - DPL::String pkgid = m_context.widgetConfig.tzPkgid; + DPL::String appid = m_context.widgetConfig.tzAppid; size_t found; if(ConfigInfo->m_liveboxId != L"") { - found = ConfigInfo->m_liveboxId.find_first_of(L"."); + found = ConfigInfo->m_liveboxId.find_last_of(L"."); if(found != std::string::npos) { - if(0 == ConfigInfo->m_liveboxId.compare(0, found, pkgid)) + if(0 == ConfigInfo->m_liveboxId.compare(0, found, appid)) liveBox.setLiveboxId(ConfigInfo->m_liveboxId); else { DPL::String liveboxId = - pkgid+DPL::String(L".")+ConfigInfo->m_liveboxId; + appid + DPL::String(L".") + ConfigInfo->m_liveboxId; liveBox.setLiveboxId(liveboxId); } } else { DPL::String liveboxId = - pkgid+DPL::String(L".")+ConfigInfo->m_liveboxId; + appid + DPL::String(L".") + ConfigInfo->m_liveboxId; liveBox.setLiveboxId(liveboxId); } } @@ -861,7 +861,7 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest) liveBox.setPrimary(ConfigInfo->m_primary); if(ConfigInfo->m_autoLaunch == L"true") - liveBox.setAutoLaunch(pkgid); + liveBox.setAutoLaunch(appid); if(ConfigInfo->m_updatePeriod != L"") liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod); @@ -890,6 +890,12 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest) box.boxSrc = defaultLocale + ConfigInfo->m_boxInfo.m_boxSrc; } + if (ConfigInfo->m_boxInfo.m_boxMouseEvent == L"true") { + box.boxMouseEvent = ConfigInfo->m_boxInfo.m_boxMouseEvent; + } else { + box.boxMouseEvent = L"false"; + } + std::list> BoxSizeList = ConfigInfo->m_boxInfo.m_boxSize; FOREACH(im, BoxSizeList) { @@ -906,10 +912,8 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest) box.pdWidth = ConfigInfo->m_boxInfo.m_pdWidth; box.pdHeight = ConfigInfo->m_boxInfo.m_pdHeight; } - liveBox.setBox(box); } - manifest.addLivebox(liveBox); } diff --git a/src/jobs/widget_uninstall/task_db_update.cpp b/src/jobs/widget_uninstall/task_db_update.cpp index c9eebd6..4c88b92 100644 --- a/src/jobs/widget_uninstall/task_db_update.cpp +++ b/src/jobs/widget_uninstall/task_db_update.cpp @@ -20,12 +20,12 @@ * @brief Implementation file for uninstaller task database updating */ +#include #include #include #include #include #include - #include #include @@ -38,6 +38,7 @@ TaskDbUpdate::TaskDbUpdate(UninstallerContext& context) : m_context(context) { AddStep(&TaskDbUpdate::StepDbUpdate); + AddStep(&TaskDbUpdate::StepLiveboxDBDelete); } TaskDbUpdate::~TaskDbUpdate() @@ -66,5 +67,18 @@ void TaskDbUpdate::StepDbUpdate() UninstallerContext::UNINSTALL_DB_UPDATE, "Widget DB Update Finished"); } + +void TaskDbUpdate::StepLiveboxDBDelete() +{ + int ret = + web_provider_info_delete_by_app_id(m_context.tzAppid.c_str()); + + if (ret < 0) { + LogDebug("failed to delete box info"); + } else { + LogInfo("delete box info: " << m_context.tzAppid); + } +} + } //namespace WidgetUninstall } //namespace Jobs diff --git a/src/jobs/widget_uninstall/task_db_update.h b/src/jobs/widget_uninstall/task_db_update.h index 93c4ff2..1f34b00 100644 --- a/src/jobs/widget_uninstall/task_db_update.h +++ b/src/jobs/widget_uninstall/task_db_update.h @@ -46,6 +46,7 @@ class TaskDbUpdate : private: void StepDbUpdate(); + void StepLiveboxDBDelete(); public: TaskDbUpdate(UninstallerContext& context); -- 2.7.4