[Release] wrt-installer_0.0.90
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_manifest_file.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 908109a..ba3b2ae
@@ -312,12 +312,9 @@ DPL::String TaskManifestFile::getIconTargetFilename(
         const DPL::String& languageTag) const
 {
     DPL::OStringStream filename;
-    DPL::Optional<DPL::String> pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
+    WidgetPkgName pkgname = m_context.widgetConfig.pkgName;
 
-    filename << DPL::ToUTF8String(*pkgname).c_str();
+    filename << DPL::ToUTF8String(pkgname).c_str();
 
     if (!languageTag.empty()) {
         DPL::OptionalString tag = getLangTag(languageTag); // translate en -> en_US etc
@@ -361,7 +358,7 @@ void TaskManifestFile::updateAilInfo()
 {
     // Update ail for desktop
     std::string cfgPkgname =
-        DPL::ToUTF8String(*m_context.widgetConfig.pkgname);
+        DPL::ToUTF8String(m_context.widgetConfig.pkgName);
     const char* pkgname = cfgPkgname.c_str();
 
     LogDebug("Update ail desktop : " << pkgname );
@@ -396,7 +393,7 @@ void TaskManifestFile::backupIconFiles()
 
     std::list<std::string> fileList;
     getFileList(GlobalConfig::GetUserWidgetDesktopIconPath(), fileList);
-    std::string pkgname = DPL::ToUTF8String(*m_context.widgetConfig.pkgname);
+    std::string pkgname = DPL::ToUTF8String(m_context.widgetConfig.pkgName);
 
     FOREACH(it, fileList)
     {
@@ -465,7 +462,7 @@ void TaskManifestFile::getFileList(const char* path,
 
 void TaskManifestFile::stepGenerateManifest()
 {
-    DPL::String pkgname = *m_context.widgetConfig.pkgname;
+    WidgetPkgName pkgname = m_context.widgetConfig.pkgName;
     manifest_name = pkgname + L".xml";
     manifest_file += L"/tmp/" + manifest_name;
 
@@ -594,12 +591,9 @@ void TaskManifestFile::setWidgetName(Manifest & manifest, UiApplication & uiApp)
         generateWidgetName(manifest, uiApp, DPL::OptionalString::Null, name, defaultNameSaved);
     }
     //appid
-    DPL::String pkgname;
-    if(!!m_context.widgetConfig.pkgname)
-    {
-        pkgname = *m_context.widgetConfig.pkgname;
-        uiApp.setAppid(pkgname);
-    }
+    WidgetPkgName pkgname = m_context.widgetConfig.pkgName;
+    uiApp.setAppid(pkgname);
+
 
     //extraid
     if(!!m_context.widgetConfig.guid) {
@@ -644,11 +638,6 @@ void TaskManifestFile::generateWidgetName(Manifest & manifest, UiApplication &ui
 
 void TaskManifestFile::setWidgetIcons(UiApplication & uiApp)
 {
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
-
     //TODO this file will need to be updated when user locale preferences
     //changes.
     bool defaultIconSaved = false;
@@ -715,10 +704,8 @@ void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp, const DPL::Opti
 
 void TaskManifestFile::setWidgetManifest(Manifest & manifest)
 {
-    if(!!m_context.widgetConfig.pkgname)
-    {
-        manifest.setPackage(*m_context.widgetConfig.pkgname);
-    }
+    manifest.setPackage(m_context.widgetConfig.pkgName);
+
     if(!!m_context.widgetConfig.version)
     {
         manifest.setVersion(*m_context.widgetConfig.version);