PluginModule::stop(context);
}
+void Bundle::fixWKMessageArgs(std::string & argScale, std::string & argEncodedBundle, std::string & argTheme)
+{
+ if (argScale != "null" && argScale[0] == '_')
+ {
+ argScale.erase(0, 1);
+
+ std::stringstream ssScale(argScale);
+ ssScale >> m_scale;
+ }
+
+ if (argEncodedBundle != "null" && argEncodedBundle[0] == '_')
+ {
+ argEncodedBundle.erase(0, 1);
+
+ m_encodedBundle = argEncodedBundle;
+ }
+
+ if (argTheme != "null" && argTheme[0] == '_')
+ {
+ argTheme.erase(0, 1);
+
+ m_theme = argTheme;
+ }
+}
+
void Bundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
{
LogDebug("got message type: " << toString(messageName).c_str());
}
// ** Language tags setting completed **
-
- if (argScale != "null" && argScale[0] == '_')
- {
- argScale.erase(0, 1);
-
- std::stringstream ssScale(argScale);
- ssScale >> m_scale;
- }
-
- if (argEncodedBundle != "null" && argEncodedBundle[0] == '_')
- {
- argEncodedBundle.erase(0, 1);
-
- m_encodedBundle = argEncodedBundle;
- }
-
- if (argTheme != "null" && argTheme[0] == '_')
- {
- argTheme.erase(0, 1);
-
- m_theme = argTheme;
- }
+ fixWKMessageArgs(argScale, argEncodedBundle, argTheme);
m_widgetType = dao.getWidgetType();
LogDebug("m_widgetType : " << m_widgetType.getApptypeToString() <<
ssMsg >> argEncodedBundle;
ssMsg >> argTheme;
- if(argScale != "null" && argScale[0] == '_')
- {
- argScale.erase(0, 1);
-
- std::stringstream ssScale(argScale);
- ssScale >> m_scale;
- }
-
- if(argEncodedBundle != "null" && argEncodedBundle[0] == '_')
- {
- argEncodedBundle.erase(0, 1);
-
- m_encodedBundle = argEncodedBundle;
- }
-
- if(argTheme != "null" && argTheme[0] == '_')
- {
- argTheme.erase(0, 1);
-
- m_theme = argTheme;
- }
+ fixWKMessageArgs(argScale, argEncodedBundle, argTheme);
//apply for each context
PageGlobalContext::iterator it = m_pageGlobalContext.begin();
return ret;
}
-static bool display_widget_info()
+static bool attachDbConnection()
{
if (NULL == g_dbConnection.get()) {
Try {
return FALSE;
}
}
+ return TRUE;
+}
+
+static bool display_widget_info()
+{
+ if(!attachDbConnection()) return FALSE;
WidgetDAOReadOnlyList widgetList =
WrtDB::WidgetDAOReadOnly::getWidgetList();
case 'v':
strncpy(temp_arg, optarg, strlen(optarg));
- if (NULL == g_dbConnection.get()) {
- Try {
- g_dbConnection.reset(new DBConnection());
- g_dbConnection->AttachDatabase();
- }
- Catch (DPL::DB::SqlConnection::Exception::Base) {
- LogDebug("Fail to connect DB");
- return FALSE;
- }
- }
+ if(!attachDbConnection()) return FALSE;
if (!strcmp("1", temp_arg)) {
WrtDB::GlobalDAO::SetDeveloperMode(true);
} else {
break;
case 'c':
strncpy(temp_arg, optarg, strlen(optarg));
- if (NULL == g_dbConnection.get()) {
- Try {
- g_dbConnection.reset(new DBConnection());
- g_dbConnection->AttachDatabase();
- }
- Catch (DPL::DB::SqlConnection::Exception::Base) {
- LogDebug("Fail to connect DB");
- return FALSE;
- }
- }
+ if(!attachDbConnection()) return FALSE;
if(!strcmp("1", temp_arg)) {
WrtDB::GlobalDAO::setComplianceMode(true);
} else {
break;
case 'i':
strncpy(temp_arg, optarg, strlen(optarg));
- if (NULL == g_dbConnection.get()) {
- Try {
- g_dbConnection.reset(new DBConnection());
- g_dbConnection->AttachDatabase();
- }
- Catch (DPL::DB::SqlConnection::Exception::Base) {
- LogDebug("Fail to connect DB");
- return FALSE;
- }
- }
+ if(!attachDbConnection()) return FALSE;
WrtDB::GlobalDAO::setComplianceFakeImei(temp_arg);
break;
case 'm':
strncpy(temp_arg, optarg, strlen(optarg));
- if (NULL == g_dbConnection.get()) {
- Try {
- g_dbConnection.reset(new DBConnection());
- g_dbConnection->AttachDatabase();
- }
- Catch (DPL::DB::SqlConnection::Exception::Base) {
- LogDebug("Fail to connect DB");
- return FALSE;
- }
- }
+ if(!attachDbConnection()) return FALSE;
WrtDB::GlobalDAO::setComplianceFakeMeid(temp_arg);
break;