Implementation for new account tags
authorDongeup Ham <dongeup.ham@samsung.com>
Tue, 26 Feb 2013 13:42:51 +0000 (22:42 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Tue, 26 Feb 2013 13:42:51 +0000 (22:42 +0900)
Change-Id: I4f15354400bbba8d7e3c09e33a35e3430620aebf
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
inc/InstallerDefs.h
src/Context/InstallationContextData.cpp
src/Context/InstallationContextData.h
src/XmlHandler/ManifestGenerator.cpp
src/XmlHandler/Parser/ManifestAccountsParser.cpp
src/XmlHandler/Parser/ManifestAccountsParser.h

index c54e6ce..c845d92 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130226.3]"
+#define OSP_INSTALLER_VERSION "version=[20130227.1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 06a8004..603fb85 100755 (executable)
@@ -53,16 +53,35 @@ AppControlData::~AppControlData()
 
 AccountData::AccountData()
 :__pNameList(null)
+,__pCapabilityList(null)
 {
-       __pNameList = new (std::nothrow) HashMap;
-       TryReturn(__pNameList, , "__pNameList is null.");
-       __pNameList->Construct();
+
 }
 
 AccountData::~AccountData()
 {
        __pNameList->RemoveAll(true);
        delete __pNameList;
+
+       __pCapabilityList->RemoveAll();
+       delete __pCapabilityList;
+}
+
+bool
+AccountData::Construct()
+{
+       result r = E_SUCCESS;
+
+       __pNameList = new (std::nothrow) HashMap;
+       TryReturn(__pNameList, false, "__pNameList is null.");
+
+       r = __pNameList->Construct();
+       TryReturn(!IsFailed(r), false, "__pNameList->Construct() is failed.");
+
+       __pCapabilityList = new (std::nothrow) ArrayListT<String*>;
+       TryReturn(__pCapabilityList, false, "__pCapabilityList is null.");
+
+       return true;
 }
 
 
index 0ed5287..5dba61e 100755 (executable)
@@ -76,12 +76,14 @@ class AccountData
 public:
        AccountData();
        virtual ~AccountData();
+       bool Construct();
 
        Tizen::Base::String __providerId;
        Tizen::Base::String __multipleAccountsSupport;
        Tizen::Base::String __accountIcon;
        Tizen::Base::String __accountSmallIcon;
        Tizen::Base::Collection::HashMap* __pNameList;
+       Tizen::Base::Collection::IListT<Tizen::Base::String*>* __pCapabilityList;
 };
 
 
index 150e3d6..dbeb6e4 100755 (executable)
@@ -854,10 +854,24 @@ ManifestGenerator::WriteAccounts(int index)
 
                WriteLanguageValue(pAccountData->__pNameList, L"label");
 
-               __pWriter->EndElement();        // end of "account-provider"
+               IListT<String*>* pCapabilityList = pAccountData->__pCapabilityList;
+               TryReturn(pCapabilityList, false, "pCapabilityList is null");
+
+               for (int capa = 0; capa < pCapabilityList->GetCount(); capa++)
+               {
+                       String* pCapability = null;
+                       pCapabilityList->GetAt(capa, pCapability);
+                       TryReturn(pCapability, false, "pCapability is null");
+
+                       __pWriter->StartElement("capability");
+                       __pWriter->WriteString(*pCapability);
+                       __pWriter->EndElement(); // end of "capability"
+               }
+
+               __pWriter->EndElement(); // end of "account-provider"
        }
 
-       __pWriter->EndElement();        // end of "account"
+       __pWriter->EndElement(); // end of "account"
 
        return true;
 }
index 0baf4b1..cedf7f2 100755 (executable)
@@ -103,6 +103,10 @@ ManifestAccountsParser::OnCharacters(const char *pCharacters)
        {
                status = OnIconValue(pCharacters);
        }
+       else if (strcasecmp(pName, "Capability") == 0)
+       {
+               status = OnCapabilityValue(pCharacters);
+       }
 
        return true;
 }
@@ -129,6 +133,9 @@ ManifestAccountsParser::OnAccountProviderStartElement(void)
        __pAccountData = new (std::nothrow) AccountData;
        TryReturn(__pAccountData, false, "__pAccountData is null");
 
+       bool res = __pAccountData->Construct();
+       TryReturn(res, false, "__pAccountData->Construct() is failed.");
+
        ManifestHandler* pHandler = GetHandler();
        TryReturn(pHandler, false, "pHandler is null");
 
@@ -143,6 +150,11 @@ ManifestAccountsParser::OnAccountProviderStartElement(void)
                __pAccountData->__providerId = pProviderId;
                AppLog("   - ProviderId=%s", pProviderId);
        }
+       else
+       {
+               __pAccountData->__providerId = L"none";
+               AppLog("   - ProviderId=%s", "none");
+       }
 
        char *pMultipleAccountsSupport = pAttr->Find("MultipleAccountsSupport");
        if (pMultipleAccountsSupport)
@@ -244,6 +256,19 @@ ManifestAccountsParser::OnIconValue(const char *pCharacters)
                __pAccountData->__accountSmallIcon = iconRelPath;
        }
 
+       return true;
+}
+
+bool
+ManifestAccountsParser::OnCapabilityValue(const char *pCharacters)
+{
+       String* pValue = new (std::nothrow) String;
+       TryReturn(pValue, false, "pValue is null.");
+
+       StringUtil::Utf8ToString(pCharacters, *pValue);
+       __pAccountData->__pCapabilityList->Add(pValue);
+
+       AppLog("  <Capability>%s</Capability>", pCharacters);
 
        return true;
 }
index 103f4e0..4209283 100755 (executable)
@@ -43,9 +43,9 @@ public:
        ManifestAccountsParser(void);
        virtual ~ManifestAccountsParser(void);
 
-       virtual bool OnStartElement(const char *pName);
-       virtual bool OnEndElement(const char *pName);
-       virtual bool OnCharacters(const char *pCharacters);
+       virtual bool OnStartElement(const charpName);
+       virtual bool OnEndElement(const charpName);
+       virtual bool OnCharacters(const charpCharacters);
 
 private:
        bool OnAccountsStartElement(void);
@@ -53,8 +53,9 @@ private:
        bool OnAccountsEndElement(void);
        bool OnAccountProviderEndElement(void);
 
-       bool OnDisplayNameValue(const char *pCharacters);
-       bool OnIconValue(const char *pCharacters);
+       bool OnDisplayNameValue(const char* pCharacters);
+       bool OnIconValue(const char* pCharacters);
+       bool OnCapabilityValue(const char* pCharacters);
 
 private:
        InstallationContext* __pContext;