Name: wrt-plugins-tizen
Summary: JavaScript plugins for WebRuntime
-Version: 0.4.49
+Version: 0.4.50
Release: 0
Group: Development/Libraries
License: Apache License, Version 2.0
#include <vector>
#include <string>
#include <sstream>
-#include <cassert>
#include <Commons/Exception.h>
#include <CommonsJavaScript/JSCallbackManager.h>
#include <dpl/shared_ptr.h>
// limitations under the License.
//
-#include <cassert>
#include <memory>
#include <dpl/shared_ptr.h>
#include <CommonsJavaScript/JSUtils.h>
// limitations under the License.
//
-#include <cassert>
#include <memory>
#include <dpl/shared_ptr.h>
#include <CommonsJavaScript/JSUtils.h>
void ContactSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, AnyPtr& matchValue, int depth)
{
+ if(matchValue == NULL || matchValue->isNullOrUndefined())
+ matchFlag = MATCH_EXISTS;
+
ContactIdSetPtr idSet = ContactIdSetPtr(new ContactIdSet());
if(attrName == "id")
{
- string value = matchValue->getString();
- idSet->insert(ContactUtility::strToInt(value));
+ if(matchFlag != MATCH_EXISTS){
+ string value = matchValue->getString();
+ idSet->insert(ContactUtility::strToInt(value));
- if(depth == 0)
- m_filteredContactIds = idSet;
- else
- {
- ContactIdSetArrayPtr parentIdSets = m_contactIdSetArrayStack.top();
- parentIdSets->push_back(idSet);
+ if(depth == 0)
+ m_filteredContactIds = idSet;
+ else
+ {
+ ContactIdSetArrayPtr parentIdSets = m_contactIdSetArrayStack.top();
+ parentIdSets->push_back(idSet);
+ }
}
return;
if(properties.type == ContactSvcPrimitiveType_Boolean)
{
- bool value = matchValue->getBool();
+ bool value = true;
+ if(matchFlag != MATCH_EXISTS)
+ value = matchValue->getBool();
+
queryAttributeBool(properties, idSet, value);
}
else if(properties.type == ContactSvcPrimitiveType_String)
{
string value;
- if(attrName == "photoURI" || attrName == "ringtoneURI" || attrName == "organizations.logoURI")
- value = ContactUtility::convertUriToPath(matchValue->getString());
- else
- value = matchValue->getString();
+
+ if(matchFlag != MATCH_EXISTS)
+ {
+ if(attrName == "photoURI" || attrName == "ringtoneURI" || attrName == "organizations.logoURI")
+ value = ContactUtility::convertUriToPath(matchValue->getString());
+ else
+ value = matchValue->getString();
+ }else
+ value = "";
contacts_match_str_flag_e flag = CONTACTS_MATCH_EXISTS;
{
int value;
- if(attrName == "id" || attrName == "personId"){
- value = ContactUtility::strToInt(matchValue->getString());
- }else if(attrName == "lastUpdated"){
- time_t tmpTime = mktime(matchValue->getDateTm());
- value = (int)tmpTime;
- }else if(attrName == "birthday" || attrName == "anniversaries.date"){
- value = ContactUtility::toDateDbInt(*matchValue->getDateTm());
- }else{
- value = matchValue->getLong();
+ if(matchFlag != MATCH_EXISTS)
+ {
+ if(attrName == "id" || attrName == "personId"){
+ value = ContactUtility::strToInt(matchValue->getString());
+ }else if(attrName == "lastUpdated"){
+ time_t tmpTime = mktime(matchValue->getDateTm());
+ value = (int)tmpTime;
+ }else if(attrName == "birthday" || attrName == "anniversaries.date"){
+ value = ContactUtility::toDateDbInt(*matchValue->getDateTm());
+ }else{
+ value = matchValue->getLong();
+ }
}
contacts_match_int_flag_e flag;
flag = CONTACTS_MATCH_EQUAL;
}
- queryAttributeInt(properties, idSet, flag, value);
+ if(attrName == "birthday" || attrName == "anniversaries.date"){
+ queryAttributeDate(attrName, properties, idSet, flag, value);
+ }else{
+ queryAttributeInt(properties, idSet, flag, value);
+ }
+
}
if(depth == 0)
_CONTACTS_SVC_QUERY_FUNC_SUFFIX(query, filter, list, property_contact_id, result);
}
+void ContactSearchEngine::queryAttributeDate(string& attrName, AttributeProperties& attributeProperties, ContactIdSetPtr& result,
+ contacts_match_int_flag_e match, int match_value)
+{
+ const char* view_uri = attributeProperties.viewUri;
+ unsigned int property_contact_id = attributeProperties.propertyContactId;
+ unsigned int property_id = attributeProperties.propertyId;
+
+ int errorCode = 0;
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ contacts_list_h list = NULL;
+
+ _CONTACTS_SVC_QUERY_FUNC_PREFIX(view_uri, query, filter);
+
+ errorCode = contacts_filter_add_int(filter, property_id, match, match_value);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+
+ LoggerD("attrName" << attrName);
+
+ if(attrName == "birthday"){
+ errorCode = contacts_filter_add_operator( filter, CONTACTS_FILTER_OPERATOR_AND);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+
+ errorCode = contacts_filter_add_int(filter, _contacts_event.type, CONTACTS_MATCH_EQUAL, CONTACTS_EVENT_TYPE_BIRTH);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+
+ }else if(attrName == "anniversaries.date"){
+ errorCode = contacts_filter_add_operator( filter, CONTACTS_FILTER_OPERATOR_AND);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+
+ errorCode = contacts_filter_add_int(filter, _contacts_event.type, CONTACTS_MATCH_EQUAL, CONTACTS_EVENT_TYPE_ANNIVERSARY);
+ if(errorCode != CONTACTS_ERROR_NONE)
+ ThrowMsg(PlatformException, "contacts_filter_add_int error : " << errorCode << " (" << __FUNCTION__ << ")");
+ }
+
+ _CONTACTS_SVC_QUERY_FUNC_SUFFIX(query, filter, list, property_contact_id, result);
+}
+
void ContactSearchEngine::queryAttributeString(AttributeProperties& attributeProperties, ContactIdSetPtr& result,
contacts_match_str_flag_e match, const char* match_value)
{
ContactArrayPtr getContacts(ContactIdSetPtr& ids);
ContactPtr getContact(int id);
+ void queryAttributeDate(std::string& attrName, AttributeProperties& attributeProperties, ContactIdSetPtr& result,
+ contacts_match_int_flag_e match, int match_value);
void queryAttributeBool(AttributeProperties& attributeProperties, ContactIdSetPtr& result,
bool match_value);
void queryAttributeInt(AttributeProperties& attributeProperties, ContactIdSetPtr& result,
EventAddressBookFindPtr dplEvent(new EventAddressBookFind());
Try {
- if (js3rdParamIsObject)
- dplEvent->setFilter(filterConverter->toFilter(arguments[2]));
+ if (js3rdParamIsObject){
+ FilterPtr filter = filterConverter->toFilter(arguments[2]);
+ if(filter)
+ dplEvent->setFilter(filter);
+ else
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "3rd argument must be an Correct 'Filter object' or 'null'");
+ }
} Catch(Exception) {
LoggerE("Error on 3rd parameter conversion : " << _rethrown_exception.GetMessage());
return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "3rd argument must be an 'Filter object' or 'null'");
}
Try {
- if (js4thParamIsObject)
- dplEvent->setSortMode(filterConverter->toSortMode(arguments[3]));
+ if (js4thParamIsObject){
+ SortModePtr sortMode = filterConverter->toSortMode(arguments[3]);
+ dplEvent->setSortMode(sortMode);
+ }
} Catch(Exception) {
LoggerE("Error on 4th parameter conversion : " << _rethrown_exception.GetMessage());
return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "4th argument must be an 'SortMode object' or 'null'");
EventContactManagerFindPtr dplEvent(new EventContactManagerFind());
Try {
- if (js3rdParamIsObject)
- dplEvent->setFilter(filterConverter->toFilter(arguments[2]));
+ if (js3rdParamIsObject){
+ FilterPtr filter = filterConverter->toFilter(arguments[2]);
+ if(filter)
+ dplEvent->setFilter(filter);
+ else
+ return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "3rd argument must be an Correct 'Filter object' or 'null'");
+ }
} Catch(Exception) {
LoggerE("Error on 3rd parameter conversion : " << _rethrown_exception.GetMessage());
return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "3rd argument must be an 'Filter object' or 'null'");
}
Try {
- if (js4thParamIsObject)
- dplEvent->setSortMode(filterConverter->toSortMode(arguments[3]));
+ if (js4thParamIsObject){
+ SortModePtr sortMode = filterConverter->toSortMode(arguments[3]);
+ dplEvent->setSortMode(sortMode);
+ }
} Catch(Exception) {
LoggerE("Error on 4th parameter conversion : " << _rethrown_exception.GetMessage());
return JSWebAPIErrorFactory::postException(context, exception, JSWebAPIErrorFactory::TYPE_MISMATCH_ERROR, "4th argument must be an 'SortMode object' or 'null'");
int errorCode = 0;
contacts_filter_h filter = NULL;
+ if(matchValue == NULL || matchValue->isNullOrUndefined())
+ matchFlag = MATCH_EXISTS;
+
if(depth != 0)
{
filter = m_filterStack.top();
int value = 0;
if(attrName == "id" || attrName == "displayContactId")
{
- string valueStr = matchValue->getString();
- value = ContactUtility::strToInt(valueStr);
+ if(matchFlag != MATCH_EXISTS){
+ string valueStr = matchValue->getString();
+ value = ContactUtility::strToInt(valueStr);
+ }
+ }
+ else{
+ if(matchFlag != MATCH_EXISTS)
+ value = matchValue->getLong();
}
- else
- value = matchValue->getLong();
contacts_match_int_flag_e flag;
if(matchFlag == MATCH_EXISTS)
else if(property.type == PrimitiveType_String)
{
string value;
- if(attrName == "photoURI" || attrName == "ringtoneURI")
- value = ContactUtility::convertUriToPath(matchValue->getString());
- else
- value = matchValue->getString();
+ if(matchFlag != MATCH_EXISTS){
+ if(attrName == "photoURI" || attrName == "ringtoneURI")
+ value = ContactUtility::convertUriToPath(matchValue->getString());
+ else
+ value = matchValue->getString();
+ }else
+ value = "";
contacts_match_str_flag_e flag = CONTACTS_MATCH_EXISTS;
if(matchFlag == MATCH_EXACTLY)
}
else if(property.type == PrimitiveType_Boolean)
{
- bool value = false;
- value = matchValue->getBool();
-
- // TODO MATCH_EXISTS
-// if(matchFlag == MATCH_EXISTS)
-// else
+ bool value = true;
+ if(matchFlag != MATCH_EXISTS)
+ value = matchValue->getBool();
errorCode = contacts_filter_add_bool(filter, property.propertyId, value);
}
ThrowMsg(WrtDeviceApis::Commons::PlatformException, ex.GetMessage());
}
+
+ if (passData)
+ {
+ bundle_free(passData);
+ passData = NULL;
+ }
}
for ( i = 0; i < attachmentCount; i++)
{
Try {
- LoggerD("attachment ID :" << attachment[i].attachment_id << " name :" << attachment[i].attachment_name << " download :" << attachment[i].save_status << "savefile :" << attachment[i].attachment_path);
- LoggerD("attachment inline status :" << attachment[i].inline_content_status);
+ LoggerD("attachment ID : [" << attachment[i].attachment_id
+ << "] name : [" << attachment[i].attachment_name
+ << "] download : [" << attachment[i].save_status
+ << "] savefile : [" << attachment[i].attachment_path
+ << "] mimetype : [" << attachment[i].attachment_mime_type
+ << "]");
+ LoggerD("attachment inline status : ["
+ << attachment[i].inline_content_status << "]");
IAttachmentPtr tmpAtt(new Attachment());
if (attachment[i].attachment_path)
tmpAtt->init(attachment[i].attachment_path, false);
if (tmpAtt)
{
- LoggerD("attachment[i].inline_content_status : " << attachment[i].inline_content_status);
+ LoggerD("attachment[i].inline_content_status : ["
+ << attachment[i].inline_content_status << "]");
tmpAtt->rename(std::string(attachment[i].attachment_name));
tmpAtt->setAttachmentID(attachment[i].attachment_id);
tmpAtt->setDownloaded(attachment[i].save_status);
if(getCurrentFolder() == DRAFTBOX)
{
- updateBody();
- updateSubject();
- updateRecipients();
+// updateBody();
+// updateSubject();
+// updateRecipients();
// updateFrom();
// updateAttachments();
updatePriority();
if(getCurrentFolder() == DRAFTBOX)
{
- updateAttachments();
+// updateAttachments();
-/*
+
email_mail_data_t* result = NULL;
error = email_get_mail_data(m_mail->mail_id, &result);
LoggerW("email_update_mail_attribute error. [" << error << "]");
}
}
+ tm* time = localtime(&result->date_time);
+ if (!time) {
+ LoggerE("localtime failed");
+ Throw(WrtDeviceApis::Commons::PlatformException);
+ }
+ setDateTime(*time);
}
if(result != NULL)
{
LoggerW("email_free_mail_data error. [" << error << "]");
}
}
-*/
+
}
if(meeting_req) {
{
throw UnknownException("get notification sound error");
}
-
- LoggerI(" sound type = " << type << " path = " << soundPath);
- if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA && soundPath)
- {
- LoggerI("soundPath = " << soundPath);
- return std::string(soundPath);
- }
- else
+
+ std::string strSoundPath;
+ if (soundPath)
{
- return std::string("");
+ LoggerI(" soudn type=" << type);
+ if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA)
+ {
+ LoggerI("soundPath = " << soundPath);
+ strSoundPath = soundPath;
+ }
}
+
+ LoggerI("soundPath :" << strSoundPath);
+ return strSoundPath;
+
}
else
{
while(fgets(duid, DUID_BUFFER_SIZE-1, fp)) {
if (strncmp(duid, "http://tizen.org/system/duid", DUID_KEY_STRING) == 0) {
- LoggerD("duid : " << duid);
- deviceCapabilitiesInfo->duid = duid;
+ deviceCapabilitiesInfo->duid = duid + (DUID_KEY_STRING+1);
+ LoggerD("deviceCapabilitiesInfo->duid : " << deviceCapabilitiesInfo->duid);
break;
}
}
}
} else {
LoggerE("get fail sim state");
+ event->makeSimObject();
+ EventRequestReceiver<EventGetSysteminfo>::ManualAnswer(event);
}
} else {
event->processGetValue((void *)m_connectionHandle);
std::string spn;
SIMProperties() :
- state(""),
+ state("UNKNOWN"),
operatorName(""),
msisdn(""),
iccid(""),