Modify system xml for Livebox
authorDuyoung Jang <duyoung.jang@samsung.com>
Fri, 2 Nov 2012 08:00:14 +0000 (17:00 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Fri, 2 Nov 2012 08:00:14 +0000 (17:00 +0900)
Change-Id: I61c7c68732db02a5f1f5e8c73453cdba00b6312a

src/XmlHandler/ManifestGenerator.cpp

index 82027c3..cea6a20 100755 (executable)
@@ -335,95 +335,81 @@ ManifestGenerator::WriteLiveboxes(_PackageAppInfoImpl* pAppInfoImpl) const
        _PackageInfoImpl* pPackageInfoImpl = __pContext->GetPackageInfoImpl();
        String label("label");
 
-       if (pLiveboxList)
+       if (pLiveboxList == null)
        {
-               for (int j = 0 ; j < pLiveboxList->GetCount(); j++)
+               return true;
+       }
+
+       for (int j = 0 ; j < pLiveboxList->GetCount(); j++)
+       {
+               LiveboxInfo* pLiveboxInfo = dynamic_cast<LiveboxInfo*>(pLiveboxList->GetAt(j));
+               if (pLiveboxInfo == null)
                {
-                       LiveboxInfo* pLiveboxInfo = dynamic_cast<LiveboxInfo*>(pLiveboxList->GetAt(j));
+                       AppLogTag(OSP_INSTALLER, "pLiveboxInfo is null [%d]", j);
+                       continue;
+               }
 
-                       if (pLiveboxInfo)
-                       {
-                               long long updatePeriod = pLiveboxInfo->GetUpdatePeriod();
-                               String period = LongLong::ToString(updatePeriod/1000);
-                               IMap* pLiveboxNameList = pLiveboxInfo->GetNameList();
-                               ArrayList* pSizeList = pLiveboxInfo->GetSizeList();
-                               String popupEnabled = pLiveboxInfo->GetPopupEnabled();
+               long long updatePeriod = pLiveboxInfo->GetUpdatePeriod();
+               String period = LongLong::ToString(updatePeriod/1000);
+               IMap* pLiveboxNameList = pLiveboxInfo->GetNameList();
+               ArrayList* pSizeList = pLiveboxInfo->GetSizeList();
+               String popupEnabled = pLiveboxInfo->GetPopupEnabled();
 
-                               __pWriter->StartElement("livebox");
+               __pWriter->StartElement("livebox");
 
-                               __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
-                               __pWriter->WriteAttribute("period", period);
-                               __pWriter->WriteAttribute("pinup", "false");
-                               __pWriter->WriteAttribute("primary", "true");
-                               __pWriter->WriteAttribute("auto_launch", "false");
-                               __pWriter->WriteAttribute("abi", "osp");
+               __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
+               __pWriter->WriteAttribute("period", period);
+               __pWriter->WriteAttribute("pinup", "false");
+               __pWriter->WriteAttribute("primary", "true");
+               __pWriter->WriteAttribute("auto_launch", "false");
+               __pWriter->WriteAttribute("abi", "osp");
 
-                               WriteLanguageValue(pLiveboxNameList, label);
+               WriteLanguageValue(pLiveboxNameList, label);
 
-                               if (pLiveboxInfo->GetIcon().IsEmpty() == false)
-                               {
-                                       String liveboxIcon;
-                                       liveboxIcon.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pLiveboxInfo->GetIcon().GetPointer());
+               if (pLiveboxInfo->GetIcon().IsEmpty() == false)
+               {
+                       String liveboxIcon;
+                       liveboxIcon.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pLiveboxInfo->GetIcon().GetPointer());
 
-                                       __pWriter->StartElement("icon");
-                                       __pWriter->WriteString(liveboxIcon);
-                                       __pWriter->EndElement();
-                               }
+                       __pWriter->StartElement("icon");
+                       __pWriter->WriteString(liveboxIcon);
+                       __pWriter->EndElement();
+               }
 
-                               if (pSizeList)
-                               {
-                                       __pWriter->StartElement("box");
-                                       __pWriter->WriteAttribute("type", "buffer");
+               if (pSizeList)
+               {
+                       __pWriter->StartElement("box");
+                       __pWriter->WriteAttribute("type", "buffer");
 
-                                       for (int k = 0 ; k < pSizeList->GetCount(); k++)
-                                       {
-                                               String* pSize  = dynamic_cast<String*>(pSizeList->GetAt(k));
-
-                                               if (pSize)
-                                               {
-                                                       String convertedSize;
-
-                                                       if ((*pSize) == L"1x1")
-                                                       {
-                                                               convertedSize = L"172x172";
-                                                       }
-                                                       else if((*pSize) == L"2x1")
-                                                       {
-                                                               convertedSize = L"348x172";
-                                                       }
-                                                       else if((*pSize) == L"2x2")
-                                                       {
-                                                               convertedSize = L"348x348";
-                                                       }
-                                                       else if((*pSize) == L"4x2")
-                                                       {
-                                                               convertedSize = L"700x348";
-                                                       }
-
-                                                       __pWriter->StartElement("size");
-                                                       __pWriter->WriteString(convertedSize);
-                                                       __pWriter->EndElement();
-                                               }
-                                       }
-                                       __pWriter->EndElement();
+                       for (int k = 0 ; k < pSizeList->GetCount(); k++)
+                       {
+                               String* pSize  = dynamic_cast<String*>(pSizeList->GetAt(k));
+                               if (pSize == null)
+                               {
+                                       AppLogTag(OSP_INSTALLER, "pSize is null [%d]", k);
+                                       continue;
                                }
 
-                               popupEnabled.ToLowerCase();
-                               if (popupEnabled == L"true")
-                               {
-                                       __pWriter->StartElement("pd");
-                                       __pWriter->WriteAttribute("type", "buffer");
+                               __pWriter->StartElement("size");
+                               __pWriter->WriteString(*pSize);
+                               __pWriter->EndElement();
+                       }
+                       __pWriter->EndElement();
+               }
 
-                                       __pWriter->StartElement("size");
-                                       __pWriter->WriteString("720x250");
-                                       __pWriter->EndElement();
+               popupEnabled.ToLowerCase();
+               if (popupEnabled == L"true")
+               {
+                       __pWriter->StartElement("pd");
+                       __pWriter->WriteAttribute("type", "buffer");
 
-                                       __pWriter->EndElement();
-                               }
-                       }
+                       __pWriter->StartElement("size");
+                       __pWriter->WriteString("720x250");
+                       __pWriter->EndElement();
 
                        __pWriter->EndElement();
                }
+               __pWriter->EndElement();
        }
 
        return true;