From 2293b4b46b4aa8d6a680284a8355577169f1e61b Mon Sep 17 00:00:00 2001 From: Dongjin Choi Date: Thu, 4 Jul 2013 17:21:51 +0900 Subject: [PATCH] Update change log and spec for wrt-plugins-tizen_0.4.50 [model] REDWOOD [binary_type] PDA [customer] OPEN [Issue#] N/A [Problem] There are including of unused files. [Solution] Removed including of unused files. [SCMRequest] N/A [Issue] N/A [Problem] updateMessages for email service bug fix [Cause] updateMessages for email service bug fix [Solution] updateMessages for email service bug fix [Issue] N/A [Problem] Dereferencing pointer "soundPath" [Cause] Null-checking "soundPath" suggests that it may be null, but it has already been dereferenced on all paths leading to the check [Solution] inserted Null check. [Issue] prevent CID : 63078 [Problem] memory leak. [Cause] free omission. [Solution] memory free. [Systeminfo] Fix bug when get duid value [team] WebAPI [request] N/A [horizontal_expansion] N/A --- packaging/wrt-plugins-tizen.spec | 2 +- src/Callhistory/CallHistory.cpp | 1 - src/Callhistory/JSCallHistoryEntry.cpp | 1 - src/Callhistory/JSRemoteParty.cpp | 1 - src/Contact/ContactSearchEngine.cpp | 109 ++++++++++++++++++++++------ src/Contact/ContactSearchEngine.h | 2 + src/Contact/JSAddressBook.cpp | 15 +++- src/Contact/JSContactManager.cpp | 15 +++- src/Contact/PersonSearchEngine.cpp | 35 +++++---- src/DataControl/SqlDataControlConsumer.cpp | 6 ++ src/Messaging/Email.cpp | 31 +++++--- src/Notification/StatusNotification.cpp | 22 +++--- src/Systeminfo/JSDeviceCapabilitiesInfo.cpp | 4 +- src/Systeminfo/Systeminfo.cpp | 2 + src/Systeminfo/SysteminfoPropertyInfo.h | 2 +- 15 files changed, 178 insertions(+), 70 deletions(-) diff --git a/packaging/wrt-plugins-tizen.spec b/packaging/wrt-plugins-tizen.spec index 531a664..91f473b 100755 --- a/packaging/wrt-plugins-tizen.spec +++ b/packaging/wrt-plugins-tizen.spec @@ -1,6 +1,6 @@ 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 diff --git a/src/Callhistory/CallHistory.cpp b/src/Callhistory/CallHistory.cpp index 9b4350b..2af0ccf 100755 --- a/src/Callhistory/CallHistory.cpp +++ b/src/Callhistory/CallHistory.cpp @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/src/Callhistory/JSCallHistoryEntry.cpp b/src/Callhistory/JSCallHistoryEntry.cpp index d12e56c..535f107 100755 --- a/src/Callhistory/JSCallHistoryEntry.cpp +++ b/src/Callhistory/JSCallHistoryEntry.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include diff --git a/src/Callhistory/JSRemoteParty.cpp b/src/Callhistory/JSRemoteParty.cpp index 7932144..c7bf5de 100755 --- a/src/Callhistory/JSRemoteParty.cpp +++ b/src/Callhistory/JSRemoteParty.cpp @@ -15,7 +15,6 @@ // limitations under the License. // -#include #include #include #include diff --git a/src/Contact/ContactSearchEngine.cpp b/src/Contact/ContactSearchEngine.cpp index 73d520a..0ff9fa1 100755 --- a/src/Contact/ContactSearchEngine.cpp +++ b/src/Contact/ContactSearchEngine.cpp @@ -285,19 +285,24 @@ void ContactSearchEngine::visitPostComposite(FilterType& type, int depth) 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; @@ -321,16 +326,24 @@ void ContactSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, 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; @@ -353,15 +366,18 @@ void ContactSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, { 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; @@ -377,7 +393,12 @@ void ContactSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, 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) @@ -780,6 +801,48 @@ void ContactSearchEngine::queryAttributeInt(AttributeProperties& attributeProper _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) { diff --git a/src/Contact/ContactSearchEngine.h b/src/Contact/ContactSearchEngine.h index 29f9387..f504aeb 100755 --- a/src/Contact/ContactSearchEngine.h +++ b/src/Contact/ContactSearchEngine.h @@ -121,6 +121,8 @@ private: 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, diff --git a/src/Contact/JSAddressBook.cpp b/src/Contact/JSAddressBook.cpp index 33eac7d..139bfbe 100755 --- a/src/Contact/JSAddressBook.cpp +++ b/src/Contact/JSAddressBook.cpp @@ -956,16 +956,23 @@ JSValueRef JSAddressBook::find(JSContextRef context, 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'"); diff --git a/src/Contact/JSContactManager.cpp b/src/Contact/JSContactManager.cpp index 4ea72c6..e33fce5 100755 --- a/src/Contact/JSContactManager.cpp +++ b/src/Contact/JSContactManager.cpp @@ -972,16 +972,23 @@ JSValueRef JSContactManager::find(JSContextRef context, 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'"); diff --git a/src/Contact/PersonSearchEngine.cpp b/src/Contact/PersonSearchEngine.cpp index 3d2bc3a..47a641f 100755 --- a/src/Contact/PersonSearchEngine.cpp +++ b/src/Contact/PersonSearchEngine.cpp @@ -196,6 +196,9 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, int errorCode = 0; contacts_filter_h filter = NULL; + if(matchValue == NULL || matchValue->isNullOrUndefined()) + matchFlag = MATCH_EXISTS; + if(depth != 0) { filter = m_filterStack.top(); @@ -214,11 +217,15 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, 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) @@ -238,10 +245,13 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, 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) @@ -261,12 +271,9 @@ void PersonSearchEngine::visitAttribute(string& attrName, MatchFlag& matchFlag, } 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); } diff --git a/src/DataControl/SqlDataControlConsumer.cpp b/src/DataControl/SqlDataControlConsumer.cpp index 597ff90..0f719d8 100644 --- a/src/DataControl/SqlDataControlConsumer.cpp +++ b/src/DataControl/SqlDataControlConsumer.cpp @@ -1169,6 +1169,12 @@ void SQLDataControlConsumer::SendAppControlLaunchToProvider(void* event) ThrowMsg(WrtDeviceApis::Commons::PlatformException, ex.GetMessage()); } + + if (passData) + { + bundle_free(passData); + passData = NULL; + } } diff --git a/src/Messaging/Email.cpp b/src/Messaging/Email.cpp index a0ae848..667b864 100644 --- a/src/Messaging/Email.cpp +++ b/src/Messaging/Email.cpp @@ -603,15 +603,22 @@ void Email::readBody() { 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); @@ -849,9 +856,9 @@ void Email::updateMessage() if(getCurrentFolder() == DRAFTBOX) { - updateBody(); - updateSubject(); - updateRecipients(); +// updateBody(); +// updateSubject(); +// updateRecipients(); // updateFrom(); // updateAttachments(); updatePriority(); @@ -885,9 +892,9 @@ void Email::updateMessage() if(getCurrentFolder() == DRAFTBOX) { - updateAttachments(); +// updateAttachments(); -/* + email_mail_data_t* result = NULL; error = email_get_mail_data(m_mail->mail_id, &result); @@ -913,6 +920,12 @@ void Email::updateMessage() 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) { @@ -921,7 +934,7 @@ void Email::updateMessage() LoggerW("email_free_mail_data error. [" << error << "]"); } } -*/ + } if(meeting_req) { diff --git a/src/Notification/StatusNotification.cpp b/src/Notification/StatusNotification.cpp index ecd5b2c..777f32c 100755 --- a/src/Notification/StatusNotification.cpp +++ b/src/Notification/StatusNotification.cpp @@ -638,17 +638,21 @@ std::string StatusNotification::getSoundPath() { 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 { diff --git a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp index 565de6f..d15508b 100755 --- a/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp +++ b/src/Systeminfo/JSDeviceCapabilitiesInfo.cpp @@ -695,8 +695,8 @@ JSValueRef JSDeviceCapabilitiesInfo::getProperty(JSContextRef context, JSObjectR 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; } } diff --git a/src/Systeminfo/Systeminfo.cpp b/src/Systeminfo/Systeminfo.cpp index 8f49a1c..f9f4f2d 100755 --- a/src/Systeminfo/Systeminfo.cpp +++ b/src/Systeminfo/Systeminfo.cpp @@ -657,6 +657,8 @@ void Systeminfo::OnRequestReceived(const EventGetSysteminfoPtr& event) } } else { LoggerE("get fail sim state"); + event->makeSimObject(); + EventRequestReceiver::ManualAnswer(event); } } else { event->processGetValue((void *)m_connectionHandle); diff --git a/src/Systeminfo/SysteminfoPropertyInfo.h b/src/Systeminfo/SysteminfoPropertyInfo.h index 781ac8b..960868c 100755 --- a/src/Systeminfo/SysteminfoPropertyInfo.h +++ b/src/Systeminfo/SysteminfoPropertyInfo.h @@ -323,7 +323,7 @@ struct SIMProperties std::string spn; SIMProperties() : - state(""), + state("UNKNOWN"), operatorName(""), msisdn(""), iccid(""), -- 2.7.4