Patch for icon nodisplay because Type attribute is deleted
authorDongeup Ham <dongeup.ham@samsung.com>
Wed, 23 Jan 2013 08:48:15 +0000 (17:48 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Wed, 23 Jan 2013 08:48:15 +0000 (17:48 +0900)
Change-Id: I27a5ee567a5be12ffdcf1e3cb2e8daf986985cc1
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
inc/InstallerDefs.h
src/XmlHandler/ManifestHandler.cpp
src/XmlHandler/Parser/ManifestAccountsParser.cpp

index cce9419..899a978 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = 20130121.1"
+#define OSP_INSTALLER_VERSION "osp-installer version = 20130123.1"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index bc239b2..3f400bd 100755 (executable)
@@ -949,82 +949,115 @@ ManifestHandler::OnPrivilegeValue(const char *pCharacters)
 bool
 ManifestHandler::OnIconValue(const char *pCharacters)
 {
-       XmlAttribute *pAttr = 0;
-       char *pAttrValue1 = 0;
-       char *pTypeValue = 0;
+       AppLog("<Icon>%s</Icon>", pCharacters);
 
-       pAttr = GetAttribute();
+       XmlAttribute* pAttr = GetAttribute();
        TryReturn(pAttr, true, "pAttr is null");
 
-       pAttrValue1 = pAttr->Find("Section");
-       TryReturn(pAttrValue1, true, "pAttrValue1 is null");
-
-       pTypeValue = pAttr->Find("Type");
-       TryReturn(pTypeValue, true, "pTypeValue is null");
+       char* pSection = pAttr->Find("Section");
+       TryReturn(pSection, true, "pSection is null");
+       AppLog(" - Section=%s", pSection);
 
-       char icon[1024] = {0,};
+       TryReturn(__pDefaultIconType, false, "__pDefaultIconType is null");
 
-       if (strcasecmp(pTypeValue, "Xhigh") == 0)
+       String iconRelPath;
+       char* pType = pAttr->Find("Type");
+       if (pType == null)
        {
-               snprintf(icon, sizeof(icon), "%s/%s", "screen-density-xhigh", pCharacters);
-       }
-       else if (strcasecmp(pTypeValue, "High") == 0)
-       {
-               snprintf(icon, sizeof(icon), "%s/%s", "screen-density-high", pCharacters);
+               AppLog("__pDefaultIconType=%s", __pDefaultIconType);
+               if (strcasecmp(__pDefaultIconType, "Xhigh") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
+               }
+               else if (strcasecmp(__pDefaultIconType, "High") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
+               }
+               else
+               {
+                       TryReturn(0, false, "Invalid __pDefaultIconType[%s]", __pDefaultIconType);
+               }
        }
-       else
+       else    // legacy
        {
-               AppLog("Invalid Type [%s]", __pDefaultIconType);
-               return false;
+               AppLog(" - Type=%s", pType);
+               if (strcasecmp(pType, "Xhigh") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
+               }
+               else if (strcasecmp(pType, "High") == 0)
+               {
+                       iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
+               }
+               else
+               {
+                       TryReturn(0, false, "Invalid IconType [%s]", __pDefaultIconType);
+               }
        }
 
        if (FindElement("Content") == true)
        {
                TryReturn(__pContentData, false, "__pContentData is null");
-               __pContentData->SetIcon(icon);
+               __pContentData->SetIcon(iconRelPath);
        }
        else
        {
-               if (strcasecmp(pAttrValue1, "MainMenu") == 0)
+               if (pType == null)
                {
-                       if (__isDefaultMainmenu == false)
-                       {
-                               __pPackageAppInfoImpl->SetMainmenuIcon(icon);
-                       }
-
-                       if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
+                       if (strcasecmp(pSection, "MainMenu") == 0)
                        {
-                               __isDefaultMainmenu = true;
+                               __pPackageAppInfoImpl->SetMainmenuIcon(iconRelPath);
                        }
-               }
-               else if (strcasecmp(pAttrValue1, "Setting") == 0)
-               {
-                       if (__isDefaultSetting == false)
+                       else if (strcasecmp(pSection, "Setting") == 0)
                        {
-                               __pPackageAppInfoImpl->SetSettingIcon(icon);
+                               __pPackageAppInfoImpl->SetSettingIcon(iconRelPath);
                        }
-
-                       if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
+                       else if (strcasecmp(pSection, "Notification") == 0)
                        {
-                               __isDefaultSetting = true;
+                               __pPackageAppInfoImpl->SetQuickpanelIcon(iconRelPath);
                        }
                }
-               else if (strcasecmp(pAttrValue1, "Notification") == 0)
+               else    // legacy
                {
-                       if (__isDefaultQuickpanel == false)
+                       if (strcasecmp(pSection, "MainMenu") == 0)
                        {
-                               __pPackageAppInfoImpl->SetQuickpanelIcon(icon);
+                               if (__isDefaultMainmenu == false)
+                               {
+                                       __pPackageAppInfoImpl->SetMainmenuIcon(iconRelPath);
+                               }
+
+                               if (strcasecmp(pType, __pDefaultIconType) == 0)
+                               {
+                                       __isDefaultMainmenu = true;
+                               }
                        }
+                       else if (strcasecmp(pSection, "Setting") == 0)
+                       {
+                               if (__isDefaultSetting == false)
+                               {
+                                       __pPackageAppInfoImpl->SetSettingIcon(iconRelPath);
+                               }
 
-                       if (strcasecmp(pTypeValue, __pDefaultIconType) == 0)
+                               if (strcasecmp(pType, __pDefaultIconType) == 0)
+                               {
+                                       __isDefaultSetting = true;
+                               }
+                       }
+                       else if (strcasecmp(pSection, "Notification") == 0)
                        {
-                               __isDefaultQuickpanel = true;
+                               if (__isDefaultQuickpanel == false)
+                               {
+                                       __pPackageAppInfoImpl->SetQuickpanelIcon(iconRelPath);
+                               }
+
+                               if (strcasecmp(pType, __pDefaultIconType) == 0)
+                               {
+                                       __isDefaultQuickpanel = true;
+                               }
                        }
                }
        }
 
-       AppLog("<Icon Section=\"%s\" Type=\"%s\">%s</Icon>", pAttrValue1, pTypeValue, pCharacters);
-
        return true;
 }
 
index ef10ba7..f044fc2 100755 (executable)
@@ -207,66 +207,45 @@ ManifestAccountsParser::OnDisplayNameValue(const char *pCharacters)
 bool
 ManifestAccountsParser::OnIconValue(const char *pCharacters)
 {
-       XmlAttribute* pAttr = 0;
-       char* pSectionValue = 0;
-       char* pTypeValue = 0;
+       AppLog("  <Icon>%s</Icon>", pCharacters);
 
        ManifestHandler* pHandler = GetHandler();
        TryReturn(pHandler, false, "pHandler is null");
 
-       pAttr = pHandler->GetAttribute();
+       XmlAttribute* pAttr = pHandler->GetAttribute();
        TryReturn(pAttr, true, "pAttr is null");
 
-       pSectionValue = pAttr->Find("Section");
-       TryReturn(pSectionValue, true, "pSectionValue is null");
-
-       pTypeValue = pAttr->Find("Type");
-       TryReturn(pTypeValue, true, "pTypeValue is null");
+       char* pSection = pAttr->Find("Section");
+       TryReturn(pSection, true, "pSection is null");
+       AppLog("   - Section=%s", pSection);
 
        char* pDefaultIconType = pHandler->GetDefaultIconType();
        TryReturn(pDefaultIconType, false, "pDefaultIconType is null");
+       AppLog("  pDefaultIconType=%s", pDefaultIconType);
 
-       String icon;
-       if (strcasecmp(pTypeValue, "Xhigh") == 0)
+       String iconRelPath;
+       if (strcasecmp(pDefaultIconType, "Xhigh") == 0)
        {
-               icon.Format(1024, L"%s/%s", "screen-density-xhigh", pCharacters);
+               iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
        }
-       else if (strcasecmp(pTypeValue, "High") == 0)
+       else if (strcasecmp(pDefaultIconType, "High") == 0)
        {
-               icon.Format(1024, L"%s/%s", "screen-density-high", pCharacters);
+               iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
        }
        else
        {
-               AppLog("Invalid Type [%s]", pDefaultIconType);
-               return false;
+               TryReturn(0, false, "Invalid pDefaultIconType[%s]", pDefaultIconType);
        }
 
-       if (strcasecmp(pSectionValue, "Account") == 0)
+       if (strcasecmp(pSection, "Account") == 0)
        {
-               if (__isAccountIconSelected == false)
-               {
-                       __pAccountData->__accountIcon = icon;
-               }
-
-               if (strcasecmp(pTypeValue, pDefaultIconType) == 0)
-               {
-                       __isAccountIconSelected = true;
-               }
+               __pAccountData->__accountIcon = iconRelPath;
        }
-       else if (strcasecmp(pSectionValue, "AccountSmall") == 0)
+       else if (strcasecmp(pSection, "AccountSmall") == 0)
        {
-               if (__isAccountSmallIconSelected == false)
-               {
-                       __pAccountData->__accountSmallIcon = icon;
-               }
-
-               if (strcasecmp(pTypeValue, pDefaultIconType) == 0)
-               {
-                       __isAccountSmallIconSelected = true;
-               }
+               __pAccountData->__accountSmallIcon = iconRelPath;
        }
 
-       AppLog("  <Icon Section=\"%s\" Type=\"%s\">%s</Icon>", pSectionValue, pTypeValue, pCharacters);
 
        return true;
 }