Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.64
+Version: 0.4.65
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
<plugin-properties>
<library-name>libwrt-plugins-tizen-alarm.so</library-name>
<feature-install-uri>alarm.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
-
<api-feature>
<name>http://tizen.org/privilege/alarm</name>
<device-capability>alarm</device-capability>
<plugin-properties>
<library-name>libwrt-plugins-tizen-application.so</library-name>
<feature-install-uri>application.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/application.launch</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-bluetooth.so</library-name>
<feature-install-uri>bluetooth.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
-
<api-feature>
<name>http://tizen.org/privilege/bluetooth.gap</name>
<device-capability>bluetooth.gap</device-capability>
<plugin-properties>
<library-name>libwrt-plugins-tizen-bookmark.so</library-name>
<feature-install-uri>bookmark.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/bookmark.read</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-calendar.so</library-name>
<feature-install-uri>calendar.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
-
<api-feature>
<name>http://tizen.org/privilege/calendar.read</name>
<device-capability>calendar.read</device-capability>
<device-capability>calendar.write</device-capability>
</api-feature>
-</plugin-properties>
\ No newline at end of file
+</plugin-properties>
<plugin-properties>
<library-name>libwrt-plugins-tizen-callhistory.so</library-name>
<feature-install-uri>callhistory.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
-
<api-feature>
<name>http://tizen.org/privilege/callhistory.read</name>
<device-capability>callhistory.read</device-capability>
<plugin-properties>
<library-name>libwrt-plugins-tizen-contact.so</library-name>
<feature-install-uri>contact.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
-
+
<api-feature>
<name>http://tizen.org/privilege/contact.read</name>
<device-capability>contact.read</device-capability>
<plugin-properties>
<library-name>libwrt-plugins-tizen-content.so</library-name>
<feature-install-uri>content.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/content.read</name>
return NULL;
}
+void DataControlConverter::checkRowDataSize(const RowData* data, const std::string& where)
+{
+ unsigned long dataSize = 0;
+
+ if (data == NULL)
+ {
+ ThrowMsg(InvalidArgumentException, "No data to handle");
+ }
+
+ std::map<std::string, std::string>::const_iterator it;
+
+ for (it = data->m_Data.begin(); it != data->m_Data.end(); ++it)
+ {
+ dataSize += (unsigned long)it->first.size();
+ dataSize += (unsigned long)it->second.size();
+ }
+ dataSize += where.size();
+
+ if (dataSize > ROW_DATA_MAX)
+ {
+ ThrowMsg(InvalidArgumentException, "Data is too big");
+ }
+}
+
RowData* DataControlConverter::toRowDataPtr(const JSValueRef& arg)
{
if (JSValueIsNull(m_context, arg) || JSValueIsUndefined(m_context, arg)
std::string toString(int arg);
std::string toString(const JSStringRef& arg);
unsigned long toULong(const JSValueRef& arg);
+ void checkRowDataSize(const RowData* data, const std::string& where);
};
}
#define OSP_PKGINFO_SQL_TYPE "Sql"
#define OSP_PKGINFO_MAP_TYPE "Map"
+#define PROTOCOL_DATA_MAX 16 * 1024
+#define ROW_DATA_MAX 1024 * 1024
enum _DataControlRequestType
{
#include <TimeTracer.h>
#include <ArgumentValidator.h>
#include <JSUtil.h>
+#include "DataType.h"
#include "DataControlFactory.h"
#include "JSMappedDataControlConsumer.h"
#include "DataControlAsyncCallbackManager.h"
unsigned int reqId = converter.toULong(reserveArguments[0]);
std::string key = converter.toString(reserveArguments[1]);
std::string value = converter.toString(reserveArguments[2]);
+
+ unsigned long dataSize = key.size() + value.size();
+
+ if (dataSize > PROTOCOL_DATA_MAX)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Data is too big");
+ }
+
+
successCallback = converter.toFunctionOrNull(reserveArguments[3]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[4]);
successCallback = converter.toFunctionOrNull(reserveArguments[4]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[5]);
+ unsigned long dataSize = key.size() + oldValue.size() + newValue.size();
+
+ if (dataSize > PROTOCOL_DATA_MAX)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Data is too big");
+ }
+
+
cbm->setOnSuccess(successCallback);
cbm->setOnError(errorCallBack);
unsigned int reqId = converter.toULong(reserveArguments[0]);
std::string key = converter.toString(reserveArguments[1]);
+
+
+ unsigned long dataSize = key.size();
+
+ if (dataSize > PROTOCOL_DATA_MAX)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Data is too big");
+ }
+
successCallback = converter.toFunctionOrNull(reserveArguments[2]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[3]);
unsigned int reqId = converter.toULong(reserveArguments[0]);
std::string key = converter.toString(reserveArguments[1]);
std::string value = converter.toString(reserveArguments[2]);
+
+ unsigned long dataSize = key.size() + value.size();
+
+ if (dataSize > PROTOCOL_DATA_MAX)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Data is too big");
+ }
+
successCallback = converter.toFunctionOrNull(reserveArguments[3]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[4]);
#include <TimeTracer.h>
#include <ArgumentValidator.h>
#include <JSUtil.h>
+#include "DataType.h"
#include "DataControlFactory.h"
#include "JSSQLDataControlConsumer.h"
#include "DataControlAsyncCallbackManager.h"
unsigned int reqId = converter.toULong(reserveArguments[0]);
RowData* rowData = converter.toRowDataPtr(reserveArguments[1]);
+ std::string dummyWhere = "";
+
+ try
+ {
+ converter.checkRowDataSize(rowData, dummyWhere);
+ }
+ catch (const WrtDeviceApis::Commons::Exception& ex)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
+ }
+
unsigned int colSize = rowData->m_Data.size();
successCallback = converter.toFunctionOrNull(reserveArguments[2]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[3]);
RowData* rowData = converter.toRowDataPtr(reserveArguments[1]);
unsigned int colSize = rowData->m_Data.size();
std::string where = converter.toString(reserveArguments[2]);
+
+ try
+ {
+ converter.checkRowDataSize(rowData, where);
+ }
+ catch (const WrtDeviceApis::Commons::Exception& ex)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, ex.GetMessage());
+ }
+
successCallback = converter.toFunctionOrNull(reserveArguments[3]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[4]);
EventSelectPtr event(new EventSelect);
unsigned int reqId = converter.toULong(reserveArguments[0]);
+ unsigned long dataSize = 0;
LoggerD(reqId);
if (columns.size() == 0)
Throw(WrtDeviceApis::Commons::ConversionException);
-
+
+ for (size_t index = 0; index < columns.size(); index++)
+ {
+ dataSize += columns[index].size();
+ }
std::string where = converter.toString(reserveArguments[2]);
-
- LoggerD(where);
-
+ dataSize += where.size();
+
+ if (dataSize > PROTOCOL_DATA_MAX)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Data is too big");
+ }
successCallback = converter.toFunctionOrNull(reserveArguments[3]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[4]);
successCallback = converter.toFunctionOrNull(reserveArguments[2]);
errorCallBack = converter.toFunctionOrNull(reserveArguments[3]);
+ unsigned long dataSize = where.size();
+
+ if (dataSize > PROTOCOL_DATA_MAX)
+ {
+ return JSWebAPIErrorFactory::postException(context, exception,
+ JSWebAPIErrorFactory::INVALID_VALUES_ERROR, "Data is too big");
+ }
+
+
cbm->setOnSuccess(successCallback);
cbm->setOnError(errorCallBack);
<plugin-properties>
<library-name>libwrt-plugins-tizen-datacontrol.so</library-name>
<feature-install-uri>datacontrol.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
+
<api-feature>
<name>http://tizen.org/privilege/datacontrol.consumer</name>
<device-capability>datacontrol.consumer</device-capability>
<plugin-properties>
<library-name>libwrt-plugins-tizen-datasync.so</library-name>
<feature-install-uri>datasync.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/datasync</name>
<device-capability>datasync</device-capability>
</api-feature>
-</plugin-properties>
\ No newline at end of file
+</plugin-properties>
<plugin-properties>
<library-name>libwrt-plugins-tizen-download.so</library-name>
<feature-install-uri>download.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/download</name>
<device-capability>download</device-capability>
</api-feature>
-</plugin-properties>
\ No newline at end of file
+</plugin-properties>
std::string realSrc = src->getFullPath();
std::string realDest = dest->getFullPath();
-
+
if (realSrc == realDest) {
ThrowMsg(Commons::PlatformException,
"Destination is same as source.");
}
+ else if (src->getPath() == dest->getPath() && dest->getName() == "") {
+ ThrowMsg(Commons::PlatformException,
+ "Destination is same as source.");
+ }
ThrowMsg(Commons::PlatformException,
"Destination is same as source.");
}
+ else if (src->getPath() == dest->getPath() && dest->getName() == "") {
+ ThrowMsg(Commons::PlatformException,
+ "Destination is same as source.");
+ }
INodePtr parent;
Try {
<plugin-properties>
<library-name>libwrt-plugins-tizen-filesystem.so</library-name>
<feature-install-uri>filesystem.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/filesystem.read</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-messageport.so</library-name>
<feature-install-uri>messageport.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/messageport</name>
m_subject = "";
m_lastMessageId = 0;
m_direction = 0;
+ m_result = true;
- return true;
+ return m_result;
}
//MailSender::getInstance();
LoggerD("account ID : " << m_accountId);
- ScopedMail mail(EmailService::createMailData(account));
+ ScopedMail mail(EmailService::createMailData(account, getWidgetPath()));
setEmailAccount(account); //save account
locationChecker = EmailUtils::isFrameworkEmailData(m_mail->file_path_plain);
if(locationChecker == true) // already exist palin body file on email frame work, we can not update that file so make new temp file
{
- LoggerD("create new plain body");
char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
error = mkstemp(buf);
umask(mask);
std::string bodyFile = buf;
- bodyFile = EmailUtils::TMP_DIR_PREFIX+bodyFile;
- LoggerD("bodyFile : " << bodyFile);
+ bodyFile = getWidgetPath()+EmailUtils::TMP_DIR_SEPERATOR+bodyFile;
FILE* f = fopen(bodyFile.c_str(), "w");
if (NULL != f) {
locationChecker = EmailUtils::isFrameworkEmailData(m_mail->file_path_html);
if((locationChecker == true) || (!m_mail->file_path_html)) // html file is not exist or exist on email frame work then create tmp html file
{
- LoggerD("create new html body");
char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
error = mkstemp(buf);
umask(mask);
std::string htmlFile = buf;
- htmlFile = EmailUtils::TMP_DIR_PREFIX+htmlFile;
- LoggerD("htmlFile : " << htmlFile);
+ htmlFile = getWidgetPath()+EmailUtils::TMP_DIR_SEPERATOR+htmlFile;
FILE* f = fopen(htmlFile.c_str(), "w");
if (NULL != f) {
EmailAccountInfo account = getEmailAccount();
m_accountId = account.getIntId(); //set account ID
LoggerD("account ID : " << m_accountId);
- m_mail.Reset(EmailService::createMailData(account));
+ m_mail.Reset(EmailService::createMailData(account, getWidgetPath()));
updateSubject();
updateBody();
EmailAccountInfo account = getEmailAccount();
m_accountId = account.getIntId(); //set account ID
LoggerD("account ID : " << m_accountId);
- m_mail.Reset(EmailService::createMailData(account));
+ m_mail.Reset(EmailService::createMailData(account, getWidgetPath()));
updateSubject();
updateBody();
//copy attachment file
std::stringstream cp_cmd;
- char buf[] = "/tmp/XXXXXX";
+ char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
error = mkstemp(buf);
umask(mask);
+ std::string attachFile = buf;
+ attachFile = getWidgetPath()+EmailUtils::TMP_DIR_SEPERATOR+attachFile;
+
cp_cmd << COMMAND_NAME;
cp_cmd << " " << COMMAND_SWITCH_RECURSIVE;
cp_cmd << " \"" << att->getFullPath() << "\"";
- cp_cmd << " \"" << buf << "\"";
+ cp_cmd << " \"" << attachFile << "\"";
attachment_info = EmailService::alloc<email_attachment_data_t>();
attachment_info->attachment_name = String::strdup(att->getShortName());
- attachment_info->attachment_path = String::strdup( buf );
+ attachment_info->attachment_path = String::strdup( attachFile );
attachment_info->save_status = true;
attachment_info->inline_content_status = 0;
if(att->getMimeType().size() > 0)
attachment_info->attachment_mime_type = String::strdup(att->getMimeType());
}
- LoggerD("attachment_info->attachment_name=" << attachment_info->attachment_name);
- LoggerD("attachment_info->attachment_path=" << attachment_info->attachment_path);
- LoggerD("attachment_info->save_status=" << attachment_info->save_status);
- LoggerD("attachment_info->inline_content_status=" << attachment_info->inline_content_status);
- LoggerD("attachment_info->attachment_mime_type=" << attachment_info->attachment_mime_type);
+// LoggerD("attachment_info->attachment_name=" << attachment_info->attachment_name);
+// LoggerD("attachment_info->attachment_path=" << attachment_info->attachment_path);
+// LoggerD("attachment_info->save_status=" << attachment_info->save_status);
+// LoggerD("attachment_info->inline_content_status=" << attachment_info->inline_content_status);
+// LoggerD("attachment_info->attachment_mime_type=" << attachment_info->attachment_mime_type);
- LoggerD("Copy Command=" << cp_cmd.str());
+// LoggerD("Copy Command=" << cp_cmd.str());
if (EINA_TRUE != ecore_file_is_dir(att->getFullPath().c_str())) {
- LoggerD("att->getFullPath().c_str()=" << att->getFullPath().c_str());
- if (EINA_TRUE != ecore_file_cp(att->getFullPath().c_str(), buf)) {
- LoggerD("buf=" << buf);
+// LoggerD("att->getFullPath().c_str()=" << att->getFullPath().c_str());
+ if (EINA_TRUE != ecore_file_cp(att->getFullPath().c_str(), attachFile.c_str())) {
+// LoggerD("buf=" << attachFile);
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to copy file");
}
}
}
*/
- LoggerD("add Attachment");
int error = email_add_attachment(m_mail->mail_id, attachment_info);
if (EMAIL_ERROR_NONE != error) {
LoggerD("error :" << error);
//copy attachment file
std::stringstream cp_cmd;
- char buf[] = "/tmp/XXXXXX";
+ char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
error = mkstemp(buf);
umask(mask);
+ std::string attachFile = buf;
+ attachFile = getWidgetPath()+EmailUtils::TMP_DIR_SEPERATOR+attachFile;
cp_cmd << COMMAND_NAME;
cp_cmd << " " << COMMAND_SWITCH_RECURSIVE;
cp_cmd << " \"" << att->getFullPath() << "\"";
- cp_cmd << " \"" << buf << "\"";
+ cp_cmd << " \"" << attachFile << "\"";
attachment_info = EmailService::alloc<email_attachment_data_t>();
attachment_info->attachment_name = String::strdup(att->getShortName());
- attachment_info->attachment_path = String::strdup( buf );
+ attachment_info->attachment_path = String::strdup( attachFile );
attachment_info->save_status = true;
attachment_info->inline_content_status = 1;
LoggerD("attachment_info->inline_content_status=" << attachment_info->inline_content_status);
attachment_info->attachment_mime_type = String::strdup(att->getMimeType());
}
- LoggerD("Copy Command=" << cp_cmd.str());
+// LoggerD("Copy Command=" << cp_cmd.str());
if (EINA_TRUE != ecore_file_is_dir(att->getFullPath().c_str())) {
- LoggerD("att->getFullPath().c_str()=" << att->getFullPath().c_str());
- if (EINA_TRUE != ecore_file_cp(att->getFullPath().c_str(), buf)) {
- LoggerD("buf=" << buf);
+// LoggerD("att->getFullPath().c_str()=" << att->getFullPath().c_str());
+ if (EINA_TRUE != ecore_file_cp(att->getFullPath().c_str(), attachFile.c_str())) {
ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Failed to copy file");
}
}
- LoggerD("attachment_info->attachment_mime_type=" << attachment_info->attachment_mime_type);
-/*
- int result = system(cp_cmd.str().c_str());
- if (-1 != result) {
- if (0 != WIFEXITED(result)) {
- if (0 != WEXITSTATUS(result)) {
- ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Command failed.");
- }
- } else {
- ThrowMsg(WrtDeviceApis::Commons::PlatformException,
- "Command terminated abnormally.");
- }
- } else {
- ThrowMsg(WrtDeviceApis::Commons::PlatformException, "Couldn't launch command.");
- }
-*/
-
-
- LoggerD("add Attachment");
int error = email_add_attachment(m_mail->mail_id, attachment_info);
if (EMAIL_ERROR_NONE != error) {
ThrowMsg(WrtDeviceApis::Commons::PlatformException,
}
else
{
- LoggerD(" attachment id : " << attachment_info->attachment_id);
- LoggerD(" attachment inline : " << attachment_info->inline_content_status);
- LoggerD(" setNth(i+(int)attachmentSize+1) : " << i+(int)attachmentSize+1);
+// LoggerD(" attachment id : " << attachment_info->attachment_id);
+// LoggerD(" attachment inline : " << attachment_info->inline_content_status);
+// LoggerD(" setNth(i+(int)attachmentSize+1) : " << i+(int)attachmentSize+1);
att->setDownloaded(true);
att->setIsInlineAttachment(TRUE);
att->setAttachmentID(attachment_info->attachment_id);
att->setMessage(SharedFromThis());
-// att->setNth(i+1);
att->setNth(i + (int)attachmentSize + 1);
}
#include "EmailService.h"
#include "ScopedMail.h"
#include "ScopedMailbox.h"
+#include "WidgetFilePathMgr.h"
#define LOG_ENTER LoggerD("---> ENTER");
#define LOG_EXIT LoggerD("---> EXIT");
namespace Messaging {
namespace EmailService {
-email_mail_data_t* createMailData(const EmailAccountInfo& account)
+email_mail_data_t* createMailData(const EmailAccountInfo& account, const std::string& filePath)
{
LOG_ENTER
int error = 0;
error = mkstemp(buf);
umask(mask);
std::string bodyFile = buf;
- bodyFile = EmailUtils::TMP_DIR_PREFIX+bodyFile;
+ bodyFile = filePath+EmailUtils::TMP_DIR_SEPERATOR+bodyFile;
LoggerD("bodyFile : " << bodyFile);
FILE* f = fopen(bodyFile.c_str(), "w");
}
#if 1
-email_mail_data_t* createMailData(const EmailAccountInfo& account);
+email_mail_data_t* createMailData(const EmailAccountInfo& account, const std::string& filePath);
email_mail_data_t* readMail(int mailId);
m_validisReadChangeStatus(true),
m_folder(DRAFTBOX),
m_folderId(-1),
+ m_widgetPath(""),
m_requestReceiver(NULL),
m_sendMessageEvent(NULL)
{
} else {
LoggerE("Failed to initialize message dateTime");
}
+ m_widgetPath = GetWidgetPath("");
}
IMessage::~IMessage()
return m_msgStatus;
}
+void IMessage::setWidgetPath(const std::string& filePath)
+{
+ m_widgetPath = filePath;
+}
+
+std::string IMessage::getWidgetPath() const
+{
+ return m_widgetPath;
+}
+
+
}
}
#include "ValidityPeriodHours.h"
#include "Subject.h"
#include "EventOnSendingFailed.h"
+#include "WidgetFilePathMgr.h"
namespace DeviceAPI {
namespace Messaging {
*/
int m_folderId;
+ /**
+ * widget path
+ */
+ std::string m_widgetPath;
+
/**
* User folder name
/**
* method used to set current user folder name
*/
+ void setWidgetPath(const std::string& arg);
+
+
+ /**
+ * method used to get current user folder name
+ */
+ std::string getWidgetPath() const;
+
+ /**
+ * method used to set current user folder name
+ */
void setCurrentUserFolder(const std::string& arg);
/**
void JSConversation::initialize(JSContextRef context, JSObjectRef object)
{
- LoggerD("JSConversation::initialize ");
JSConversationPriv* priv = static_cast<JSConversationPriv*>(JSObjectGetPrivate(object));
-;
+
if (priv == NULL)
{
LoggerD("Private data is null ");
void JSConversation::finalize(JSObjectRef object) {
JSConversationPriv* priv = static_cast<JSConversationPriv*>(JSObjectGetPrivate(object));
- LoggerD("JSConversation::Finalize");
-
if (priv != NULL)
{
JSObjectSetPrivate(object, NULL);
JSStringRef propertyName,
JSValueRef* exception)
{
- LoggerD("OK");
ConverterMessageFactory::ConverterType converter = ConverterMessageFactory::getConverter(context);
// WrtDeviceApis::CommonsJavaScript::Converter converter(context);
JSValueRef value,
JSValueRef* exception)
{
- LoggerD("entered");
if (JSStringIsEqualToUTF8CString(propertyName, CONVID)) {
return true;
JSObjectRef object,
JSPropertyNameAccumulatorRef propertyNames)
{
- LoggerD("Entered");
JSStringRef propertyName = NULL;
propertyName = JSStringCreateWithUTF8CString(CONVID);
#include <ArgumentValidator.h>
#include <Export.h>
+#include <WidgetDB/WidgetDBMgr.h>
#include "JSMessagingServiceManager.h"
#include "MessagingController.h"
#include "plugin_config.h"
#include "MessageAsyncCallbackManager.h"
#include "MessagingErrorMsg.h"
+#include "WidgetFilePathMgr.h"
using namespace std;
void JSMessagingServiceManager::initialize(JSContextRef context, JSObjectRef object) {
LoggerD("creation messaging instance");
+ int widgetId = -1;
JSMessagingServiceManagerPriv *priv = static_cast<JSMessagingServiceManagerPriv*>(JSObjectGetPrivate(object));
if (priv == NULL)
IMessagingServiceManagerPtr MessagingServiceManager(MessagingFactory::getInstance().getMessagingServiceManager());
priv = new JSMessagingServiceManagerPriv( context, MessagingServiceManager);
+ widgetId = WrtAccessSingleton::Instance().getWidgetId();
+ WrtDeviceApis::WidgetDB::Api::IWidgetDBPtr widgetDB = WrtDeviceApis::WidgetDB::Api::getWidgetDB(widgetId);
+ GetWidgetPath(widgetDB->getWidgetPersistentStoragePath());
+
if(!JSObjectSetPrivate(object, static_cast<void*>(priv))) {
LoggerE("Object can't store private data.");
delete priv;
#include <Logger.h>
IMPLEMENT_SAFE_SINGLETON(DeviceAPI::Messaging::MsgServiceHandle)
+IMPLEMENT_SAFE_SINGLETON(DeviceAPI::Messaging::WidgetFilePath)
#define LOG_ENTER LoggerD("---> ENTER");
#include "DBus/Connection.h"
#include "DBus/MessageEvent.h"
#include "MsgServiceHandleMgr.h"
+#include "WidgetFilePathMgr.h"
#include <IFilter.h>
#include "IConversation.h"
#include "Messaging.h"
#include "CallbackMgr.h"
#include "MsgServiceHandleMgr.h"
+#include "WidgetFilePathMgr.h"
#include <Logger.h>
#include <vconf.h>
namespace {
const char* TEXT_AREA = "Text";
const char* TEXT_FILE_EXTENSION = ".txt";
-const char* TEXT_DIR_PREFIX = "/tmp/";
+const char* TEXT_DIR_SEPERATOR = "/";
const int WHITE_COLOR = 0xffffff;
const int BLACK_COLOR = 0x000000;
const int ROOT_LAYOUT_WIDTH = 100;
Mms::Mms(const string& id) :
IMessage(MMS, id),
-// m_bodyFilePath(string(tmpnam(NULL)) + TEXT_FILE_EXTENSION),
m_messageData(NULL)
{
LoggerD("m_id=" << getIdRef());
- LoggerD("m_msgType=" << getMessageType());
char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
LoggerD("buf : " << buf << " i : " << i);
umask(mask);
m_bodyFilePath = buf;
- m_bodyFilePath = TEXT_DIR_PREFIX+m_bodyFilePath+TEXT_FILE_EXTENSION;
-
- LoggerD("m_bodyFilePath : " << m_bodyFilePath);
+ m_bodyFilePath = getWidgetPath()+TEXT_DIR_SEPERATOR+m_bodyFilePath+TEXT_FILE_EXTENSION;
if (getIdRef().empty()) {
- LoggerD("create new message");
createNewMessage();
} else {
- LoggerD("read existing message");
readExistingMessage();
}
}
m_messageData(NULL)
{
LoggerD("m_id=" << getIdRef());
- LoggerD("m_msgType=" << getMessageType());
- LoggerD("created msg_data : " << msg_data);
m_messageData = createNewCopyOfPLatformMsgWithAddressList(msg_data);
- LoggerD("created m_messageData : " << m_messageData);
char buf[] = "XXXXXX";
mode_t mask = umask(S_IWGRP | S_IWOTH);
LoggerD("buf : " << buf << " i : " << i);
umask(mask);
m_bodyFilePath = buf;
- m_bodyFilePath = TEXT_DIR_PREFIX+m_bodyFilePath+TEXT_FILE_EXTENSION;
-
- LoggerD("m_bodyFilePath : " << m_bodyFilePath);
-
+ m_bodyFilePath = getWidgetPath()+TEXT_DIR_SEPERATOR+m_bodyFilePath+TEXT_FILE_EXTENSION;
+
readConversationId(m_messageData);
readRecipientList(m_messageData);
readPriority(m_messageData);
readDateTime(m_messageData);
readReadStatus(m_messageData);
readMessageStatus(m_messageData);
-// setMessageStatus(MESSAGE_STATUS_LOADED);
}
--- /dev/null
+//
+// Tizen Web Device API
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#ifndef WIDGETFILEPATHMGR_H
+#define WIDGETFILEPATHMGR_H
+
+#include <dpl/singleton.h>
+#include <dpl/shared_ptr.h>
+#include <dpl/thread.h>
+#include <Commons/Exception.h>
+#include <Logger.h>
+
+extern "C" {
+#include <msg.h>
+}
+
+namespace DeviceAPI {
+namespace Messaging {
+
+/*
+ * Class used for msg service handle manager
+ */
+class MsgWidgetPathMgr
+{
+ public:
+ MsgWidgetPathMgr(std::string path) : m_widgetPath("")
+ {
+ m_widgetPath = path;
+ }
+
+ public:
+ ~MsgWidgetPathMgr()
+ {
+ }
+
+ std::string getPath() const
+ {
+ return m_widgetPath;
+ }
+
+
+ private:
+ std::string m_widgetPath;
+};
+
+typedef DPL::SharedPtr<MsgWidgetPathMgr> MsgWidgetPathMgrPtr;
+typedef DPL::ThreadLocalVariable<MsgWidgetPathMgrPtr> TlvWidgetPathMgr;
+
+class WidgetFilePath
+{
+ protected:
+ WidgetFilePath()
+ {
+ }
+
+ public:
+ ~WidgetFilePath()
+ {
+ }
+
+ std::string getPath(std::string path)
+ {
+ if (m_tlvWidgetPath.IsNull()) {
+ m_tlvWidgetPath = MsgWidgetPathMgrPtr(new MsgWidgetPathMgr(path));
+ }
+ return (*m_tlvWidgetPath)->getPath();
+ }
+
+
+ private:
+ TlvWidgetPathMgr m_tlvWidgetPath;
+};
+
+typedef DPL::Singleton<WidgetFilePath> WidgetPathSingleton;
+
+#define GetWidgetPath(PATH) WidgetPathSingleton::Instance().getPath(PATH)
+
+
+}
+}
+#endif /* WIDGETFILEPATHMGR_H */
+
<plugin-properties>
<library-name>libwrt-plugins-tizen-messaging.so</library-name>
<feature-install-uri>messaging.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
int NFCAdapter::setTagListener(const EventNFCChangedEmitterPtr& emitter, const TagFilterPtr& filter) {
LoggerD(" NFCAdapter::setTagListener Entered");
+ if (!getPowerState())
+ ThrowMsg(PlatformException, "NFC is OFF.");
if (m_NFCTagEmitterPtr.Get() != NULL)
ThrowMsg(PlatformException, "It has already set Tag Listener");
int NFCAdapter::setPeerListener(const EventNFCChangedEmitterPtr& emitter) {
LoggerD(" NFCAdapter::setPeerListener Entered");
-
+ if (!getPowerState())
+ ThrowMsg(PlatformException, "NFC is OFF.");
if (m_NFCTargetEmitterPtr.Get() != NULL)
ThrowMsg(PlatformException, "It has already set Peer Listener");
}
void NFCAdapter::unsetTagListener() {
LoggerD(" NFCAdapter::unsetTagListener Entered");
+ if (!getPowerState())
+ ThrowMsg(PlatformException, "NFC is OFF.");
m_NFCTagEmitterPtr.Reset();
m_tagFilter.Reset();
NFCDefaultAdapterSingleton::Instance().unsetTagListener(this);
void NFCAdapter::unsetPeerListener() {
LoggerD(" NFCAdapter::unsetPeerListener Entered");
+ if (!getPowerState())
+ ThrowMsg(PlatformException, "NFC is OFF.");
m_NFCTargetEmitterPtr.Reset();
NFCDefaultAdapterSingleton::Instance().unsetPeerListener(this);
}
<plugin-properties>
<library-name>libwrt-plugins-tizen-nfc.so</library-name>
<feature-install-uri>nfc.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/nfc.common</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-networkbearerselection.so</library-name>
<feature-install-uri>networkbearerselection.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/networkbearerselection</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-notification.so</library-name>
<feature-install-uri>notification.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/notification</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-package.so</library-name>
<feature-install-uri>package.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/packagemanager.install</name>
}
int nativeBrightness = (int)(brightness*maxBrightness);
+ if (nativeBrightness == 0)
+ nativeBrightness = 1;
+
setPlatformBrightness(nativeBrightness);
LOGI("Set the brightness value: %d", nativeBrightness);
}
<plugin-properties>
<library-name>libwrt-plugins-tizen-power.so</library-name>
<feature-install-uri>power.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/power</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-push.so</library-name>
<feature-install-uri>push.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/push</name>
<device-capability>push</device-capability>
</api-feature>
-</plugin-properties>
\ No newline at end of file
+</plugin-properties>
<plugin-properties>
<library-name>libwrt-plugins-tizen-secureelement.so</library-name>
<feature-install-uri>secureelement.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/secureelement</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-systemsetting.so</library-name>
<feature-install-uri>systemsetting.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/setting</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-systeminfo.so</library-name>
<feature-install-uri>systeminfo.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/systeminfo</name>
#include <Commons/Exception.h>
#include <JSWebAPIErrorFactory.h>
#include <ArgumentValidator.h>
-
+#include <JSUtil.h>
#include "DurationProperties.h"
#include "JSTZDate.h"
#include "TimeUtilConverter.h"
JSObjectRef JSTZDate::constructor(JSContextRef ctx, JSObjectRef constructor, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LoggerD("entered");
- TZDateProperties prop;
JSObjectRef tzDate = NULL;
+ ArgumentValidator validator(ctx, argumentCount, arguments);
Try {
if (argumentCount == 0)
tzDate = createJSObject(ctx);
else if (argumentCount <= 2) {
- TimeUtilConverter converter(ctx);
std::string timezone = "";
try {
- if ((argumentCount == 2) && !JSValueIsNull(ctx, arguments[1]) && !JSValueIsUndefined(ctx, arguments[1]))
- timezone = converter.toString(arguments[1]);
+ timezone = validator.toString(1, true);
- JSStringRef toStringName = JSStringCreateWithUTF8CString("toString");
- JSValueRef toStringFuction = JSObjectGetProperty(ctx, converter.toJSObjectRef(arguments[0]), toStringName, exception);
- JSStringRelease(toStringName);
+ JSObjectRef dateObj = validator.toObject(0, true);
+ if (dateObj) {
+ JSValueRef dateException = NULL;
- if (!toStringFuction)
- ThrowMsg(ConversionException, "Couldn't get date string.");
-
- JSObjectRef function = JSValueToObject(ctx, toStringFuction, exception);
- JSValueRef result = JSObjectCallAsFunction(ctx, function, converter.toJSObjectRef(arguments[0]), 0, NULL, exception);
-
- LoggerD(converter.toDateString(arguments[0]));
- std::string stringDate = converter.toString(result);
- stringDate.erase(stringDate.find(" GMT"));
-
- JSStringRef getMillisecondsName = JSStringCreateWithUTF8CString("getMilliseconds");
- JSValueRef getMiliSecFuction = JSObjectGetProperty(ctx, converter.toJSObjectRef(arguments[0]), getMillisecondsName, exception);
- JSStringRelease(getMillisecondsName);
- long millisec = 0;
- if (getMiliSecFuction) {
- function = JSValueToObject(ctx, getMiliSecFuction, exception);
- result = JSObjectCallAsFunction(ctx, function, converter.toJSObjectRef(arguments[0]), 0, NULL, exception);
- millisec = converter.toLong(result);
+ JSValueRef toStringFuction = JSUtil::getProperty(ctx, dateObj, "toString", NULL);
+ JSObjectRef function = JSUtil::JSValueToObject(ctx, toStringFuction);
+
+ JSValueRef result = JSObjectCallAsFunction(ctx, function, dateObj, 0, NULL, &dateException);
+ if (dateException)
+ ThrowMsg(ConversionException, "Couldn't get date string");
+
+ std::string stringDate = JSUtil::JSValueToString(ctx, result);
+ LoggerD(stringDate);
+ stringDate.erase(stringDate.find(" GMT"));
+
+ JSValueRef getMiliSecFuction = JSUtil::getProperty(ctx, dateObj, "getMilliseconds", NULL);
+ function = JSUtil::JSValueToObject(ctx, getMiliSecFuction);
+
+ result = JSObjectCallAsFunction(ctx, function, dateObj, 0, NULL, &dateException);
+ if (dateException)
+ ThrowMsg(ConversionException, "Couldn't get milliseconds");
+
+ long millisec = JSUtil::JSValueToLong(ctx, result);
LoggerD("getMilliseconds = " << millisec);
+ tzDate = createJSObject(ctx, stringDate, millisec, timezone);
}
- tzDate = createJSObject(ctx, stringDate, millisec, timezone);
+ } catch (const BasePlatformException& err) {
+ LoggerE(err.getName() << ":"<<err.getMessage());
+ if (tzDate) {
+ TZDatePrivObject *priv = static_cast<TZDatePrivObject*>(JSObjectGetPrivate(tzDate));
+ if (priv)
+ delete priv;
+ }
+ tzDate = NULL;
} catch (const WrtDeviceApis::Commons::Exception& err) {
LoggerE(err.GetClassName() << ":"<<err.GetMessage());
if (tzDate) {
if (priv)
delete priv;
}
-
- tzDate = createJSObject(ctx, timezone);
+ tzDate = NULL;
}
- if (tzDate == NULL)
- tzDate = createJSObject(ctx, prop);
+ if (!tzDate)
+ tzDate = createJSObject(ctx, timezone);
} else {
- ArgumentValidator validator(ctx, argumentCount, arguments);
+ TZDateProperties prop;
prop.year = validator.toLong(0);
if ((prop.year >= 0) && (prop.year <= 99))
prop.year += 1900;
<plugin-properties>
<library-name>libwrt-plugins-tizen-timeutil.so</library-name>
<feature-install-uri>time.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/time</name>
<plugin-properties>
<library-name>libwrt-plugins-tizen-tizen.so</library-name>
<feature-install-uri>tizen.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/tizen</name>
INCLUDE_DIRECTORIES(
${INCLUDE_COMMON}
- ${websetting_INCLUDE_DIRS}
+ ${platform_pkgs_websetting_INCLUDE_DIRS}
)
SET(CMAKE_INSTALL_RPATH
TARGET_LINK_LIBRARIES(${TARGET_IMPL_NAME}
${LIBS_COMMON}
${tizen_impl}
- ${websetting_LIBRARIES}
+ ${platform_pkgs_websetting_LIBRARIES}
)
SET(SRCS
<plugin-properties>
<library-name>libwrt-plugins-tizen-websetting.so</library-name>
<feature-install-uri>websetting.install.uri</feature-install-uri>
- <feature-key-cn>SAMSUNG plugin group</feature-key-cn>
- <feature-root-cn>SAMSUNG certificate authority</feature-root-cn>
- <feature-root-fingerprint>AAAABBBBCCCCDDDEEEE0000</feature-root-fingerprint>
<api-feature>
<name>http://tizen.org/privilege/websetting</name>
<device-capability>websetting</device-capability>
</api-feature>
-</plugin-properties>
\ No newline at end of file
+</plugin-properties>