Implementation for Category list
authorDongeup Ham <dongeup.ham@samsung.com>
Sun, 16 Dec 2012 14:38:35 +0000 (23:38 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Sun, 16 Dec 2012 14:38:35 +0000 (23:38 +0900)
Change-Id: I05973c62f80ce4f73609d3e675358de0628e0e3e

CMakeLists.txt
inc/InstallerDefs.h
src/Context/InstallationContext.cpp
src/Context/InstallationContext.h [changed mode: 0644->0755]
src/XmlHandler/ManifestGenerator.cpp [changed mode: 0644->0755]
src/XmlHandler/ManifestGenerator.h
src/XmlHandler/ManifestHandler.cpp [changed mode: 0644->0755]
src/XmlHandler/ManifestHandler.h [changed mode: 0644->0755]

index a9bcbaa..815bc60 100755 (executable)
@@ -6,6 +6,13 @@ SET(CMAKE_EXECUTABLE_SUFFIX "")
 SET(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/output")
 
 INCLUDE_DIRECTORIES(
+       inc
+       src/Context
+       src/Installer
+       src/Manager
+       src/XmlHandler
+       src/Step
+       src/Util
        /usr/include/glib-2.0
        /usr/lib/glib-2.0/include
        /usr/include/dlog
@@ -20,13 +27,6 @@ INCLUDE_DIRECTORIES(
        /usr/include/libxml2
        /usr/include/system
        /usr/include/drm-intel
-       inc
-       src/Context
-       src/Installer
-       src/Manager
-       src/XmlHandler
-       src/Step
-       src/Util
 )
 
 SET (${this_target}_SOURCE_FILES
index b1996c7..e01e45d 100755 (executable)
@@ -21,7 +21,7 @@
 #ifndef _INSTALLER_DEFS_H_
 #define _INSTALLER_DEFS_H_
 
-#define OSP_INSTALLER_VERSION "osp-installer version = [2012/12/12]_RC[2]"
+#define OSP_INSTALLER_VERSION "osp-installer version = [2012/12/17]_RC[1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 95f7c19..09a2ba1 100644 (file)
@@ -38,7 +38,8 @@ using namespace Tizen::Security::Cert;
 using namespace Tizen::App::Package;
 
 InstallationContext::InstallationContext(void)
-:__pStep(null)
+:__pAppDataList(null)
+,__pStep(null)
 ,__pDrmLicense(null)
 ,__error(INSTALLER_ERROR_NONE)
 ,__step(INSTALLER_STEP_NONE)
@@ -90,14 +91,20 @@ InstallationContext::~InstallationContext(void)
                delete __pLiveBoxList;
                __pLiveBoxList = null;
        }
+
+       __pAppDataList->RemoveAll();
+       __pAppDataList = null;
 }
 
 InstallerError
 InstallationContext::Construct(void)
 {
-       __pPackageInfoImpl = new _PackageInfoImpl();
+       __pPackageInfoImpl = new (std::nothrow) _PackageInfoImpl();
        TryReturn(__pPackageInfoImpl, INSTALLER_ERROR_MEMORY, "[osp-installer] __pPackageInfoImpl is null.");
 
+       __pAppDataList = new (std::nothrow) ArrayListT<AppData*>;
+       TryReturn(__pAppDataList, INSTALLER_ERROR_MEMORY, "[osp-installer] __pAppDataList is null");
+
        return INSTALLER_ERROR_NONE;
 }
 
@@ -679,3 +686,15 @@ ContentInfo::GetNameList(void) const
        return __pNameList;
 }
 
+AppData::AppData()
+:__pCategoryList(null)
+{
+       __pCategoryList = new (std::nothrow) ArrayListT<String*>;
+
+}
+
+AppData::~AppData()
+{
+       __pCategoryList->RemoveAll();
+       delete __pCategoryList;
+}
old mode 100644 (file)
new mode 100755 (executable)
index effd419..99f00ee
 
 class IInstallationStep;
 
+class PackageData
+       : public Tizen::Base::Object
+{
+public:
+       PackageData(){};
+       virtual ~PackageData(){};
+
+};
+
+class AppData
+       : public Tizen::Base::Object
+{
+public:
+       AppData();
+       virtual ~AppData();
+
+       Tizen::Base::Collection::IListT<Tizen::Base::String *>* __pCategoryList;
+
+private:
+};
 /**
  * @class              InstallationContext
  * @brief              This class represents the class of InstallationContext.
@@ -141,6 +161,9 @@ public:
 
        Tizen::App::Package::_PackageInfoImpl* GetPackageInfoImpl(void) const;
 
+       PackageData __packageData;
+       Tizen::Base::Collection::IListT<AppData *>* __pAppDataList;
+
 private:
        InstallationContext(const InstallationContext& value);
        InstallationContext& operator =(const InstallationContext& source);
old mode 100644 (file)
new mode 100755 (executable)
index f14945f..115d120
@@ -149,18 +149,11 @@ ManifestGenerator::Write()
                                        nodisplay = L"true";
                                }
 
-                               int categoryType = pAppInfoImpl->GetAppFeature();
-
-                               if (categoryType != CATEGORY_TYPE_NONE)
+                               if (FindCategory(i, "http://tizen.org/category/ime") == true)
                                {
-                                       category = InstallerUtil::GetCategory(categoryType);
-                                       category.ToLowerCase();
-
-                                       if (_Aul::GetAppType(category) != 0)
-                                       {
-                                               taskmanage = L"false";
-                                               nodisplay = L"true";
-                                       }
+                                       AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/ime] is detected. taskmanage=false, nodisplay=true");
+                                       taskmanage = L"false";
+                                       nodisplay = L"true";
                                }
                        }
 
@@ -176,10 +169,7 @@ ManifestGenerator::Write()
                        __pWriter->WriteAttribute("type", type);
                        __pWriter->WriteAttribute("hw-acceleration", glFrame);
 
-                       if (category.IsEmpty() == false)
-                       {
-                               __pWriter->WriteAttribute("categories", category);
-                       }
+                       WriteCategory(i);
 
 #if 0
                        if (pAppInfoImpl->GetType() == L"UiApp")
@@ -520,3 +510,64 @@ ManifestGenerator::WriteAppControl(_PackageAppInfoImpl* pAppInfoImpl) const
 
        return true;
 }
+
+bool
+ManifestGenerator::WriteCategory(int index) const
+{
+       IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
+       TryReturn(pAppDataList, true, "[osp-installer] pAppDataList is null");
+
+       AppData* pAppData = null;
+       pAppDataList->GetAt(index, pAppData);
+       TryReturn(pAppData, true, "[osp-installer] pAppData is null");
+
+       IListT<String*>* pCategoryList = pAppData->__pCategoryList;
+       TryReturn(pCategoryList, true, "[osp-installer] pCategoryList is null");
+
+       for (int i = 0; i < pCategoryList->GetCount(); i++)
+       {
+               String *pStr = null;
+               pCategoryList->GetAt(i, pStr);
+               TryReturn(pStr, false, "[osp-installer] pStr is null");
+
+               AppLogTag(OSP_INSTALLER, "WriteCategory(): Category String=[%ls]", pStr->GetPointer());
+
+               __pWriter->StartElement("category");
+               __pWriter->WriteAttribute("name", *pStr);
+               __pWriter->EndElement();
+       }
+
+       return true;
+}
+
+bool
+ManifestGenerator::FindCategory(int index, const String& category) const
+{
+       result r = E_SUCCESS;
+
+       IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
+       TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
+
+       AppData* pAppData = null;
+       r = pAppDataList->GetAt(index, pAppData);
+       TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+
+       IListT<String*>* pCategoryList = pAppData->__pCategoryList;
+       TryReturn(pCategoryList, false, "[osp-installer] pCategoryList is null");
+
+       for (int i = 0; i < pCategoryList->GetCount(); i++)
+       {
+               String *pStr = null;
+               pCategoryList->GetAt(i, pStr);
+               TryReturn(pStr, false, "[osp-installer] pStr is null");
+
+               if (*pStr == category)
+               {
+                       AppLogTag(OSP_INSTALLER, "FindCategory(): Category is found=[%ls]", pStr->GetPointer());
+                       return true;
+               }
+
+       }
+
+       return false;
+}
index ce65b5c..ba56ccb 100644 (file)
@@ -56,6 +56,9 @@ private:
        bool WriteAppControl(Tizen::App::Package::_PackageAppInfoImpl* pAppInfoImpl) const;
        Tizen::Base::String GetGlFrameValue(Tizen::Base::Collection::ArrayList* pFeatureList) const;
 
+       bool WriteCategory(int index) const;
+       bool FindCategory(int index, const Tizen::Base::String& category) const;
+
 private:
        InstallationContext* __pContext;
        Tizen::App::Package::_PackageInfoImpl* __pPackageInfoImpl;
old mode 100644 (file)
new mode 100755 (executable)
index c937c3c..3cf56e8
@@ -60,6 +60,7 @@ ManifestHandler::ManifestHandler(void)
 ,__isDefaultLaunchImage(false)
 ,__isDefaultName(false)
 ,__isDefaultAppDetected(false)
+,__pAppData(null)
 {
 }
 
@@ -187,6 +188,10 @@ ManifestHandler::OnEndElement(const char *pName)
                __pPackageAppInfoImpl = null;
 
                __isDefaultName = false;
+
+               __pContext->__pAppDataList->Add(__pAppData);
+               __pAppData = null;
+
                AppLogTag(OSP_INSTALLER, "</%s>", pName);
        }
        else if (strcasecmp(pName, "ServiceApp") == 0)
@@ -195,6 +200,10 @@ ManifestHandler::OnEndElement(const char *pName)
                __pPackageAppInfoImpl = null;
 
                __isDefaultName = false;
+
+               __pContext->__pAppDataList->Add(__pAppData);
+               __pAppData = null;
+
                AppLogTag(OSP_INSTALLER, "</%s>", pName);
        }
        else if (strcasecmp(pName, "AppControl") == 0)
@@ -371,6 +380,10 @@ ManifestHandler::OnCharacters(const char *pCharacters)
        {
                status = OnInstallationLocationValue(pCharacters);
        }
+       else if (strcasecmp(pName, "Category") == 0)
+       {
+               status = OnCategoryValue(pCharacters);
+       }
 
        if (!status)
        {
@@ -1005,6 +1018,15 @@ ManifestHandler::OnInstallationLocationValue(const char *pCharacters)
 }
 
 bool
+ManifestHandler::OnCategoryValue(const char *pCharacters)
+{
+       TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
+
+       __pAppData->__pCategoryList->Add(new String(pCharacters));
+       return true;
+}
+
+bool
 ManifestHandler::OnAppControlElement(void)
 {
        XmlAttribute *pAttr = null;
@@ -1116,6 +1138,9 @@ ManifestHandler::OnUiAppElement(void)
        __pPackageAppInfoImpl = new _PackageAppInfoImpl;
        TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null");
 
+       __pAppData = new (std::nothrow) AppData;
+       TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
+
        pAttr = GetAttribute();
        TryReturn(pAttr, true, "[osp-installer] pAttr is null");
 
@@ -1174,8 +1199,23 @@ ManifestHandler::OnUiAppElement(void)
        {
                AppLogTag(OSP_INSTALLER, "<Category=%s>", pCategory);
 
-               CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory);
-               __pPackageAppInfoImpl->SetAppFeature(categoryType);
+               if (strcasecmp(pCategory, "home-screen") == 0)
+               {
+                       // __pCategoryList->Add(new String("home-screen"));
+                       __pAppData->__pCategoryList->Add(new String("http://tizen.org/category/homescreen"));
+               }
+               else if (strcasecmp(pCategory, "lock-screen") == 0)
+               {
+                       // __pCategoryList->Add(new String("lock-screen"));
+                       __pAppData->__pCategoryList->Add(new String("http://tizen.org/category/lockscreen"));
+               }
+               else if (strcasecmp(pCategory, "Ime") == 0)
+               {
+                       __pAppData->__pCategoryList->Add(new String("http://tizen.org/category/ime"));
+               }
+
+               // CategoryType categoryType = InstallerUtil::GetCategoryType(pCategory);
+               // __pPackageAppInfoImpl->SetAppFeature(categoryType);
        }
 
        String app_id;
@@ -1210,6 +1250,9 @@ ManifestHandler::OnServiceAppElement(void)
        __pPackageAppInfoImpl = new _PackageAppInfoImpl;
        TryReturn(__pPackageAppInfoImpl, false, "[osp-installer] __pPackageAppInfoImpl is null");
 
+       __pAppData = new (std::nothrow) AppData;
+       TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
+
        pAttr = GetAttribute();
        TryReturn(pAttr, true, "pAttr is null");
 
old mode 100644 (file)
new mode 100755 (executable)
index 4c46b74..8b0d9aa
@@ -82,6 +82,7 @@ private:
        bool OnNotificationValue(const char *pCharacters);
        bool OnSizeValue(const char *pCharacters);
        bool OnInstallationLocationValue(const char *pCharacters);
+       bool OnCategoryValue(const char *pCharacters);
 
        bool OnAppControlElement(void);
        bool OnCapabilityElement(void);
@@ -119,6 +120,8 @@ private:
        bool __isDefaultName;
        bool __isDefaultAppDetected;
 
+       AppData* __pAppData;
+
 }; // ManifestHandler
 
 #endif // _MANIFEST_HANDLER_H_