[Release] wrt-installer_0.0.90
[platform/framework/web/wrt-installer.git] / src / jobs / widget_install / job_widget_install.cpp
index ad57eb7..ce93dcd 100644 (file)
@@ -354,7 +354,7 @@ bool JobWidgetInstall::setTizenId(
             regfree(&reg);
             return false;
         }
-        m_installerContext.widgetConfig.pkgname = configInfo.tizenId;
+        m_installerContext.widgetConfig.pkgName = *configInfo.tizenId;
 
     } else {
         WidgetPkgName tizenId = WidgetDAOReadOnly::generateTizenId();
@@ -373,19 +373,19 @@ bool JobWidgetInstall::setTizenId(
                 break;
             }
 
-            m_installerContext.widgetConfig.pkgname = tizenId;
+            m_installerContext.widgetConfig.pkgName = tizenId;
         }
         LogInfo("tizen_id name was generated by WRT: " << tizenId);
         // send start signal of pkgmgr
         getInstallerStruct().pkgmgrInterface->setPkgname(DPL::ToUTF8String(
-                    *m_installerContext.widgetConfig.pkgname));
+                    m_installerContext.widgetConfig.pkgName));
         getInstallerStruct().pkgmgrInterface->sendSignal(
                 PKGMGR_START_KEY,
                 PKGMGR_START_INSTALL);
     }
     regfree(&reg);
 
-    LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgname);
+    LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgName);
     LogInfo("W3C Widget GUID : " << m_installerContext.widgetConfig.guid);
     return true;
 }
@@ -394,7 +394,7 @@ void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
                                                const std::string& tempPath)
 {
     m_installerContext.locations =
-        WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname),
+        WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.pkgName),
                 widgetPath, tempPath,
                 m_installerContext.widgetConfig.packagingType,
                 m_installerContext.locationType);
@@ -412,7 +412,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
     if (!setTizenId(configData, update, m_jobStruct.m_preload)) {
         return ConfigureResult::Failed;
     } else {
-        LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
+        LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgName);
 
         configureWidgetLocation(widgetSource, tempPath);
     }
@@ -446,19 +446,14 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
         LogInfo("Widget info exists. PkgName: " <<
                 update.existingWidgetInfo.pkgname);
 
-        DPL::OptionalString pkgname = update.existingWidgetInfo.pkgname;
-
-        if(pkgname.IsNull()) {
-            LogInfo("But package name doesn't exist");
-            return ConfigureResult::Failed;
-        }
+        WidgetPkgName pkgname = update.existingWidgetInfo.pkgname;
 
         LogInfo("Widget model exists. package name: " << pkgname);
 
         // Check running state
         int retval = APP_MANAGER_ERROR_NONE;
         bool isRunning = false;
-        retval = app_manager_is_running(DPL::ToUTF8String(*pkgname).c_str(), &isRunning);
+        retval = app_manager_is_running(DPL::ToUTF8String(pkgname).c_str(), &isRunning);
         if (APP_MANAGER_ERROR_NONE != retval) {
             LogError("Fail to get running state");
             return ConfigureResult::Failed;
@@ -479,7 +474,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
             }
         }
 
-        m_installerContext.widgetConfig.pkgname = pkgname;
+        m_installerContext.widgetConfig.pkgName = pkgname;
         OptionalWidgetVersion existingVersion;
         existingVersion = update.existingWidgetInfo.existingVersion;
         OptionalWidgetVersion incomingVersion = update.incomingVersion;
@@ -665,7 +660,7 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
             widgetGUID,
             widgetVersion,
             WidgetUpdateInfo::ExistingWidgetInfo(
-                *dao.getPkgname(), dao.getVersion()));
+                dao.getPkgName(), dao.getVersion()));
     }
     Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
     {
@@ -718,7 +713,7 @@ void JobWidgetInstall::SendFinishedSuccess()
     //inform widget info
     JobWidgetInstall::displayWidgetInfo();
 
-    DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname;
+    WidgetPkgName& tizenId = m_installerContext.widgetConfig.pkgName;
 
     // send signal of pkgmgr
     getInstallerStruct().pkgmgrInterface->sendSignal(
@@ -727,7 +722,7 @@ void JobWidgetInstall::SendFinishedSuccess()
 
     LogDebug("Call widget install successfinishedCallback");
     getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
-            tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), Exceptions::Success);
+            DPL::ToUTF8String(tizenId), Exceptions::Success);
 }
 
 void JobWidgetInstall::SendFinishedFailure()
@@ -738,7 +733,7 @@ void JobWidgetInstall::SendFinishedFailure()
 
     LogError("Error in installation step: " << m_exceptionCaught);
     LogError("Message: " << m_exceptionMessage);
-    DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname;
+    WidgetPkgName & tizenId = m_installerContext.widgetConfig.pkgName;
 
     LogDebug("Call widget install failure finishedCallback");
 
@@ -748,7 +743,7 @@ void JobWidgetInstall::SendFinishedFailure()
                 PKGMGR_END_FAILURE);
 
     getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
-            tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), m_exceptionCaught);
+            DPL::ToUTF8String(tizenId), m_exceptionCaught);
 }
 
 void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
@@ -763,18 +758,18 @@ void JobWidgetInstall::displayWidgetInfo()
 
     std::ostringstream out;
     WidgetLocalizedInfo localizedInfo =
-        W3CFileLocalization::getLocalizedInfo(*dao.getPkgname());
+        W3CFileLocalization::getLocalizedInfo(dao.getPkgName());
 
     out << std::endl <<
         "===================================== INSTALLED WIDGET INFO ========="\
         "============================";
     out << std::endl << "Name:                        " << localizedInfo.name;
-    out << std::endl << "PkgName:                     " << dao.getPkgname();
+    out << std::endl << "PkgName:                     " << dao.getPkgName();
     WidgetSize size = dao.getPreferredSize();
     out << std::endl << "Width:                       " << size.width;
     out << std::endl << "Height:                      " << size.height;
     out << std::endl << "Start File:                  " <<
-        W3CFileLocalization::getStartFile(*dao.getPkgname());
+        W3CFileLocalization::getStartFile(dao.getPkgName());
     out << std::endl << "Version:                     " << dao.getVersion();
     out << std::endl << "Licence:                     " <<
         localizedInfo.license;
@@ -789,9 +784,8 @@ void JobWidgetInstall::displayWidgetInfo()
         dao.isDistributorSigned();
     out << std::endl << "Widget trusted:              " << dao.isTrusted();
 
-    OptionalWidgetIcon icon = W3CFileLocalization::getIcon(*dao.getPkgname());
-    DPL::OptionalString iconSrc =
-        !!icon ? icon->src : DPL::OptionalString::Null;
+    OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getPkgName());
+    DPL::OptionalString iconSrc = !!icon ? icon->src : DPL::OptionalString::Null;
     out << std::endl << "Icon:                        " << iconSrc;
 
     out << std::endl << "Preferences:";