From: Pawel Sikorski
Date: Wed, 6 Feb 2013 14:40:10 +0000 (+0100)
Subject: Source code formating unification
X-Git-Tag: accepted/tizen_2.1/20130425.023916~20^2~15^2~6
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc7aa67ff30adf069eb57724628fb35c0d12a261;p=framework%2Fweb%2Fwrt-installer.git
Source code formating unification
[Issue#] N/A
[Problem] Source code was not formatted to any rules. In this situation
creating new patches or making review may become uncomfortable.
[Cause] No formatting rules/tool used.
[Solution] To make implementation and review process more comfortable,
whole installer repository source code has been formatted with uncrustify
tool.
The configuration of the tool is located in the repository
(./uncrustify.cfg).
Command used (stored in uncrustify.sh):
uncrustify -c ./uncrustify.cfg --no-backup `find . -regex
"\(.*\.cpp\|.*\.h\|.*\.c\|.*\.cc\)" | grep -v
"orm.h\|orm_generator.h\|3rdparty"`
[Verification] Build the repository
Change-Id: I47893d5d81e495c33d97fc3c8f47be166d265307
---
diff --git a/src/commons/wrt_common_types.h b/src/commons/wrt_common_types.h
index 4fe586f..f888c85 100644
--- a/src/commons/wrt_common_types.h
+++ b/src/commons/wrt_common_types.h
@@ -26,8 +26,8 @@
#include
/**
-* Widget version is optional
-*/
+ * Widget version is optional
+ */
typedef DPL::Optional OptionalWidgetVersion;
/* Define db type */
diff --git a/src/commons/wrt_error.h b/src/commons/wrt_error.h
index 22599f3..ae4f2de 100644
--- a/src/commons/wrt_error.h
+++ b/src/commons/wrt_error.h
@@ -126,7 +126,8 @@ enum Type
AlreadyRunning, ///< Widget is already running
AlreadyStopped, ///< Widget is already stopped
InvalidLanguage, ///< Widget is invalid in current locales
- StillAuthorizing, ///< Widget is still autorizing and has not yet finished it
+ StillAuthorizing, ///< Widget is still autorizing and has not yet
+ // finished it
EarlyKilled, ///< Widget was early killed during launch
AccessDenied, ///< Access denied from ACE
CertificateRevoked, ///< Some certificate was revoked.
diff --git a/src/configuration_parser/WidgetConfigurationManager.cpp b/src/configuration_parser/WidgetConfigurationManager.cpp
index 94a7c54..6044a5f 100644
--- a/src/configuration_parser/WidgetConfigurationManager.cpp
+++ b/src/configuration_parser/WidgetConfigurationManager.cpp
@@ -47,10 +47,10 @@ const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml";
}
bool WidgetConfigurationManager::locateAndParseConfigurationFile(
- const std::string& _currentPath,
- WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode)
+ const std::string& _currentPath,
+ WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
+ const std::string& baseFolder,
+ int* pErrCode)
{
using namespace WrtDB;
@@ -63,7 +63,7 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
// check if this installation from browser, or not.
size_t pos = _currentPath.rfind("/");
std::ostringstream infoPath;
- infoPath << _currentPath.substr(pos+1);
+ infoPath << _currentPath.substr(pos + 1);
ParserRunner parser;
std::string language = "";
@@ -92,7 +92,8 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
//TODO why don't we use fopen here
bool has_config_xml = false;
errno = 0;
- while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name
+ while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based
+ // on its name
if (ptr->d_type == DT_REG) {
if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
_WrtUtilSetAbsolutePath(cfgAbsPath,
@@ -121,10 +122,15 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
}
//
- // WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance();
- // if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
- // LogDebug("Invalid widget configuration file!");
- // *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+ // WidgetConfigurationParser & parser =
+ // WidgetConfigurationParserSingleton::Instance();
+ // if
+ // (!parser.parseConfigurationFile(cfgAbsPath, configInfo,
+ // baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
+ // LogDebug("Invalid widget configuration
+ // file!");
+ // *pErrCode =
+ // WRT_WM_ERR_INVALID_ARCHIVE;
// closedir(dir);
// return false;
// }
@@ -147,11 +153,12 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
Try
{
parser.Parse(_currentPath, ElementParserPtr(new
- RootParser<
- WidgetParser>(
- configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ RootParser<
+ WidgetParser>(
+ configInfo,
+ DPL::
+ FromUTF32String(
+ L"widget"))));
}
Catch(ElementParser::Exception::Base)
{
@@ -162,7 +169,6 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
}
}
-
char *tmp_language;
if (!_WrtUtilStringToLower(baseFolder.c_str(), &tmp_language)) {
*pErrCode = WRT_ERR_UNKNOWN;
@@ -217,13 +223,16 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
return true;
}
-void WidgetConfigurationManager::processFile(const std::string& path,
- WrtDB::WidgetRegisterInfo &widgetConfiguration)
+void WidgetConfigurationManager::processFile(
+ const std::string& path,
+ WrtDB::WidgetRegisterInfo &
+ widgetConfiguration)
{
int pErrCode;
if (!locateAndParseConfigurationFile(path, widgetConfiguration,
- DEFAULT_LANGUAGE, &pErrCode)) {
+ DEFAULT_LANGUAGE, &pErrCode))
+ {
LogWarning("Widget archive: Failed while parsing config file");
ThrowMsg(Exception::ProcessFailed, path);
}
diff --git a/src/configuration_parser/WidgetConfigurationManager.h b/src/configuration_parser/WidgetConfigurationManager.h
index 84ad2f7..7bda14f 100644
--- a/src/configuration_parser/WidgetConfigurationManager.h
+++ b/src/configuration_parser/WidgetConfigurationManager.h
@@ -53,10 +53,12 @@ class WidgetConfigurationManager
private:
typedef std::list > StringPairList;
- bool locateAndParseConfigurationFile(const std::string& currentPath,
- WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
- const std::string& baseFolder,
- int* pErrCode);
+ bool locateAndParseConfigurationFile(
+ const std::string& currentPath,
+ WrtDB::WidgetRegisterInfo&
+ pWidgetConfigInfo,
+ const std::string& baseFolder,
+ int* pErrCode);
};
typedef DPL::Singleton
diff --git a/src/configuration_parser/deny_all_parser.cpp b/src/configuration_parser/deny_all_parser.cpp
index cffa56a..e807d5e 100644
--- a/src/configuration_parser/deny_all_parser.cpp
+++ b/src/configuration_parser/deny_all_parser.cpp
@@ -17,8 +17,7 @@
#include
DenyAllParser::DenyAllParser() : ElementParser()
-{
-}
+{}
ElementParserPtr DenyAllParser::Create()
{
@@ -26,7 +25,7 @@ ElementParserPtr DenyAllParser::Create()
}
ElementParser::ActionFunc DenyAllParser::GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
ThrowMsg(Exception::ParseError, "There must not be any subelement");
}
diff --git a/src/configuration_parser/deny_all_parser.h b/src/configuration_parser/deny_all_parser.h
index 2d45707..d9dfe56 100644
--- a/src/configuration_parser/deny_all_parser.h
+++ b/src/configuration_parser/deny_all_parser.h
@@ -31,10 +31,9 @@ struct DenyAllParser : public ElementParser
virtual void Accept(const XmlAttribute& /*attribute*/);
virtual void Accept(const Text& /*text*/);
virtual void Verify()
- {
- }
+ {}
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name);
+ const DPL::String& name);
DenyAllParser();
};
diff --git a/src/configuration_parser/element_parser.h b/src/configuration_parser/element_parser.h
index 4751672..a44f94a 100644
--- a/src/configuration_parser/element_parser.h
+++ b/src/configuration_parser/element_parser.h
@@ -79,15 +79,13 @@ class ElementParser : public std::enable_shared_from_this
virtual void Accept(const Text&) = 0;
virtual void Verify() = 0;
virtual ActionFunc GetElementParser(const DPL::String &ns,
- const DPL::String &name) = 0;
+ const DPL::String &name) = 0;
virtual ~ElementParser()
- {
- }
+ {}
protected:
ElementParser()
- {
- }
+ {}
};
#endif // ELEMENT_PARSER_H_
diff --git a/src/configuration_parser/ignoring_parser.cpp b/src/configuration_parser/ignoring_parser.cpp
index 9fc90a0..29520d5 100644
--- a/src/configuration_parser/ignoring_parser.cpp
+++ b/src/configuration_parser/ignoring_parser.cpp
@@ -24,8 +24,7 @@
#include
IgnoringParser::IgnoringParser() : ElementParser()
-{
-}
+{}
ElementParserPtr IgnoringParser::Create()
{
@@ -38,23 +37,19 @@ ElementParserPtr IgnoringParser::Reuse()
}
ElementParser::ActionFunc IgnoringParser::GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &IgnoringParser::Reuse);
}
void IgnoringParser::Accept(const Element& /*element*/)
-{
-}
+{}
void IgnoringParser::Accept(const Text& /*text*/)
-{
-}
+{}
void IgnoringParser::Accept(const XmlAttribute& /*attribute*/)
-{
-}
+{}
void IgnoringParser::Verify()
-{
-}
+{}
diff --git a/src/configuration_parser/ignoring_parser.h b/src/configuration_parser/ignoring_parser.h
index 9f1f6d5..b14f1ad 100644
--- a/src/configuration_parser/ignoring_parser.h
+++ b/src/configuration_parser/ignoring_parser.h
@@ -28,7 +28,7 @@ struct IgnoringParser : public ElementParser
{
static ElementParserPtr Create();
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name);
+ const DPL::String& name);
virtual void Accept(const Element&);
virtual void Accept(const Text&);
virtual void Accept(const XmlAttribute&);
diff --git a/src/configuration_parser/libiriwrapper.cpp b/src/configuration_parser/libiriwrapper.cpp
index f429344..6d8de2a 100644
--- a/src/configuration_parser/libiriwrapper.cpp
+++ b/src/configuration_parser/libiriwrapper.cpp
@@ -27,8 +27,7 @@
namespace LibIri {
Wrapper::Wrapper(const char* aIri) : m_Iri(iri_parse(aIri))
-{
-}
+{}
Wrapper::~Wrapper()
{
iri_destroy(m_Iri);
@@ -52,10 +51,10 @@ bool Wrapper::Validate()
}
std::ostream & operator<<(std::ostream& a_stream,
- const Wrapper& a_wrapper)
+ const Wrapper& a_wrapper)
{
iri_t& iri = *a_wrapper.m_Iri;
-#define PRINT_FIELD(field) "] " # field " [" << (iri.field ? iri.field : "null")
+#define PRINT_FIELD(field) "] " #field " [" << (iri.field ? iri.field : "null")
a_stream <<
" display [" << (iri.display ? iri.display : "null") <<
PRINT_FIELD(scheme) <<
diff --git a/src/configuration_parser/libiriwrapper.h b/src/configuration_parser/libiriwrapper.h
index 1029059..b0b3e86 100644
--- a/src/configuration_parser/libiriwrapper.h
+++ b/src/configuration_parser/libiriwrapper.h
@@ -39,7 +39,7 @@ struct Wrapper
};
std::ostream & operator<<(std::ostream& a_stream,
- const Wrapper& a_wrapper);
+ const Wrapper& a_wrapper);
} //namespace LibIri
#endif // _WRT_ENGINE_SRC_INSTALLERCORE_CONFIGURATION_PARSER_LIBIRIWRAPPER_H_
diff --git a/src/configuration_parser/parser_runner.cpp b/src/configuration_parser/parser_runner.cpp
index 6de0c0d..cff02f7 100644
--- a/src/configuration_parser/parser_runner.cpp
+++ b/src/configuration_parser/parser_runner.cpp
@@ -33,14 +33,14 @@ class ParserRunner::Impl
{
public:
void Parse(const std::string& filename,
- const ElementParserPtr& root)
+ const ElementParserPtr& root)
{
DPL::FileInput input(filename);
Parse(&input, root);
}
void Parse (DPL::AbstractInput *input,
- const ElementParserPtr& root)
+ const ElementParserPtr& root)
{
Try
{
@@ -123,8 +123,7 @@ class ParserRunner::Impl
Impl() :
m_reader(NULL),
m_parsingError(false)
- {
- }
+ {}
~Impl()
{
@@ -136,24 +135,24 @@ class ParserRunner::Impl
private:
static void xmlTextReaderErrorHandler(void* arg,
- const char* msg,
- xmlParserSeverities /* severity */,
- xmlTextReaderLocatorPtr /* locator */)
+ const char* msg,
+ xmlParserSeverities /* severity */,
+ xmlTextReaderLocatorPtr /* locator */)
{
ParserRunner::Impl* impl = static_cast(arg);
impl->ErrorHandler(DPL::FromASCIIString(msg));
}
static void xmlTextReaderStructuredErrorHandler(void* arg,
- xmlErrorPtr error)
+ xmlErrorPtr error)
{
ParserRunner::Impl* impl = static_cast(arg);
impl->StructuredErrorHandler(error);
}
static int XMLCALL IoRead(void *context,
- char *buffer,
- int len)
+ char *buffer,
+ int len)
{
DPL::AbstractInput *input = static_cast(context);
DPL::BinaryQueueAutoPtr data = input->Read(static_cast(len));
@@ -384,17 +383,16 @@ class ParserRunner::Impl
ParserRunner::ParserRunner() :
m_impl(new ParserRunner::Impl())
-{
-}
+{}
void ParserRunner::Parse(const std::string& filename,
- ElementParserPtr root)
+ ElementParserPtr root)
{
m_impl->Parse(filename, root);
}
void ParserRunner::Parse(DPL::AbstractInput *input,
- ElementParserPtr root)
+ ElementParserPtr root)
{
m_impl->Parse(input, root);
}
diff --git a/src/configuration_parser/parser_runner.h b/src/configuration_parser/parser_runner.h
index 1176165..80a3208 100644
--- a/src/configuration_parser/parser_runner.h
+++ b/src/configuration_parser/parser_runner.h
@@ -31,9 +31,9 @@ class ParserRunner : private DPL::Noncopyable
{
public:
void Parse(const std::string& filename,
- ElementParserPtr root);
+ ElementParserPtr root);
void Parse(DPL::AbstractInput *input,
- ElementParserPtr root);
+ ElementParserPtr root);
ParserRunner();
~ParserRunner();
diff --git a/src/configuration_parser/root_parser.h b/src/configuration_parser/root_parser.h
index 3f4a86b..df7ea6a 100644
--- a/src/configuration_parser/root_parser.h
+++ b/src/configuration_parser/root_parser.h
@@ -31,7 +31,7 @@ class RootParser : public ElementParser
public:
typedef typename ta_Parser::Data Data;
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == m_tag) {
return DPL::MakeDelegate(this,
@@ -43,15 +43,13 @@ class RootParser : public ElementParser
}
RootParser(Data data,
- const DPL::String& tag) :
+ const DPL::String& tag) :
m_data(data),
m_tag(tag)
- {
- }
+ {}
virtual ~RootParser()
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
{
diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp
old mode 100755
new mode 100644
index 10ed283..5f0d6ca
--- a/src/configuration_parser/widget_parser.cpp
+++ b/src/configuration_parser/widget_parser.cpp
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- /**
+/**
* This file have been implemented in compliance with W3C WARP SPEC.
* but there are some patent issue between W3C WARP SPEC and APPLE.
* so if you want to use this file, refer to the README file in root directory
@@ -68,7 +68,7 @@ Direction ParseDirAttribute(const XmlAttribute& attribute)
}
void UpdateTextWithDirectionMark(Direction direction,
- DPL::String* text)
+ DPL::String* text)
{
Assert(text);
switch (direction) {
@@ -96,14 +96,13 @@ class InnerElementsParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &InnerElementsParser::Other);
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& text)
{
@@ -133,8 +132,7 @@ class InnerElementsParser : public ElementParser
InnerElementsParser(ElementParserPtr parent) :
m_parentParser(parent),
m_textDirection(Unicode::EMPTY)
- {
- }
+ {}
ElementParserPtr Other()
{
@@ -153,7 +151,7 @@ class NameParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &NameParser::Other);
}
@@ -203,11 +201,10 @@ class NameParser : public ElementParser
}
NameParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_textDirection(direction)
- {
- }
+ {}
ElementParserPtr Other()
{
@@ -235,7 +232,7 @@ class AccessParser : public ElementParser
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &AccessParser::Other);
}
@@ -251,8 +248,7 @@ class AccessParser : public ElementParser
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
void AcceptWac(const XmlAttribute& attribute)
{
@@ -318,8 +314,7 @@ class AccessParser : public ElementParser
m_standardType(STANDARD_TYPE_NONE),
m_network(false),
m_data(data)
- {
- }
+ {}
ElementParserPtr Other()
{
@@ -339,7 +334,7 @@ class DescriptionParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &DescriptionParser::Other);
}
@@ -386,13 +381,12 @@ class DescriptionParser : public ElementParser
}
DescriptionParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_lang(),
m_description(),
m_textDirection(direction)
- {
- }
+ {}
private:
ConfigParserData& m_data;
@@ -405,17 +399,16 @@ class AuthorParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &AuthorParser::Other);
}
AuthorParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_textDirection(direction)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
{
@@ -482,18 +475,17 @@ class LicenseParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return DPL::MakeDelegate(this, &LicenseParser::Other);
}
LicenseParser(Unicode::Direction direction,
- ConfigParserData& data) :
+ ConfigParserData& data) :
m_data(data),
m_ignore(true),
m_textDirection(direction)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
@@ -561,19 +553,17 @@ class IconParser : public ElementParser
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
IconParser(ConfigParserData& data) : ElementParser(),
m_data(data)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
@@ -635,7 +625,8 @@ class IconParser : public ElementParser
strtol(DPL::ToUTF8String(value).c_str(), &reterr, 10);
if (errno != 0 ||
std::string(reterr) == DPL::ToUTF8String(value) ||
- valueInt <= 0) {
+ valueInt <= 0)
+ {
return DPL::OptionalInt::Null;
} else {
return valueInt;
@@ -645,7 +636,8 @@ class IconParser : public ElementParser
}
/**
- * @brief delocalizePath removes locales folder from relative path if neccessary
+ * @brief delocalizePath removes locales folder from relative path if
+ * neccessary
* @param source source string
*
* @throw BadSrcError if string is bad value of src attribute
@@ -659,15 +651,11 @@ class IconParser : public ElementParser
DPL::String result = source;
- if(source.substr(0,index) == localeFolder)
- {
- size_t pos = result.find_first_of('/',index);
- if(pos != std::string::npos && pos + 1 < source.size())
- {
- result = result.substr(pos + 1,source.size());
- }
- else
- {
+ if (source.substr(0, index) == localeFolder) {
+ size_t pos = result.find_first_of('/', index);
+ if (pos != std::string::npos && pos + 1 < source.size()) {
+ result = result.substr(pos + 1, source.size());
+ } else {
Throw(BadSrcError);
}
}
@@ -679,7 +667,7 @@ class ContentParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
@@ -687,16 +675,13 @@ class ContentParser : public ElementParser
ContentParser(ConfigParserData& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
@@ -756,7 +741,7 @@ class FeatureParser : public ElementParser
struct ParamParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
@@ -773,8 +758,7 @@ class FeatureParser : public ElementParser
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
{
@@ -801,8 +785,7 @@ class FeatureParser : public ElementParser
ParamParser(ConfigParserData::Feature& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_name;
@@ -811,7 +794,7 @@ class FeatureParser : public ElementParser
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"param") {
return DPL::MakeDelegate(this, &FeatureParser::OnParamElement);
@@ -821,12 +804,10 @@ class FeatureParser : public ElementParser
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
@@ -848,7 +829,8 @@ class FeatureParser : public ElementParser
if (m_feature.name != L"") {
if (iri.Validate()) {
if (m_data.featuresList.find(m_feature) ==
- m_data.featuresList.end()) {
+ m_data.featuresList.end())
+ {
m_data.featuresList.insert(m_feature);
} else {
LogDebug("Ignoring feature with name" <<
@@ -872,8 +854,7 @@ class FeatureParser : public ElementParser
ElementParser(),
m_data(data),
m_feature(L"")
- {
- }
+ {}
private:
ConfigParserData& m_data;
@@ -884,7 +865,7 @@ class PreferenceParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
@@ -905,8 +886,7 @@ class PreferenceParser : public ElementParser
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
{
@@ -924,7 +904,8 @@ class PreferenceParser : public ElementParser
ConfigParserData::Preference preference(*m_name, m_required);
preference.value = m_value;
if (m_data.preferencesList.find(preference) ==
- m_data.preferencesList.end()) {
+ m_data.preferencesList.end())
+ {
m_data.preferencesList.insert(preference);
}
}
@@ -933,8 +914,7 @@ class PreferenceParser : public ElementParser
ElementParser(),
m_required(false),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_name;
@@ -947,7 +927,7 @@ class LinkParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &DenyAllParser::Create;
}
@@ -961,8 +941,9 @@ class LinkParser : public ElementParser
ThrowMsg(Exception::ParseError,
"rel attribute must have describedby value");
}
- } else if (attribute.name == L"type") {
- } else if (attribute.name == L"href") {
+ } else if (attribute.name == L"type") {} else if (attribute.name ==
+ L"href")
+ {
LogDebug("here is href");
m_href = attribute.value;
} else {
@@ -1011,8 +992,7 @@ class LinkParser : public ElementParser
m_properNamespace(false),
m_data(data),
m_href(DPL::OptionalString::Null)
- {
- }
+ {}
private:
bool m_properNamespace;
@@ -1024,18 +1004,16 @@ class SettingParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const XmlAttribute& attribute)
{
@@ -1045,15 +1023,13 @@ class SettingParser : public ElementParser
}
virtual void Verify()
- {
- }
+ {}
SettingParser(ConfigParserData& data) :
ElementParser(),
m_data(data),
m_setting(L"", L"")
- {
- }
+ {}
private:
ConfigParserData& m_data;
@@ -1087,7 +1063,7 @@ class AppServiceParser : public ElementParser
LogWarning("namespace for app service = " << element.ns);
if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName) {
ThrowMsg(Exception::ParseError,
- "Wrong xml namespace for widget element");
+ "Wrong xml namespace for widget element");
}
}
@@ -1114,33 +1090,33 @@ class AppServiceParser : public ElementParser
DPL::String wildString(L"*/*");
DPL::String nullString(L"");
ConfigParserData::ServiceInfo serviceInfo(
- m_src.IsNull() ? nullString:*m_src,
- m_operation.IsNull() ? nullString:*m_operation,
- m_scheme.IsNull() ? nullString:*m_scheme,
- m_mime.IsNull() ? nullString:*m_mime);
+ m_src.IsNull() ? nullString : *m_src,
+ m_operation.IsNull() ? nullString : *m_operation,
+ m_scheme.IsNull() ? nullString : *m_scheme,
+ m_mime.IsNull() ? nullString : *m_mime);
FOREACH(iterator, m_data.appServiceList) {
if (iterator->m_operation == serviceInfo.m_operation &&
// check scheme
(iterator->m_scheme == serviceInfo.m_scheme ||
- // check input scheme is "*/*" case
- (iterator->m_scheme == wildString &&
- serviceInfo.m_scheme != nullString) ||
- // check iterator scheme is "*/*" case
- (serviceInfo.m_scheme == wildString &&
- iterator->m_scheme != nullString)) &&
+ // check input scheme is "*/*" case
+ (iterator->m_scheme == wildString &&
+ serviceInfo.m_scheme != nullString) ||
+ // check iterator scheme is "*/*" case
+ (serviceInfo.m_scheme == wildString &&
+ iterator->m_scheme != nullString)) &&
(iterator->m_mime == serviceInfo.m_mime ||
- // check input mime is "*/*" case
- (iterator->m_mime == wildString &&
- serviceInfo.m_mime != nullString) ||
- // check iterator mime is "*/*" case
- (serviceInfo.m_mime == wildString &&
- iterator->m_mime != nullString)))
+ // check input mime is "*/*" case
+ (iterator->m_mime == wildString &&
+ serviceInfo.m_mime != nullString) ||
+ // check iterator mime is "*/*" case
+ (serviceInfo.m_mime == wildString &&
+ iterator->m_mime != nullString)))
{
ThrowMsg(Exception::ParseError,
- "service operation is duplicated " +
- DPL::ToUTF8String(*m_operation));
+ "service operation is duplicated " +
+ DPL::ToUTF8String(*m_operation));
}
}
m_data.appServiceList.push_back(serviceInfo);
@@ -1153,8 +1129,7 @@ class AppServiceParser : public ElementParser
m_scheme(DPL::OptionalString::Null),
m_mime(DPL::OptionalString::Null),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_src;
@@ -1167,231 +1142,221 @@ class AppServiceParser : public ElementParser
class AppControlParser : public ElementParser
{
public:
- struct SourceParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create;
- }
-
- virtual void Accept(const Text& /*text*/)
- {
- }
-
- virtual void Accept(const Element& /*element*/)
- {
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"name") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value== L"") {
- return;
- }
-
- m_data.m_src = *m_value;
- }
-
- SourceParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
-
- struct OperationParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create;
- }
-
- virtual void Accept(const Text& /*text*/)
- {
- }
-
- virtual void Accept(const Element& /*element*/)
- {
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"name") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value== L"") {
- return;
- }
-
- m_data.m_operation = *m_value;
- }
-
- OperationParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
-
- struct UriParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create;
- }
-
- virtual void Accept(const Text& /*text*/)
- {
- }
-
- virtual void Accept(const Element& /*element*/)
- {
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"name") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
-
- DPL::String wildString(L"*/*");
- if ((m_data.m_uriList.find(wildString) ==
- m_data.m_uriList.end())
- && (m_data.m_uriList.find(*m_value) ==
- m_data.m_uriList.end())) {
-
- m_data.m_uriList.insert(*m_value);
- } else {
- LogDebug("Ignoring uri with name" <<
- DPL::ToUTF8String(*m_value));
- }
- }
-
- UriParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
-
- struct MimeParser : public ElementParser
- {
- public:
- virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
- {
- return &IgnoringParser::Create;
- }
-
- virtual void Accept(const Text& /*text*/)
- {
- }
-
- virtual void Accept(const Element& /*element*/)
- {
- }
-
- virtual void Accept(const XmlAttribute& attribute)
- {
- if (attribute.name == L"name") {
- if (attribute.value.size() > 0) {
- m_value = attribute.value;
- NormalizeString(m_value);
- }
- }
- }
-
- virtual void Verify()
- {
- if (m_value.IsNull() || *m_value == L"") {
- return;
- }
-
- DPL::String wildString(L"*/*");
- if ((m_data.m_mimeList.find(wildString) ==
- m_data.m_mimeList.end())
- && (m_data.m_mimeList.find(*m_value) ==
- m_data.m_mimeList.end())) {
- m_data.m_mimeList.insert(*m_value);
- } else {
- LogDebug("Ignoring mime with name" <<
- DPL::ToUTF8String(*m_value));
- }
- }
-
- MimeParser(ConfigParserData::AppControlInfo& data) :
- ElementParser(),
- m_properNamespace(false),
- m_data(data)
- {
- }
-
- private:
- bool m_properNamespace;
- DPL::OptionalString m_value;
- ConfigParserData::AppControlInfo& m_data;
- };
+ struct SourceParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {}
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"name") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ m_data.m_src = *m_value;
+ }
+
+ SourceParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
+
+ struct OperationParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {}
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"name") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ m_data.m_operation = *m_value;
+ }
+
+ OperationParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
+
+ struct UriParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {}
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"name") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ DPL::String wildString(L"*/*");
+ if ((m_data.m_uriList.find(wildString) ==
+ m_data.m_uriList.end())
+ && (m_data.m_uriList.find(*m_value) ==
+ m_data.m_uriList.end()))
+ {
+ m_data.m_uriList.insert(*m_value);
+ } else {
+ LogDebug("Ignoring uri with name" <<
+ DPL::ToUTF8String(*m_value));
+ }
+ }
+
+ UriParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
+
+ struct MimeParser : public ElementParser
+ {
+ public:
+ virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
+ const DPL::String& /*name*/)
+ {
+ return &IgnoringParser::Create;
+ }
+
+ virtual void Accept(const Text& /*text*/)
+ {}
+
+ virtual void Accept(const Element& /*element*/)
+ {}
+
+ virtual void Accept(const XmlAttribute& attribute)
+ {
+ if (attribute.name == L"name") {
+ if (attribute.value.size() > 0) {
+ m_value = attribute.value;
+ NormalizeString(m_value);
+ }
+ }
+ }
+
+ virtual void Verify()
+ {
+ if (m_value.IsNull() || *m_value == L"") {
+ return;
+ }
+
+ DPL::String wildString(L"*/*");
+ if ((m_data.m_mimeList.find(wildString) ==
+ m_data.m_mimeList.end())
+ && (m_data.m_mimeList.find(*m_value) ==
+ m_data.m_mimeList.end()))
+ {
+ m_data.m_mimeList.insert(*m_value);
+ } else {
+ LogDebug("Ignoring mime with name" <<
+ DPL::ToUTF8String(*m_value));
+ }
+ }
+
+ MimeParser(ConfigParserData::AppControlInfo& data) :
+ ElementParser(),
+ m_properNamespace(false),
+ m_data(data)
+ {}
+
+ private:
+ bool m_properNamespace;
+ DPL::OptionalString m_value;
+ ConfigParserData::AppControlInfo& m_data;
+ };
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"src") {
return DPL::MakeDelegate(this, &AppControlParser::OnSourceElement);
} else if (name == L"operation") {
- return DPL::MakeDelegate(this, &AppControlParser::OnOperationElement);
+ return DPL::MakeDelegate(this,
+ &AppControlParser::OnOperationElement);
} else if (name == L"uri") {
return DPL::MakeDelegate(this, &AppControlParser::OnUriElement);
- } else if (name == L"mime") {
+ } else if (name == L"mime") {
return DPL::MakeDelegate(this, &AppControlParser::OnMimeElement);
} else {
return &IgnoringParser::Create;
@@ -1399,15 +1364,14 @@ class AppControlParser : public ElementParser
}
virtual void Accept(const XmlAttribute& attribute)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
LogWarning("namespace for app service = " << element.ns);
if (element.ns == ConfigurationNamespace::W3CWidgetNamespaceName) {
ThrowMsg(Exception::ParseError,
- "Wrong xml namespace for widget element");
+ "Wrong xml namespace for widget element");
}
}
@@ -1418,24 +1382,24 @@ class AppControlParser : public ElementParser
virtual void Verify()
{
- if (m_appControl.m_src == L""){
+ if (m_appControl.m_src == L"") {
LogWarning("service element must have src element");
return;
}
- if (m_appControl.m_operation == L""){
+ if (m_appControl.m_operation == L"") {
LogWarning("service element must have operation element");
return;
}
FOREACH(iterator, m_data.appControlList) {
if (iterator->m_src == m_appControl.m_src &&
- iterator->m_operation == m_appControl.m_operation )
+ iterator->m_operation == m_appControl.m_operation)
{
ThrowMsg(Exception::ParseError,
- "app control element is duplicated " +
- DPL::ToUTF8String(m_appControl.m_src) + ", " +
- DPL::ToUTF8String(m_appControl.m_operation));
+ "app control element is duplicated " +
+ DPL::ToUTF8String(m_appControl.m_src) + ", " +
+ DPL::ToUTF8String(m_appControl.m_operation));
}
}
m_data.appControlList.push_back(m_appControl);
@@ -1465,8 +1429,7 @@ class AppControlParser : public ElementParser
ElementParser(),
m_data(data),
m_appControl(L"")
- {
- }
+ {}
private:
ConfigParserData& m_data;
@@ -1477,7 +1440,7 @@ class ApplicationParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
@@ -1523,16 +1486,16 @@ class ApplicationParser : public ElementParser
virtual void Verify()
{
- if(!m_id) {
+ if (!m_id) {
ThrowMsg(Exception::ParseError,
"application element must have id attribute");
}
- if(!!m_package) {
+ if (!!m_package) {
m_data.tizenPkgId = m_package;
}
- if(!m_version) {
+ if (!m_version) {
ThrowMsg(Exception::ParseError,
"application element must have required_version attribute");
}
@@ -1548,8 +1511,7 @@ class ApplicationParser : public ElementParser
m_id(DPL::OptionalString::Null),
m_version(DPL::OptionalString::Null),
m_properNamespace(false)
- {
- }
+ {}
private:
ConfigParserData& m_data;
@@ -1578,17 +1540,16 @@ class SplashParser : public ElementParser
}
virtual void Accept(const Element& element)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
if (m_src.IsNull()) {
- LogWarning("src attribute of splash element is mandatory - ignoring");
+ LogWarning(
+ "src attribute of splash element is mandatory - ignoring");
return;
}
@@ -1598,8 +1559,7 @@ class SplashParser : public ElementParser
SplashParser(ConfigParserData& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_src;
@@ -1625,17 +1585,16 @@ class BackgroundParser : public ElementParser
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
if (m_src.IsNull()) {
- LogWarning("src attribute of background element is mandatory - ignoring");
+ LogWarning(
+ "src attribute of background element is mandatory - ignoring");
return;
}
@@ -1644,8 +1603,7 @@ class BackgroundParser : public ElementParser
explicit BackgroundParser(ConfigParserData& data) :
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_src;
@@ -1656,14 +1614,13 @@ class PrivilegeParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
return &IgnoringParser::Create;
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
@@ -1693,7 +1650,8 @@ class PrivilegeParser : public ElementParser
if (m_feature.name != L"") {
if (iri.Validate()) {
if (m_data.featuresList.find(m_feature) ==
- m_data.featuresList.end()) {
+ m_data.featuresList.end())
+ {
m_data.featuresList.insert(m_feature);
} else {
LogDebug("Ignoring feature with name" <<
@@ -1708,7 +1666,8 @@ class PrivilegeParser : public ElementParser
if (m_privilege.name != L"") {
if (iriPrivilege.Validate()) {
if (m_data.privilegeList.find(m_privilege) ==
- m_data.privilegeList.end()) {
+ m_data.privilegeList.end())
+ {
m_data.privilegeList.insert(m_privilege);
} else {
LogDebug("Ignoring privilege with name" <<
@@ -1724,8 +1683,7 @@ class PrivilegeParser : public ElementParser
m_feature(L""),
m_privilege(L""),
m_properNamespace(false)
- {
- }
+ {}
private:
ConfigParserData& m_data;
@@ -1753,30 +1711,29 @@ class CategoryParser : public ElementParser
}
virtual void Accept(const Element& /*element*/)
- {
- }
+ {}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
if (m_name.IsNull()) {
- LogWarning("name attribute of category element is mandatory - ignoring");
+ LogWarning(
+ "name attribute of category element is mandatory - ignoring");
return;
}
if (m_data.categoryList.find(*m_name) ==
- m_data.categoryList.end()) {
+ m_data.categoryList.end())
+ {
m_data.categoryList.insert(*m_name);
}
}
explicit CategoryParser(ConfigParserData& data) :
m_data(data)
- {
- }
+ {}
private:
DPL::OptionalString m_name;
@@ -1785,24 +1742,23 @@ class CategoryParser : public ElementParser
class LiveboxParser : public ElementParser
{
- public:
+ public:
struct BoxLabelParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
@@ -1810,8 +1766,9 @@ class LiveboxParser : public ElementParser
virtual void Accept(const Text& text)
{
- if(m_properNamespace)
+ if (m_properNamespace) {
m_label = text.value;
+ }
}
virtual void Verify()
@@ -1823,10 +1780,9 @@ class LiveboxParser : public ElementParser
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_label;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
@@ -1835,14 +1791,14 @@ class LiveboxParser : public ElementParser
struct BoxIconParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
{
- if(m_properNamespace) {
+ if (m_properNamespace) {
if (attribute.name == L"src") {
m_icon = attribute.value;
}
@@ -1852,15 +1808,14 @@ class LiveboxParser : public ElementParser
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
@@ -1871,10 +1826,9 @@ class LiveboxParser : public ElementParser
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_icon;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
@@ -1885,14 +1839,14 @@ class LiveboxParser : public ElementParser
struct BoxSizeParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& /*name*/)
+ const DPL::String& /*name*/)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
{
- if(m_properNamespace) {
+ if (m_properNamespace) {
if (attribute.name == L"preview") {
m_preview = attribute.value;
}
@@ -1902,7 +1856,7 @@ class LiveboxParser : public ElementParser
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
@@ -1910,8 +1864,9 @@ class LiveboxParser : public ElementParser
virtual void Accept(const Text& text)
{
- if(m_properNamespace)
+ if (m_properNamespace) {
m_size = text.value;
+ }
}
virtual void Verify()
@@ -1922,13 +1877,13 @@ class LiveboxParser : public ElementParser
m_data.m_boxSize.push_back(boxSize);
}
- explicit BoxSizeParser(ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
+ explicit BoxSizeParser(
+ ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
ElementParser(),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_size;
DPL::String m_preview;
bool m_properNamespace;
@@ -1938,14 +1893,14 @@ class LiveboxParser : public ElementParser
struct PdParser : public ElementParser
{
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
return &IgnoringParser::Create;
}
virtual void Accept(const XmlAttribute& attribute)
{
- if(m_properNamespace) {
+ if (m_properNamespace) {
if (attribute.name == L"src") {
m_src = attribute.value;
} else if (attribute.name == L"width") {
@@ -1959,15 +1914,14 @@ class LiveboxParser : public ElementParser
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
@@ -1976,14 +1930,14 @@ class LiveboxParser : public ElementParser
m_data.m_pdHeight = m_height;
}
- explicit PdParser(ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
+ explicit PdParser(
+ ConfigParserData::LiveboxInfo::BoxContentInfo& data) :
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
- private:
+ private:
DPL::String m_src;
DPL::String m_width;
DPL::String m_height;
@@ -1993,39 +1947,47 @@ class LiveboxParser : public ElementParser
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"box-size") {
- return DPL::MakeDelegate(this, &LiveboxParser::BoxContentParser::OnBoxSizeElement);
+ return DPL::MakeDelegate(
+ this,
+ &LiveboxParser::BoxContentParser::
+ OnBoxSizeElement);
} else if (name == L"pd") {
- return DPL::MakeDelegate(this, &LiveboxParser::BoxContentParser::OnPdElement);
- } else{
- ThrowMsg(Exception::ParseError, "No element parser for name: " << name);
+ return DPL::MakeDelegate(
+ this,
+ &LiveboxParser::BoxContentParser::
+ OnPdElement);
+ } else {
+ ThrowMsg(Exception::ParseError,
+ "No element parser for name: " << name);
}
}
virtual void Accept(const XmlAttribute& attribute)
{
if (m_properNamespace) {
- if (attribute.name == L"src")
+ if (attribute.name == L"src") {
m_box.m_boxSrc = attribute.value;
- if (attribute.name == L"mouse-event")
+ }
+ if (attribute.name == L"mouse-event") {
m_box.m_boxMouseEvent = attribute.value;
+ }
}
}
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
@@ -2036,8 +1998,7 @@ class LiveboxParser : public ElementParser
ElementParser(),
m_properNamespace(false),
m_data(data)
- {
- }
+ {}
ElementParserPtr OnBoxSizeElement()
{
@@ -2049,7 +2010,7 @@ class LiveboxParser : public ElementParser
return ElementParserPtr(new PdParser(m_box));
}
- private:
+ private:
DPL::String m_src;
bool m_properNamespace;
ConfigParserData::LiveboxInfo& m_data;
@@ -2057,13 +2018,13 @@ class LiveboxParser : public ElementParser
};
virtual ActionFunc GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ const DPL::String& name)
{
if (name == L"box-label") {
return DPL::MakeDelegate(this, &LiveboxParser::OnBoxLabelElement);
} else if (name == L"box-icon") {
return DPL::MakeDelegate(this, &LiveboxParser::OnBoxIconElement);
- } else if (name == L"box-content") {
+ } else if (name == L"box-content") {
return DPL::MakeDelegate(this, &LiveboxParser::OnBoxContentElement);
} else {
return &IgnoringParser::Create;
@@ -2090,15 +2051,14 @@ class LiveboxParser : public ElementParser
virtual void Accept(const Element& element)
{
if (element.ns ==
- ConfigurationNamespace::TizenWebAppNamespaceName)
+ ConfigurationNamespace::TizenWebAppNamespaceName)
{
m_properNamespace = true;
}
}
virtual void Accept(const Text& /*text*/)
- {
- }
+ {}
virtual void Verify()
{
@@ -2149,7 +2109,7 @@ class CspParser : public ElementParser
{
public:
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name)
+ const DPL::String& name)
{
return &IgnoringParser::Create;
}
@@ -2158,31 +2118,30 @@ class CspParser : public ElementParser
ElementParser(),
m_data(data),
m_properNamespace(false)
- {
- }
+ {}
virtual void Accept(const Element& element)
{
- if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName)
- {
+ if (element.ns == ConfigurationNamespace::TizenWebAppNamespaceName) {
m_properNamespace = true;
}
}
virtual void Accept(const XmlAttribute& attribute)
- {
- }
+ {}
virtual void Accept(const Text& text)
{
- if (m_properNamespace)
+ if (m_properNamespace) {
m_policy = text.value;
+ }
}
virtual void Verify()
{
- if (!m_policy.IsNull())
+ if (!m_policy.IsNull()) {
m_data.cspPolicy = *m_policy;
+ }
}
private:
@@ -2191,9 +2150,10 @@ class CspParser : public ElementParser
DPL::OptionalString m_policy;
};
-
-ElementParser::ActionFunc WidgetParser::GetElementParser(const DPL::String& /*ns*/,
- const DPL::String& name)
+ElementParser::ActionFunc WidgetParser::GetElementParser(
+ const DPL::String& /*ns*/,
+ const DPL::String&
+ name)
{
FuncMap::const_iterator it = m_map.find(name);
if (it != m_map.end()) {
@@ -2225,18 +2185,29 @@ WidgetParser::WidgetParser(ConfigParserData& data) :
m_map[L"setting"] =
DPL::MakeDelegate(this, &WidgetParser::OnSettingElement);
// TODO: appservice will be removed
- m_map[L"appservice"] = DPL::MakeDelegate(this, &WidgetParser::OnAppServiceElement);
- m_map[L"application"] = DPL::MakeDelegate(this, &WidgetParser::OnApplicationElement);
+ m_map[L"appservice"] = DPL::MakeDelegate(this,
+ &WidgetParser::OnAppServiceElement);
+ m_map[L"application"] = DPL::MakeDelegate(
+ this,
+ &WidgetParser::
+ OnApplicationElement);
m_map[L"splash"] = DPL::MakeDelegate(this, &WidgetParser::OnSplashElement);
- m_map[L"background"] = DPL::MakeDelegate(this, &WidgetParser::OnBackgroundElement);
- m_map[L"privilege"] = DPL::MakeDelegate(this, &WidgetParser::OnPrivilegeElement);
- m_map[L"app-control"] = DPL::MakeDelegate(this,
- &WidgetParser::OnAppControlElement);
+ m_map[L"background"] = DPL::MakeDelegate(this,
+ &WidgetParser::OnBackgroundElement);
+ m_map[L"privilege"] = DPL::MakeDelegate(this,
+ &WidgetParser::OnPrivilegeElement);
+ m_map[L"app-control"] = DPL::MakeDelegate(
+ this,
+ &WidgetParser::
+ OnAppControlElement);
m_map[L"category"] = DPL::MakeDelegate(this,
- &WidgetParser::OnCategoryElement);
+ &WidgetParser::OnCategoryElement);
m_map[L"livebox"] = DPL::MakeDelegate(this, &WidgetParser::OnLiveboxElement);
#ifdef CSP_ENABLED
- m_map[L"Content-Security-Policy"] = DPL::MakeDelegate(this, &WidgetParser::OnCspElement);
+ m_map[L"Content-Security-Policy"] = DPL::MakeDelegate(
+ this,
+ &WidgetParser::
+ OnCspElement);
#endif
}
@@ -2430,26 +2401,27 @@ void WidgetParser::Accept(const XmlAttribute& attribute)
m_defaultlocale = attribute.value;
NormalizeString(m_defaultlocale);
if (!LanguageSubtagRstTreeSingleton::Instance().ValidateLanguageTag(
- DPL::ToUTF8String(*m_defaultlocale))) {
+ DPL::ToUTF8String(*m_defaultlocale)))
+ {
LogWarning("Language tag: " <<
m_defaultlocale << " is not valid");
m_defaultlocale = DPL::OptionalString::Null;
- }
- else
+ } else {
LogDebug("Default Locale Found " << m_defaultlocale);
+ }
} else {
LogWarning("Ignoring subsequent default locale");
}
- //Any other value consider as a namespace definition
+ //Any other value consider as a namespace definition
} else if (attribute.name == L"xmlns" || attribute.prefix == L"xmlns") {
LogInfo("Namespace domain: " << attribute.name);
LogInfo("Namespace value: " << attribute.value);
m_nameSpaces[attribute.name] = attribute.value;
} else {
LogError("Unknown attirbute: namespace=" << attribute.ns <<
- ", name=" << attribute.name <<
- ", value=" << attribute.value);
+ ", name=" << attribute.name <<
+ ", value=" << attribute.value);
}
}
@@ -2458,7 +2430,8 @@ void WidgetParser::Verify()
FOREACH(mode, m_windowModes) {
if (L"windowed" == *mode || L"floating" == *mode ||
L"fullscreen" == *mode || L"maximized" == *mode ||
- L"minimized" == *mode) {
+ L"minimized" == *mode)
+ {
m_data.windowModes.insert(*mode);
}
}
diff --git a/src/configuration_parser/widget_parser.h b/src/configuration_parser/widget_parser.h
old mode 100755
new mode 100644
index 4ee0c14..af39afd
--- a/src/configuration_parser/widget_parser.h
+++ b/src/configuration_parser/widget_parser.h
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
- /**
+/**
* This file have been implemented in compliance with W3C WARP SPEC.
* but there are some patent issue between W3C WARP SPEC and APPLE.
* so if you want to use this file, refer to the README file in root directory
@@ -86,7 +86,7 @@ class WidgetParser : public ElementParser
ElementParserPtr OnCspElement();
virtual ActionFunc GetElementParser(const DPL::String& ns,
- const DPL::String& name);
+ const DPL::String& name);
virtual void Accept(const Element&);
virtual void Accept(const Text&);
diff --git a/src/jobs/job.cpp b/src/jobs/job.cpp
index 64903b2..a94bc63 100644
--- a/src/jobs/job.cpp
+++ b/src/jobs/job.cpp
@@ -21,8 +21,7 @@ Job::Job(InstallationType installType) :
m_installationType(installType),
m_UndoType(false),
m_paused(false)
-{
-}
+{}
InstallationType Job::GetInstallationType() const
{
@@ -88,18 +87,14 @@ JobHandle Job::GetJobHandle() const
}
void Job::SendProgress()
-{
-}
+{}
void Job::SendFinishedSuccess()
-{
-}
+{}
void Job::SendFinishedFailure()
-{
-}
+{}
void Job::SaveExceptionData(const Jobs::JobExceptionBase&)
-{
-}
+{}
} //namespace Jobs
diff --git a/src/jobs/job.h b/src/jobs/job.h
index 877a966..c8d35ab 100644
--- a/src/jobs/job.h
+++ b/src/jobs/job.h
@@ -56,6 +56,7 @@ class Job :
virtual void SendFinishedFailure();
virtual void SaveExceptionData(const Jobs::JobExceptionBase&);
+
private:
JobHandle m_handle;
InstallationType m_installationType;
diff --git a/src/jobs/job_base.h b/src/jobs/job_base.h
index 86e1746..c2ed1d8 100644
--- a/src/jobs/job_base.h
+++ b/src/jobs/job_base.h
@@ -34,8 +34,7 @@ class JobProgressBase
public:
JobProgressBase() : m_progressFlag(false),
m_progresPercent(0.0)
- {
- }
+ {}
void SetProgressFlag(bool flag)
{
@@ -57,7 +56,7 @@ class JobProgressBase
}
void UpdateProgress(T_InstallationStep step,
- ProgressDescription const &description)
+ ProgressDescription const &description)
{
m_progresPercent =
((static_cast(step) + 1.0) /
@@ -72,13 +71,13 @@ class JobContextBase
public:
JobContextBase(const T_JobStruct& jobStruct) :
m_jobStruct(jobStruct)
- {
- }
+ {}
T_JobStruct getInstallerStruct() const
{
return m_jobStruct;
- } //TODO RENAME
+ } //TODO
+ // RENAME
protected:
T_JobStruct m_jobStruct;
@@ -96,17 +95,15 @@ struct JobCallbacksBase
finishedCallback(0),
progressCallback(0),
userParam(0)
- {
- }
+ {}
JobCallbacksBase(T_finishedCb finished,
- T_progressCb progress,
- void *param) :
+ T_progressCb progress,
+ void *param) :
finishedCallback(finished),
progressCallback(progress),
userParam(param)
- {
- }
+ {}
};
} //namespace Jobs
diff --git a/src/jobs/job_exception_base.h b/src/jobs/job_exception_base.h
index 3f12a2d..9612bc2 100644
--- a/src/jobs/job_exception_base.h
+++ b/src/jobs/job_exception_base.h
@@ -33,24 +33,24 @@
const char *function, \
int line, \
const std::string & message = std::string()) : \
- Base(path, function, line, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Base(path, function, line, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- Class(const char *path, \
- const char *function, \
- int line, \
- const Exception &reason, \
- const std::string & message = std::string()) : \
- Base(path, function, line, reason, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Class(const char *path, \
+ const char *function, \
+ int line, \
+ const Exception &reason, \
+ const std::string & message = std::string()) : \
+ Base(path, function, line, reason, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- virtual int getParam() const \
+ virtual int getParam() const \
{ \
return m_param; \
} \
@@ -67,24 +67,24 @@
const char *function, \
int line, \
const std::string & message = std::string()) : \
- Base(path, function, line, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Base(path, function, line, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- Class(const char *path, \
- const char *function, \
- int line, \
- const Exception &reason, \
- const std::string & message = std::string()) : \
- Base(path, function, line, reason, message) \
- { \
- m_className = # Class; \
- m_param = Param; \
- } \
+ Class(const char *path, \
+ const char *function, \
+ int line, \
+ const Exception &reason, \
+ const std::string & message = std::string()) : \
+ Base(path, function, line, reason, message) \
+ { \
+ m_className = #Class; \
+ m_param = Param; \
+ } \
\
- virtual int getParam() const \
+ virtual int getParam() const \
{ \
return m_param; \
} \
diff --git a/src/jobs/plugin_install/job_plugin_install.cpp b/src/jobs/plugin_install/job_plugin_install.cpp
index 8bf52ff..ac1642f 100644
--- a/src/jobs/plugin_install/job_plugin_install.cpp
+++ b/src/jobs/plugin_install/job_plugin_install.cpp
@@ -29,7 +29,8 @@
namespace Jobs {
namespace PluginInstall {
JobPluginInstall::JobPluginInstall(std::string const &pluginPath,
- const PluginInstallerStruct &installerStruct) :
+ const PluginInstallerStruct &installerStruct)
+ :
Job(PluginInstallation),
JobContextBase(installerStruct)
{
@@ -52,7 +53,8 @@ void JobPluginInstall::SendProgress()
if (GetProgressFlag() && getInstallerStruct().progressCallback != NULL) {
LogDebug("Call Plugin install progressCallback");
getInstallerStruct().progressCallback(getInstallerStruct().userParam,
- GetProgressPercent(), GetProgressDescription());
+ GetProgressPercent(),
+ GetProgressDescription());
}
}
@@ -65,11 +67,11 @@ void JobPluginInstall::SendFinishedSuccess()
{
LogDebug("Call Plugin install success finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- Exceptions::Success);
+ Exceptions::Success);
} else {
LogDebug("Call Plugin install waiting finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- Exceptions::InstallationWaiting);
+ Exceptions::InstallationWaiting);
LogInfo("Installation: " << getFilePath() <<
" NOT possible");
@@ -83,7 +85,7 @@ void JobPluginInstall::SendFinishedFailure()
LogDebug("Call Plugin install failure finishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- m_exceptionCaught);
+ m_exceptionCaught);
}
void JobPluginInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
diff --git a/src/jobs/plugin_install/job_plugin_install.h b/src/jobs/plugin_install/job_plugin_install.h
index a7fde44..46af82a 100644
--- a/src/jobs/plugin_install/job_plugin_install.h
+++ b/src/jobs/plugin_install/job_plugin_install.h
@@ -48,7 +48,7 @@ class JobPluginInstall :
* @brief Automaticaly sets installation process
*/
JobPluginInstall(std::string const &pluginPath,
- const PluginInstallerStruct &installerStruct);
+ const PluginInstallerStruct &installerStruct);
WrtDB::DbPluginHandle getNewPluginHandle() const
{
@@ -67,6 +67,7 @@ class JobPluginInstall :
void SendFinishedSuccess();
void SendFinishedFailure();
void SaveExceptionData(const Jobs::JobExceptionBase &e);
+
private:
//TODO move somewhere this attribute
//(as it is in all Jobs...)
diff --git a/src/jobs/plugin_install/plugin_install_task.cpp b/src/jobs/plugin_install/plugin_install_task.cpp
index 57d3c0c..b4c30c3 100644
--- a/src/jobs/plugin_install/plugin_install_task.cpp
+++ b/src/jobs/plugin_install/plugin_install_task.cpp
@@ -53,7 +53,7 @@ const std::string DIRECTORY_SEPARATOR = std::string("/");
PluginInstallerContext::step, desc);
#define DISABLE_IF_PLUGIN_WITHOUT_LIB() \
- if(m_pluginInfo.m_libraryName.empty()) \
+ if (m_pluginInfo.m_libraryName.empty()) \
{ \
LogWarning("Plugin without library."); \
return; \
@@ -61,7 +61,6 @@ const std::string DIRECTORY_SEPARATOR = std::string("/");
namespace Jobs {
namespace PluginInstall {
-
PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) :
DPL::TaskDecl(this),
m_context(inCont),
@@ -81,8 +80,7 @@ PluginInstallTask::PluginInstallTask(PluginInstallerContext *inCont) :
}
PluginInstallTask::~PluginInstallTask()
-{
-}
+{}
void PluginInstallTask::stepCheckPluginPath()
{
@@ -128,7 +126,7 @@ void PluginInstallTask::stepParseConfigFile()
FOREACH(it, m_pluginInfo.m_featureContainer)
{
LogDebug("Parsed feature : " << it->m_name);
- FOREACH (devCap, it->m_deviceCapabilities) {
+ FOREACH(devCap, it->m_deviceCapabilities) {
LogDebug(" | DevCap : " << *devCap);
}
}
@@ -145,25 +143,22 @@ void PluginInstallTask::stepParseConfigFile()
void PluginInstallTask::stepFindPluginLibrary()
{
- if (m_dataFromConfigXML)
- {
+ if (m_dataFromConfigXML) {
return;
}
LogDebug("Plugin installation: step find plugin library");
std::string pluginPath = m_context->pluginFilePath;
size_t indexpos = pluginPath.find_last_of('/');
- if (std::string::npos == indexpos)
- {
+ if (std::string::npos == indexpos) {
indexpos = 0;
- }
- else
- {
+ } else {
indexpos += 1; // move after '/'
}
std::string libName = pluginPath.substr(indexpos);
- libName = GlobalConfig::GetPluginPrefix() + libName + GlobalConfig::GetPluginSuffix();
+ libName = GlobalConfig::GetPluginPrefix() + libName +
+ GlobalConfig::GetPluginSuffix();
LogDebug("Plugin .so: " << libName);
m_pluginInfo.m_libraryName = libName;
}
@@ -190,10 +185,10 @@ void PluginInstallTask::stepLoadPluginLibrary()
LogDebug("Loading plugin: " << filename);
void *dlHandle = dlopen(filename.c_str(), RTLD_NOW);
- if (dlHandle == NULL ) {
+ if (dlHandle == NULL) {
LogError(
- "Failed to load plugin: " << filename <<
- ". Reason: " << dlerror());
+ "Failed to load plugin: " << filename <<
+ ". Reason: " << dlerror());
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
@@ -202,14 +197,14 @@ void PluginInstallTask::stepLoadPluginLibrary()
getWidgetEntityMapProcPtr =
reinterpret_cast(dlsym(dlHandle,
- PLUGIN_GET_CLASS_MAP_PROC_NAME));
+ PLUGIN_GET_CLASS_MAP_PROC_NAME));
if (getWidgetEntityMapProcPtr) {
rawEntityList = (*getWidgetEntityMapProcPtr)();
} else {
rawEntityList =
static_cast(dlsym(dlHandle,
- PLUGIN_CLASS_MAP_NAME));
+ PLUGIN_CLASS_MAP_NAME));
}
if (rawEntityList == NULL) {
@@ -218,14 +213,12 @@ void PluginInstallTask::stepLoadPluginLibrary()
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
}
- if (!m_dataFromConfigXML)
- {
+ if (!m_dataFromConfigXML) {
on_widget_init_proc *onWidgetInitProc =
reinterpret_cast(
dlsym(dlHandle, PLUGIN_WIDGET_INIT_PROC_NAME));
- if (NULL == onWidgetInitProc)
- {
+ if (NULL == onWidgetInitProc) {
dlclose(dlHandle);
LogError("Failed to read onWidgetInit symbol" << filename);
ThrowMsg(Exceptions::PluginLibraryError, "Library error");
@@ -246,25 +239,24 @@ void PluginInstallTask::stepLoadPluginLibrary()
LogDebug("Getting mapping from features to device capabilities");
- for (size_t i = 0; i < devcapMapping->featuresCount; ++i)
- {
+ for (size_t i = 0; i < devcapMapping->featuresCount; ++i) {
PluginMetafileData::Feature feature;
feature.m_name = devcapMapping->features[i].feature_name;
LogDebug("Feature: " << feature.m_name);
const devcaps_t* dc =
- mappingInterface.dcGetter(devcapMapping,
- devcapMapping->features[i].feature_name);
+ mappingInterface.dcGetter(
+ devcapMapping,
+ devcapMapping->features[i].
+ feature_name);
LogDebug("device=cap: " << dc);
- if (dc)
- {
+ if (dc) {
LogDebug("devcaps count: " << dc->devCapsCount);
- for (size_t j = 0; j < dc->devCapsCount; ++j)
- {
+ for (size_t j = 0; j < dc->devCapsCount; ++j) {
LogDebug("devcap: " << dc->deviceCaps[j]);
feature.m_deviceCapabilities.insert(dc->deviceCaps[j]);
}
@@ -284,14 +276,14 @@ void PluginInstallTask::stepLoadPluginLibrary()
LogInfo("#####");
while (rawEntityListIterator->parent_name != NULL &&
- rawEntityListIterator->object_name != NULL)
+ rawEntityListIterator->object_name != NULL)
{
LogInfo("##### [" << rawEntityListIterator->object_name << "]: ");
LogInfo("##### Parent: " << rawEntityListIterator->parent_name);
LogInfo("#####");
m_libraryObjects->addObjects(rawEntityListIterator->parent_name,
- rawEntityListIterator->object_name);
+ rawEntityListIterator->object_name);
++rawEntityListIterator;
}
@@ -367,10 +359,11 @@ void PluginInstallTask::stepResolvePluginDependencies()
LogInfo("Plugin installation: step resolve dependencies ");
//DISABLE_IF_PLUGIN_WITHOUT_LIB
- if(m_pluginInfo.m_libraryName.empty())
- {
- PluginDAO::setPluginInstallationStatus(m_pluginHandle,
- PluginDAO::INSTALLATION_COMPLETED);
+ if (m_pluginInfo.m_libraryName.empty()) {
+ PluginDAO::setPluginInstallationStatus(
+ m_pluginHandle,
+ PluginDAO::
+ INSTALLATION_COMPLETED);
//Installation completed
m_context->pluginHandle = m_pluginHandle;
m_context->installationCompleted = true;
diff --git a/src/jobs/plugin_install/plugin_installer_errors.h b/src/jobs/plugin_install/plugin_installer_errors.h
index 35f0353..73132f0 100644
--- a/src/jobs/plugin_install/plugin_installer_errors.h
+++ b/src/jobs/plugin_install/plugin_installer_errors.h
@@ -55,5 +55,6 @@ DECLARE_JOB_EXCEPTION(Base, UnknownError, Unknown)
} //namespace
} //namespace
-#endif /* WRT_SRC_INSTALLER_CORE_PLUGIN_INSTALLER_TASKS_PLUGIN_INSTALLER_ERRORS_H_ */
+#endif
+//WRT_SRC_INSTALLER_CORE_PLUGIN_INSTALLER_TASKS_PLUGIN_INSTALLER_ERRORS_H_
diff --git a/src/jobs/plugin_install/plugin_metafile_reader.cpp b/src/jobs/plugin_install/plugin_metafile_reader.cpp
index ac500e8..b65c2e3 100644
--- a/src/jobs/plugin_install/plugin_metafile_reader.cpp
+++ b/src/jobs/plugin_install/plugin_metafile_reader.cpp
@@ -57,8 +57,7 @@ PluginMetafileReader::PluginMetafileReader() : m_parserSchema(this)
}
void PluginMetafileReader::blankFunction(PluginMetafileData & /* data */)
-{
-}
+{}
void PluginMetafileReader::tokenEndLibraryName(PluginMetafileData &data)
{
diff --git a/src/jobs/plugin_install/plugin_objects.cpp b/src/jobs/plugin_install/plugin_objects.cpp
index 71e9131..2747f8b 100644
--- a/src/jobs/plugin_install/plugin_objects.cpp
+++ b/src/jobs/plugin_install/plugin_objects.cpp
@@ -35,7 +35,8 @@ std::string normalizeName(const std::string& objectName)
}
if (!objectName.compare(0, GLOBAL_OBJECT_NAME.size(),
- GLOBAL_OBJECT_NAME)) {
+ GLOBAL_OBJECT_NAME))
+ {
return objectName;
}
@@ -44,7 +45,7 @@ std::string normalizeName(const std::string& objectName)
}
std::string normalizeName(const std::string& objectName,
- const std::string& parentName)
+ const std::string& parentName)
{
if (objectName.empty() || parentName.empty()) {
LogError("Normalize name, name size or parent name size is 0");
@@ -76,7 +77,7 @@ PluginObjects::ObjectsPtr PluginObjects::getDependentObjects() const
}
void PluginObjects::addObjects(const std::string& parentName,
- const std::string& name)
+ const std::string& name)
{
addImplementedObject(normalizeName(name, parentName));
addDependentObject(normalizeName(parentName));
diff --git a/src/jobs/plugin_install/plugin_objects.h b/src/jobs/plugin_install/plugin_objects.h
index 4a8ab14..0b27a14 100644
--- a/src/jobs/plugin_install/plugin_objects.h
+++ b/src/jobs/plugin_install/plugin_objects.h
@@ -43,7 +43,7 @@ class PluginObjects : public WrtDB::PluginObjectsDAO
//add object declaration
void addObjects(const std::string& parentName,
- const std::string& name);
+ const std::string& name);
//check if library implemements object given as name
bool hasObject(const std::string& name) const;
diff --git a/src/jobs/widget_install/ace_registration.cpp b/src/jobs/widget_install/ace_registration.cpp
index 00165f1..faee3ea 100644
--- a/src/jobs/widget_install/ace_registration.cpp
+++ b/src/jobs/widget_install/ace_registration.cpp
@@ -26,46 +26,44 @@
#include
namespace {
-
char* toAceString(const DPL::OptionalString& os)
{
- if (!os.IsNull())
+ if (!os.IsNull()) {
return strdup(DPL::ToUTF8String(*os).c_str());
- else
+ } else {
return NULL;
+ }
}
char* toAceString(const std::string& str)
{
- if (!str.empty())
+ if (!str.empty()) {
return strdup(str.c_str());
- else
+ } else {
return NULL;
+ }
}
-
} //anonymous namespace
namespace AceApi {
-
bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
- const WrtDB::WidgetRegisterInfo& widgetConfig,
- const WrtDB::WidgetCertificateDataList& certList)
+ const WrtDB::WidgetRegisterInfo& widgetConfig,
+ const WrtDB::WidgetCertificateDataList& certList)
{
LogDebug("Updating Ace database");
struct widget_info wi;
DPL::OptionalString os;
- switch(widgetConfig.webAppType.appType)
- {
- case WrtDB::APP_TYPE_WAC20:
- wi.type = WAC20;
- break;
- case WrtDB::APP_TYPE_TIZENWEBAPP:
- wi.type = Tizen;
- break;
- default:
- LogError("Unknown application type");
- return false;
+ switch (widgetConfig.webAppType.appType) {
+ case WrtDB::APP_TYPE_WAC20:
+ wi.type = WAC20;
+ break;
+ case WrtDB::APP_TYPE_TIZENWEBAPP:
+ wi.type = Tizen;
+ break;
+ default:
+ LogError("Unknown application type");
+ return false;
}
wi.id = toAceString(widgetConfig.configInfo.widget_id);
@@ -76,7 +74,8 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
//one more element for NULL termination
LogDebug("Found: " << certList.size() << " certificates");
- ace_certificate_data** certData = new ace_certificate_data*[certList.size() + 1];
+ ace_certificate_data** certData = new ace_certificate_data *
+ [certList.size() + 1];
certData[certList.size()] = NULL; // last element set to NULL
int i = 0;
@@ -84,39 +83,40 @@ bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
{
certData[i] = new ace_certificate_data;
switch (it->owner) {
- case WrtDB::WidgetCertificateData::AUTHOR :
+ case WrtDB::WidgetCertificateData::AUTHOR:
certData[i]->owner = AUTHOR;
break;
- case WrtDB::WidgetCertificateData::DISTRIBUTOR :
+ case WrtDB::WidgetCertificateData::DISTRIBUTOR:
certData[i]->owner = DISTRIBUTOR;
break;
- default :
+ default:
LogDebug("Unknown owner type of cert");
certData[i]->owner = UNKNOWN;
}
switch (it->type) {
- case WrtDB::WidgetCertificateData::ENDENTITY :
- certData[i]->type = ENDENTITY;
- break;
- case WrtDB::WidgetCertificateData::ROOT :
- certData[i]->type = ROOT;
- break;
- default :
- LogError("Unknown type of cert");
- certData[i]->type = ENDENTITY;
+ case WrtDB::WidgetCertificateData::ENDENTITY:
+ certData[i]->type = ENDENTITY;
+ break;
+ case WrtDB::WidgetCertificateData::ROOT:
+ certData[i]->type = ROOT;
+ break;
+ default:
+ LogError("Unknown type of cert");
+ certData[i]->type = ENDENTITY;
}
certData[i]->chain_id = it->chainId;
certData[i]->md5_fp = toAceString(it->strMD5Fingerprint);
certData[i]->sha1_fp = toAceString(it->strSHA1Fingerprint);
- certData[i]->common_name = toAceString(DPL::ToUTF8String(it->strCommonName));
+ certData[i]->common_name =
+ toAceString(DPL::ToUTF8String(it->strCommonName));
++i;
}
LogDebug("Registerign widget in ace");
ace_return_t retval = ACE_ACE_UNKNOWN_ERROR;
retval = ace_register_widget(
- static_cast(widgetHandle), &wi, certData);
+ static_cast(widgetHandle), &wi, certData);
//clean up - WidgetInfo
free(wi.author);
diff --git a/src/jobs/widget_install/ace_registration.h b/src/jobs/widget_install/ace_registration.h
index 2f4a3b0..a9e0577 100644
--- a/src/jobs/widget_install/ace_registration.h
+++ b/src/jobs/widget_install/ace_registration.h
@@ -25,12 +25,10 @@
#include
namespace AceApi {
-
bool registerAceWidget(const WrtDB::DbWidgetHandle& widgetHandle,
const WrtDB::WidgetRegisterInfo& widgetConfig,
const WrtDB::WidgetCertificateDataList& certList);
-
}
-#endif /* WRT_SRC_INSTALLER_CORE_ACE_REGISTRATION_H_ */
+#endif /* WRT_SRC_INSTALLER_CORE_ACE_REGISTRATION_H_ */
diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp
index 4303a56..1337293 100644
--- a/src/jobs/widget_install/job_widget_install.cpp
+++ b/src/jobs/widget_install/job_widget_install.cpp
@@ -125,19 +125,21 @@ class InstallerTaskFail :
const std::string XML_EXTENSION = ".xml";
-bool hasExtension(const std::string& filename, const std::string& extension) {
- LogDebug("Looking for extension " << extension << " in: " << filename);
+bool hasExtension(const std::string& filename, const std::string& extension)
+{
+ LogDebug("Looking for extension " << extension << " in: " << filename);
size_t fileLen = filename.length();
size_t extLen = extension.length();
if (fileLen < extLen) {
LogError("Filename " << filename << " is shorter than extension "
- << extension);
+ << extension);
return false;
}
- return (0 == filename.compare(fileLen-extLen, extLen, extension));
+ return (0 == filename.compare(fileLen - extLen, extLen, extension));
}
-bool checkTizenPkgIdExist(const std::string& tizenPkgId) {
+bool checkTizenPkgIdExist(const std::string& tizenPkgId)
+{
std::string installPath =
std::string(GlobalConfig::GetUserInstalledWidgetPath()) +
"/" + tizenPkgId;
@@ -147,7 +149,8 @@ bool checkTizenPkgIdExist(const std::string& tizenPkgId) {
struct stat dirStat;
if ((stat(installPath.c_str(), &dirStat) == 0) &&
- (stat(preinstallPath.c_str(), &dirStat) == 0)) {
+ (stat(preinstallPath.c_str(), &dirStat) == 0))
+ {
return true;
}
return false;
@@ -156,8 +159,10 @@ bool checkTizenPkgIdExist(const std::string& tizenPkgId) {
namespace Jobs {
namespace WidgetInstall {
-JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
- const WidgetInstallationStruct &installerStruct) :
+JobWidgetInstall::JobWidgetInstall(
+ std::string const &widgetPath,
+ const WidgetInstallationStruct &
+ installerStruct) :
Job(Installation),
JobContextBase(installerStruct),
m_exceptionCaught(Exceptions::Success)
@@ -178,17 +183,17 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
// Create installation tasks
if (m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
+ WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
!m_isDRM)
{
AddTask(new TaskUnzip(m_installerContext));
}
AddTask(new TaskWidgetConfig(m_installerContext));
- if (m_installerContext.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ if (m_installerContext.widgetConfig.packagingType ==
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
{
AddTask(new TaskPrepareFiles(m_installerContext));
}
@@ -208,7 +213,8 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
AddTask(new TaskManifestFile(m_installerContext));
AddTask(new TaskCertificates(m_installerContext));
if (m_installerContext.widgetConfig.packagingType ==
- PKG_TYPE_HYBRID_WEB_APP) {
+ PKG_TYPE_HYBRID_WEB_APP)
+ {
AddTask(new TaskInstallOspsvc(m_installerContext));
}
AddTask(new TaskPluginsCopy(m_installerContext));
@@ -219,9 +225,9 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
LogInfo("Widget Update");
m_installerContext.job->SetProgressFlag(true);
if (m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP &&
m_installerContext.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
+ WrtDB::PKG_TYPE_DIRECTORY_WEB_APP &&
!m_isDRM)
{
AddTask(new TaskUnzip(m_installerContext));
@@ -230,7 +236,7 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
AddTask(new TaskWidgetConfig(m_installerContext));
if (m_installerContext.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
{
AddTask(new TaskPrepareFiles(m_installerContext));
}
@@ -247,7 +253,8 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
AddTask(new TaskManifestFile(m_installerContext));
if (m_installerContext.widgetConfig.packagingType ==
- PKG_TYPE_HYBRID_WEB_APP) {
+ PKG_TYPE_HYBRID_WEB_APP)
+ {
AddTask(new TaskInstallOspsvc(m_installerContext));
}
if (m_installerContext.widgetConfig.packagingType !=
@@ -261,7 +268,6 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
//TODO: remove widgetHandle from this task and move before database task
// by now widget handle is needed in ace check
// Any error in acecheck while update will break widget
-
} else if (result == ConfigureResult::Deferred) {
// Installation is deferred
LogInfo("Configure installation deferred");
@@ -278,7 +284,7 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
}
JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
- const std::string &widgetPath)
+ const std::string &widgetPath)
{
ConfigureResult result;
m_needEncryption = false;
@@ -291,7 +297,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
m_isDRM = isDRMWidget(widgetPath);
if (true == m_isDRM) {
LogDebug("decrypt DRM widget");
- if(DecryptDRMWidget(widgetPath, tempDir)) {
+ if (DecryptDRMWidget(widgetPath, tempDir)) {
LogDebug("Failed decrypt DRM widget");
return ConfigureResult::Failed;
}
@@ -302,12 +308,12 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
m_installerContext.widgetConfig.packagingType =
checkPackageType(widgetPath, tempDir);
ConfigParserData configData = getWidgetDataFromXML(
- widgetPath,
- tempDir,
- m_installerContext.widgetConfig.packagingType,
- m_isDRM);
+ widgetPath,
+ tempDir,
+ m_installerContext.widgetConfig.packagingType,
+ m_isDRM);
LogDebug("widget packaging type : " <<
- m_installerContext.widgetConfig.packagingType.pkgType);
+ m_installerContext.widgetConfig.packagingType.pkgType);
setTizenId(configData);
setApplicationType(configData);
@@ -327,24 +333,24 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::PrePareInstallation(
}
void JobWidgetInstall::setTizenId(
- const WrtDB::ConfigParserData &configInfo)
+ const WrtDB::ConfigParserData &configInfo)
{
bool shouldMakeAppid = false;
using namespace PackageManager;
- if(!!configInfo.tizenAppId) {
+ if (!!configInfo.tizenAppId) {
LogDebug("Setting tizenAppId provided in config.xml: " <<
- configInfo.tizenAppId);
+ configInfo.tizenAppId);
m_installerContext.widgetConfig.tzAppid = *configInfo.tizenAppId;
//check package id.
- if(!!configInfo.tizenPkgId) {
+ if (!!configInfo.tizenPkgId) {
LogDebug("Setting tizenPkgId provided in config.xml: " <<
- configInfo.tizenPkgId);
+ configInfo.tizenPkgId);
m_installerContext.widgetConfig.tzPkgid = *configInfo.tizenPkgId;
} else {
DPL::String appid = *configInfo.tizenAppId;
- if(appid.length() > PACKAGE_ID_LENGTH) {
+ if (appid.length() > PACKAGE_ID_LENGTH) {
m_installerContext.widgetConfig.tzPkgid =
appid.substr(0, PACKAGE_ID_LENGTH);
} else {
@@ -370,10 +376,9 @@ void JobWidgetInstall::setTizenId(
m_installerContext.widgetConfig.tzPkgid = pkgId;
LogInfo("tizen_id name was generated by WRT: " <<
m_installerContext.widgetConfig.tzPkgid);
-
}
- if(shouldMakeAppid == true) {
+ if (shouldMakeAppid == true) {
DPL::OptionalString name;
DPL::OptionalString defaultLocale = configInfo.defaultlocale;
@@ -385,27 +390,27 @@ void JobWidgetInstall::setTizenId(
name = localizedData->second.name;
break;
}
-
} else {
name = localizedData->second.name;
break;
}
}
regex_t regx;
- if(regcomp(®x, REG_NAME_PATTERN, REG_NOSUB | REG_EXTENDED)!=0){
+ if (regcomp(®x, REG_NAME_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
LogDebug("Regcomp failed");
}
LogDebug("Name : " << name);
if (!name || (regexec(®x, DPL::ToUTF8String(*name).c_str(),
- static_cast(0), NULL, 0) != REG_NOERROR)) {
+ static_cast(0), NULL, 0) != REG_NOERROR))
+ {
// TODO : generate name move to wrt-commons
std::string allowedString("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
std::ostringstream genName;
genName << "_" << allowedString[rand() % allowedString.length()];
name = DPL::FromUTF8String(genName.str());
- LogDebug("name was generated by WRT" );
+ LogDebug("name was generated by WRT");
}
regfree(®x);
LogDebug("Name : " << name);
@@ -420,10 +425,12 @@ void JobWidgetInstall::setTizenId(
// send start signal of pkgmgr
getInstallerStruct().pkgmgrInterface->setPkgname(DPL::ToUTF8String(
- m_installerContext.widgetConfig.tzAppid));
+ m_installerContext.
+ widgetConfig.
+ tzAppid));
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_START_KEY,
- PKGMGR_START_INSTALL);
+ PKGMGR_START_KEY,
+ PKGMGR_START_INSTALL);
LogInfo("Tizen App Id : " << m_installerContext.widgetConfig.tzAppid);
LogInfo("Tizen Pkg Id : " << m_installerContext.widgetConfig.tzPkgid);
@@ -434,41 +441,48 @@ void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath,
const std::string& tempPath)
{
m_installerContext.locations =
- WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.tzPkgid),
- widgetPath, tempPath,
- m_installerContext.widgetConfig.packagingType,
- m_installerContext.locationType);
+ WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.
+ tzPkgid),
+ widgetPath, tempPath,
+ m_installerContext.widgetConfig.packagingType,
+ m_installerContext.locationType);
m_installerContext.locations->registerAppid(
- DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
+ DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid));
LogInfo("widgetSource " << widgetPath);
}
JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
- const std::string &widgetSource,
- const WrtDB::ConfigParserData &configData,
- const std::string &tempPath)
+ const std::string &widgetSource,
+ const WrtDB::ConfigParserData &configData,
+ const std::string &tempPath)
{
- WidgetUpdateInfo update = detectWidgetUpdate(configData,
- m_installerContext.widgetConfig.webAppType,
- m_installerContext.widgetConfig.tzAppid);
+ WidgetUpdateInfo update = detectWidgetUpdate(
+ configData,
+ m_installerContext.
+ widgetConfig.webAppType,
+ m_installerContext.
+ widgetConfig.tzAppid);
ConfigureResult result = checkWidgetUpdate(update);
// Validate tizenId
regex_t reg;
- if(regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED)!=0){
+ if (regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED) != 0) {
LogDebug("Regcomp failed");
}
if ((regexec(®,
- DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).c_str(),
- static_cast(0), NULL, 0) != REG_NOERROR) ||
- (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig.tzPkgid)) &&
- result != ConfigureResult::Updated))
+ DPL::ToUTF8String(m_installerContext.widgetConfig.tzAppid).
+ c_str(),
+ static_cast(0), NULL, 0) != REG_NOERROR) ||
+ (checkTizenPkgIdExist(DPL::ToUTF8String(m_installerContext.widgetConfig
+ .tzPkgid)) &&
+ result != ConfigureResult::Updated))
{
//it is true when tizenId does not fit REG_TIZENID_PATTERN
LogError("tizen_id provided but not proper or pkgId directory exists");
- //TODO(t.iwanek): appId is unique, what about installation of abcdefghij.test1 and abcdefghij.test2?
+ //TODO(t.iwanek): appId is unique, what about installation of
+ // abcdefghij.test1 and abcdefghij.test2?
regfree(®);
return ConfigureResult::Failed;
}
@@ -486,7 +500,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
}
JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
- const WidgetUpdateInfo &update)
+ const WidgetUpdateInfo &update)
{
LogInfo(
"Widget install/update: incoming guid = '" <<
@@ -512,7 +526,8 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
// Check running state
int retval = APP_MANAGER_ERROR_NONE;
bool isRunning = false;
- retval = app_manager_is_running(DPL::ToUTF8String(tzAppid).c_str(), &isRunning);
+ retval = app_manager_is_running(DPL::ToUTF8String(
+ tzAppid).c_str(), &isRunning);
if (APP_MANAGER_ERROR_NONE != retval) {
LogError("Fail to get running state");
return ConfigureResult::Failed;
@@ -543,20 +558,20 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::checkWidgetUpdate(
// Calc proceed flag
if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0 ||
m_jobStruct.updateMode ==
- WidgetUpdateMode::PolicyDirectoryForceInstall)
+ WidgetUpdateMode::PolicyDirectoryForceInstall)
{
LogInfo("Whether widget policy allow proceed ok");
return ConfigureResult::Updated;
- }
- else
+ } else {
return ConfigureResult::Failed;
+ }
}
return ConfigureResult::Ok;
}
WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
- const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const
+ const OptionalWidgetVersion &existingVersion,
+ const OptionalWidgetVersion &incomingVersion) const
{
// Widget is installed, check versions
if (!existingVersion && !incomingVersion) {
@@ -588,10 +603,10 @@ WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
}
ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
- const std::string &widgetSource,
- const std::string &tempPath,
- WrtDB::PackagingType pkgType,
- bool isDRM)
+ const std::string &widgetSource,
+ const std::string &tempPath,
+ WrtDB::PackagingType pkgType,
+ bool isDRM)
{
// Parse config
ParserRunner parser;
@@ -601,20 +616,20 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
{
if (pkgType == PKG_TYPE_HOSTED_WEB_APP) {
parser.Parse(widgetSource,
- ElementParserPtr(
- new RootParser(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ ElementParserPtr(
+ new RootParser(configInfo,
+ DPL::FromUTF32String(
+ L"widget"))));
} else if (pkgType == PKG_TYPE_DIRECTORY_WEB_APP) {
parser.Parse(widgetSource + '/' + WITH_OSP_XML,
ElementParserPtr(
new RootParser(
- configInfo,
- DPL::FromUTF32String(L"widget"))));
+ configInfo,
+ DPL::FromUTF32String(L"widget"))));
} else {
if (!isDRM) {
std::unique_ptr zipFile(
- new DPL::ZipInput(widgetSource));
+ new DPL::ZipInput(widgetSource));
std::unique_ptr configFile;
@@ -631,10 +646,11 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
DPL::Copy(&inputAdapter, &outputAdapter);
parser.Parse(&buffer,
- ElementParserPtr(
- new RootParser(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ ElementParserPtr(
+ new RootParser(configInfo,
+ DPL::
+ FromUTF32String(
+ L"widget"))));
} else {
// DRM widget
std::string configFile;
@@ -645,10 +661,11 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
}
parser.Parse(configFile,
- ElementParserPtr(
- new RootParser(configInfo,
- DPL::FromUTF32String(
- L"widget"))));
+ ElementParserPtr(
+ new RootParser(configInfo,
+ DPL::
+ FromUTF32String(
+ L"widget"))));
}
}
}
@@ -686,9 +703,9 @@ ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
}
WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
- const ConfigParserData &configInfo,
- const WrtDB::WidgetType appType,
- const WrtDB::TizenAppId &tizenId)
+ const ConfigParserData &configInfo,
+ const WrtDB::WidgetType appType,
+ const WrtDB::TizenAppId &tizenId)
{
LogInfo("Checking up widget package for config.xml...");
@@ -719,18 +736,18 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
// Search widget handle by GUID
WidgetDAOReadOnly dao(widgetGUID);
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getTzAppId(), dao.getVersion()));
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo(
+ dao.getTzAppId(), dao.getVersion()));
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
// GUID isn't installed
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo());
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo());
}
} else {
Try
@@ -738,20 +755,19 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
// Search widget handle by appId
WidgetDAOReadOnly dao(tizenId);
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo(
- dao.getTzAppId(), dao.getVersion()));
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo(
+ dao.getTzAppId(), dao.getVersion()));
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
// GUID isn't installed
return WidgetUpdateInfo(
- widgetGUID,
- widgetVersion,
- WidgetUpdateInfo::ExistingWidgetInfo());
+ widgetGUID,
+ widgetVersion,
+ WidgetUpdateInfo::ExistingWidgetInfo());
}
-
}
}
@@ -764,12 +780,14 @@ void JobWidgetInstall::SendProgress()
std::ostringstream percent;
percent << static_cast(GetProgressPercent());
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_PROGRESS_KEY,
- percent.str());
+ PKGMGR_PROGRESS_KEY,
+ percent.str());
LogDebug("Call widget install progressCallbak");
- getInstallerStruct().progressCallback(getInstallerStruct().userParam,
- GetProgressPercent(),GetProgressDescription());
+ getInstallerStruct().progressCallback(
+ getInstallerStruct().userParam,
+ GetProgressPercent(),
+ GetProgressDescription());
}
}
}
@@ -780,7 +798,6 @@ void JobWidgetInstall::SendFinishedSuccess()
// TODO : sync should move to separate task.
sync();
-
if (INSTALL_LOCATION_TYPE_EXTERNAL == m_installerContext.locationType) {
if (false == m_installerContext.existingWidgetInfo.isExist) {
WidgetInstallToExtSingleton::Instance().postInstallation(true);
@@ -800,12 +817,13 @@ void JobWidgetInstall::SendFinishedSuccess()
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_END_KEY,
- PKGMGR_END_SUCCESS);
+ PKGMGR_END_KEY,
+ PKGMGR_END_SUCCESS);
LogDebug("Call widget install successfinishedCallback");
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- DPL::ToUTF8String(tizenId), Exceptions::Success);
+ DPL::ToUTF8String(
+ tizenId), Exceptions::Success);
}
void JobWidgetInstall::SendFinishedFailure()
@@ -822,11 +840,12 @@ void JobWidgetInstall::SendFinishedFailure()
// send signal of pkgmgr
getInstallerStruct().pkgmgrInterface->sendSignal(
- PKGMGR_END_KEY,
- PKGMGR_END_FAILURE);
+ PKGMGR_END_KEY,
+ PKGMGR_END_FAILURE);
getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
- DPL::ToUTF8String(tizenId), m_exceptionCaught);
+ DPL::ToUTF8String(
+ tizenId), m_exceptionCaught);
}
void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
@@ -844,31 +863,32 @@ void JobWidgetInstall::displayWidgetInfo()
W3CFileLocalization::getLocalizedInfo(dao.getTzAppId());
out << std::endl <<
- "===================================== INSTALLED WIDGET INFO ========="\
- "============================";
+ "===================================== INSTALLED WIDGET INFO =========" \
+ "============================";
out << std::endl << "Name: " << localizedInfo.name;
out << std::endl << "AppId: " << dao.getTzAppId();
WidgetSize size = dao.getPreferredSize();
out << std::endl << "Width: " << size.width;
out << std::endl << "Height: " << size.height;
out << std::endl << "Start File: " <<
- W3CFileLocalization::getStartFile(dao.getTzAppId());
+ W3CFileLocalization::getStartFile(dao.getTzAppId());
out << std::endl << "Version: " << dao.getVersion();
out << std::endl << "Licence: " <<
- localizedInfo.license;
+ localizedInfo.license;
out << std::endl << "Licence Href: " <<
- localizedInfo.licenseHref;
+ localizedInfo.licenseHref;
out << std::endl << "Description: " <<
- localizedInfo.description;
+ localizedInfo.description;
out << std::endl << "Widget Id: " << dao.getGUID();
out << std::endl << "Widget recognized: " << dao.isRecognized();
out << std::endl << "Widget wac signed: " << dao.isWacSigned();
out << std::endl << "Widget distributor signed: " <<
- dao.isDistributorSigned();
+ dao.isDistributorSigned();
out << std::endl << "Widget trusted: " << dao.isTrusted();
OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getTzAppId());
- DPL::OptionalString iconSrc = !!icon ? icon->src : DPL::OptionalString::Null;
+ DPL::OptionalString iconSrc =
+ !!icon ? icon->src : DPL::OptionalString::Null;
out << std::endl << "Icon: " << iconSrc;
out << std::endl << "Preferences:";
@@ -877,9 +897,9 @@ void JobWidgetInstall::displayWidgetInfo()
FOREACH(it, list)
{
out << std::endl << " Key: " <<
- it->key_name;
+ it->key_name;
out << std::endl << " Readonly: " <<
- it->readonly;
+ it->readonly;
}
}
@@ -900,11 +920,12 @@ void JobWidgetInstall::displayWidgetInfo()
}
WrtDB::PackagingType JobWidgetInstall::checkPackageType(
- const std::string &widgetSource,
- const std::string &tempPath)
+ const std::string &widgetSource,
+ const std::string &tempPath)
{
// Check installation type (direcotory/ or config.xml or widget.wgt)
- if (WidgetUpdateMode::PolicyDirectoryForceInstall == m_jobStruct.updateMode)
+ if (WidgetUpdateMode::PolicyDirectoryForceInstall ==
+ m_jobStruct.updateMode)
{
LogDebug("Install directly from directory");
return PKG_TYPE_DIRECTORY_WEB_APP;
@@ -931,7 +952,6 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
{
// Open zip file
zipFile.reset(new DPL::ZipInput(widgetSource));
-
}
Catch(DPL::ZipInput::Exception::OpenFailed)
{
@@ -948,7 +968,7 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
{
// Open config.xml file in package root
std::unique_ptr configFile(
- zipFile->OpenFile(CONFIG_XML));
+ zipFile->OpenFile(CONFIG_XML));
return PKG_TYPE_NOMAL_WEB_APP;
}
Catch(DPL::ZipInput::Exception::OpenFileFailed)
@@ -960,7 +980,7 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
{
// Open config.xml file in package root
std::unique_ptr configFile(
- zipFile->OpenFile(WITH_OSP_XML));
+ zipFile->OpenFile(WITH_OSP_XML));
return PKG_TYPE_HYBRID_WEB_APP;
}
@@ -975,9 +995,8 @@ WrtDB::PackagingType JobWidgetInstall::checkPackageType(
}
void JobWidgetInstall::setApplicationType(
- const WrtDB::ConfigParserData &configInfo)
+ const WrtDB::ConfigParserData &configInfo)
{
-
FOREACH(iterator, configInfo.nameSpaces) {
LogInfo("namespace = [" << *iterator << "]");
AppType currentAppType = APP_TYPE_UNKNOWN;
@@ -992,15 +1011,18 @@ void JobWidgetInstall::setApplicationType(
{
currentAppType = APP_TYPE_WAC20;
} else if (*iterator ==
- ConfigurationNamespace::TizenWebAppNamespaceName) {
+ ConfigurationNamespace::TizenWebAppNamespaceName)
+ {
currentAppType = APP_TYPE_TIZENWEBAPP;
}
if (m_installerContext.widgetConfig.webAppType ==
- APP_TYPE_UNKNOWN) {
+ APP_TYPE_UNKNOWN)
+ {
m_installerContext.widgetConfig.webAppType = currentAppType;
} else if (m_installerContext.widgetConfig.webAppType ==
- currentAppType) {
+ currentAppType)
+ {
continue;
} else {
ThrowMsg(Exceptions::WidgetConfigFileInvalid,
@@ -1014,15 +1036,18 @@ void JobWidgetInstall::setApplicationType(
}
LogInfo("type = [" <<
- m_installerContext.widgetConfig.webAppType.getApptypeToString() << "]");
+ m_installerContext.widgetConfig.webAppType.getApptypeToString() <<
+ "]");
}
-bool JobWidgetInstall::detectResourceEncryption(const WrtDB::ConfigParserData &configData)
+bool JobWidgetInstall::detectResourceEncryption(
+ const WrtDB::ConfigParserData &configData)
{
FOREACH(it, configData.settingsList)
{
if (it->m_name == SETTING_VALUE_ENCRYPTION &&
- it->m_value == SETTING_VALUE_ENCRYPTION_ENABLE) {
+ it->m_value == SETTING_VALUE_ENCRYPTION_ENABLE)
+ {
LogDebug("resource need encryption");
return true;
}
@@ -1030,8 +1055,10 @@ bool JobWidgetInstall::detectResourceEncryption(const WrtDB::ConfigParserData &c
return false;
}
-void JobWidgetInstall::setInstallLocationType(const
- WrtDB::ConfigParserData &configData)
+void JobWidgetInstall::setInstallLocationType(
+ const
+ WrtDB::ConfigParserData &
+ configData)
{
m_installerContext.locationType = INSTALL_LOCATION_TYPE_NOMAL;
@@ -1042,8 +1069,9 @@ void JobWidgetInstall::setInstallLocationType(const
FOREACH(it, configData.settingsList)
{
if (it->m_name == SETTING_VALUE_INSTALLTOEXT_NAME &&
- it->m_value ==
- SETTING_VALUE_INSTALLTOEXT_PREPER_EXT) {
+ it->m_value ==
+ SETTING_VALUE_INSTALLTOEXT_PREPER_EXT)
+ {
LogDebug("This widget will be installed to sd card");
m_installerContext.locationType =
INSTALL_LOCATION_TYPE_EXTERNAL;
@@ -1055,16 +1083,16 @@ void JobWidgetInstall::setInstallLocationType(const
bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
{
/* TODO :
- drm_bool_type_e is_drm_file = DRM_UNKNOWN;
- int ret = -1;
-
- ret = drm_is_drm_file(widgetPath.c_str(), &is_drm_file);
- if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file) {
- */
+ * drm_bool_type_e is_drm_file = DRM_UNKNOWN;
+ * int ret = -1;
+ *
+ * ret = drm_is_drm_file(widgetPath.c_str(), &is_drm_file);
+ * if(DRM_RETURN_SUCCESS == ret && DRM_TRUE == is_drm_file) {
+ */
/* blow code temporary code for drm. */
int ret = drm_oem_intel_isDrmFile(const_cast(widgetPath.c_str()));
- if ( 1 == ret) {
+ if (1 == ret) {
return true;
} else {
return false;
@@ -1072,34 +1100,34 @@ bool JobWidgetInstall::isDRMWidget(std::string widgetPath)
}
bool JobWidgetInstall::DecryptDRMWidget(std::string widgetPath,
- std::string destPath)
+ std::string destPath)
{
/* TODO :
- drm_trusted_sapps_decrypt_package_info_s package_info;
-
- strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
- sizeof(package_info.sadcf_filepath));
- strncpy(package_info.decrypt_filepath, destPath.c_str(),
- sizeof(package_info.decrypt_filepath));
-
- drm_trusted_request_type_e requestType =
- DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
-
- int ret = drm_trusted_handle_request(requestType,
- (void *)&package_info, NULL);
- if (DRM_TRUSTED_RETURN_SUCCESS == ret) {
- return true;
- } else {
- return false;
- }
- */
+ * drm_trusted_sapps_decrypt_package_info_s package_info;
+ *
+ * strncpy(package_info.sadcf_filepath, widgetPath.c_str(),
+ * sizeof(package_info.sadcf_filepath));
+ * strncpy(package_info.decrypt_filepath, destPath.c_str(),
+ * sizeof(package_info.decrypt_filepath));
+ *
+ * drm_trusted_request_type_e requestType =
+ * DRM_TRUSTED_REQ_TYPE_SAPPS_DECRYPT_PACKAGE;
+ *
+ * int ret = drm_trusted_handle_request(requestType,
+ * (void *)&package_info, NULL);
+ * if (DRM_TRUSTED_RETURN_SUCCESS == ret) {
+ * return true;
+ * } else {
+ * return false;
+ * }
+ */
if (drm_oem_intel_decrypt_package(const_cast(widgetPath.c_str()),
- const_cast(destPath.c_str())) != 0) {
+ const_cast(destPath.c_str())) != 0)
+ {
return true;
} else {
return false;
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
diff --git a/src/jobs/widget_install/job_widget_install.h b/src/jobs/widget_install/job_widget_install.h
index ec23ef9..a97b8eb 100644
--- a/src/jobs/widget_install/job_widget_install.h
+++ b/src/jobs/widget_install/job_widget_install.h
@@ -48,8 +48,8 @@ class JobWidgetInstall :
Exceptions::Type m_exceptionCaught;
std::string m_exceptionMessage;
WidgetUpdateInfo m_widgetUpdateInfo;
- bool m_needEncryption;
- bool m_isDRM;
+ bool m_needEncryption;
+ bool m_isDRM;
enum class ConfigureResult
{
@@ -61,28 +61,28 @@ class JobWidgetInstall :
&configData,
const std::string &tempPath);
static WrtDB::ConfigParserData getWidgetDataFromXML(
- const std::string &widgetSource,
- const std::string &tempPath,
- WrtDB::PackagingType pkgType,
- bool isDRM);
+ const std::string &widgetSource,
+ const std::string &tempPath,
+ WrtDB::PackagingType pkgType,
+ bool isDRM);
static WidgetUpdateInfo detectWidgetUpdate(
- const WrtDB::ConfigParserData &configInfo,
- const WrtDB::WidgetType appType,
- const WrtDB::TizenAppId &tizenId);
+ const WrtDB::ConfigParserData &configInfo,
+ const WrtDB::WidgetType appType,
+ const WrtDB::TizenAppId &tizenId);
WidgetUpdateMode::Type CalcWidgetUpdatePolicy(
- const OptionalWidgetVersion &existingVersion,
- const OptionalWidgetVersion &incomingVersion) const;
+ const OptionalWidgetVersion &existingVersion,
+ const OptionalWidgetVersion &incomingVersion) const;
void setTizenId(const WrtDB::ConfigParserData &configInfo);
void displayWidgetInfo();
void configureWidgetLocation(const std::string & widgetPath,
const std::string &tempPath);
WrtDB::PackagingType checkPackageType(
- const std::string &widgetSource,
- const std::string &tempPath);
+ const std::string &widgetSource,
+ const std::string &tempPath);
bool detectResourceEncryption(const WrtDB::ConfigParserData &configData);
void setInstallLocationType(const WrtDB::ConfigParserData
- &configData);
+ &configData);
bool isDRMWidget(std::string widgetPath);
bool DecryptDRMWidget(std::string widgetPath, std::string destPath);
ConfigureResult PrePareInstallation(const std::string &widgetPath);
@@ -94,7 +94,7 @@ class JobWidgetInstall :
* @brief Automaticaly sets installation process
*/
JobWidgetInstall(std::string const & widgetPath,
- const WidgetInstallationStruct &installerStruct);
+ const WidgetInstallationStruct &installerStruct);
//overrides
void SendProgress();
diff --git a/src/jobs/widget_install/manifest.cpp b/src/jobs/widget_install/manifest.cpp
old mode 100755
new mode 100644
index 0c369d9..f11c954
--- a/src/jobs/widget_install/manifest.cpp
+++ b/src/jobs/widget_install/manifest.cpp
@@ -25,13 +25,12 @@
namespace Jobs {
namespace WidgetInstall {
-
void writeElement(xmlTextWriterPtr writer, const char * name, DPL::String body)
{
int state = xmlTextWriterWriteElement(writer, BAD_CAST name,
- BAD_CAST DPL::ToUTF8String(body).c_str());
- if (state < 0)
- {
+ BAD_CAST DPL::ToUTF8String(
+ body).c_str());
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteElement failed");
}
}
@@ -39,9 +38,8 @@ void writeElement(xmlTextWriterPtr writer, const char * name, DPL::String body)
void writeText(xmlTextWriterPtr writer, DPL::String text)
{
int state = xmlTextWriterWriteString(writer,
- BAD_CAST DPL::ToUTF8String(text).c_str());
- if (state < 0)
- {
+ BAD_CAST DPL::ToUTF8String(text).c_str());
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteText failed");
}
}
@@ -49,15 +47,17 @@ void writeText(xmlTextWriterPtr writer, DPL::String text)
void writeElement(xmlTextWriterPtr writer, const char * name, const char * body)
{
int state = xmlTextWriterWriteElement(writer, BAD_CAST name, BAD_CAST body);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteElement failed");
}
}
-void writeElementWithOneAttribute(xmlTextWriterPtr writer, const char * name,
- DPL::String body, const char * nameAttr, DPL::String bodyAttr,
- bool condition = true)
+void writeElementWithOneAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ DPL::String body,
+ const char * nameAttr,
+ DPL::String bodyAttr,
+ bool condition = true)
{
startElement(writer, name);
writeAttribute(writer, nameAttr, bodyAttr, condition);
@@ -68,8 +68,7 @@ void writeElementWithOneAttribute(xmlTextWriterPtr writer, const char * name,
void startElement(xmlTextWriterPtr writer, const char * name)
{
int state = xmlTextWriterStartElement(writer, BAD_CAST name);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterStartElement failed");
}
}
@@ -77,34 +76,42 @@ void startElement(xmlTextWriterPtr writer, const char * name)
void endElement(xmlTextWriterPtr writer)
{
int state = xmlTextWriterEndElement(writer);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterEndElement failed");
}
}
-void writeAttribute(xmlTextWriterPtr writer, const char * name, DPL::String body,
- bool condition = true)
+void writeAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ DPL::String body,
+ bool condition = true)
{
- if (!condition)
+ if (!condition) {
return;
+ }
int state = xmlTextWriterWriteAttribute(writer, BAD_CAST name,
- BAD_CAST DPL::ToUTF8String(body).c_str());
- if (state < 0)
- {
- ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteAttribute failed");
+ BAD_CAST DPL::ToUTF8String(
+ body).c_str());
+ if (state < 0) {
+ ThrowMsg(LibxmlUtils::Libxml2Error,
+ "xmlTextWriterWriteAttribute failed");
}
}
-void writeAttribute(xmlTextWriterPtr writer, const char * name, const char * body,
- bool condition = true)
+void writeAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ const char * body,
+ bool condition = true)
{
- if (!condition)
+ if (!condition) {
return;
- int state = xmlTextWriterWriteAttribute(writer, BAD_CAST name, BAD_CAST body);
- if (state < 0)
- {
- ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterWriteAttribute failed");
+ }
+ int state = xmlTextWriterWriteAttribute(writer,
+ BAD_CAST name,
+ BAD_CAST body);
+ if (state < 0) {
+ ThrowMsg(LibxmlUtils::Libxml2Error,
+ "xmlTextWriterWriteAttribute failed");
}
}
@@ -112,28 +119,28 @@ void Manifest::generate(DPL::String filename)
{
xmlTextWriterPtr writer;
int state;
- writer = xmlNewTextWriterFilename(DPL::ToUTF8String(filename).c_str(), 0); //compression set to 0
- if (writer == NULL)
+
+ //compression set to 0
+ writer = xmlNewTextWriterFilename(DPL::ToUTF8String(filename).c_str(), 0);
+
+ if (writer == NULL) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlNewTextWriterFilename failed");
- state = xmlTextWriterSetIndent (writer, 1);
- if (state < 0)
- {
+ }
+ state = xmlTextWriterSetIndent(writer, 1);
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterSetIndent failed");
}
state = xmlTextWriterStartDocument(writer, NULL, "utf-8", NULL);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterStartDocument failed");
}
this->serialize(writer);
state = xmlTextWriterEndDocument(writer);
- if (state < 0)
- {
+ if (state < 0) {
ThrowMsg(LibxmlUtils::Libxml2Error, "xmlTextWriterEndDocument failed");
}
- if (writer != NULL)
- {
+ if (writer != NULL) {
xmlFreeTextWriter(writer);
writer = NULL;
}
@@ -147,19 +154,20 @@ void Manifest::serialize(xmlTextWriterPtr writer)
writeAttribute(writer, "package", this->package);
writeAttribute(writer, "type", this->type);
writeAttribute(writer, "version", this->version);
- if (!this->installLocation.IsNull())
+ if (!this->installLocation.IsNull()) {
writeAttribute(writer, "install-location", (*this->installLocation),
- (*this->installLocation).empty());
+ (*this->installLocation).empty());
+ }
FOREACH(l, this->label)
{
writeElementWithOneAttribute(writer, "label", l->getString(),
- "xml:lang", l->getLang(), l->hasLang());
+ "xml:lang", l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(),
- "xml:lang", i->getLang(), i->hasLang());
+ "xml:lang", i->getLang(), i->hasLang());
}
FOREACH(a, this->author)
{
@@ -168,15 +176,23 @@ void Manifest::serialize(xmlTextWriterPtr writer)
FOREACH(d, this->description)
{
writeElementWithOneAttribute(writer, "description", d->getString(),
- "xml:lang", d->getLang(), d->hasLang());
+ "xml:lang", d->getLang(), d->hasLang());
}
//FOREACH(c, this->compatibility) { c->serialize(writer); }
//FOREACH(d, this->deviceProfile) { d->serialize(writer); }
- FOREACH(s, this->serviceApplication) { s->serialize(writer); }
- FOREACH(u, this->uiApplication) { u->serialize(writer); }
- FOREACH(i, this->imeApplication) { i->serialize(writer); }
+ FOREACH(s, this->serviceApplication) {
+ s->serialize(writer);
+ }
+ FOREACH(u, this->uiApplication) {
+ u->serialize(writer);
+ }
+ FOREACH(i, this->imeApplication) {
+ i->serialize(writer);
+ }
//FOREACH(f, this->font) { f->serialize(writer); }
- FOREACH(l, this->livebox) { l->serialize(writer); }
+ FOREACH(l, this->livebox) {
+ l->serialize(writer);
+ }
}
endElement(writer);
}
@@ -195,21 +211,24 @@ void ServiceApplication::serialize(xmlTextWriterPtr writer)
{
startElement(writer, "service-application");
writeAttribute(writer, "appid", this->appid);
- writeAttribute(writer, "auto-restart", (!this->autoRestart.IsNull() &&
- (*this->autoRestart)) ? "true" : "false");
+ writeAttribute(writer, "auto-restart",
+ (!this->autoRestart.IsNull() &&
+ (*this->autoRestart)) ? "true" :
+ "false");
writeAttribute(writer, "exec", this->exec);
writeAttribute(writer, "on-boot", (!this->onBoot.IsNull() &&
- (*this->onBoot)) ? "true" : "false");
+ (*this->onBoot)) ? "true" : "false");
writeAttribute(writer, "type", this->type);
FOREACH(l, this->label)
{
- writeElementWithOneAttribute(writer, "label", l->getString(), "xml:lang",
- l->getLang(), l->hasLang());
+ writeElementWithOneAttribute(writer, "label",
+ l->getString(), "xml:lang",
+ l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
- i->getLang(), i->hasLang());
+ i->getLang(), i->hasLang());
}
FOREACH(a, this->appControl)
{
@@ -223,25 +242,34 @@ void UiApplication::serialize(xmlTextWriterPtr writer)
startElement(writer, "ui-application");
writeAttribute(writer, "appid", this->appid);
writeAttribute(writer, "exec", this->exec);
- if (!this->multiple.IsNull())
+ if (!this->multiple.IsNull()) {
writeAttribute(writer, "multiple", (*this->multiple) ? "true" : "false");
- if (!this->nodisplay.IsNull())
- writeAttribute(writer, "nodisplay", (*this->nodisplay) ? "true" : "false");
- if (!this->taskmanage.IsNull())
- writeAttribute(writer, "taskmanage", (*this->taskmanage) ? "true" : "false");
+ }
+ if (!this->nodisplay.IsNull()) {
+ writeAttribute(writer,
+ "nodisplay",
+ (*this->nodisplay) ? "true" : "false");
+ }
+ if (!this->taskmanage.IsNull()) {
+ writeAttribute(writer,
+ "taskmanage",
+ (*this->taskmanage) ? "true" : "false");
+ }
writeAttribute(writer, "type", this->type);
writeAttribute(writer, "extraid", this->extraid);
- if (!this->categories.IsNull())
+ if (!this->categories.IsNull()) {
writeAttribute(writer, "categories", (*this->categories));
+ }
FOREACH(l, this->label)
{
- writeElementWithOneAttribute(writer, "label", l->getString(), "xml:lang",
- l->getLang(), l->hasLang());
+ writeElementWithOneAttribute(writer, "label",
+ l->getString(), "xml:lang",
+ l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
- i->getLang(), i->hasLang());
+ i->getLang(), i->hasLang());
}
FOREACH(a, this->appControl)
{
@@ -261,20 +289,25 @@ void ImeApplication::serialize(xmlTextWriterPtr writer)
startElement(writer, "ime-application");
writeAttribute(writer, "appid", this->appid);
writeAttribute(writer, "exec", this->exec);
- if (!this->multiple.IsNull())
+ if (!this->multiple.IsNull()) {
writeAttribute(writer, "multiple", (*this->multiple) ? "true" : "false");
- if (!this->nodisplay.IsNull())
- writeAttribute(writer, "nodisplay", (*this->nodisplay) ? "true" : "false");
+ }
+ if (!this->nodisplay.IsNull()) {
+ writeAttribute(writer,
+ "nodisplay",
+ (*this->nodisplay) ? "true" : "false");
+ }
writeAttribute(writer, "type", this->type);
FOREACH(l, this->label)
{
- writeElementWithOneAttribute(writer, "label", l->getString(), "xml:lang",
- l->getLang(), l->hasLang());
+ writeElementWithOneAttribute(writer, "label",
+ l->getString(), "xml:lang",
+ l->getLang(), l->hasLang());
}
FOREACH(i, this->icon)
{
writeElementWithOneAttribute(writer, "icon", i->getString(), "xml:lang",
- i->getLang(), i->hasLang());
+ i->getLang(), i->hasLang());
}
endElement(writer);
}
@@ -306,15 +339,15 @@ void AppControl::serialize(xmlTextWriterPtr writer)
void LiveBox::serialize(xmlTextWriterPtr writer)
{
startElement(writer, "livebox");
- if(!this->liveboxId.empty()) {
+ if (!this->liveboxId.empty()) {
writeAttribute(writer, "appid", this->liveboxId);
}
- if(!this->primary.empty()) {
+ if (!this->primary.empty()) {
writeAttribute(writer, "primary", this->primary);
}
- if(!this->updatePeriod.empty()) {
+ if (!this->updatePeriod.empty()) {
writeAttribute(writer, "period", this->updatePeriod);
}
@@ -322,27 +355,27 @@ void LiveBox::serialize(xmlTextWriterPtr writer)
writeAttribute(writer, "network", "true");
writeAttribute(writer, "nodisplay", "false");
- if(!this->label.empty()) {
+ if (!this->label.empty()) {
startElement(writer, "label");
writeText(writer, this->label);
endElement(writer);
}
- if(!this->icon.empty()) {
+ if (!this->icon.empty()) {
startElement(writer, "icon");
writeText(writer, this->icon);
endElement(writer);
}
- if(!this->autoLaunch.empty()) {
+ if (!this->autoLaunch.empty()) {
startElement(writer, "launch");
writeText(writer, this->autoLaunch);
endElement(writer);
}
- if(!this->box.boxSrc.empty() &&
- !this->box.boxMouseEvent.empty() &&
- !this->box.boxSize.empty())
+ if (!this->box.boxSrc.empty() &&
+ !this->box.boxMouseEvent.empty() &&
+ !this->box.boxSize.empty())
{
startElement(writer, "box");
writeAttribute(writer, "type", "buffer");
@@ -352,8 +385,9 @@ void LiveBox::serialize(xmlTextWriterPtr writer)
{
std::pair boxSize = *m;
startElement(writer, "size");
- if(!boxSize.second.empty())
+ if (!boxSize.second.empty()) {
writeAttribute(writer, "preview", boxSize.second);
+ }
writeText(writer, boxSize.first);
endElement(writer);
}
@@ -364,15 +398,16 @@ void LiveBox::serialize(xmlTextWriterPtr writer)
endElement(writer);
- if(!this->box.pdSrc.empty() &&
- !this->box.pdWidth.empty() &&
- !this->box.pdHeight.empty())
+ if (!this->box.pdSrc.empty() &&
+ !this->box.pdWidth.empty() &&
+ !this->box.pdHeight.empty())
{
startElement(writer, "pd");
writeAttribute(writer, "type", "buffer");
startElement(writer, "size");
- DPL::String pdSize = this->box.pdWidth+DPL::String(L"x")+this->box.pdHeight;
+ DPL::String pdSize = this->box.pdWidth + DPL::String(L"x") +
+ this->box.pdHeight;
writeText(writer, pdSize);
endElement(writer);
@@ -386,6 +421,5 @@ void LiveBox::serialize(xmlTextWriterPtr writer)
endElement(writer);
}
-
} //namespace Jobs
} //namespace WidgetInstall
diff --git a/src/jobs/widget_install/manifest.h b/src/jobs/widget_install/manifest.h
old mode 100755
new mode 100644
index d09c057..d2b3917
--- a/src/jobs/widget_install/manifest.h
+++ b/src/jobs/widget_install/manifest.h
@@ -32,20 +32,29 @@
namespace Jobs {
namespace WidgetInstall {
-
/**
* @brief string with optional language attribute
*/
class StringWithLang
{
-public:
+ public:
StringWithLang() { }
- StringWithLang(DPL::String s): string(s) { }
- StringWithLang(DPL::String s, DPL::String l): string(s), lang(l) { }
- DPL::String getString() { return this->string; }
- DPL::String getLang() { return this->lang; }
- bool hasLang() { return !this->lang.empty(); }
-private:
+ StringWithLang(DPL::String s) : string(s) { }
+ StringWithLang(DPL::String s, DPL::String l) : string(s), lang(l) { }
+ DPL::String getString()
+ {
+ return this->string;
+ }
+ DPL::String getLang()
+ {
+ return this->lang;
+ }
+ bool hasLang()
+ {
+ return !this->lang.empty();
+ }
+
+ private:
DPL::String string;
DPL::String lang;
};
@@ -55,7 +64,8 @@ typedef StringWithLang LabelType, IconType, DescriptionType;
/**
* These types are basicaly strings but they should allow usage of different
* range of characters or words (details in XML spec.).
- * For simplicity DPL::Strings are used, although this can lead to XML validation
+ * For simplicity DPL::Strings are used, although this can lead to XML
+ * validation
* errors (related to usage of not allowed characters in given places).
*/
typedef DPL::String NcnameType, NmtokenType, AnySimpleType, LangType;
@@ -69,30 +79,34 @@ typedef DPL::String AppCategoryType;
void writeElement(xmlTextWriterPtr writer, const char * name, DPL::String body);
void writeText(xmlTextWriterPtr writer, DPL::String text);
void writeElement(xmlTextWriterPtr writer, const char * name, const char * body);
-void writeElementWithOneAttribute(xmlTextWriterPtr writer, const char * name,
- const char * body, const char * nameAttr, DPL::String bodyAttr,
- bool condition = true);
+void writeElementWithOneAttribute(xmlTextWriterPtr writer,
+ const char * name,
+ const char * body,
+ const char * nameAttr,
+ DPL::String bodyAttr,
+ bool condition = true);
void startElement(xmlTextWriterPtr writer, const char * name);
void endElement(xmlTextWriterPtr writer);
void writeAttribute(xmlTextWriterPtr writer, const char * name,
- DPL::String body, bool condition);
+ DPL::String body, bool condition);
void writeAttribute(xmlTextWriterPtr writer, const char * name,
- const char * body, bool condition);
+ const char * body, bool condition);
/**
* @brief author element
*/
class Author
{
-public:
+ public:
Author() {}
Author(AnySimpleType e,
- NcnameType h,
- LangType l,
- DPL::String b)
- : email(e), href(h), lang(l), body(b) {}
+ NcnameType h,
+ LangType l,
+ DPL::String b) :
+ email(e), href(h), lang(l), body(b) {}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
AnySimpleType email;
NcnameType href;
LangType lang;
@@ -106,13 +120,23 @@ typedef Author AuthorType;
*/
class AppControl
{
-public:
+ public:
AppControl() {}
- void addOperation(const OperationType &x) { this->operation.push_back(x); }
- void addUri(const UriType &x) { this->uri.push_back(x); }
- void addMime(const MimeType &x) { this->mime.push_back(x); }
+ void addOperation(const OperationType &x)
+ {
+ this->operation.push_back(x);
+ }
+ void addUri(const UriType &x)
+ {
+ this->uri.push_back(x);
+ }
+ void addMime(const MimeType &x)
+ {
+ this->mime.push_back(x);
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
std::list operation; //attr name AnySimpleType
std::list uri; //attr name AnySimpleType
std::list mime; //attr name AnySimpleType
@@ -125,17 +149,39 @@ typedef AppControl AppControlType;
*/
class ImeApplication
{
-public:
+ public:
ImeApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setExec(const NcnameType &x) { this->exec = x; }
- void setMultiple(bool x) { this->multiple = x; }
- void setNodisplay(bool x) { this->nodisplay = x; }
- void setType(const TypeType &x) { this->type = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setExec(const NcnameType &x)
+ {
+ this->exec = x;
+ }
+ void setMultiple(bool x)
+ {
+ this->multiple = x;
+ }
+ void setNodisplay(bool x)
+ {
+ this->nodisplay = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
NcnameType exec;
DPL::OptionalBool multiple;
@@ -152,21 +198,43 @@ typedef ImeApplication ImeApplicationType;
*/
class ServiceApplication
{
-public:
+ public:
ServiceApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setAutoRestart(bool x) { this->autoRestart = x; }
- void setExec(const AnySimpleType &x) { this->exec = x; }
- void setOnBoot(bool x) { this->onBoot = x; }
- void setType(const TypeType &x) { this->type = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setAutoRestart(bool x)
+ {
+ this->autoRestart = x;
+ }
+ void setExec(const AnySimpleType &x)
+ {
+ this->exec = x;
+ }
+ void setOnBoot(bool x)
+ {
+ this->onBoot = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void addAppControl(const AppControlType &x)
{
this->appControl.push_back(x);
}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
DPL::OptionalBool autoRestart;
AnySimpleType exec;
@@ -184,18 +252,48 @@ typedef ServiceApplication ServiceApplicationType;
*/
class UiApplication
{
-public:
+ public:
UiApplication() {}
- void setAppid(const NcnameType &x) { this->appid = x; }
- void setExtraid(const NcnameType &x) { this->extraid = x; }
- void setExec(const AnySimpleType &x) { this->exec = x; }
- void setMultiple(bool x) { this->multiple = x; }
- void setNodisplay(bool x) { this->nodisplay = x; }
- void setTaskmanage(bool x) { this->taskmanage = x; }
- void setType(const TypeType &x) { this->type = x; }
- void setCategories(const NcnameType &x) { this->categories = x; }
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
+ void setAppid(const NcnameType &x)
+ {
+ this->appid = x;
+ }
+ void setExtraid(const NcnameType &x)
+ {
+ this->extraid = x;
+ }
+ void setExec(const AnySimpleType &x)
+ {
+ this->exec = x;
+ }
+ void setMultiple(bool x)
+ {
+ this->multiple = x;
+ }
+ void setNodisplay(bool x)
+ {
+ this->nodisplay = x;
+ }
+ void setTaskmanage(bool x)
+ {
+ this->taskmanage = x;
+ }
+ void setType(const TypeType &x)
+ {
+ this->type = x;
+ }
+ void setCategories(const NcnameType &x)
+ {
+ this->categories = x;
+ }
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
void addAppControl(const AppControlType &x)
{
this->appControl.push_back(x);
@@ -205,7 +303,8 @@ public:
this->appCategory.push_back(x);
}
void serialize(xmlTextWriterPtr writer);
-private:
+
+ private:
NcnameType appid;
NcnameType extraid;
AnySimpleType exec;
@@ -225,8 +324,7 @@ typedef UiApplication UiApplicationType;
/**
* @brief LiveBox element
*/
-typedef std::list> boxSizeType;
-
+typedef std::list > boxSizeType;
struct BoxInfo
{
@@ -241,19 +339,40 @@ typedef BoxInfo BoxInfoType;
class LiveBox
{
-public:
+ public:
LiveBox() { }
- void setLiveboxId(const NcnameType &x) { this->liveboxId = x; }
- void setPrimary(const NcnameType &x) { this->primary = x; }
- void setAutoLaunch(const NcnameType &x) { this->autoLaunch = x; }
- void setUpdatePeriod(const NcnameType &x) { this->updatePeriod = x; }
- void setLabel(const NcnameType &x) { this->label = x; }
- void setIcon(const NcnameType &x) { this->icon = x; }
- void setBox(const BoxInfoType &x) { this->box = x; }
+ void setLiveboxId(const NcnameType &x)
+ {
+ this->liveboxId = x;
+ }
+ void setPrimary(const NcnameType &x)
+ {
+ this->primary = x;
+ }
+ void setAutoLaunch(const NcnameType &x)
+ {
+ this->autoLaunch = x;
+ }
+ void setUpdatePeriod(const NcnameType &x)
+ {
+ this->updatePeriod = x;
+ }
+ void setLabel(const NcnameType &x)
+ {
+ this->label = x;
+ }
+ void setIcon(const NcnameType &x)
+ {
+ this->icon = x;
+ }
+ void setBox(const BoxInfoType &x)
+ {
+ this->box = x;
+ }
void serialize(xmlTextWriterPtr writer);
-private:
+ private:
NcnameType liveboxId;
NcnameType primary;
NcnameType autoLaunch;
@@ -273,26 +392,35 @@ typedef LiveBox LiveBoxInfo;
*/
class Manifest
{
-public:
+ public:
Manifest() {}
void serialize(xmlTextWriterPtr writer);
void generate(DPL::String filename);
- void addLabel(const LabelType &x) { this->label.push_back(x); }
- void addIcon(const IconType &x) { this->icon.push_back(x); }
- void addAuthor(const AuthorType &x) { this->author.push_back(x); };
+ void addLabel(const LabelType &x)
+ {
+ this->label.push_back(x);
+ }
+ void addIcon(const IconType &x)
+ {
+ this->icon.push_back(x);
+ }
+ void addAuthor(const AuthorType &x)
+ {
+ this->author.push_back(x);
+ }
void addDescription(const DescriptionType &x)
{
this->description.push_back(x);
}
-// void addCompatibility(const CompatibilityType &x)
-// {
-// this->compatibility.push_back(x);
-// }
-// void addDeviceProfile(const DeviceProfileType &x)
-// {
-// this->deviceProfile.push_back(x);
-// }
+ // void addCompatibility(const CompatibilityType &x)
+ // {
+ // this->compatibility.push_back(x);
+ // }
+ // void addDeviceProfile(const DeviceProfileType &x)
+ // {
+ // this->deviceProfile.push_back(x);
+ // }
void addServiceApplication(const ServiceApplicationType &x)
{
this->serviceApplication.push_back(x);
@@ -305,7 +433,7 @@ public:
{
this->imeApplication.push_back(x);
}
-// void addFont(const FontType &x) { this->font.push_back(x); }
+ // void addFont(const FontType &x) { this->font.push_back(x); }
void addLivebox(const LiveBoxInfo &x)
{
@@ -316,27 +444,36 @@ public:
{
this->installLocation = x;
}
- void setPackage(const NcnameType &x) { this->package = x; }
- void setType(const PackageType &x) { this->type = x; }
- void setVersion(const NmtokenType &x) { this->version = x; }
-private:
+ void setPackage(const NcnameType &x)
+ {
+ this->package = x;
+ }
+ void setType(const PackageType &x)
+ {
+ this->type = x;
+ }
+ void setVersion(const NmtokenType &x)
+ {
+ this->version = x;
+ }
+
+ private:
std::list label;
std::list icon;
std::list author;
std::list description;
-// std::list compatibility;
-// std::list deviceProfile;
+ // std::list compatibility;
+ // std::list deviceProfile;
std::list serviceApplication;
std::list uiApplication;
std::list imeApplication;
-// std::list font;
+ // std::list font;
std::list livebox;
InstallLocationType installLocation;
NcnameType package;
PackageType type;
NmtokenType version;
};
-
} //namespace Jobs
} //namespace WidgetInstall
diff --git a/src/jobs/widget_install/task_ace_check.cpp b/src/jobs/widget_install/task_ace_check.cpp
index 77e35d1..2697a9c 100644
--- a/src/jobs/widget_install/task_ace_check.cpp
+++ b/src/jobs/widget_install/task_ace_check.cpp
@@ -38,7 +38,6 @@
namespace Jobs {
namespace WidgetInstall {
-
TaskAceCheck::TaskAceCheck(InstallerContext& context) :
DPL::TaskDecl(this),
m_context(context)
@@ -75,18 +74,21 @@ void TaskAceCheck::StepAceCheck()
std::string devCapStr = DPL::ToUTF8String(deviceCap);
ace_policy_result_t policyResult = ACE_DENY;
+
+ //TODO: remove dao.getHandle()
ace_return_t ret = ace_get_policy_result(
const_cast(devCapStr.c_str()),
- dao.getHandle(), //TODO: remove dao.getHandle()
+ dao.getHandle(),
&policyResult);
if (ACE_OK != ret) {
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
- "ACE check failure");
+ "ACE check failure");
}
LogInfo("PolicyResult is : " << static_cast(policyResult));
m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap,
- policyResult == ACE_PERMIT));
+ policyResult ==
+ ACE_PERMIT));
m_context.featureLogic->setAceResponse(policyResult != ACE_DENY);
}
@@ -95,7 +97,8 @@ void TaskAceCheck::StepProcessAceResponse()
{
WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
if (m_context.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ {
return;
}
@@ -109,9 +112,9 @@ void TaskAceCheck::StepProcessAceResponse()
std::vector devCaps;
std::vector devCapsSmack;
// Saving static dev cap permissions
- FOREACH (cap, m_context.staticPermittedDevCaps) {
+ FOREACH(cap, m_context.staticPermittedDevCaps) {
LogInfo("staticPermittedDevCaps : " << cap->first
- << " smack: " << cap->second);
+ << " smack: " << cap->second);
std::string devCapStr = DPL::ToUTF8String(cap->first);
devCaps.push_back(devCapStr);
devCapsSmack.push_back(cap->second);
@@ -122,21 +125,22 @@ void TaskAceCheck::StepProcessAceResponse()
for (unsigned int i = 0; i < devCaps.size(); ++i) {
list.items[i].device_capability =
- const_cast(devCaps[i].c_str());
+ const_cast(devCaps[i].c_str());
list.items[i].smack_granted =
- devCapsSmack[i] ? ACE_TRUE : ACE_FALSE;
+ devCapsSmack[i] ? ACE_TRUE : ACE_FALSE;
}
- ace_return_t ret = ace_set_requested_dev_caps(dao.getHandle(), //TODO: remove dao.getHandle()
+ //TODO: remove dao.getHandle()
+ ace_return_t ret = ace_set_requested_dev_caps(dao.getHandle(),
&list);
if (ACE_OK != ret) {
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
- "ACE failure");
+ "ACE failure");
}
- delete [] list.items;
+ delete[] list.items;
std::set acceptedFeature;
auto it = m_context.featureLogic->resultBegin();
- for (;it != m_context.featureLogic->resultEnd(); ++it) {
+ for (; it != m_context.featureLogic->resultEnd(); ++it) {
if (!(it->rejected)) {
acceptedFeature.insert(DPL::ToUTF8String(it->name));
}
@@ -145,22 +149,24 @@ void TaskAceCheck::StepProcessAceResponse()
featureList.count = acceptedFeature.size();
featureList.items = new ace_string_t[featureList.count];
- size_t i=0;
+ size_t i = 0;
for (std::set::const_iterator iter = acceptedFeature.begin();
- iter != acceptedFeature.end(); ++iter) {
+ iter != acceptedFeature.end(); ++iter)
+ {
LogDebug("Accepted feature item: " << iter->c_str());
featureList.items[i] = const_cast(iter->c_str());
i++;
}
- ret = ace_set_accepted_feature(dao.getHandle(), &featureList); //TODO: remove dao.getHandle()
+ //TODO: remove dao.getHandle()
+ ret = ace_set_accepted_feature(dao.getHandle(), &featureList);
- delete [] featureList.items;
+ delete[] featureList.items;
if (ACE_OK != ret) {
LogError("Error in ace_set_feature");
ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
- "ace_set_feature failure.");
+ "ace_set_feature failure.");
}
return;
}
@@ -175,14 +181,18 @@ void TaskAceCheck::StepCheckAceResponse()
LogInfo("Checking ACE response");
if (m_context.featureLogic->isRejected()) {
LogError("Installation failure. Some devCap was not accepted by ACE.");
- ThrowMsg(Exceptions::NotAllowed, "Instalation failure. "
+ ThrowMsg(
+ Exceptions::NotAllowed,
+ "Instalation failure. "
"Some deviceCap was not accepted by ACE.");
}
LogInfo("Updating \"feature reject status\" in database!");
auto it = m_context.featureLogic->resultBegin();
auto end = m_context.featureLogic->resultEnd();
- for(;it != end; ++it){
- LogInfo(" |- Feature: " << it->name << " has reject status: " << it->rejected);
+ for (; it != end; ++it) {
+ LogInfo(
+ " |- Feature: " << it->name << " has reject status: " <<
+ it->rejected);
if (it->rejected) {
WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
dao.updateFeatureRejectStatus(*it);
@@ -194,6 +204,5 @@ void TaskAceCheck::StepCheckAceResponse()
InstallerContext::INSTALL_ACE_CHECK,
"Widget Access Control Check Finished");
}
-
} //namespace WidgetInstall
} //namespace Jobs
diff --git a/src/jobs/widget_install/task_certificates.cpp b/src/jobs/widget_install/task_certificates.cpp
old mode 100755
new mode 100644
index 14395d4..3854ad6
--- a/src/jobs/widget_install/task_certificates.cpp
+++ b/src/jobs/widget_install/task_certificates.cpp
@@ -37,7 +37,6 @@ using namespace WrtDB;
namespace Jobs {
namespace WidgetInstall {
-
TaskCertificates::TaskCertificates(InstallerContext& context) :
DPL::TaskDecl(this),
m_context(context)
@@ -53,19 +52,20 @@ void TaskCertificates::StepSetCertiInfo()
if (pkgmgr_installer_create_certinfo_set_handle(&m_pkgHandle) < 0) {
LogError("pkgmgrInstallerCreateCertinfoSetHandle fail");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to create certificate handle");
+ "Failed to create certificate handle");
}
SetCertiInfo(SIGNATURE_AUTHOR);
SetCertiInfo(SIGNATURE_DISTRIBUTOR);
if ((pkgmgr_installer_save_certinfo(
- const_cast(DPL::ToUTF8String(
- m_context.widgetConfig.tzPkgid).c_str()),
- m_pkgHandle)) < 0) {
+ const_cast(DPL::ToUTF8String(
+ m_context.widgetConfig.tzPkgid).c_str()),
+ m_pkgHandle)) < 0)
+ {
LogError("pkgmgrInstallerSaveCertinfo fail");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to Installer Save Certinfo");
+ "Failed to Installer Save Certinfo");
} else {
LogDebug("Succeed to save Certinfo");
}
@@ -89,22 +89,22 @@ void TaskCertificates::SetCertiInfo(CertificateSource source)
if (false == chain.load(*it)) {
LogError("Chain is broken");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to Installer Save Certinfo");
+ "Failed to Installer Save Certinfo");
}
- if (!chain.sort()){
+ if (!chain.sort()) {
LogError("Chain failed at sorting");
}
ValidationCore::CertificateList list = chain.getCertificateList();
- FOREACH(certIt, list)
+ FOREACH(certIt, list)
{
pkgmgr_instcert_type instCertType;
if (source == SIGNATURE_DISTRIBUTOR) {
std::string
- Name(DPL::ToUTF8String(*(*certIt)->getOrganizationName()));
+ Name(DPL::ToUTF8String(*(*certIt)->getOrganizationName()));
size_t found = Name.find("Tizen");
if (found != std::string::npos) {
@@ -124,7 +124,8 @@ void TaskCertificates::SetCertiInfo(CertificateSource source)
instCertType = PM_SET_DISTRIBUTOR2_ROOT_CERT;
} else {
if ((*certIt)->isCA()) {
- instCertType = PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT;
+ instCertType =
+ PM_SET_DISTRIBUTOR2_INTERMEDIATE_CERT;
} else {
instCertType = PM_SET_DISTRIBUTOR2_SIGNER_CERT;
}
@@ -143,13 +144,14 @@ void TaskCertificates::SetCertiInfo(CertificateSource source)
}
}
LogDebug("cert type : " << instCertType);
- if((pkgmgr_installer_set_cert_value(
- m_pkgHandle,
- instCertType,
- const_cast(((*certIt)->getBase64()).c_str()))) < 0) {
+ if ((pkgmgr_installer_set_cert_value(
+ m_pkgHandle,
+ instCertType,
+ const_cast(((*certIt)->getBase64()).c_str()))) < 0)
+ {
LogError("pkgmgrInstallerSetCertValue fail");
ThrowMsg(Exceptions::SetCertificateInfoFailed,
- "Failed to Set CertValue");
+ "Failed to Set CertValue");
}
}
}
@@ -158,11 +160,12 @@ void TaskCertificates::SetCertiInfo(CertificateSource source)
void TaskCertificates::StepAbortCertiInfo()
{
if ((pkgmgr_installer_delete_certinfo(
- const_cast(DPL::ToUTF8String(
- m_context.widgetConfig.tzPkgid).c_str()))) < 0) {
+ const_cast(DPL::ToUTF8String(
+ m_context.widgetConfig.tzPkgid).c_str()))) <
+ 0)
+ {
LogError("pkgmgr_installer_delete_certinfo fail");
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
diff --git a/src/jobs/widget_install/task_certificates.h b/src/jobs/widget_install/task_certificates.h
old mode 100755
new mode 100644
index 8a377d6..e689cee
--- a/src/jobs/widget_install/task_certificates.h
+++ b/src/jobs/widget_install/task_certificates.h
@@ -34,7 +34,7 @@ class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
-class TaskCertificates:
+class TaskCertificates :
public DPL::TaskDecl,
public DPL::Event::ICDelegateSupport
{
diff --git a/src/jobs/widget_install/task_certify.cpp b/src/jobs/widget_install/task_certify.cpp
index 4d22aca..9b2d1b9 100644
--- a/src/jobs/widget_install/task_certify.cpp
+++ b/src/jobs/widget_install/task_certify.cpp
@@ -54,8 +54,8 @@ using namespace WrtDB;
namespace {
const std::string LABEL_NEW_LINE = "
";
const std::string LABEL_NEW_LINE_2 = "
";
-const std::string UNTRUSTED_WIDGET ="It is an Untrusted Widget";
-const char *QUESTION ="Do you wanto to install?";
+const std::string UNTRUSTED_WIDGET = "It is an Untrusted Widget";
+const char *QUESTION = "Do you wanto to install?";
WidgetCertificateData toWidgetCertificateData(const SignatureData &data,
bool root)
@@ -79,7 +79,7 @@ WidgetCertificateData toWidgetCertificateData(const SignatureData &data,
}
Assert(certificate && !certificate->getCommonName().IsNull() &&
- "CommonName is Null");
+ "CommonName is Null");
result.strCommonName = *certificate->getCommonName();
@@ -106,7 +106,8 @@ TaskCertify::TaskCertify(InstallerContext &inCont) :
// Block until fixed popup issues
if (!GlobalSettings::PopupsTestModeEnabled()
- && !m_installContext.m_quiet && !isTizenWebApp()) {
+ && !m_installContext.m_quiet && !isTizenWebApp())
+ {
AddStep(&TaskCertify::stepWarningPopup);
AddStep(&TaskCertify::stepWarningPopupAnswer);
AddStep(&TaskCertify::stepAuthorInfoPopup);
@@ -130,14 +131,14 @@ void TaskCertify::processDistributorSignature(const SignatureData &data,
CertificateCollection collection;
collection.load(data.getCertList());
Assert(collection.sort() &&
- "Certificate collection can't sort");
+ "Certificate collection can't sort");
Assert(collection.isChain() &&
"Certificate collection is not able to create chain. "
"It is not possible to verify this signature.");
m_contextData.wacSecurity.getCertificateChainListRef().push_back(
- collection);
+ collection);
if (first) {
m_contextData.wacSecurity.getCertificateListRef().push_back(
@@ -174,7 +175,7 @@ void TaskCertify::processAuthorSignature(const SignatureData &data)
"It is not possible to verify this signature.");
m_contextData.wacSecurity.getAuthorsCertificateChainListRef().push_back(
- collection);
+ collection);
FOREACH(it, dnsIdentity){
if (widgetId.matchHost(*it)) {
@@ -188,7 +189,8 @@ void TaskCertify::stepSignature()
{
LogInfo("================ Step: <> ENTER ===============");
- std::string widgetPath = m_contextData.locations->getTemporaryRootDir() + "/";
+ std::string widgetPath = m_contextData.locations->getTemporaryRootDir() +
+ "/";
SignatureFileInfoSet signatureFiles;
SignatureFinder signatureFinder(widgetPath);
@@ -216,27 +218,31 @@ void TaskCertify::stepSignature()
xml.initialize(data, GlobalConfig::GetSignatureXmlSchema());
xml.read(data);
- WrtSignatureValidator::AppType appType = WrtSignatureValidator::WAC20;
+ WrtSignatureValidator::AppType appType =
+ WrtSignatureValidator::WAC20;
- if (m_installContext.widgetConfig.webAppType == APP_TYPE_TIZENWEBAPP) {
+ if (m_installContext.widgetConfig.webAppType ==
+ APP_TYPE_TIZENWEBAPP)
+ {
appType = WrtSignatureValidator::TIZEN;
}
WrtSignatureValidator::Result result;
if (m_contextData.widgetConfig.packagingType
- == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+ == WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
{
// In directory installation mode, the validation is skipped.
result = WrtSignatureValidator::SIGNATURE_VERIFIED;
- }
- else
- {
- WrtSignatureValidator validator(appType,
- !GlobalSettings::OCSPTestModeEnabled(),
- !GlobalSettings::CrlTestModeEnabled(),
- complianceMode);
+ } else {
+ WrtSignatureValidator validator(
+ appType,
+ !GlobalSettings::
+ OCSPTestModeEnabled(),
+ !GlobalSettings::
+ CrlTestModeEnabled(),
+ complianceMode);
result = validator.check(data, widgetPath);
}
@@ -259,7 +265,9 @@ void TaskCertify::stepSignature()
m_contextData.wacSecurity.isDistributorSigned())
{
processAuthorSignature(data);
- } else if (result == WrtSignatureValidator::SIGNATURE_DISREGARD) {
+ } else if (result ==
+ WrtSignatureValidator::SIGNATURE_DISREGARD)
+ {
continue;
}
} else {
@@ -276,8 +284,7 @@ void TaskCertify::stepSignature()
std::string realMEID;
TapiHandle *tapiHandle = tel_init(NULL);
char *meid = tel_get_misc_me_sn_sync(tapiHandle);
- if (meid)
- {
+ if (meid) {
realMEID = meid;
free(meid);
}
@@ -329,11 +336,11 @@ void TaskCertify::stepSignature()
void TaskCertify::createInstallPopup(PopupType type, const std::string &label)
{
m_contextData.job->Pause();
- if(m_popup)
+ if (m_popup) {
destroyPopup();
+ }
bool ret = createPopup();
- if(ret)
- {
+ if (ret) {
loadPopup(type, label);
showPopup();
}
@@ -414,9 +421,9 @@ std::string TaskCertify::createAuthorWidgetInfo() const
void TaskCertify::stepAuthorInfoPopup()
{
LogInfo("Step:: <>");
- std::string label
- = createAuthorWidgetInfo() + LABEL_NEW_LINE_2 + QUESTION;
- createInstallPopup(PopupType::WIDGET_AUTHOR_INFO, label);
+ std::string label
+ = createAuthorWidgetInfo() + LABEL_NEW_LINE_2 + QUESTION;
+ createInstallPopup(PopupType::WIDGET_AUTHOR_INFO, label);
}
void TaskCertify::stepFinalize()
@@ -428,12 +435,11 @@ void TaskCertify::stepFinalize()
"Widget Certification Check Finished");
}
-
void TaskCertify::stepWarningPopupAnswer()
{
LogInfo("Step: <>");
if (false == m_contextData.wacSecurity.isDistributorSigned() &&
- WRT_POPUP_BUTTON_CANCEL == m_installCancel)
+ WRT_POPUP_BUTTON_CANCEL == m_installCancel)
{
LogWarning("User does not agreed to install unsigned widgets!");
m_installCancel = WRT_POPUP_BUTTON;
@@ -445,7 +451,7 @@ void TaskCertify::stepWarningPopupAnswer()
void TaskCertify::stepAuthorInfoPopupAnswer()
{
LogInfo("Step: <>");
- if ( WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
+ if (WRT_POPUP_BUTTON_CANCEL == m_installCancel) {
LogWarning("User does not agreed to install widget!");
m_installCancel = WRT_POPUP_BUTTON;
destroyPopup();
@@ -457,8 +463,10 @@ bool TaskCertify::isTizenWebApp() const
{
bool ret = FALSE;
if (m_installContext.widgetConfig.webAppType.appType
- == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
+ == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
+ {
ret = TRUE;
+ }
return ret;
}
diff --git a/src/jobs/widget_install/task_certify.h b/src/jobs/widget_install/task_certify.h
old mode 100755
new mode 100644
index e6ca9ac..8ee7e2b
--- a/src/jobs/widget_install/task_certify.h
+++ b/src/jobs/widget_install/task_certify.h
@@ -60,13 +60,12 @@ class TaskCertify :
void createInstallPopup(PopupType type, const std::string &label);
void processDistributorSignature(const ValidationCore::SignatureData &data,
- bool first);
+ bool first);
void processAuthorSignature(const ValidationCore::SignatureData &data);
std::string createAuthorWidgetInfo() const;
bool isTizenWebApp() const;
-
};
} //namespace WidgetInstall
} //namespace Jobs
diff --git a/src/jobs/widget_install/task_commons.cpp b/src/jobs/widget_install/task_commons.cpp
index fea9ea1..ff1006a 100644
--- a/src/jobs/widget_install/task_commons.cpp
+++ b/src/jobs/widget_install/task_commons.cpp
@@ -34,63 +34,60 @@
namespace Jobs {
namespace WidgetInstall {
-
namespace {
-
const char * const TEMPORARY_PATH_POSTFIX = "temp";
const mode_t TEMPORARY_PATH_MODE = 0775;
-
} // namespace
-
std::string createTempPath(bool preload)
{
LogInfo("Step: Creating temporary path");
- // Temporary path
- std::ostringstream tempPathBuilder;
-
- if (preload) {
- tempPathBuilder << WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
- } else {
- tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
- }
- tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
- tempPathBuilder << "/";
- tempPathBuilder << TEMPORARY_PATH_POSTFIX;
- tempPathBuilder << "_";
-
- timeval tv;
- gettimeofday(&tv, NULL);
- tempPathBuilder <<
- (static_cast(tv.tv_sec) * 1000000ULL +
- static_cast(tv.tv_usec));
-
- std::string tempPath = tempPathBuilder.str();
-
- // Remove old path if any
- struct stat fileInfo;
-
- if (stat(tempPath.c_str(), &fileInfo) == 0) {
- if(!WrtUtilRemove(tempPath)){
- ThrowMsg(Exceptions::RemovingFolderFailure,
- "Failed to to remove temporary directory");
- }
- }
- // Create new path
- if(!WrtUtilMakeDir(tempPath, TEMPORARY_PATH_MODE)){
- ThrowMsg(Exceptions::InternalError, "Failed to create temporary directory");
- }
-
- return tempPath;
+ // Temporary path
+ std::ostringstream tempPathBuilder;
+
+ if (preload) {
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserPreloadedWidgetPath();
+ } else {
+ tempPathBuilder << WrtDB::GlobalConfig::GetUserInstalledWidgetPath();
+ }
+ tempPathBuilder << WrtDB::GlobalConfig::GetTmpDirPath();
+ tempPathBuilder << "/";
+ tempPathBuilder << TEMPORARY_PATH_POSTFIX;
+ tempPathBuilder << "_";
+
+ timeval tv;
+ gettimeofday(&tv, NULL);
+ tempPathBuilder <<
+ (static_cast(tv.tv_sec) * 1000000ULL +
+ static_cast(tv.tv_usec));
+
+ std::string tempPath = tempPathBuilder.str();
+
+ // Remove old path if any
+ struct stat fileInfo;
+
+ if (stat(tempPath.c_str(), &fileInfo) == 0) {
+ if (!WrtUtilRemove(tempPath)) {
+ ThrowMsg(Exceptions::RemovingFolderFailure,
+ "Failed to to remove temporary directory");
+ }
+ }
+ // Create new path
+ if (!WrtUtilMakeDir(tempPath, TEMPORARY_PATH_MODE)) {
+ ThrowMsg(Exceptions::InternalError,
+ "Failed to create temporary directory");
+ }
+
+ return tempPath;
}
void createTempPath(const std::string& path)
{
- if(!WrtUtilMakeDir(path, TEMPORARY_PATH_MODE)){
- ThrowMsg(Exceptions::InternalError, "Failed to create temporary directory");
- }
+ if (!WrtUtilMakeDir(path, TEMPORARY_PATH_MODE)) {
+ ThrowMsg(Exceptions::InternalError,
+ "Failed to create temporary directory");
+ }
}
-
} // WidgetInstall
} // Jobs
diff --git a/src/jobs/widget_install/task_commons.h b/src/jobs/widget_install/task_commons.h
index 5193c3d..6a2f223 100644
--- a/src/jobs/widget_install/task_commons.h
+++ b/src/jobs/widget_install/task_commons.h
@@ -26,16 +26,13 @@
namespace Jobs {
namespace WidgetInstall {
-
//TODO make directory like jobs common?
std::string createTempPath(bool preload = false);
std::string createTempPath(bool preload);
void createTempPath(const std::string& path);
-
} // WidgetInstall
} // Jobs
-
#endif /* INSTALLER_CORE_JOS_WIDGET_INSTALL_TASK_COMMONS_H_ */
diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp
index ea2cd3c..d5ba2b9 100644
--- a/src/jobs/widget_install/task_database.cpp
+++ b/src/jobs/widget_install/task_database.cpp
@@ -18,7 +18,8 @@
* @author Lukasz Wrzosek(l.wrzosek@samsung.com)
* @author Soyoung kim(sy037.kim@samsung.com)
* @version 1.0
- * @brief Implementation file for installer task database updating for widget update
+ * @brief Implementation file for installer task database updating for widget
+ * update
*/
#include
#include
@@ -46,7 +47,6 @@ using namespace WrtDB;
namespace Jobs {
namespace WidgetInstall {
-
TaskDatabase::TaskDatabase(InstallerContext& context) :
DPL::TaskDecl(this),
m_context(context),
@@ -70,40 +70,41 @@ void TaskDatabase::StepWrtDBInsert()
/* Set install Time */
time(&m_context.widgetConfig.installedTime);
- if (m_context.existingWidgetInfo.isExist) //update
- {
+ if (m_context.existingWidgetInfo.isExist) { //update
LogInfo("Registering widget... (update)");
Try
{
m_handleToRemove = WidgetDAOReadOnly::getHandle(
- m_context.widgetConfig.tzAppid);
+ m_context.widgetConfig.tzAppid);
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
- LogError("Given tizenId not found for update installation (Same GUID?)");
- ThrowMsg(Exceptions::InvalidPackage, "Given tizenId not found for update installation");
+ LogError(
+ "Given tizenId not found for update installation (Same GUID?)");
+ ThrowMsg(Exceptions::InvalidPackage,
+ "Given tizenId not found for update installation");
}
WidgetDAO::registerOrUpdateWidget(
- m_context.widgetConfig.tzAppid,
- m_context.widgetConfig,
- m_context.wacSecurity);
+ m_context.widgetConfig.tzAppid,
+ m_context.widgetConfig,
+ m_context.wacSecurity);
m_handle = WidgetDAOReadOnly::getHandle(
- m_context.widgetConfig.tzAppid);
- }
- else //new installation
- {
+ m_context.widgetConfig.tzAppid);
+ } else { //new installation
LogInfo("Registering widget...");
WidgetDAO::registerWidget(
- m_context.widgetConfig.tzAppid,
- m_context.widgetConfig,
- m_context.wacSecurity);
+ m_context.widgetConfig.tzAppid,
+ m_context.widgetConfig,
+ m_context.wacSecurity);
m_handle = WidgetDAOReadOnly::getHandle(
- m_context.widgetConfig.tzAppid);
+ m_context.widgetConfig.tzAppid);
}
- FOREACH (cap, m_context.staticPermittedDevCaps) {
- LogInfo("staticPermittedDevCaps : " << cap->first
- << " smack status: " << cap->second);
+ FOREACH(cap, m_context.staticPermittedDevCaps) {
+ LogInfo(
+ "staticPermittedDevCaps : " << cap->first
+ << " smack status: " <<
+ cap->second);
}
LogInfo("Widget registered");
@@ -128,15 +129,17 @@ void TaskDatabase::StepAceDBInsert()
if (ACE_OK != ace_unregister_widget(
static_cast(m_handleToRemove)))
{
- LogWarning("Error while removing ace entry for previous insallation");
- };
+ LogWarning(
+ "Error while removing ace entry for previous insallation");
+ }
}
- if(!AceApi::registerAceWidget(m_handle, m_context.widgetConfig,
- m_context.wacSecurity.getCertificateList()))
+ if (!AceApi::registerAceWidget(m_handle, m_context.widgetConfig,
+ m_context.wacSecurity.getCertificateList()))
{
LogError("ace database insert failed");
- ThrowMsg(Exceptions::UpdateFailed, "Update failure. ace_register_widget failed");
+ ThrowMsg(Exceptions::UpdateFailed,
+ "Update failure. ace_register_widget failed");
}
LogDebug("Ace data inserted");
@@ -147,16 +150,19 @@ void TaskDatabase::StepAceDBInsert()
void TaskDatabase::StepRegisterExternalFiles()
{
- WrtDB::ExternalLocationList externalLocationsUpdate = m_context.locations->listExternalLocations();
- if (m_context.existingWidgetInfo.isExist) //update
- {
+ WrtDB::ExternalLocationList externalLocationsUpdate =
+ m_context.locations->listExternalLocations();
+ if (m_context.existingWidgetInfo.isExist) { //update
Try
{
WidgetDAO dao(m_context.widgetConfig.tzAppid);
- WrtDB::ExternalLocationList externalLocationsDB = dao.getWidgetExternalLocations();
+ WrtDB::ExternalLocationList externalLocationsDB =
+ dao.getWidgetExternalLocations();
FOREACH(file, externalLocationsDB)
{
- if(std::find(externalLocationsUpdate.begin(), externalLocationsUpdate.end(), *file) == externalLocationsUpdate.end())
+ if (std::find(externalLocationsUpdate.begin(),
+ externalLocationsUpdate.end(),
+ *file) == externalLocationsUpdate.end())
{
m_externalLocationsToRemove.push_back(*file);
}
@@ -164,8 +170,10 @@ void TaskDatabase::StepRegisterExternalFiles()
}
Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
{
- LogError("Given tizenId not found for update installation (Same GUID?)");
- ThrowMsg(Exceptions::UpdateFailed, "Given tizenId not found for update installation");
+ LogError(
+ "Given tizenId not found for update installation (Same GUID?)");
+ ThrowMsg(Exceptions::UpdateFailed,
+ "Given tizenId not found for update installation");
}
}
LogDebug("Registering external files:");
@@ -180,31 +188,25 @@ void TaskDatabase::StepRegisterExternalFiles()
void TaskDatabase::StepRemoveExternalFiles()
{
- if(!m_externalLocationsToRemove.empty())
- {
+ if (!m_externalLocationsToRemove.empty()) {
LogDebug("Removing external files:");
}
FOREACH(file, m_externalLocationsToRemove)
{
- if(WrtUtilFileExists(*file))
- {
+ if (WrtUtilFileExists(*file)) {
LogDebug(" -> " << *file);
if (-1 == TEMP_FAILURE_RETRY(remove(file->c_str()))) {
ThrowMsg(Exceptions::RemovingFileFailure,
"Failed to remove external file");
}
- }
- else if(WrtUtilDirExists(*file))
- {
+ } else if (WrtUtilDirExists(*file)) {
LogDebug(" -> " << *file);
- if(!WrtUtilRemove(*file)){
+ if (!WrtUtilRemove(*file)) {
ThrowMsg(Exceptions::RemovingFolderFailure,
- "Failed to remove external directory");
+ "Failed to remove external directory");
}
- }
- else
- {
+ } else {
LogWarning(" -> " << *file << "(no such a path)");
}
}
@@ -244,7 +246,8 @@ void TaskDatabase::StepCreateVconf()
command << " \"" << static_cast((*it).second) << "\"";
int ret = system(command.str().c_str());
if (-1 == ret) {
- ThrowMsg(Exceptions::CreateVconfFailure, "Failed to create vconf files");
+ ThrowMsg(Exceptions::CreateVconfFailure,
+ "Failed to create vconf files");
}
}
}
@@ -265,8 +268,9 @@ void TaskDatabase::StepAbortDBInsert()
ace_unregister_widget(static_cast(m_handle));
// Remove also old one. If it was already updated nothing wrong will happen,
// but if not old widget will be removed.
- if (INVALID_WIDGET_HANDLE != m_handleToRemove)
+ if (INVALID_WIDGET_HANDLE != m_handleToRemove) {
ace_unregister_widget(static_cast(m_handle));
+ }
}
void TaskDatabase::StepLiveboxDBInsert()
@@ -278,7 +282,7 @@ void TaskDatabase::StepLiveboxDBInsert()
std::string tizenId = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
for (auto it = m_context.widgetConfig.configInfo.m_livebox.begin();
- it != m_context.widgetConfig.configInfo.m_livebox.end(); ++it)
+ it != m_context.widgetConfig.configInfo.m_livebox.end(); ++it)
{
std::string boxId = DPL::ToUTF8String((**it).m_liveboxId);
std::string boxType;
@@ -292,13 +296,12 @@ void TaskDatabase::StepLiveboxDBInsert()
int ret =
web_provider_info_insert_box_type(
- boxId.c_str(), tizenId.c_str(), boxType.c_str());
+ boxId.c_str(), tizenId.c_str(), boxType.c_str());
if (ret < 0) {
LogDebug("failed to set type of livebox: " << boxId);
}
}
}
-
} //namespace WidgetInstall
} //namespace Jobs
diff --git a/src/jobs/widget_install/task_database.h b/src/jobs/widget_install/task_database.h
index 5b2c154..608dbfe 100644
--- a/src/jobs/widget_install/task_database.h
+++ b/src/jobs/widget_install/task_database.h
@@ -32,7 +32,7 @@ class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
-class TaskDatabase:
+class TaskDatabase :
public DPL::TaskDecl
{
private:
diff --git a/src/jobs/widget_install/task_encrypt_resource.cpp b/src/jobs/widget_install/task_encrypt_resource.cpp
index b6fe720..0d61b81 100644
--- a/src/jobs/widget_install/task_encrypt_resource.cpp
+++ b/src/jobs/widget_install/task_encrypt_resource.cpp
@@ -79,7 +79,7 @@ void TaskEncryptResource::StepEncryptResource()
LogDebug("Step Encrypt resource");
m_resEnc = new ResourceEncryptor;
m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(m_context.
- widgetConfig.tzAppid));
+ widgetConfig.tzAppid));
EncryptDirectory(m_context.locations->getTemporaryRootDir());
}
@@ -88,52 +88,52 @@ void TaskEncryptResource::EncryptDirectory(std::string path)
{
FTS *fts;
FTSENT *ftsent;
- char * const paths[] = {const_cast(path.c_str()), NULL};
+ char * const paths[] = { const_cast(path.c_str()), NULL };
- if ((fts = fts_open(paths, FTS_PHYSICAL|FTS_NOCHDIR, NULL)) == NULL) {
+ if ((fts = fts_open(paths, FTS_PHYSICAL | FTS_NOCHDIR, NULL)) == NULL) {
//ERROR
int error = errno;
LogWarning(__PRETTY_FUNCTION__ << ": fts_open failed with error: "
- << strerror(error));
+ << strerror(error));
ThrowMsg(Exceptions::InternalError, "Error reading directory: "
- << path);
+ << path);
}
while ((ftsent = fts_read(fts)) != NULL) {
switch (ftsent->fts_info) {
- case FTS_DP:
- case FTS_DC:
- case FTS_D:
- case FTS_DEFAULT:
- case FTS_SLNONE:
- //directories, non-regular files, dangling symbolic links
- break;
- case FTS_F:
- case FTS_NSOK:
- case FTS_SL:
- //regular files and other objects that can be counted
- if (isSupportedForEncryption(ftsent->fts_path)) {
- EncryptFile(ftsent->fts_path);
- }
- break;
- case FTS_NS:
- case FTS_DOT:
- case FTS_DNR:
- case FTS_ERR:
- default:
- LogWarning(__PRETTY_FUNCTION__
- << ": traversal failed on file: "
- << ftsent->fts_path
- << " with error: "
- << strerror(ftsent->fts_errno));
- ThrowMsg(Exceptions::InternalError, "Error reading file");
+ case FTS_DP:
+ case FTS_DC:
+ case FTS_D:
+ case FTS_DEFAULT:
+ case FTS_SLNONE:
+ //directories, non-regular files, dangling symbolic links
+ break;
+ case FTS_F:
+ case FTS_NSOK:
+ case FTS_SL:
+ //regular files and other objects that can be counted
+ if (isSupportedForEncryption(ftsent->fts_path)) {
+ EncryptFile(ftsent->fts_path);
+ }
+ break;
+ case FTS_NS:
+ case FTS_DOT:
+ case FTS_DNR:
+ case FTS_ERR:
+ default:
+ LogWarning(__PRETTY_FUNCTION__
+ << ": traversal failed on file: "
+ << ftsent->fts_path
+ << " with error: "
+ << strerror(ftsent->fts_errno));
+ ThrowMsg(Exceptions::InternalError, "Error reading file");
}
}
if (fts_close(fts) == -1) {
int error = errno;
LogWarning(__PRETTY_FUNCTION__ << ": fts_close failed with error: "
- << strerror(error));
+ << strerror(error));
}
}
@@ -146,11 +146,11 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
struct stat buf;
int ret = stat(fileName.c_str(), &buf);
- if(ret == 0) {
+ if (ret == 0) {
size_t fileSize = buf.st_size;
FILE* resFp = fopen(fileName.c_str(), "r");
- if ( NULL == resFp) {
+ if (NULL == resFp) {
LogError("Couldnot open file : " << fileName);
return;
}
@@ -164,10 +164,12 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
memset(outEncBuf, 0, blockSize);
ret = fread(readBuf, sizeof(unsigned char), fileSize, resFp);
- if (ret!=fileSize){
- LogError("Failed to read ecryption buffer with error: " << strerror(errno) );
+ if (ret != fileSize) {
+ LogError(
+ "Failed to read ecryption buffer with error: " <<
+ strerror(errno) );
fclose(resFp);
- return;
+ return;
}
m_resEnc->EncryptChunk(readBuf, outEncBuf, fileSize);
@@ -192,8 +194,9 @@ void TaskEncryptResource::EncryptFile(const std::string &fileName)
}
std::string realPath = fileName;
- realPath.replace(0, m_context.locations->getTemporaryRootDir().length(),
- m_context.locations->getSourceDir());
+ realPath.replace(0,
+ m_context.locations->getTemporaryRootDir().length(),
+ m_context.locations->getSourceDir());
WrtDB::EncryptedFileInfo info;
info.fileName = DPL::FromUTF8String(realPath);
diff --git a/src/jobs/widget_install/task_encrypt_resource.h b/src/jobs/widget_install/task_encrypt_resource.h
index de37640..72dac56 100644
--- a/src/jobs/widget_install/task_encrypt_resource.h
+++ b/src/jobs/widget_install/task_encrypt_resource.h
@@ -31,10 +31,9 @@ class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
-
class TaskEncryptResource : public DPL::TaskDecl
{
-private:
+ private:
// Installation context
InstallerContext &m_context;
std::string tempInstalledPath;
@@ -49,7 +48,6 @@ private:
public:
explicit TaskEncryptResource(InstallerContext &installerContext);
};
-
} // namespace WidgetInstall
} // namespace Jobs
#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_ENCRYPT_RESOURCE_H_ */
diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp
index 82aa151..65ccc0f 100644
--- a/src/jobs/widget_install/task_file_manipulation.cpp
+++ b/src/jobs/widget_install/task_file_manipulation.cpp
@@ -68,7 +68,7 @@ bool _FolderCopy(std::string source, std::string dest)
}
if (S_ISDIR(statInfo.st_mode)) {
- if(("." == fileName) || (".." == fileName)) {
+ if (("." == fileName) || (".." == fileName)) {
continue;
}
std::string destFolder = dest + "/" + fileName;
@@ -87,7 +87,7 @@ bool _FolderCopy(std::string source, std::string dest)
outfile.close();
infile.close();
}
- } while(dEntry);
+ } while (dEntry);
closedir(dir);
return true;
}
@@ -100,11 +100,12 @@ TaskFileManipulation::TaskFileManipulation(InstallerContext& context) :
m_context(context)
{
if (INSTALL_LOCATION_TYPE_EXTERNAL !=
- m_context.locationType) {
+ m_context.locationType)
+ {
AddStep(&TaskFileManipulation::StepCreateDirs);
AddStep(&TaskFileManipulation::StepCreatePrivateStorageDir);
if (m_context.widgetConfig.packagingType !=
- WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
+ WrtDB::PKG_TYPE_DIRECTORY_WEB_APP)
{
AddStep(&TaskFileManipulation::StepRenamePath);
AddAbortStep(&TaskFileManipulation::StepAbortRenamePath);
@@ -149,37 +150,37 @@ void TaskFileManipulation::StepCreatePrivateStorageDir()
std::string storagePath = m_context.locations->getPrivateStorageDir();
if (euidaccess(storagePath.c_str(), F_OK) != 0) {
- if(!WrtUtilMakeDir(storagePath, PRIVATE_STORAGE_MODE)){
+ if (!WrtUtilMakeDir(storagePath, PRIVATE_STORAGE_MODE)) {
LogError("Failed to create directory for private storage");
ThrowMsg(Exceptions::InternalError,
- "Failed to create directory for private storage");
+ "Failed to create directory for private storage");
}
// '5000' is default uid, gid for applications.
- // So installed applications should be launched as process of uid '5000'.
+ // So installed applications should be launched as process of uid
+ // '5000'.
// the process can access private directory 'data' of itself.
- if(chown(storagePath.c_str(),
- WEBAPP_DEFAULT_UID,
- WEBAPP_DEFAULT_GID) != 0)
+ if (chown(storagePath.c_str(),
+ WEBAPP_DEFAULT_UID,
+ WEBAPP_DEFAULT_GID) != 0)
{
ThrowMsg(Exceptions::InternalError,
- "Chown to invaild user");
+ "Chown to invaild user");
}
} else if (euidaccess(storagePath.c_str(), W_OK | R_OK | X_OK) == 0) {
LogInfo("Private storage already exists.");
// Even if private directory already is created, private dircetory
// should change owner.
- if(chown(storagePath.c_str(),
- WEBAPP_DEFAULT_UID,
- WEBAPP_DEFAULT_GID) != 0)
+ if (chown(storagePath.c_str(),
+ WEBAPP_DEFAULT_UID,
+ WEBAPP_DEFAULT_GID) != 0)
{
ThrowMsg(Exceptions::InternalError,
- "Chown to invaild user");
+ "Chown to invaild user");
}
- if(chmod(storagePath.c_str(), PRIVATE_STORAGE_MODE) != 0) {
+ if (chmod(storagePath.c_str(), PRIVATE_STORAGE_MODE) != 0) {
ThrowMsg(Exceptions::InternalError,
- "chmod to 0700");
+ "chmod to 0700");
}
-
} else {
ThrowMsg(Exceptions::InternalError,
"No access to private storage.");
@@ -199,12 +200,14 @@ void TaskFileManipulation::StepRenamePath()
LogDebug("Copy file from temp directory to " << instDir);
if (!WrtUtilRemove(instDir)) {
ThrowMsg(Exceptions::RemovingFolderFailure,
- "Error occurs during removing existing folder");
+ "Error occurs during removing existing folder");
}
- if (!(rename(m_context.locations->getTemporaryPackageDir().c_str(), instDir.c_str()) == 0)) {
+ if (!(rename(m_context.locations->getTemporaryPackageDir().c_str(),
+ instDir.c_str()) == 0))
+ {
ThrowMsg(Exceptions::UnknownError,
- "Error occurs during renaming widget folder");
+ "Error occurs during renaming widget folder");
}
m_context.job->UpdateProgress(
InstallerContext::INSTALL_RENAME_PATH,
@@ -219,7 +222,7 @@ void TaskFileManipulation::StepAbortRenamePath()
widgetPath = m_context.locations->getPackageInstallationDir();
if (!WrtUtilRemove(widgetPath)) {
ThrowMsg(Exceptions::RemovingFolderFailure,
- "Error occurs during removing existing folder");
+ "Error occurs during removing existing folder");
}
}
LogDebug("Rename widget path sucessful!");
@@ -242,13 +245,15 @@ void TaskFileManipulation::StepPrepareExternalDir()
GList *list = NULL;
app2ext_dir_details* dirDetail = NULL;
- std::string dirNames[2] = {GLIST_RES_DIR, GLIST_BIN_DIR};
+ std::string dirNames[2] = { GLIST_RES_DIR, GLIST_BIN_DIR };
for (int i = 0; i < 2; i++) {
dirDetail = (app2ext_dir_details*) calloc(1,
- sizeof(app2ext_dir_details));
+ sizeof(
+ app2ext_dir_details));
if (NULL == dirDetail) {
- ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "error in app2ext");
+ ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "error in app2ext");
}
dirDetail->name = strdup(dirNames[i].c_str());
dirDetail->type = APP2EXT_DIR_RO;
@@ -257,17 +262,18 @@ void TaskFileManipulation::StepPrepareExternalDir()
if (false == m_context.existingWidgetInfo.isExist) {
WidgetInstallToExtSingleton::Instance().preInstallation(list,
- folderSize);
+ folderSize);
} else {
WidgetInstallToExtSingleton::Instance().preUpgrade(list,
- folderSize);
+ folderSize);
}
free(dirDetail);
g_list_free(list);
}
- Catch (WidgetInstallToExt::Exception::ErrorInstallToExt)
+ Catch(WidgetInstallToExt::Exception::ErrorInstallToExt)
{
- ReThrowMsg(Exceptions::ErrorExternalInstallingFailure, "Error during \
+ ReThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "Error during \
create external folder ");
}
}
@@ -276,17 +282,18 @@ void TaskFileManipulation::StepInstallToExternal()
{
LogDebug("StepInstallExternal");
if (!WrtUtilMakeDir(m_context.locations->getSourceDir())) {
- ThrowMsg(Exceptions::ErrorExternalInstallingFailure, "To make src \
+ ThrowMsg(Exceptions::ErrorExternalInstallingFailure,
+ "To make src \
directory failed");
}
LogDebug("Resource move to external storage " <<
- m_context.locations->getSourceDir());
+ m_context.locations->getSourceDir());
if (!_FolderCopy(m_context.locations->getTemporaryPackageDir(),
- m_context.locations->getSourceDir()))
+ m_context.locations->getSourceDir()))
{
ThrowMsg(Exceptions::UnknownError,
- "Error occurs during renaming widget folder");
+ "Error occurs during renaming widget folder");
}
}
diff --git a/src/jobs/widget_install/task_install_ospsvc.cpp b/src/jobs/widget_install/task_install_ospsvc.cpp
index 150f60f..3fe94ef 100644
--- a/src/jobs/widget_install/task_install_ospsvc.cpp
+++ b/src/jobs/widget_install/task_install_ospsvc.cpp
@@ -55,7 +55,8 @@ void TaskInstallOspsvc::StepInstallOspService()
LogInfo("Step: installation for osp service");
std::ostringstream commStr;
- commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.locations->getPackageInstallationDir());
+ commStr << OSP_INSTALL_STR << BashUtils::escape_arg(
+ m_context.locations->getPackageInstallationDir());
//commStr << " 2>&1";
LogDebug("osp install command : " << commStr.str());
@@ -64,7 +65,8 @@ void TaskInstallOspsvc::StepInstallOspService()
fd = popen(commStr.str().c_str(), "r");
if (NULL == fd) {
LogError("Failed to installtion osp service");
- ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\
+ ThrowMsg(Exceptions::InstallOspsvcFailed,
+ "Error occurs during\
install osp service");
}
fgets(readBuf, MAX_BUF_SIZE, fd);
@@ -72,7 +74,8 @@ void TaskInstallOspsvc::StepInstallOspService()
int result = atoi(readBuf);
if (0 != result) {
- ThrowMsg(Exceptions::InstallOspsvcFailed, "Error occurs during\
+ ThrowMsg(Exceptions::InstallOspsvcFailed,
+ "Error occurs during\
install osp service");
}
diff --git a/src/jobs/widget_install/task_install_ospsvc.h b/src/jobs/widget_install/task_install_ospsvc.h
index 29d6d80..445bfb4 100644
--- a/src/jobs/widget_install/task_install_ospsvc.h
+++ b/src/jobs/widget_install/task_install_ospsvc.h
@@ -29,10 +29,9 @@ class InstallerContext;
namespace Jobs {
namespace WidgetInstall {
-
class TaskInstallOspsvc : public DPL::TaskDecl
{
-private:
+ private:
// Installation context
InstallerContext &m_context;
@@ -42,14 +41,13 @@ private:
// return callback
static int StatusCallback(
- int req_id, const char *pkg_type, const char *pkg_name,
- const char *key, const char *val, const void *pmsg,
- void *priv_data);
+ int req_id, const char *pkg_type, const char *pkg_name,
+ const char *key, const char *val, const void *pmsg,
+ void *priv_data);
public:
explicit TaskInstallOspsvc(InstallerContext &installerContext);
};
-
} // namespace WidgetInstall
} // namespace Jobs
#endif /* SRC_JOBS_WIDGET_INSTALL_TASK_INSTALL_OSPSVC_H_ */
diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp
old mode 100755
new mode 100644
index 67a4f4e..92b372c
--- a/src/jobs/widget_install/task_manifest_file.cpp
+++ b/src/jobs/widget_install/task_manifest_file.cpp
@@ -63,7 +63,7 @@ LanguageTagMap getLanguageTagMap()
{
LanguageTagMap map;
-#define ADD(tag, l_tag) map.insert(std::make_pair(L ## # tag, L ## # l_tag));
+#define ADD(tag, l_tag) map.insert(std::make_pair(L###tag, L###l_tag));
#include "languages.def"
#undef ADD
@@ -97,7 +97,6 @@ DPL::OptionalString getLangTag(const DPL::String& tag)
namespace Jobs {
namespace WidgetInstall {
-
const char * TaskManifestFile::encoding = "UTF-8";
TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
@@ -113,7 +112,7 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
} else {
- // for widget update.
+ // for widget update.
AddStep(&TaskManifestFile::stepBackupIconFiles);
AddStep(&TaskManifestFile::stepCopyIconFiles);
AddStep(&TaskManifestFile::stepGenerateManifest);
@@ -125,8 +124,7 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
}
TaskManifestFile::~TaskManifestFile()
-{
-}
+{}
void TaskManifestFile::stepCreateExecFile()
{
@@ -149,27 +147,32 @@ void TaskManifestFile::stepCopyIconFiles()
//which there is at least one icon in widget for, icon file is copied.
//Coping prioritize last positions when coping. If there is several icons
//with given locale, the one, that will be copied, will be icon
- //which is declared by tag later than the others in config.xml of widget
+ //which is declared by tag later than the others in config.xml of
+ // widget
std::vector generatedLocales;
- WrtDB::WidgetRegisterInfo::LocalizedIconList & icons = m_context.widgetConfig.localizationData.icons;
+ WrtDB::WidgetRegisterInfo::LocalizedIconList & icons =
+ m_context.widgetConfig.localizationData.icons;
- //reversed: last has highest priority to be copied if it has given locale (TODO: why was that working that way?)
- for(WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator icon = icons.rbegin(); icon != icons.rend(); icon++)
+ //reversed: last has highest priority to be copied if it has given
+ // locale (TODO: why was that working that way?)
+ for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
+ icon = icons.rbegin();
+ icon != icons.rend();
+ icon++)
{
FOREACH(locale, icon->availableLocales)
{
DPL::String src = icon->src;
LogDebug("Icon for locale: " << *locale << "is : " << src);
- if(std::find(generatedLocales.begin(), generatedLocales.end(), *locale) != generatedLocales.end())
+ if (std::find(generatedLocales.begin(), generatedLocales.end(),
+ *locale) != generatedLocales.end())
{
LogDebug("Skipping - has that locale");
continue;
- }
- else
- {
+ } else {
generatedLocales.push_back(*locale);
}
@@ -187,10 +190,11 @@ void TaskManifestFile::stepCopyIconFiles()
targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
targetFile << getIconTargetFilename(*locale);
-
if (m_context.widgetConfig.packagingType ==
- WrtDB::PKG_TYPE_HOSTED_WEB_APP) {
- m_context.locations->setIconTargetFilenameForLocale(targetFile.str());
+ WrtDB::PKG_TYPE_HOSTED_WEB_APP)
+ {
+ m_context.locations->setIconTargetFilenameForLocale(
+ targetFile.str());
}
LogDebug("Copying icon: " << sourceFile.str() <<
@@ -208,27 +212,30 @@ void TaskManifestFile::stepCopyIconFiles()
Catch(DPL::FileInput::Exception::Base)
{
// Error while opening or closing source file
- //ReThrowMsg(InstallerException::CopyIconFailed, sourceFile.str());
+ //ReThrowMsg(InstallerException::CopyIconFailed,
+ // sourceFile.str());
LogError(
- "Copying widget's icon failed. Widget's icon will not be"\
+ "Copying widget's icon failed. Widget's icon will not be" \
"available from Main Screen");
}
Catch(DPL::FileOutput::Exception::Base)
{
// Error while opening or closing target file
- //ReThrowMsg(InstallerException::CopyIconFailed, targetFile.str());
+ //ReThrowMsg(InstallerException::CopyIconFailed,
+ // targetFile.str());
LogError(
- "Copying widget's icon failed. Widget's icon will not be"\
+ "Copying widget's icon failed. Widget's icon will not be" \
"available from Main Screen");
}
Catch(DPL::CopyFailed)
{
// Error while copying
- //ReThrowMsg(InstallerException::CopyIconFailed, targetFile.str());
+ //ReThrowMsg(InstallerException::CopyIconFailed,
+ // targetFile.str());
LogError(
- "Copying widget's icon failed. Widget's icon will not be"\
+ "Copying widget's icon failed. Widget's icon will not be" \
"available from Main Screen");
}
}
@@ -286,18 +293,18 @@ void TaskManifestFile::stepAbortIconFiles()
Catch(DPL::FileInput::Exception::Base)
{
LogError("Restoration icon File Failed." << backup_file.str()
- << " to " << res_file.str());
+ << " to " << res_file.str());
}
Catch(DPL::FileOutput::Exception::Base)
{
LogError("Restoration icon File Failed." << backup_file.str()
- << " to " << res_file.str());
+ << " to " << res_file.str());
}
Catch(DPL::CopyFailed)
{
LogError("Restoration icon File Failed." << backup_file.str()
- << " to " << res_file.str());
+ << " to " << res_file.str());
}
}
}
@@ -309,7 +316,7 @@ void TaskManifestFile::stepUpdateFinalize()
}
DPL::String TaskManifestFile::getIconTargetFilename(
- const DPL::String& languageTag) const
+ const DPL::String& languageTag) const
{
DPL::OStringStream filename;
TizenAppId appid = m_context.widgetConfig.tzAppid;
@@ -317,12 +324,15 @@ DPL::String TaskManifestFile::getIconTargetFilename(
filename << DPL::ToUTF8String(appid).c_str();
if (!languageTag.empty()) {
- DPL::OptionalString tag = getLangTag(languageTag); // translate en -> en_US etc
- if (tag.IsNull()) { tag = languageTag; }
+ DPL::OptionalString tag = getLangTag(languageTag); // translate en ->
+ // en_US etc
+ if (tag.IsNull()) {
+ tag = languageTag;
+ }
DPL::String locale =
LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
- if(locale.empty()) {
+ if (locale.empty()) {
filename << L"." << languageTag;
} else {
filename << L"." << locale;
@@ -339,13 +349,12 @@ void TaskManifestFile::stepFinalize()
LogInfo("Finished ManifestFile step");
}
-
void TaskManifestFile::saveLocalizedKey(std::ofstream &file,
- const DPL::String& key,
- const DPL::String& languageTag)
+ const DPL::String& key,
+ const DPL::String& languageTag)
{
DPL::String locale =
- LanguageTagsProvider::BCP47LanguageTagToLocale(languageTag);
+ LanguageTagsProvider::BCP47LanguageTagToLocale(languageTag);
file << key;
if (!locale.empty()) {
@@ -398,7 +407,8 @@ void TaskManifestFile::backupIconFiles()
FOREACH(it, fileList)
{
if (0 == (strncmp((*it).c_str(), appid.c_str(),
- strlen(appid.c_str())))) {
+ strlen(appid.c_str()))))
+ {
std::ostringstream icon_file, backup_icon;
icon_file << GlobalConfig::GetUserWidgetDesktopIconPath();
icon_file << "/" << (*it);
@@ -406,7 +416,7 @@ void TaskManifestFile::backupIconFiles()
backup_icon << b_icon_dir.str() << "/" << (*it);
LogDebug("Backup icon file " << icon_file.str() << " to " <<
- backup_icon.str());
+ backup_icon.str());
Try
{
DPL::FileInput input(icon_file.str());
@@ -435,7 +445,7 @@ void TaskManifestFile::backupIconFiles()
}
void TaskManifestFile::getFileList(const char* path,
- std::list &list)
+ std::list &list)
{
DIR* dir = opendir(path);
if (!dir) {
@@ -446,17 +456,18 @@ void TaskManifestFile::getFileList(const char* path,
struct dirent* d_ent;
do {
if ((d_ent = readdir(dir))) {
- if(strcmp(d_ent->d_name, ".") == 0 ||
- strcmp(d_ent->d_name, "..") == 0) {
+ if (strcmp(d_ent->d_name, ".") == 0 ||
+ strcmp(d_ent->d_name, "..") == 0)
+ {
continue;
}
std::string file_name = d_ent->d_name;
list.push_back(file_name);
}
- }while(d_ent);
+ } while (d_ent);
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
LogError("Failed to close dir: " << path << " with error: "
- << DPL::GetErrnoString());
+ << DPL::GetErrnoString());
}
}
@@ -481,13 +492,13 @@ void TaskManifestFile::stepParseManifest()
int code = pkgmgr_parser_parse_manifest_for_installation(
DPL::ToUTF8String(manifest_file).c_str(), NULL);
- if(code != 0)
- {
+ if (code != 0) {
LogError("Manifest parser error: " << code);
ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
}
- // TODO : It will be removed. AIL update is temporary code request by pkgmgr team.
+ // TODO : It will be removed. AIL update is temporary code request by pkgmgr
+ // team.
updateAilInfo();
m_context.job->UpdateProgress(
@@ -501,13 +512,13 @@ void TaskManifestFile::stepParseUpgradedManifest()
int code = pkgmgr_parser_parse_manifest_for_upgrade(
DPL::ToUTF8String(manifest_file).c_str(), NULL);
- if(code != 0)
- {
+ if (code != 0) {
LogError("Manifest parser error: " << code);
ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
}
- // TODO : It will be removed. AIL update is temporary code request by pkgmgr team.
+ // TODO : It will be removed. AIL update is temporary code request by pkgmgr
+ // team.
updateAilInfo();
m_context.job->UpdateProgress(
@@ -565,42 +576,44 @@ void TaskManifestFile::setWidgetName(Manifest & manifest, UiApplication & uiApp)
{
bool defaultNameSaved = false;
- DPL::OptionalString defaultLocale = m_context.widgetConfig.configInfo.defaultlocale;
- std::pair defaultLocalizedData;
+ DPL::OptionalString defaultLocale =
+ m_context.widgetConfig.configInfo.defaultlocale;
+ std::pair defaultLocalizedData;
//labels
FOREACH(localizedData, m_context.widgetConfig.configInfo.localizedDataSet)
{
Locale i = localizedData->first;
DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc
- if (tag.IsNull())
- {
+ if (tag.IsNull()) {
tag = i;
}
DPL::OptionalString name = localizedData->second.name;
generateWidgetName(manifest, uiApp, tag, name, defaultNameSaved);
//store default locale localized data
- if(!!defaultLocale && defaultLocale == i)
- {
+ if (!!defaultLocale && defaultLocale == i) {
defaultLocalizedData = *localizedData;
}
}
- if (!!defaultLocale && !defaultNameSaved)
- {
+ if (!!defaultLocale && !defaultNameSaved) {
DPL::OptionalString name = defaultLocalizedData.second.name;
- generateWidgetName(manifest, uiApp, DPL::OptionalString::Null, name, defaultNameSaved);
+ generateWidgetName(manifest,
+ uiApp,
+ DPL::OptionalString::Null,
+ name,
+ defaultNameSaved);
}
//appid
TizenAppId appid = m_context.widgetConfig.tzAppid;
uiApp.setAppid(appid);
-
//extraid
- if(!!m_context.widgetConfig.guid) {
+ if (!!m_context.widgetConfig.guid) {
uiApp.setExtraid(*m_context.widgetConfig.guid);
} else {
- if(!appid.empty()) {
+ if (!appid.empty()) {
uiApp.setExtraid(DPL::String(L"http://") + appid);
}
}
@@ -610,25 +623,24 @@ void TaskManifestFile::setWidgetName(Manifest & manifest, UiApplication & uiApp)
manifest.setType(L"wgt");
}
-void TaskManifestFile::generateWidgetName(Manifest & manifest, UiApplication &uiApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool & defaultNameSaved)
+void TaskManifestFile::generateWidgetName(Manifest & manifest,
+ UiApplication &uiApp,
+ const DPL::OptionalString& tag,
+ DPL::OptionalString name,
+ bool & defaultNameSaved)
{
if (!!name) {
- if (!!tag)
- {
+ if (!!tag) {
DPL::String locale =
- LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
+ LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
if (!locale.empty()) {
- uiApp.addLabel(LabelType(*name,*tag));
- }
- else
- {
+ uiApp.addLabel(LabelType(*name, *tag));
+ } else {
uiApp.addLabel(LabelType(*name));
manifest.addLabel(LabelType(*name));
}
- }
- else
- {
+ } else {
defaultNameSaved = true;
uiApp.addLabel(LabelType(*name));
manifest.addLabel(LabelType(*name));
@@ -642,62 +654,65 @@ void TaskManifestFile::setWidgetIcons(UiApplication & uiApp)
//changes.
bool defaultIconSaved = false;
- DPL::OptionalString defaultLocale = m_context.widgetConfig.configInfo.defaultlocale;
+ DPL::OptionalString defaultLocale =
+ m_context.widgetConfig.configInfo.defaultlocale;
std::vector generatedLocales;
- WrtDB::WidgetRegisterInfo::LocalizedIconList & icons = m_context.widgetConfig.localizationData.icons;
-
- //reversed: last has highest priority to be writen to manifest if it has given locale (TODO: why was that working that way?)
- for(WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator icon = icons.rbegin(); icon != icons.rend(); icon++)
+ WrtDB::WidgetRegisterInfo::LocalizedIconList & icons =
+ m_context.widgetConfig.localizationData.icons;
+
+ //reversed: last has highest priority to be writen to manifest if it
+ // has given locale (TODO: why was that working that way?)
+ for (WrtDB::WidgetRegisterInfo::LocalizedIconList::const_reverse_iterator
+ icon = icons.rbegin();
+ icon != icons.rend();
+ icon++)
{
FOREACH(locale, icon->availableLocales)
{
- if(std::find(generatedLocales.begin(), generatedLocales.end(), *locale) != generatedLocales.end())
+ if (std::find(generatedLocales.begin(), generatedLocales.end(),
+ *locale) != generatedLocales.end())
{
LogDebug("Skipping - has that locale - already in manifest");
continue;
- }
- else
- {
+ } else {
generatedLocales.push_back(*locale);
}
- DPL::OptionalString tag = getLangTag(*locale); // translate en -> en_US etc
- if (tag.IsNull()) { tag = *locale; }
+ DPL::OptionalString tag = getLangTag(*locale); // translate en ->
+ // en_US etc
+ if (tag.IsNull()) {
+ tag = *locale;
+ }
generateWidgetIcon(uiApp, tag, *locale, defaultIconSaved);
}
}
- if (!!defaultLocale && !defaultIconSaved)
- {
+ if (!!defaultLocale && !defaultIconSaved) {
generateWidgetIcon(uiApp, DPL::OptionalString::Null,
DPL::String(),
defaultIconSaved);
}
}
-void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag,
- const DPL::String& language, bool & defaultIconSaved)
+void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp,
+ const DPL::OptionalString& tag,
+ const DPL::String& language,
+ bool & defaultIconSaved)
{
DPL::String locale;
- if (!!tag)
- {
+ if (!!tag) {
locale = LanguageTagsProvider::BCP47LanguageTagToLocale(*tag);
- }
- else
- {
+ } else {
defaultIconSaved = true;
}
DPL::String iconText;
iconText += getIconTargetFilename(language);
- if(!locale.empty())
- {
+ if (!locale.empty()) {
uiApp.addIcon(IconType(iconText, locale));
- }
- else
- {
+ } else {
uiApp.addIcon(IconType(iconText));
}
}
@@ -706,44 +721,44 @@ void TaskManifestFile::setWidgetManifest(Manifest & manifest)
{
manifest.setPackage(m_context.widgetConfig.tzPkgid);
- if(!!m_context.widgetConfig.version)
- {
+ if (!!m_context.widgetConfig.version) {
manifest.setVersion(*m_context.widgetConfig.version);
}
DPL::String email = (!!m_context.widgetConfig.configInfo.authorEmail ?
- *m_context.widgetConfig.configInfo.authorEmail : L"");
+ *m_context.widgetConfig.configInfo.authorEmail : L"");
DPL::String href = (!!m_context.widgetConfig.configInfo.authorHref ?
- *m_context.widgetConfig.configInfo.authorHref : L"");
+ *m_context.widgetConfig.configInfo.authorHref : L"");
DPL::String name = (!!m_context.widgetConfig.configInfo.authorName ?
- *m_context.widgetConfig.configInfo.authorName : L"");
- manifest.addAuthor(Author(email,href,L"",name));
+ *m_context.widgetConfig.configInfo.authorName : L"");
+ manifest.addAuthor(Author(email, href, L"", name));
}
void TaskManifestFile::setWidgetOtherInfo(UiApplication & uiApp)
{
FOREACH(it, m_context.widgetConfig.configInfo.settingsList)
{
- if(!strcmp(DPL::ToUTF8String(it->m_name).c_str(), ST_NODISPLAY)) {
- if(!strcmp(DPL::ToUTF8String(it->m_value).c_str(), ST_TRUE)) {
+ if (!strcmp(DPL::ToUTF8String(it->m_name).c_str(), ST_NODISPLAY)) {
+ if (!strcmp(DPL::ToUTF8String(it->m_value).c_str(), ST_TRUE)) {
uiApp.setNodisplay(true);
uiApp.setTaskmanage(false);
- }
- else {
+ } else {
uiApp.setNodisplay(false);
uiApp.setTaskmanage(true);
}
- }
- }
+ }
+ }
//TODO
//There is no "X-TIZEN-PackageType=wgt"
- //There is no X-TIZEN-PackageID in manifest "X-TIZEN-PackageID=" << DPL::ToUTF8String(*widgetID).c_str()
+ //There is no X-TIZEN-PackageID in manifest "X-TIZEN-PackageID=" <<
+ // DPL::ToUTF8String(*widgetID).c_str()
//There is no Comment in pkgmgr "Comment=Widget application"
//that were in desktop file
}
void TaskManifestFile::setAppServiceInfo(UiApplication & uiApp)
{
- WrtDB::ConfigParserData::ServiceInfoList appServiceList = m_context.widgetConfig.configInfo.appServiceList;
+ WrtDB::ConfigParserData::ServiceInfoList appServiceList =
+ m_context.widgetConfig.configInfo.appServiceList;
if (appServiceList.empty()) {
LogInfo("Widget doesn't contain application service");
@@ -819,14 +834,12 @@ void TaskManifestFile::stepAbortParseManifest()
int code = pkgmgr_parser_parse_manifest_for_uninstallation(
DPL::ToUTF8String(manifest_file).c_str(), NULL);
- if (0 != code)
- {
+ if (0 != code) {
LogWarning("Manifest parser error: " << code);
ThrowMsg(ManifestParsingError, "Parser returncode: " << code);
}
int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
- if (0 != ret)
- {
+ if (0 != ret) {
LogWarning("No manifest file found: " << manifest_file);
}
}
@@ -840,12 +853,12 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
DPL::String appid = m_context.widgetConfig.tzAppid;
size_t found;
- if(ConfigInfo->m_liveboxId != L"") {
+ if (ConfigInfo->m_liveboxId != L"") {
found = ConfigInfo->m_liveboxId.find_last_of(L".");
- if(found != std::string::npos) {
- if(0 == ConfigInfo->m_liveboxId.compare(0, found, appid))
+ if (found != std::string::npos) {
+ if (0 == ConfigInfo->m_liveboxId.compare(0, found, appid)) {
liveBox.setLiveboxId(ConfigInfo->m_liveboxId);
- else {
+ } else {
DPL::String liveboxId =
appid + DPL::String(L".") + ConfigInfo->m_liveboxId;
liveBox.setLiveboxId(liveboxId);
@@ -857,37 +870,47 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
}
}
- if(ConfigInfo->m_primary != L"")
+ if (ConfigInfo->m_primary != L"") {
liveBox.setPrimary(ConfigInfo->m_primary);
+ }
- if(ConfigInfo->m_autoLaunch == L"true")
+ if (ConfigInfo->m_autoLaunch == L"true") {
liveBox.setAutoLaunch(appid);
+ }
- if(ConfigInfo->m_updatePeriod != L"")
+ if (ConfigInfo->m_updatePeriod != L"") {
liveBox.setUpdatePeriod(ConfigInfo->m_updatePeriod);
+ }
- if(ConfigInfo->m_label != L"")
+ if (ConfigInfo->m_label != L"") {
liveBox.setLabel(ConfigInfo->m_label);
+ }
DPL::String defaultLocale
- = DPL::FromUTF8String(m_context.locations->getPackageInstallationDir())
- + DPL::String(L"/res/wgt/");
+ = DPL::FromUTF8String(
+ m_context.locations->getPackageInstallationDir())
+ + DPL::String(L"/res/wgt/");
- if(ConfigInfo->m_icon!=L"") {
- liveBox.setIcon(defaultLocale+ConfigInfo->m_icon);
+ if (ConfigInfo->m_icon != L"") {
+ liveBox.setIcon(defaultLocale + ConfigInfo->m_icon);
}
- if (ConfigInfo->m_boxInfo.m_boxSrc.empty() || ConfigInfo->m_boxInfo.m_boxSize.empty()) {
+ if (ConfigInfo->m_boxInfo.m_boxSrc.empty() ||
+ ConfigInfo->m_boxInfo.m_boxSize.empty())
+ {
LogInfo("Widget doesn't contain box");
return;
} else {
BoxInfoType box;
if (!ConfigInfo->m_boxInfo.m_boxSrc.empty()) {
- if((0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 4, L"http"))
- || (0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 5, L"https")))
+ if ((0 == ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 4, L"http"))
+ || (0 ==
+ ConfigInfo->m_boxInfo.m_boxSrc.compare(0, 5, L"https")))
+ {
box.boxSrc = ConfigInfo->m_boxInfo.m_boxSrc;
- else
+ } else {
box.boxSrc = defaultLocale + ConfigInfo->m_boxInfo.m_boxSrc;
+ }
}
if (ConfigInfo->m_boxInfo.m_boxMouseEvent == L"true") {
@@ -896,18 +919,20 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
box.boxMouseEvent = L"false";
}
- std::list> BoxSizeList
+ std::list > BoxSizeList
= ConfigInfo->m_boxInfo.m_boxSize;
FOREACH(im, BoxSizeList) {
std::pair boxSize = *im;
- if(!boxSize.second.empty())
+ if (!boxSize.second.empty()) {
boxSize.second = defaultLocale + boxSize.second;
+ }
box.boxSize.push_back(boxSize);
}
if (!ConfigInfo->m_boxInfo.m_pdSrc.empty()
- && !ConfigInfo->m_boxInfo.m_pdWidth.empty()
- && !ConfigInfo->m_boxInfo.m_pdHeight.empty()) {
+ && !ConfigInfo->m_boxInfo.m_pdWidth.empty()
+ && !ConfigInfo->m_boxInfo.m_pdHeight.empty())
+ {
box.pdSrc = defaultLocale + ConfigInfo->m_boxInfo.m_pdSrc;
box.pdWidth = ConfigInfo->m_boxInfo.m_pdWidth;
box.pdHeight = ConfigInfo->m_boxInfo.m_pdHeight;
@@ -916,8 +941,6 @@ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
}
manifest.addLivebox(liveBox);
}
-
}
-
} //namespace WidgetInstall
} //namespace Jobs
diff --git a/src/jobs/widget_install/task_manifest_file.h b/src/jobs/widget_install/task_manifest_file.h
old mode 100755
new mode 100644
index ec9e12b..de18c42
--- a/src/jobs/widget_install/task_manifest_file.h
+++ b/src/jobs/widget_install/task_manifest_file.h
@@ -38,7 +38,6 @@
#include
-
class InstallerContext;
namespace Jobs {
@@ -77,7 +76,8 @@ class TaskManifestFile :
void stepAbortIconFiles();
//private data
- std::list icon_list; //TODO: this should be registered as external files
+ std::list icon_list; //TODO: this should be registered as
+ // external files
std::ostringstream backup_dir;
xmlTextWriterPtr writer;
DPL::String manifest_name;
@@ -100,8 +100,15 @@ class TaskManifestFile :
void setAppCategory(UiApplication & uiApp);
void setLiveBoxInfo(Manifest& manifest);
- void generateWidgetName(Manifest & manifest, UiApplication &uiApp, const DPL::OptionalString& tag, DPL::OptionalString name, bool & defaultNameSaved);
- void generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag, const DPL::String& language, bool & defaultIconSaved);
+ void generateWidgetName(Manifest & manifest,
+ UiApplication &uiApp,
+ const DPL::OptionalString& tag,
+ DPL::OptionalString name,
+ bool & defaultNameSaved);
+ void generateWidgetIcon(UiApplication & uiApp,
+ const DPL::OptionalString& tag,
+ const DPL::String& language,
+ bool & defaultIconSaved);
//for widget update
void backupIconFiles();
@@ -109,11 +116,10 @@ class TaskManifestFile :
DPL::String getIconTargetFilename(const DPL::String& languageTag) const;
static void saveLocalizedKey(std::ofstream &file,
- const DPL::String& key,
- const DPL::String& languageTag);
+ const DPL::String& key,
+ const DPL::String& languageTag);
static const char * encoding;
-
};
} //namespace WidgetInstall
} //namespace Jobs
diff --git a/src/jobs/widget_install/task_plugins_copy.cpp b/src/jobs/widget_install/task_plugins_copy.cpp
index 528f12e..0e72ced 100644
--- a/src/jobs/widget_install/task_plugins_copy.cpp
+++ b/src/jobs/widget_install/task_plugins_copy.cpp
@@ -45,14 +45,13 @@ const std::string plugins_dir = "i586";
#endif
namespace {
- const std::string PackagePluginsDir = "/plugins/";
- const std::string InstallationPluginsDir = "/data/.netscape/plugins/";
- const mode_t InstallationPluginsDirMode = 0755;
+const std::string PackagePluginsDir = "/plugins/";
+const std::string InstallationPluginsDir = "/data/.netscape/plugins/";
+const mode_t InstallationPluginsDirMode = 0755;
}
namespace Jobs {
namespace WidgetInstall {
-
TaskPluginsCopy::TaskPluginsCopy(InstallerContext& context) :
DPL::TaskDecl(this),
m_context(context)
@@ -63,9 +62,9 @@ TaskPluginsCopy::TaskPluginsCopy(InstallerContext& context) :
AddStep(&TaskPluginsCopy::StepCopyingFinished);
LogDebug("Widget plugins copy task ended");
m_npsource = m_context.locations->getSourceDir() + PackagePluginsDir
- + plugins_dir;
+ + plugins_dir;
m_npdestination = m_context.locations->getPackageInstallationDir()
- + InstallationPluginsDir;
+ + InstallationPluginsDir;
}
void TaskPluginsCopy::StepFindPlugins()
@@ -73,9 +72,11 @@ void TaskPluginsCopy::StepFindPlugins()
LogDebug("Starting plugins finding step");
/* Check whether plugins directory for actual architecture exists
* (plugins for other architectures are omitted even they exists). */
- if(!WrtUtilDirExists(m_npsource)) {
- LogDebug("Plugins directory (" <d_name;
- if(lstat(tempname.c_str(), &st) != 0) {
- LogWarning("Failed to call \"lstat\" (errno:" <d_name, "..", 2)!=0
- && strncmp(entry->d_name, ".", 1)!=0) {
+ if (S_ISDIR(st.st_mode)) {
+ if (strncmp(entry->d_name, "..", 2) != 0
+ && strncmp(entry->d_name, ".", 1) != 0)
+ {
LogError("Directory detected instead of plugin file: "
- << entry->d_name);
+ << entry->d_name);
/* Subdirectories inside plugins/ARCH are not supported */
if (-1 == TEMP_FAILURE_RETRY(closedir(dir))) {
- LogError("Failed to close dir: " << m_npsource
- << " with error: " << DPL::GetErrnoString());
+ LogError(
+ "Failed to close dir: " << m_npsource
+ << " with error: " <<
+ DPL::GetErrnoString());
}
- ThrowMsg(Exceptions::PluginsSubdirectory,
- "Subdirectories inside plugins directory are not supported");
- }
- else {
+ ThrowMsg(
+ Exceptions::PluginsSubdirectory,
+ "Subdirectories inside plugins directory are not supported");
+ } else {
continue;
}
}
tempname = std::string(entry->d_name);
/* Check whether file extension is ".so" */
- if(tempname.compare(tempname.size()-ext.size(), ext.size(), ext) == 0) {
+ if (tempname.compare(tempname.size() - ext.size(), ext.size(),
+ ext) == 0)
+ {
/* Plugin file found */
- LogDebug("Plugin file found: " <::const_iterator it = m_nplugins.begin();
- it != m_nplugins.end(); it++) {
+ for (std::list::const_iterator it = m_nplugins.begin();
+ it != m_nplugins.end(); it++)
+ {
LogDebug("Copying plugin file: " << (*it));
source = m_npsource + "/" + (*it);
destination = m_npdestination + (*it);
- if(rename(source.c_str(), destination.c_str()) != 0) {
- LogError("Failed to move " <