diff options
author | Sangtai Kim <sangtai.kim@samsung.com> | 2012-02-17 20:48:29 +0900 |
---|---|---|
committer | Sangtai Kim <sangtai.kim@samsung.com> | 2012-02-17 20:57:02 +0900 |
commit | 1c5040afa54de91e8cc3ff0c43f71b4234dbb67b (patch) | |
tree | 05c3812a779c55ddb134dccb671aca462767e10b /src | |
parent | a87694c0ced5c390c924a345ab3eb0ad1549718d (diff) | |
download | wrt-plugins-tizen-1c5040afa54de91e8cc3ff0c43f71b4234dbb67b.tar.gz wrt-plugins-tizen-1c5040afa54de91e8cc3ff0c43f71b4234dbb67b.tar.bz2 wrt-plugins-tizen-1c5040afa54de91e8cc3ff0c43f71b4234dbb67b.zip |
merge wrt-plugins-tizen_0.2.0-3
Diffstat (limited to 'src')
28 files changed, 592 insertions, 389 deletions
diff --git a/src/platform/API/Call/CallDefine.h b/src/platform/API/Call/CallDefine.h new file mode 100755 index 0000000..160f0e9 --- /dev/null +++ b/src/platform/API/Call/CallDefine.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * 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 TIZENAPIS_API_CALL_DEFINE_H_ +#define TIZENAPIS_API_CALL_DEFINE_H_ + +namespace { + +#define STR_TIZEN_TEL "tizen.tel" +#define STR_TIZEN_XMPP "tizen.xmpp" +#define STR_TIZEN_SIP "tizen.sip" + +#define STR_CALL "call" +#define STR_CALL_VOICE "call.voice" +#define STR_CALL_VIDEO "call.video" +#define STR_CALL_EMERGENCY "call.emergency" + +#define STR_DIALED "dialed" +#define STR_RECEIVED "received" +#define STR_MISSED_NEW "missed-new" +#define STR_MISSED "missed" +#define STR_REJECTED "rejected" +#define STR_BLOCKED "blocked" + +#define STR_BASE_QUERY "SELECT id, log_type, related_id, number, log_time, data1 FROM phonelogs" + +#define STR_ENTRY_ID "entryId" +#define STR_SERVICE_ID "serviceId" +#define STR_CALL_TYPE "callType" +#define STR_TAGS "tags" +#define STR_REMOTE_PARTIES "remoteParties" +#define STR_FORWARDEDFROM "forwardedFrom" +#define STR_START_TIME "startTime" +#define STR_DURATION "duration" +#define STR_END_REASON "endReason" +#define STR_DIRECTION "direction" +#define STR_RECORDING "recording" +#define STR_COST "cost" +#define STR_CURRENCY "currency" + +#define STR_REMOTE_PARTY "remoteParty" +#define STR_DISPLAY_NAME "displayName" +#define STR_CONTACT_ID "contactId" + +#define STR_RP_REMOTEPARTY "remoteParties.remoteParty" +#define STR_RP_CONTACTID "remoteParties.contactId" + +#define STR_NUMBER "number" +#define STR_LOG_TIME "log_time" +#define STR_LOG_TYPE "log_type" +#define STR_DATA1 "data1" +#define STR_RELATED_ID "related_id" + +#define STR_TEL_URI "tel://" +#define STR_TIZEN_DIALER "com.samsung.phone" //org.tizen.phone + +#define STR_SERVICE_NAME "serviceName" +#define STR_PROVIDER_ID "providerId" + +#define STR_HISTORY "history" +#define STR_SERVICE_NAME "serviceName" +#define STR_SERVICE "service" +#define STR_VOICEMAIL_NUMBERS "voicemailNumbers" +#define STR_SUBSCRIBER_NUMBERS "subscriberNumbers" +#define STR_EMERGENCY_NUMBERS "emergencyNumbers" +} + +#endif
\ No newline at end of file diff --git a/src/platform/API/Call/CallServiceFilter.cpp b/src/platform/API/Call/CallServiceFilter.cpp index 87559df..d342b2a 100755 --- a/src/platform/API/Call/CallServiceFilter.cpp +++ b/src/platform/API/Call/CallServiceFilter.cpp @@ -20,16 +20,16 @@ namespace TizenApis { namespace Api { namespace Call { CallServiceFilter::CallServiceFilter() : - m_serviceTypeId(""), + m_callType(""), m_serviceName(""), m_providerId("") { m_tags = StringArrayPtr(new StringArray()); } -void CallServiceFilter::setServiceTypeId(const std::string serviceTypeId) +void CallServiceFilter::setCallType(const std::string callType) { - m_serviceTypeId = serviceTypeId; + m_callType = callType; } void CallServiceFilter::setTags(const StringArrayPtr tags) @@ -47,9 +47,9 @@ void CallServiceFilter::setProviderId(const std::string providerId) m_providerId = providerId; } -std::string CallServiceFilter::getServiceTypeId() const +std::string CallServiceFilter::getCallType() const { - return m_serviceTypeId; + return m_callType; } StringArrayPtr CallServiceFilter::getTags() const diff --git a/src/platform/API/Call/CallServiceFilter.h b/src/platform/API/Call/CallServiceFilter.h index fcd381a..b3ab55a 100755 --- a/src/platform/API/Call/CallServiceFilter.h +++ b/src/platform/API/Call/CallServiceFilter.h @@ -33,18 +33,18 @@ typedef DPL::SharedPtr<StringArray> StringArrayPtr; class CallServiceFilter { private: - std::string m_serviceTypeId; + std::string m_callType; StringArrayPtr m_tags; std::string m_serviceName; std::string m_providerId; public: - void setServiceTypeId(const std::string serviceTypeId); + void setCallType(const std::string callType); void setTags(const StringArrayPtr tags); void setServiceName(const std::string serviceName); void setProviderId(const std::string providerId); - std::string getServiceTypeId() const; + std::string getCallType() const; StringArrayPtr getTags() const; std::string getServiceName() const; std::string getProviderId() const; diff --git a/src/platform/API/Call/EventLaunchDialer.cpp b/src/platform/API/Call/EventLaunchDialer.cpp index dadacae..18c66da 100755 --- a/src/platform/API/Call/EventLaunchDialer.cpp +++ b/src/platform/API/Call/EventLaunchDialer.cpp @@ -34,6 +34,10 @@ void EventLaunchDialer::setExtension(const std::string extension) m_extension = extension; } +void EventLaunchDialer::setAppId(const std::string appId) +{ + m_appId = appId; +} std::string EventLaunchDialer::getRemoteParty() const { @@ -45,6 +49,11 @@ std::string EventLaunchDialer::getExtension() const return m_extension; } +std::string EventLaunchDialer::getAppId() const +{ + return m_appId; +} + } } } diff --git a/src/platform/API/Call/EventLaunchDialer.h b/src/platform/API/Call/EventLaunchDialer.h index ecd8f4b..877bd68 100755 --- a/src/platform/API/Call/EventLaunchDialer.h +++ b/src/platform/API/Call/EventLaunchDialer.h @@ -30,12 +30,15 @@ class EventLaunchDialer : public WrtDeviceApis::Commons::IEvent<EventLaunchDiale private: std::string m_remoteParty; std::string m_extension; + std::string m_appId; public: void setRemoteParty(const std::string remoteParty); void setExtension(const std::string extension); + void setAppId(const std::string appId); std::string getRemoteParty() const; std::string getExtension() const; + std::string getAppId() const; EventLaunchDialer(); }; diff --git a/src/platform/API/Contact/IContact.cpp b/src/platform/API/Contact/IContact.cpp index 6e38f35..bbc9bb4 100755 --- a/src/platform/API/Contact/IContact.cpp +++ b/src/platform/API/Contact/IContact.cpp @@ -367,6 +367,69 @@ int IContact::getCategoriesNum() const return m_categories->size(); } +void IContact::copy(const ContactPtr &contact) +{ + m_id = contact->m_id; + m_lastUpdated = contact->m_lastUpdated; + + m_name = contact->m_name->clone(); + m_account = contact->m_account->clone(); + m_addresses = ContactAddressArrayPtr(new ContactAddressArray()); + ContactAddressArray::iterator contactAddressIter; + for(contactAddressIter = contact->m_addresses->begin(); contactAddressIter != contact->m_addresses->end(); contactAddressIter++) + m_addresses->push_back((*contactAddressIter)->clone()); + + m_photoURI = contact->m_photoURI; + m_phoneNumbers = ContactPhoneNumberArrayPtr(new ContactPhoneNumberArray()); + ContactPhoneNumberArray::iterator contactPhoneNumberIter; + for(contactPhoneNumberIter = contact->m_phoneNumbers->begin(); contactPhoneNumberIter != contact->m_phoneNumbers->end(); contactPhoneNumberIter++) + m_phoneNumbers->push_back((*contactPhoneNumberIter)->clone()); + + m_emails = ContactEmailAddressArrayPtr(new ContactEmailAddressArray()); + ContactEmailAddressArray::iterator contactEmailAddressIter; + for(contactEmailAddressIter = contact->m_emails->begin(); contactEmailAddressIter != contact->m_emails->end(); contactEmailAddressIter++) + m_emails->push_back((*contactEmailAddressIter)->clone()); + + m_birthday = contact->m_birthday; + m_anniversaries = ContactAnniversaryArrayPtr(new ContactAnniversaryArray()); + ContactAnniversaryArray::iterator contactAnniversaryIter; + for(contactAnniversaryIter = contact->m_anniversaries->begin(); contactAnniversaryIter != contact->m_anniversaries->end(); contactAnniversaryIter++) + m_anniversaries->push_back((*contactAnniversaryIter)->clone()); + + m_organization = contact->m_organization->clone(); + m_notes = StringArrayPtr(new StringArray()); + StringArray::iterator noteIter; + for(noteIter = contact->m_notes->begin(); noteIter != contact->m_notes->end(); noteIter++) + { + std::string note = *noteIter; + m_notes->push_back(note); + } + + m_urls = ContactWebSiteArrayPtr(new ContactWebSiteArray()); + ContactWebSiteArray::iterator contactWebSiteIter; + for(contactWebSiteIter = contact->m_urls->begin(); contactWebSiteIter != contact->m_urls->end(); contactWebSiteIter++) + m_urls->push_back((*contactWebSiteIter)->clone()); + + m_isFavorite = contact->m_isFavorite; + m_ringtoneURI = contact->m_ringtoneURI; + m_categories = StringArrayPtr(new StringArray()); + StringArray::iterator categoryIter; + for(categoryIter = contact->m_categories->begin(); categoryIter != contact->m_categories->end(); categoryIter++) + { + std::string category = *categoryIter; + m_categories->push_back(category); + } + + m_idIsSet = contact->m_idIsSet; + m_lastUpdatedIsSet = contact->m_lastUpdatedIsSet; + m_nameIsSet = contact->m_nameIsSet; + m_accountIsSet = contact->m_accountIsSet; + m_photoURIIsSet = contact->m_photoURIIsSet; + m_birthdayIsSet = contact->m_birthdayIsSet; + m_organizationIsSet = contact->m_organizationIsSet; + m_ringtoneURIIsSet = contact->m_ringtoneURIIsSet; +} + void IContact::clear() { m_id = ""; diff --git a/src/platform/API/Contact/IContact.h b/src/platform/API/Contact/IContact.h index a7ce7ad..d137ce8 100755 --- a/src/platform/API/Contact/IContact.h +++ b/src/platform/API/Contact/IContact.h @@ -130,6 +130,7 @@ public: void addCategory(const std::string &value); int getCategoriesNum() const; + virtual void copy(const ContactPtr &contact); virtual void clear(); virtual ContactPtr clone() const; diff --git a/src/platform/Tizen/Call/CallHistory.cpp b/src/platform/Tizen/Call/CallHistory.cpp index 04a09c0..3f34a74 100755 --- a/src/platform/Tizen/Call/CallHistory.cpp +++ b/src/platform/Tizen/Call/CallHistory.cpp @@ -26,6 +26,7 @@ #include <dpl/log/log.h> #include <API/Filter/IFilter.h> #include <API/Filter/IFilterVisitor.h> +#include <API/Call/CallDefine.h> #include <calllog.h> #include <contacts-svc.h> @@ -358,14 +359,14 @@ bool CallHistory::executeQuery(std::string &query, CallHistoryEntryListPtr &call std::string CallHistory::convertAttrName(std::string &name) { std::string attrName(""); - if (name.compare("remoteParty") == 0) { - return attrName.append("number"); - } else if (name.compare("startTime") == 0) { - return attrName.append("log_time"); - } else if (name.compare("duration") == 0) { - return attrName.append("data1"); - } else if (name.compare("direction") == 0) { - return attrName.append("log_type"); + if (name.compare(STR_RP_REMOTEPARTY) == 0) { + return attrName.append(STR_NUMBER); + } else if (name.compare(STR_START_TIME) == 0) { + return attrName.append(STR_LOG_TIME); + } else if (name.compare(STR_DURATION) == 0) { + return attrName.append(STR_DATA1); + } else if (name.compare(STR_DIRECTION) == 0) { + return attrName.append(STR_LOG_TYPE); } else { return attrName; } diff --git a/src/platform/Tizen/Call/CallHistoryFilter.cpp b/src/platform/Tizen/Call/CallHistoryFilter.cpp index a15a5db..93d5cc9 100755 --- a/src/platform/Tizen/Call/CallHistoryFilter.cpp +++ b/src/platform/Tizen/Call/CallHistoryFilter.cpp @@ -18,6 +18,7 @@ #include <dpl/log/log.h> #include <iomanip> +#include <API/Call/CallDefine.h> #include "CallHistoryFilter.h" #include "CallHistoryQuery.h" @@ -26,31 +27,31 @@ using namespace TizenApis::Api::Tizen; using namespace TizenApis::Api::Call; namespace { -const std::string STR_LOG_TYPE ("log_type"); -const std::string STR_CONTACT_ID ("contact_id"); -const std::string STR_NUMBER ("number"); -const std::string STR_LOG_TIME ("log_time"); -const std::string STR_DURATION ("data1"); -const std::string STR_VOICE_ANSWERED ("1"); -const std::string STR_VOICE_OUTGOING ("2"); -const std::string STR_VOICE_MISSED_UNCHECKED ("5"); -const std::string STR_VOICE_MISSED_CHECKED ("6"); -const std::string STR_VOICE_REJECTED ("9"); -const std::string STR_VOICE_BLOCKED ("11"); -const std::string STR_VIDEO_ANSWERED ("3"); -const std::string STR_VIDEO_OUTGOING ("4"); -const std::string STR_VIDEO_MISSED_UNCHECKED ("7"); -const std::string STR_VIDEO_MISSED_CHECKED ("8"); -const std::string STR_VIDEO_REJECTED ("10"); -const std::string STR_VIDEO_BLOCKED ("12"); -const std::string STR_LEFT_BRACKET(" ("); -const std::string STR_RIGHT_BRACKET(")"); -const std::string STR_AND(" AND "); -const std::string STR_OR(" OR "); -const std::string STR_GREATER_THAN (">"); -const std::string STR_LESS_THAN ("<"); -const std::string STR_EQUAL ("="); -const std::string STR_S_QUOTATION ("'"); +const std::string F_LOG_TYPE (STR_LOG_TYPE); +const std::string F_RELATED_ID (STR_RELATED_ID); +const std::string F_NUMBER (STR_NUMBER); +const std::string F_LOG_TIME (STR_LOG_TIME); +const std::string F_DURATION (STR_DATA1); +const std::string F_VOICE_ANSWERED ("1"); +const std::string F_VOICE_OUTGOING ("2"); +const std::string F_VOICE_MISSED_UNCHECKED ("5"); +const std::string F_VOICE_MISSED_CHECKED ("6"); +const std::string F_VOICE_REJECTED ("9"); +const std::string F_VOICE_BLOCKED ("11"); +const std::string F_VIDEO_ANSWERED ("3"); +const std::string F_VIDEO_OUTGOING ("4"); +const std::string F_VIDEO_MISSED_UNCHECKED ("7"); +const std::string F_VIDEO_MISSED_CHECKED ("8"); +const std::string F_VIDEO_REJECTED ("10"); +const std::string F_VIDEO_BLOCKED ("12"); +const std::string F_LEFT_BRACKET(" ("); +const std::string F_RIGHT_BRACKET(")"); +const std::string F_AND(" AND "); +const std::string F_OR(" OR "); +const std::string F_GREATER_THAN (">"); +const std::string F_LESS_THAN ("<"); +const std::string F_EQUAL ("="); +const std::string F_S_QUOTATION ("'"); } namespace TizenApis { namespace Platform { @@ -67,20 +68,20 @@ CallHistoryFilter::~CallHistoryFilter() void CallHistoryFilter::visitPreComposite(FilterType& type, int depth) { - m_query = m_query + STR_LEFT_BRACKET; + m_query = m_query + F_LEFT_BRACKET; } void CallHistoryFilter::visitInComposite(FilterType& type, int depth) { if(type == Api::Tizen::UNION_FILTER) - m_query = m_query + STR_OR; + m_query = m_query + F_OR; else if(type == Api::Tizen::INTERSECTION_FILTER) - m_query = m_query + STR_AND; + m_query = m_query + F_AND; } void CallHistoryFilter::visitPostComposite(FilterType& type, int depth) { - m_query = m_query + STR_RIGHT_BRACKET; + m_query = m_query + F_RIGHT_BRACKET; } void CallHistoryFilter::visitAttribute(std::string& attrName, MatchFlag& matchFlag, Api::Tizen::AnyPtr& matchValue, int depth) @@ -106,14 +107,14 @@ void CallHistoryFilter::visitAttributeRange(std::string& attrName, AnyPtr& initi string initialValueStr (""); string endValueStr (""); - if (attrName.compare("remoteParties.remoteParty") == 0) { - name = STR_NUMBER; - } else if (attrName.compare("remoteParties.contactId") == 0) { - name = STR_CONTACT_ID; - } else if (attrName.compare("startTime") == 0) { - name = STR_LOG_TIME; - } else if (attrName.compare("duration") == 0) { - name = STR_DURATION; + if (attrName.compare(STR_RP_REMOTEPARTY) == 0) { + name = F_NUMBER; + } else if (attrName.compare(STR_RP_CONTACTID) == 0) { + name = F_RELATED_ID; + } else if (attrName.compare(STR_START_TIME) == 0) { + name = F_LOG_TIME; + } else if (attrName.compare(F_DURATION) == 0) { + name = F_DURATION; } else { name = attrName; } @@ -142,11 +143,11 @@ void CallHistoryFilter::visitAttributeRange(std::string& attrName, AnyPtr& initi } if (!initialValue->isNullOrUndefined() && endValue->isNullOrUndefined()) { - str = STR_LEFT_BRACKET + name + STR_GREATER_THAN + STR_EQUAL + STR_S_QUOTATION + initialValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET; + str = F_LEFT_BRACKET + name + F_GREATER_THAN + F_EQUAL + F_S_QUOTATION + initialValueStr + F_S_QUOTATION + F_RIGHT_BRACKET; } else if (initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) { - str = STR_LEFT_BRACKET + name + STR_LESS_THAN + STR_S_QUOTATION + endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET; + str = F_LEFT_BRACKET + name + F_LESS_THAN + F_S_QUOTATION + endValueStr + F_S_QUOTATION + F_RIGHT_BRACKET; } else if (!initialValue->isNullOrUndefined() && !endValue->isNullOrUndefined()) { - str = STR_LEFT_BRACKET + name + STR_GREATER_THAN + STR_EQUAL + STR_S_QUOTATION + initialValueStr + STR_S_QUOTATION + STR_AND + name + STR_LESS_THAN + STR_S_QUOTATION + endValueStr + STR_S_QUOTATION + STR_RIGHT_BRACKET; + str = F_LEFT_BRACKET + name + F_GREATER_THAN + F_EQUAL + F_S_QUOTATION + initialValueStr + F_S_QUOTATION + F_AND + name + F_LESS_THAN + F_S_QUOTATION + endValueStr + F_S_QUOTATION + F_RIGHT_BRACKET; } m_query = m_query + str; @@ -161,71 +162,71 @@ std::string CallHistoryFilter::convertAttributeArray(std::string &name, AnyArray { std::string query(""); AnyArray::iterator it = values->begin(); - query.append(STR_LEFT_BRACKET); + query.append(F_LEFT_BRACKET); do { if (it != values->begin()) { - query.append(STR_OR); + query.append(F_OR); } query.append(convertAttribute(name, *it)); it++; } while(it != values->end()); - query.append(STR_RIGHT_BRACKET); + query.append(F_RIGHT_BRACKET); return query; } std::string CallHistoryFilter::convertAttribute(std::string &name, AnyPtr& value) { std::string query(""); - if (name.compare("direction") == 0) { + if (name.compare(STR_DIRECTION) == 0) { if (value->toString().compare(STR_RECEIVED) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_ANSWERED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_ANSWERED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VOICE_ANSWERED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_ANSWERED + F_RIGHT_BRACKET; } else if (value->toString().compare(STR_DIALED) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_OUTGOING + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_OUTGOING + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VOICE_OUTGOING + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_OUTGOING + F_RIGHT_BRACKET; } else if (value->toString().compare(STR_MISSED) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_MISSED_CHECKED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_MISSED_CHECKED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VOICE_MISSED_CHECKED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_MISSED_CHECKED + F_RIGHT_BRACKET; } else if (value->toString().compare(STR_MISSED_NEW) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_MISSED_UNCHECKED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_MISSED_UNCHECKED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VOICE_MISSED_UNCHECKED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_MISSED_UNCHECKED + F_RIGHT_BRACKET; } else if (value->toString().compare(STR_REJECTED) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_REJECTED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_REJECTED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VOICE_REJECTED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_REJECTED + F_RIGHT_BRACKET; } else if (value->toString().compare(STR_BLOCKED) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_BLOCKED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_BLOCKED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VOICE_BLOCKED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_BLOCKED + F_RIGHT_BRACKET; } else { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + "=0" + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + "=0" + F_RIGHT_BRACKET; } - } else if (name.compare("tags") == 0) { + } else if (name.compare(STR_TAGS) == 0) { if (value->toString().compare(STR_CALL) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_GREATER_THAN + STR_EQUAL + STR_VOICE_ANSWERED + STR_AND - + STR_LOG_TYPE + STR_LESS_THAN + STR_EQUAL + STR_VIDEO_BLOCKED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_GREATER_THAN + F_EQUAL + F_VOICE_ANSWERED + F_AND + + F_LOG_TYPE + F_LESS_THAN + F_EQUAL + F_VIDEO_BLOCKED + F_RIGHT_BRACKET; } else if (value->toString().compare(STR_CALL_VOICE) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_ANSWERED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_OUTGOING + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_MISSED_UNCHECKED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_MISSED_CHECKED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_REJECTED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VOICE_BLOCKED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VOICE_ANSWERED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VOICE_OUTGOING + F_OR + + F_LOG_TYPE + F_EQUAL + F_VOICE_MISSED_UNCHECKED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VOICE_MISSED_CHECKED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VOICE_REJECTED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VOICE_BLOCKED + F_RIGHT_BRACKET; } else if (value->toString().compare(STR_CALL_VIDEO) == 0) { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_ANSWERED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_OUTGOING + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_MISSED_UNCHECKED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_MISSED_CHECKED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_REJECTED + STR_OR - + STR_LOG_TYPE + STR_EQUAL + STR_VIDEO_BLOCKED + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + F_EQUAL + F_VIDEO_ANSWERED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_OUTGOING + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_MISSED_UNCHECKED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_MISSED_CHECKED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_REJECTED + F_OR + + F_LOG_TYPE + F_EQUAL + F_VIDEO_BLOCKED + F_RIGHT_BRACKET; } else { - query = STR_LEFT_BRACKET + STR_LOG_TYPE + "=0" + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TYPE + "=0" + F_RIGHT_BRACKET; } - } else if (name.compare("remoteParties.remoteParty") == 0) { - query = STR_LEFT_BRACKET + STR_NUMBER + STR_EQUAL + STR_S_QUOTATION + value->toString() + STR_S_QUOTATION + STR_RIGHT_BRACKET; - } else if (name.compare("remoteParties.contactId") == 0) { - query = STR_LEFT_BRACKET + STR_CONTACT_ID + STR_EQUAL + STR_S_QUOTATION + value->toString() + STR_S_QUOTATION + STR_RIGHT_BRACKET; - } else if (name.compare("startTime") == 0) { + } else if (name.compare(STR_RP_REMOTEPARTY) == 0) { + query = F_LEFT_BRACKET + F_NUMBER + F_EQUAL + F_S_QUOTATION + value->toString() + F_S_QUOTATION + F_RIGHT_BRACKET; + } else if (name.compare(STR_RP_CONTACTID) == 0) { + query = F_LEFT_BRACKET + F_RELATED_ID + F_EQUAL + F_S_QUOTATION + value->toString() + F_S_QUOTATION + F_RIGHT_BRACKET; + } else if (name.compare(STR_START_TIME) == 0) { std::string dateStr (""); if(value->getType() == PrimitiveType_Time) { tm date = value->getDateTm(); @@ -235,9 +236,9 @@ std::string CallHistoryFilter::convertAttribute(std::string &name, AnyPtr& value } else { return query; } - query = STR_LEFT_BRACKET + STR_LOG_TIME + STR_EQUAL + STR_S_QUOTATION + dateStr + STR_S_QUOTATION + STR_RIGHT_BRACKET; - } else if (name.compare("duration") == 0) { - query = STR_LEFT_BRACKET + STR_DURATION + STR_EQUAL + STR_S_QUOTATION + value->toString() + STR_S_QUOTATION + STR_RIGHT_BRACKET; + query = F_LEFT_BRACKET + F_LOG_TIME + F_EQUAL + F_S_QUOTATION + dateStr + F_S_QUOTATION + F_RIGHT_BRACKET; + } else if (name.compare(F_DURATION) == 0) { + query = F_LEFT_BRACKET + F_DURATION + F_EQUAL + F_S_QUOTATION + value->toString() + F_S_QUOTATION + F_RIGHT_BRACKET; } return query; diff --git a/src/platform/Tizen/Call/CallHistoryFilter.h b/src/platform/Tizen/Call/CallHistoryFilter.h index 0dd2e8a..43f5e2b 100755 --- a/src/platform/Tizen/Call/CallHistoryFilter.h +++ b/src/platform/Tizen/Call/CallHistoryFilter.h @@ -24,28 +24,12 @@ #include <API/Filter/IFilterVisitor.h> #include <API/Call/CallHistoryEntryProperties.h> +#include <API/Call/CallDefine.h> namespace TizenApis { namespace Platform { namespace Call { -#define STR_TIZEN_TEL "tizen.tel" -#define STR_TIZEN_XMPP "tizen.xmpp" -#define STR_TIZEN_SIP "tizen.sip" - -#define STR_CALL "call" -#define STR_CALL_VOICE "call.voice" -#define STR_CALL_VIDEO "call.video" -#define STR_TIZEN_EMERGENCY "call.emergency" - -#define STR_DIALED "dialed" -#define STR_RECEIVED "received" -#define STR_MISSED_NEW "missed-new" -#define STR_MISSED "missed" -#define STR_REJECTED "rejected" -#define STR_BLOCKED "blocked" - -#define STR_BASE_QUERY "SELECT id, log_type, related_id, number, log_time, data1 FROM phonelogs" class CallHistoryFilter: public Api::Tizen::IFilterVisitor { diff --git a/src/platform/Tizen/Call/CallManager.cpp b/src/platform/Tizen/Call/CallManager.cpp index 0d5f77a..6666187 100755 --- a/src/platform/Tizen/Call/CallManager.cpp +++ b/src/platform/Tizen/Call/CallManager.cpp @@ -19,6 +19,7 @@ #include <call.h> #include <dpl/log/log.h> #include <API/Account/AccountServices.h> +#include <API/Call/CallDefine.h> #include "CallManager.h" using namespace WrtDeviceApis::Commons; @@ -86,41 +87,50 @@ void CallManager::OnRequestReceived(const EventGetCallServicePtr& event) ThrowMsg(UnsupportedException, "Not supported filter : providerId"); } - std::string typeId(filter->getServiceTypeId()); + std::string typeId(filter->getCallType()); StringArrayPtr tags(filter->getTags()); - if (typeId.compare("tizen.tel") != 0) { - ThrowMsg(UnsupportedException, "Not supported value : serviceTypeId"); + if (typeId.compare(STR_TIZEN_TEL) != 0 + && typeId.compare(STR_TIZEN_XMPP) != 0 + && typeId.compare(STR_TIZEN_SIP) != 0 + && typeId.compare("") != 0) { + ThrowMsg(InvalidArgumentException, "Invalid value : ServiceTypeId"); } - for (size_t cnt = 0; cnt < tags->size(); cnt++) { - if (((*tags)[cnt]).compare("call") == 0 - ||((*tags)[cnt]).compare("call.voice") == 0 - || ((*tags)[cnt]).compare("call.video") == 0 - || ((*tags)[cnt]).compare("call.emergency") == 0) { - continue; - } else { - ThrowMsg(UnsupportedException, "Not supported value : tags"); + size_t cnt = 0; + for (; cnt < tags->size(); cnt++) { + if (((*tags)[cnt]).compare(STR_CALL) != 0 + &&((*tags)[cnt]).compare(STR_CALL_VOICE) != 0 + && ((*tags)[cnt]).compare(STR_CALL_VIDEO) != 0 + && ((*tags)[cnt]).compare(STR_CALL_EMERGENCY) != 0) { + ThrowMsg(InvalidArgumentException, "Invalid value : tags"); } } AccountServicesArrayPtr accountServicesList(new AccountServicesArray()); AccountServicesPtr callServices(new AccountServices()); - callServices->setServiceTypeId("tizen.tel"); + if (typeId.compare(STR_TIZEN_XMPP) == 0 + || typeId.compare(STR_TIZEN_SIP) == 0) { + event->setResult(accountServicesList); + EventRequestReceiver<EventGetCallService>::ManualAnswer(event); + } + + callServices->setServiceTypeId(STR_TIZEN_TEL); StringArrayPtr supportTags(new StringArray()); - supportTags->push_back("call.voice"); - supportTags->push_back("call.video"); - supportTags->push_back("call.emergency"); + supportTags->push_back(STR_CALL_VOICE); + supportTags->push_back(STR_CALL_VIDEO); + supportTags->push_back(STR_CALL_EMERGENCY); callServices->setTags(*supportTags); + callServices->setApplicationId(STR_TIZEN_DIALER); accountServicesList->push_back(callServices); event->setResult(accountServicesList); EventRequestReceiver<EventGetCallService>::ManualAnswer(event); - } catch (const UnsupportedException& ex) { + } catch (const InvalidArgumentException& ex) { LogError("Exception: " << ex.GetMessage()); - event->setExceptionCode(ExceptionCodes::UnsupportedException); + event->setExceptionCode(ExceptionCodes::InvalidArgumentException); EventRequestReceiver<EventGetCallService>::ManualAnswer(event); } catch (const PlatformException& ex) { LogError("Exception: " << ex.GetMessage()); diff --git a/src/platform/Tizen/Call/CallService.cpp b/src/platform/Tizen/Call/CallService.cpp index 34b7f48..a64947f 100755 --- a/src/platform/Tizen/Call/CallService.cpp +++ b/src/platform/Tizen/Call/CallService.cpp @@ -21,6 +21,7 @@ #include <ITapiSim.h> #include <call.h> #include <dpl/log/log.h> +#include <API/Call/CallDefine.h> #include "CallService.h" using namespace WrtDeviceApis::Commons; @@ -212,7 +213,7 @@ void CallService::OnRequestReceived(const EventLaunchDialerPtr& event) try { event->switchToManualAnswer(); - std::string remoteParty("tel://"); + std::string remoteParty(STR_TEL_URI); remoteParty.append(event->getRemoteParty()); remoteParty.append(event->getExtension()); @@ -220,7 +221,7 @@ void CallService::OnRequestReceived(const EventLaunchDialerPtr& event) service_create(&service); service_set_operation(service, SERVICE_OPERATION_DEFAULT); - service_set_package(service, "com.samsung.phone"); //org.tizen.phone + service_set_package(service, event->getAppId().c_str()); service_set_uri(service, remoteParty.c_str()); diff --git a/src/platform/Tizen/Contact/AddressBook.cpp b/src/platform/Tizen/Contact/AddressBook.cpp index 95f6685..ab00a29 100755 --- a/src/platform/Tizen/Contact/AddressBook.cpp +++ b/src/platform/Tizen/Contact/AddressBook.cpp @@ -62,21 +62,8 @@ AddressBook::~AddressBook() ContactPtr AddressBook::get(const std::string &contactId) { LogDebug("entered"); - if(contactId == "") - ThrowMsg(InvalidArgumentException, "contactId argument is wrong"); - ContactSearchEnginePtr searchEngine(new ContactSearchEngine(ContactSearchEngine::CONTACT_QUERY)); - - searchEngine->setCondition(contactId); - searchEngine->setAttributeOfInterest(); - searchEngine->setSortMode(); - - ContactArrayPtr contacts = searchEngine->getContactSearchResult(); - - if(contacts->size() == 0) - ThrowMsg(NotFoundException, "No contact with ID:" << contactId); - - return contacts->at(0); + return internalGetById(contactId); } void AddressBook::add(const ContactPtr &contact) @@ -467,7 +454,13 @@ void AddressBook::internalAddContact(const ContactPtr &newContact) LogError("error code " << id); ThrowMsg(PlatformException, "Error during executing contacts_svc_insert_contact()"); } - newContact->setId(id); + + std::stringstream oss; + oss << id; + std::string idStr = oss.str(); + ContactPtr insertedContact = internalGetById(idStr); + + newContact->copy(insertedContact); } } @@ -487,6 +480,25 @@ void AddressBook::internalDeleteContactById(int id) ThrowMsg(PlatformException, "Error during executing contacts_svc_delete_contact()"); } +ContactPtr AddressBook::internalGetById(const std::string &contactId) +{ + if(contactId == "") + ThrowMsg(InvalidArgumentException, "contactId argument is wrong"); + + ContactSearchEnginePtr searchEngine(new ContactSearchEngine(ContactSearchEngine::CONTACT_QUERY)); + + searchEngine->setCondition(contactId); + searchEngine->setAttributeOfInterest(); + searchEngine->setSortMode(); + + ContactArrayPtr contacts = searchEngine->getContactSearchResult(); + + if(contacts->size() == 0) + ThrowMsg(NotFoundException, "No contact with ID:" << contactId); + + return contacts->at(0); +} + void AddressBook::contactsSvcContactChangedCallback(void *data) { AddressBook *addressBook = static_cast<AddressBook *>(data); diff --git a/src/platform/Tizen/Contact/AddressBook.h b/src/platform/Tizen/Contact/AddressBook.h index 5d3c92a..314703e 100755 --- a/src/platform/Tizen/Contact/AddressBook.h +++ b/src/platform/Tizen/Contact/AddressBook.h @@ -71,6 +71,8 @@ protected: private: int m_latestVersion; + TizenApis::Api::Contact::ContactPtr internalGetById(const std::string &contactId); + void internalAddContact(const TizenApis::Api::Contact::ContactPtr &newContact); void internalDeleteContactById(int id); DPL::Mutex m_contactEditingMutex; diff --git a/src/platform/Tizen/Contact/ContactSearchEngine.cpp b/src/platform/Tizen/Contact/ContactSearchEngine.cpp index 6fb68d2..8e9c16b 100755 --- a/src/platform/Tizen/Contact/ContactSearchEngine.cpp +++ b/src/platform/Tizen/Contact/ContactSearchEngine.cpp @@ -202,7 +202,7 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() str = query_get_attribute(m_contact_query_service, CONTACT_RINGTONE, &err); if( str ) - contact->setRingtoneURI(str); + contact->setRingtoneURI(std::string("file://") + str); str = query_get_attribute(m_contact_query_service, CONTACT_NOTE, &err); if( str ) @@ -214,7 +214,7 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() str = query_get_attribute(m_contact_query_service, CONTACT_PHOTO_URI, &err); if( str ) - contact->setPhotoURI(str); + contact->setPhotoURI(std::string("file://") + str); str = query_get_attribute(m_contact_query_service, CONTACT_LAST_UPDATED_TIME_STAMP, &err); if( str ) @@ -227,31 +227,14 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() contact->setLastUpdated(time_stamp); } - ContactNamePtr contactName = contact->getName(); + char *firstName = query_get_attribute(m_contact_query_service, NAME_FIRST, &err); + char *lastName = query_get_attribute(m_contact_query_service, NAME_LAST, &err); + char *middleName = query_get_attribute(m_contact_query_service, NAME_MIDDLE, &err); + char *displayName = query_get_attribute(m_contact_query_service, NAME_DISPLAY, &err); + char *prefix = query_get_attribute(m_contact_query_service, NAME_PREFIX, &err); + char *phoneticName = query_get_attribute(m_contact_query_service, NAME_PHONETIC, &err); - str = query_get_attribute(m_contact_query_service, NAME_FIRST, &err); - if( str ) - contactName->setFirstName(str); - - str = query_get_attribute(m_contact_query_service, NAME_LAST, &err); - if( str ) - contactName->setLastName(str); - - str = query_get_attribute(m_contact_query_service, NAME_MIDDLE, &err); - if( str ) - contactName->setMiddleName(str); - - str = query_get_attribute(m_contact_query_service, NAME_DISPLAY, &err); - if( str ) - contactName->setDisplayName(str); - - str = query_get_attribute(m_contact_query_service, NAME_PREFIX, &err); - if( str ) - contactName->setPrefix(str); - - str = query_get_attribute(m_contact_query_service, NAME_PHONETIC, &err); - if( str ) - contactName->setPhoneticName(str); + setName(contact, prefix, firstName, middleName, lastName, phoneticName, displayName); nameAlreadyChecked = true; } @@ -346,14 +329,24 @@ ContactArrayPtr ContactSearchEngine::getContactSearchResult() } else if (!nicknameAlreadyChecked && (pattr == NICKNAME_NAME)) { + ContactNamePtr contactName(NULL); + + if(!contact->getNameIsSet()) + contactName = ContactNamePtr(new ContactName()); + else + contactName = contact->getName(); + do { char *nickname = query_get_attribute(m_contact_query_service, NICKNAME_NAME, &err); if(nickname) - contact->getName()->addNickname(string(nickname)); + contactName->addNickname(string(nickname)); } while ( fetch_next_row(m_contact_query_service) == QUERY_SUCCESS ); + if(!contact->getNameIsSet()) + contact->setName(contactName); + nicknameAlreadyChecked = true; } else if (!categoryAlreadyChecked && (pattr == CATEGORY_INFO)) @@ -616,6 +609,43 @@ void ContactSearchEngine::setPlatformAttrValue(Contact& contact, contact_attribu } #endif +void ContactSearchEngine::setName(ContactPtr& contact, + char *prefix, char *firstName, char *middleName, + char *lastName, char *phoneticName, char *displayName) +{ + if(prefix == NULL && firstName == NULL && middleName == NULL + && lastName == NULL && phoneticName == NULL && displayName == NULL) + return; + + ContactNamePtr contactName(NULL); + + if(!contact->getNameIsSet()) + contactName = ContactNamePtr(new ContactName); + else + contactName = contact->getName(); + + if( prefix ) + contactName->setFirstName(prefix); + + if( firstName ) + contactName->setLastName(firstName); + + if( middleName ) + contactName->setMiddleName(middleName); + + if( lastName ) + contactName->setDisplayName(lastName); + + if( phoneticName ) + contactName->setPrefix(phoneticName); + + if( phoneticName ) + contactName->setPhoneticName(phoneticName); + + if(!contact->getNameIsSet()) + contact->setName(contactName); +} + void ContactSearchEngine::setPhoneNumber(ContactPtr& contact, char *number, char *type) { if(number == NULL) @@ -782,6 +812,9 @@ void ContactSearchEngine::setEvent(ContactPtr& contact, char *date, char *type) void ContactSearchEngine::setOrganization(ContactPtr& contact, char* org_name, char* org_dept, char* org_title, char* org_role) { + if(org_name == NULL && org_dept == NULL && org_title == NULL && org_role == NULL) + return; + ContactOrganizationPtr org = ContactOrganizationPtr(new ContactOrganization()); if(org_name) diff --git a/src/platform/Tizen/Contact/ContactSearchEngine.h b/src/platform/Tizen/Contact/ContactSearchEngine.h index 33808e8..f231324 100755 --- a/src/platform/Tizen/Contact/ContactSearchEngine.h +++ b/src/platform/Tizen/Contact/ContactSearchEngine.h @@ -88,6 +88,7 @@ private: void setPlatformAttrValue(TizenApis::Api::Contact::Contact& contact, contact_attribute_e attr, char* val); #endif + void setName(TizenApis::Api::Contact::ContactPtr& contact, char *prefix, char *firstName, char *middleName, char *lastName, char *phoneticName, char *displayName); void setPhoneNumber(TizenApis::Api::Contact::ContactPtr& contact, char *number, char *type); void setEmailAddresses(TizenApis::Api::Contact::ContactPtr& contact, char *email, char *type); void setUrlAddresses(TizenApis::Api::Contact::ContactPtr& contact, char *url, char *type); diff --git a/src/platform/Tizen/Contact/ContactWrapper.cpp b/src/platform/Tizen/Contact/ContactWrapper.cpp index afd7115..891ddf5 100755 --- a/src/platform/Tizen/Contact/ContactWrapper.cpp +++ b/src/platform/Tizen/Contact/ContactWrapper.cpp @@ -26,6 +26,7 @@ #include <pcrecpp.h> #include <dpl/log/log.h> #include <Commons/Exception.h> +#include <Commons/Regex.h> #include "ContactWrapper.h" #include "AddressBook.h" #include "Contact.h" @@ -203,11 +204,11 @@ bool ContactWrapper::convertToAbstractObject() charValue = contacts_svc_value_get_str(value, CTS_BASE_VAL_IMG_PATH_STR); if (charValue) - m_abstractContact->setPhotoURI(charValue); + m_abstractContact->setPhotoURI(convertPathToUri(charValue)); charValue = contacts_svc_value_get_str(value, CTS_BASE_VAL_RINGTONE_PATH_STR); if (charValue) - m_abstractContact->setRingtoneURI(charValue); + m_abstractContact->setRingtoneURI(convertPathToUri(charValue)); charValue = contacts_svc_value_get_str(value, CTS_BASE_VAL_NOTE_STR); if (charValue) @@ -306,9 +307,9 @@ bool ContactWrapper::convertToAbstractBaseData() if (charValue) contactName->setPrefix(charValue); - charValue = contacts_svc_value_get_str(value, CTS_NAME_VAL_SUFFIX_STR); - if (charValue) - contactName->setPhoneticName(charValue); + //charValue = contacts_svc_value_get_str(value, CTS_NAME_VAL_SUFFIX_STR); + //if (charValue) + // contactName->setPhoneticName(charValue); } else if (errorCode != CTS_ERR_NO_DATA || value == NULL) @@ -316,6 +317,32 @@ bool ContactWrapper::convertToAbstractBaseData() return false; } +// errorCode = contacts_svc_struct_get_value(m_platformContact, CTS_CF_BASE_INFO_VALUE, &value); +// if (CTS_SUCCESS == errorCode && value != NULL) +// { +// const char *charValue = NULL; +// +// charValue = contacts_svc_value_get_str(value, CTS_BASE_VAL_IMG_PATH_STR); +// if (charValue) +// m_abstractContact->setPhotoURI(convertPathToUri(charValue)); +// +// charValue = contacts_svc_value_get_str(value, CTS_BASE_VAL_RINGTONE_PATH_STR); +// if (charValue) +// m_abstractContact->setRingtoneURI(convertPathToUri(charValue)); +// +// bool boolValue = contacts_svc_value_get_bool(value, CTS_BASE_VAL_FAVORITE_BOOL); +// if (boolValue) +// m_abstractContact->setIsFavorite(boolValue); +// +// charValue = contacts_svc_value_get_str(value, CTS_BASE_VAL_NOTE_STR); +// if (charValue) +// m_abstractContact->addNote(charValue); +// } +// else if (errorCode != CTS_ERR_NO_DATA || value == NULL) +// { +// return false; +// } + return true; } @@ -345,22 +372,12 @@ bool ContactWrapper::convertToAbstractAddressObject() addresses->push_back(address); int type = contacts_svc_value_get_int(static_cast<CTSvalue*>(addressList->data), CTS_POSTAL_VAL_TYPE_INT); - switch (type) - { - case CTS_ADDR_TYPE_NONE: + if(type & CTS_ADDR_TYPE_POSTAL) // TODO to be checked address->addType(CONTACT_ADDRESS_TYPE_PREF); - break; - case CTS_ADDR_TYPE_HOME: + if(type & CTS_ADDR_TYPE_HOME) address->addType(CONTACT_ADDRESS_TYPE_HOME); - break; - case CTS_ADDR_TYPE_WORK: + if(type & CTS_ADDR_TYPE_WORK) address->addType(CONTACT_ADDRESS_TYPE_WORK); - break; - default: - LogError("invalid address type"); - address->addType(CONTACT_ADDRESS_TYPE_PREF); - break; - } const char *charValue = NULL; @@ -637,22 +654,13 @@ bool ContactWrapper::convertToAbstractEmailObject() emailAddresses->push_back(email); int type = contacts_svc_value_get_int(static_cast<CTSvalue*>(emailList->data), CTS_EMAIL_VAL_TYPE_INT); - switch (type) - { - case CTS_EMAIL_TYPE_NONE: + + if(type | CTS_EMAIL_TYPE_NONE) email->addType(CONTACT_EMAIL_TYPE_PREF); - break; - case CTS_EMAIL_TYPE_HOME: + if(type | CTS_EMAIL_TYPE_HOME) email->addType(CONTACT_EMAIL_TYPE_HOME); - break; - case CTS_EMAIL_TYPE_WORK: + if(type | CTS_EMAIL_TYPE_WORK) email->addType(CONTACT_EMAIL_TYPE_WORK); - break; - default: - LogError("invalid phone type"); - email->addType(CONTACT_EMAIL_TYPE_PREF); - break; - } const char *charValue = NULL; @@ -697,55 +705,36 @@ bool ContactWrapper::convertToAbstractPhoneObject() phoneNumbers->push_back(phoneNumber); int type = contacts_svc_value_get_int(static_cast<CTSvalue*>(phoneList->data), CTS_NUM_VAL_TYPE_INT); - switch (type) - { - case CTS_NUM_TYPE_WORK: + if(type & CTS_NUM_TYPE_WORK) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_WORK); - break; - case CTS_NUM_TYPE_NONE: + if(type & CTS_NUM_TYPE_NONE) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_PREF); - break; - case CTS_NUM_TYPE_HOME: + if(type & CTS_NUM_TYPE_HOME) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_HOME); - break; - case CTS_NUM_TYPE_FAX: + if(type & CTS_NUM_TYPE_FAX) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_FAX); - break; - case CTS_NUM_TYPE_CELL: + if(type & CTS_NUM_TYPE_CELL) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_CELL); - break; - case CTS_NUM_TYPE_PAGER: + if(type & CTS_NUM_TYPE_PAGER) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_PAGER); - break; - case CTS_NUM_TYPE_CAR: + if(type & CTS_NUM_TYPE_CAR) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_CAR); - break; - case CTS_NUM_TYPE_VOICE: + if(type & CTS_NUM_TYPE_VOICE) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_VOICE); - break; - case CTS_NUM_TYPE_MSG: + if(type & CTS_NUM_TYPE_MSG) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_MSG); - break; - case CTS_NUM_TYPE_BBS: + if(type & CTS_NUM_TYPE_BBS) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_BBS); - break; - case CTS_NUM_TYPE_MODEM: - phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_MODEM); - break; - case CTS_NUM_TYPE_ISDN: + if(type & CTS_NUM_TYPE_ISDN) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_ISDN); - break; - case CTS_NUM_TYPE_VIDEO: + if(type & CTS_NUM_TYPE_VIDEO) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_VIDEO); - break; - case CTS_NUM_TYPE_PCS: + if(type & CTS_NUM_TYPE_PCS) phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_PCS); - break; - default: - LogError("invalid phone type"); - phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_PREF); - break; - } + if(type & CTS_NUM_TYPE_WORK) + phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_WORK); + if(type & CTS_NUM_TYPE_WORK) + phoneNumber->addType(CONTACT_PHONE_NUMBER_TYPE_WORK); const char *charValue = NULL; @@ -1743,17 +1732,17 @@ bool ContactWrapper::convertToPlatformAddressObject() switch (types->at(j)) { case CONTACT_ADDRESS_TYPE_PREF: - type = CTS_ADDR_TYPE_NONE; + type |= CTS_ADDR_TYPE_POSTAL; // TODO To be checked break; case CONTACT_ADDRESS_TYPE_WORK: - type = CTS_ADDR_TYPE_WORK; + type |= CTS_ADDR_TYPE_WORK; break; case CONTACT_ADDRESS_TYPE_HOME: - type = CTS_ADDR_TYPE_HOME; + type |= CTS_ADDR_TYPE_HOME; break; default: LogError("invalid address type"); - type = CTS_EMAIL_TYPE_NONE; + type |= CTS_EMAIL_TYPE_NONE; break; } } @@ -1835,7 +1824,7 @@ bool ContactWrapper::convertToPlatformBaseData() || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_ADDITION_STR, contactName->getMiddleName().c_str()) || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_DISPLAY_STR, contactName->getDisplayName().c_str()) || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_PREFIX_STR, contactName->getPrefix().c_str()) - || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_SUFFIX_STR, contactName->getPhoneticName().c_str()) + // || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_SUFFIX_STR, contactName->getPhoneticName().c_str()) || CTS_SUCCESS != contacts_svc_struct_store_value(m_platformContact, CTS_CF_NAME_VALUE, value)) { contacts_svc_value_free(value); @@ -1855,7 +1844,7 @@ bool ContactWrapper::convertToPlatformBaseData() || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_LAST_STR, contactName->getLastName().c_str()) || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_ADDITION_STR, contactName->getMiddleName().c_str()) || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_DISPLAY_STR, contactName->getDisplayName().c_str()) - || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_SUFFIX_STR, contactName->getPhoneticName().c_str()) + // || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_SUFFIX_STR, contactName->getPhoneticName().c_str()) || CTS_SUCCESS != contacts_svc_value_set_str(value, CTS_NAME_VAL_PREFIX_STR, contactName->getPrefix().c_str())) { contacts_svc_value_free(value); @@ -1877,17 +1866,20 @@ bool ContactWrapper::convertToPlatformBaseData() { if (m_abstractContact->getPhotoURIIsSet()) { - if (CTS_SUCCESS != contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_IMG_PATH_STR, m_abstractContact->getPhotoURI().c_str())) + if (CTS_SUCCESS != contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_IMG_PATH_STR, convertUriToPath(m_abstractContact->getPhotoURI()).c_str())) { contacts_svc_value_free(baseinfo); return false; } } - if (CTS_SUCCESS != contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_RINGTONE_PATH_STR, m_abstractContact->getRingtoneURI().c_str())) + if (m_abstractContact->getRingtoneURIIsSet()) { - contacts_svc_value_free(baseinfo); - return false; + if (CTS_SUCCESS != contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_RINGTONE_PATH_STR, convertUriToPath(m_abstractContact->getRingtoneURI()).c_str())) + { + contacts_svc_value_free(baseinfo); + return false; + } } if (CTS_SUCCESS != contacts_svc_value_set_bool(baseinfo, CTS_BASE_VAL_FAVORITE_BOOL, m_abstractContact->getIsFavorite())) @@ -1924,19 +1916,33 @@ bool ContactWrapper::convertToPlatformBaseData() strOldImagePath = static_cast<string>(oldimgpath); } - string strNewImagePath = m_abstractContact->getPhotoURI(); + string strNewImagePath = convertUriToPath(m_abstractContact->getPhotoURI()); if (strOldImagePath != strNewImagePath) { if (CTS_SUCCESS != contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_IMG_PATH_STR, strNewImagePath.c_str())) { - contacts_svc_value_free(value); + contacts_svc_value_free(baseinfo); return false; } } - if (CTS_SUCCESS != contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_RINGTONE_PATH_STR, m_abstractContact->getRingtoneURI().c_str())) + const char * oldringtonepath = NULL; + oldringtonepath = contacts_svc_value_get_str(baseinfo, CTS_BASE_VAL_IMG_PATH_STR); + + string strOldRingtonePath = ""; + if (NULL != oldringtonepath) + { + strOldRingtonePath = static_cast<string>(oldringtonepath); + } + + string strNewRingtonePath = convertUriToPath(m_abstractContact->getRingtoneURI()); + if (strOldRingtonePath != strNewRingtonePath) { - return false; + if (CTS_SUCCESS != contacts_svc_value_set_str(baseinfo, CTS_BASE_VAL_RINGTONE_PATH_STR, strNewRingtonePath.c_str())) + { + contacts_svc_value_free(baseinfo); + return false; + } } if(m_abstractContact->getNotesNum() > 0) @@ -1957,7 +1963,7 @@ bool ContactWrapper::convertToPlatformBaseData() } contacts_svc_struct_store_value(m_platformContact, CTS_CF_BASE_INFO_VALUE, baseinfo); - contacts_svc_value_free(value); + contacts_svc_value_free(baseinfo); } /* //save company information @@ -2015,6 +2021,30 @@ void ContactWrapper::printAbstractObject() { } +string ContactWrapper::convertUriToPath(string str) const +{ + string result; + + if(validate("^file\\:///[a-zA-Z]{2,3}(/\\S*)?$", str, VALIDATE_MATCH_CASELESS)) + result = str.substr(string("file://").size()); + else if(validate("^/[a-zA-Z]{2,3}(/\\S*)?$", str, VALIDATE_MATCH_CASELESS)) + result = str; + + return result; +} + +string ContactWrapper::convertPathToUri(string str) const +{ + string result; + + if(validate("^/[a-zA-Z]{2,3}(/\\S*)?$", str, VALIDATE_MATCH_CASELESS)) + result = "file://" + str; + else if(validate("^file\\:///[a-zA-Z]{2,3}(/\\S*)?$", str, VALIDATE_MATCH_CASELESS)) + result = str; + + return result; +} + } // Contact } // Platform } // TizenApis diff --git a/src/platform/Tizen/Contact/ContactWrapper.h b/src/platform/Tizen/Contact/ContactWrapper.h index 321dfa9..c87df67 100755 --- a/src/platform/Tizen/Contact/ContactWrapper.h +++ b/src/platform/Tizen/Contact/ContactWrapper.h @@ -89,6 +89,9 @@ private: void printPlatformObject(); //for debug purpose only void printAbstractObject(); + + std::string convertUriToPath(std::string str) const; + std::string convertPathToUri(std::string str) const; }; typedef DPL::SharedPtr<ContactWrapper> ContactWrapperPtr; diff --git a/src/platform/Tizen/Contact/DownloadManager.cpp b/src/platform/Tizen/Contact/DownloadManager.cpp index 50736e0..0f555bc 100755 --- a/src/platform/Tizen/Contact/DownloadManager.cpp +++ b/src/platform/Tizen/Contact/DownloadManager.cpp @@ -105,14 +105,18 @@ string DownloadManager::getRealPath(const string &path) const string result; Try { - if ( validate("^(http(s)?://)?\\w+.*$", path, VALIDATE_MATCH_CASELESS) ) + if(validate("^http(s)?\\://[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}(/\\S*)?$", path, VALIDATE_MATCH_CASELESS)) { // if path is URL then Image will be downloaded. result = downloadImage(path); } - else + else if(validate("^file\\:///[a-zA-Z]{2,3}(/\\S*)?$", path, VALIDATE_MATCH_CASELESS)) { - result = path; + result = path; + } + else if(validate("^/[a-zA-Z]{2,3}(/\\S*)?$", path, VALIDATE_MATCH_CASELESS)) + { + result = "file://" + path; } } Catch(Exception) diff --git a/src/standards/Tizen/Call/Converter.cpp b/src/standards/Tizen/Call/Converter.cpp index 331a053..2a7535c 100755 --- a/src/standards/Tizen/Call/Converter.cpp +++ b/src/standards/Tizen/Call/Converter.cpp @@ -23,33 +23,12 @@ #include <CommonsJavaScript/ScopedJSStringRef.h> #include <CommonsJavaScript/JSUtils.h> #include <CommonsJavaScript/JSCallbackManager.h> +#include <API/Call/CallDefine.h> #include "JSCallHistoryEntry.h" #include "JSRemoteParty.h" #include "JSCallService.h" #include "JSCellularCallService.h" -#define CH_ENTRY_ID "entryId" -#define CH_SERVICE_ID "serviceId" -#define CH_CALL_TYPE "callType" -#define CH_TAGS "tags" -#define CH_REMOTE_PARTIES "remoteParties" -#define CH_FORWARDEDFROM "forwardedFrom" -#define CH_START_TIME "startTime" -#define CH_DURATION "duration" -#define CH_END_REASON "endReason" -#define CH_DIRECTION "direction" -#define CH_RECORDING "recording" -#define CH_COST "cost" -#define CH_CURRENCY "currency" - -#define CH_REMOTE_PARTY "remoteParty" -#define CH_DISPLAY_NAME "displayName" -#define CH_CONTACT_ID "contactId" - -#define CH_SERVICETYPE_ID "serviceTypeId" -#define CH_SERVICENAME "serviceName" -#define CH_PROVIDER_ID "providerId" - using namespace WrtDeviceApis; using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; @@ -143,9 +122,9 @@ RemotePartyPtr Converter::toRemoteParty(const JSValueRef &jsValue) ThrowMsg(Commons::InvalidArgumentException, "Wrong attribute of RemoteParty"); } - const ScopedJSStringRef remotePartyStr(JSStringCreateWithUTF8CString(CH_REMOTE_PARTY)); - const ScopedJSStringRef displayNameStr(JSStringCreateWithUTF8CString(CH_DISPLAY_NAME)); - const ScopedJSStringRef contactIdStr(JSStringCreateWithUTF8CString(CH_CONTACT_ID)); + const ScopedJSStringRef remotePartyStr(JSStringCreateWithUTF8CString(STR_REMOTE_PARTY)); + const ScopedJSStringRef displayNameStr(JSStringCreateWithUTF8CString(STR_DISPLAY_NAME)); + const ScopedJSStringRef contactIdStr(JSStringCreateWithUTF8CString(STR_CONTACT_ID)); JSObjectRef jsObject = toJSObjectRef(jsValue); @@ -185,23 +164,23 @@ CallServiceFilterPtr Converter::toCallServiceFilter(const JSValueRef &jsValue) { Validator validator(m_context); if (!validator.checkArrayKeys(m_allowedCallServiceFilter, jsValue)) { - ThrowMsg(Commons::InvalidArgumentException, "Wrong attribute of RemoteParty"); + ThrowMsg(Commons::InvalidArgumentException, "Wrong attribute of call service filter"); } - const ScopedJSStringRef serviceTypeIdStr(JSStringCreateWithUTF8CString(CH_SERVICETYPE_ID)); - const ScopedJSStringRef tagsStr(JSStringCreateWithUTF8CString(CH_TAGS)); - const ScopedJSStringRef serviceNameStr(JSStringCreateWithUTF8CString(CH_SERVICENAME)); - const ScopedJSStringRef providerIdStr(JSStringCreateWithUTF8CString(CH_PROVIDER_ID)); + const ScopedJSStringRef callTypeStr(JSStringCreateWithUTF8CString(STR_CALL_TYPE)); + const ScopedJSStringRef tagsStr(JSStringCreateWithUTF8CString(STR_TAGS)); + const ScopedJSStringRef serviceNameStr(JSStringCreateWithUTF8CString(STR_SERVICE_NAME)); + const ScopedJSStringRef providerIdStr(JSStringCreateWithUTF8CString(STR_PROVIDER_ID)); JSObjectRef jsObject = toJSObjectRef(jsValue); - JSValueRef jServiceTypeId = JSObjectGetProperty(m_context, jsObject, serviceTypeIdStr.get(), NULL); + JSValueRef jCallType = JSObjectGetProperty(m_context, jsObject, callTypeStr.get(), NULL); JSValueRef jTags = JSObjectGetProperty(m_context, jsObject, tagsStr.get(), NULL); JSValueRef jServiceName = JSObjectGetProperty(m_context, jsObject, serviceNameStr.get(), NULL); JSValueRef jProviderId = JSObjectGetProperty(m_context, jsObject, providerIdStr.get(), NULL); - std::string serviceTypeId; - StringArrayPtr tags; + std::string callType; + StringArrayPtr tags(new StringArray()); std::string serviceName; std::string providerId; @@ -211,19 +190,9 @@ CallServiceFilterPtr Converter::toCallServiceFilter(const JSValueRef &jsValue) Throw(Commons::ConversionException); } - if (!JSValueIsUndefined(m_context, jServiceTypeId)) { - serviceTypeId = toString(jServiceTypeId); - result->setServiceTypeId(serviceTypeId); - } - - if (!JSValueIsUndefined(m_context, jTags)) { - tags = toStringArray(jProviderId); - result->setTags(tags); - } - - if (!JSValueIsUndefined(m_context, jServiceName)) { - serviceName = toString(jServiceName); - result->setServiceName(serviceName); + if (!JSValueIsUndefined(m_context, jCallType)) { + callType = toString(jCallType); + result->setCallType(callType); } if (!JSValueIsUndefined(m_context, jProviderId)) { @@ -241,19 +210,19 @@ CallHistoryEntryPropertiesPtr Converter::toCallHistoryEntryProperties(const JSVa ThrowMsg(Commons::InvalidArgumentException, "Wrong attribute of call history entry"); } - const ScopedJSStringRef entryIdStr(JSStringCreateWithUTF8CString(CH_ENTRY_ID)); - const ScopedJSStringRef serviceIdStr(JSStringCreateWithUTF8CString(CH_SERVICE_ID)); - const ScopedJSStringRef callTypeStr(JSStringCreateWithUTF8CString(CH_CALL_TYPE)); - const ScopedJSStringRef tagsStr(JSStringCreateWithUTF8CString(CH_TAGS)); - const ScopedJSStringRef remotePartiesStr(JSStringCreateWithUTF8CString(CH_REMOTE_PARTIES)); - const ScopedJSStringRef forwardedFromStr(JSStringCreateWithUTF8CString(CH_FORWARDEDFROM)); - const ScopedJSStringRef startTimeStr(JSStringCreateWithUTF8CString(CH_START_TIME)); - const ScopedJSStringRef durationStr(JSStringCreateWithUTF8CString(CH_DURATION)); - const ScopedJSStringRef endReasonStr(JSStringCreateWithUTF8CString(CH_END_REASON)); - const ScopedJSStringRef directionStr(JSStringCreateWithUTF8CString(CH_DIRECTION)); - const ScopedJSStringRef recordingStr(JSStringCreateWithUTF8CString(CH_RECORDING)); - const ScopedJSStringRef costStr(JSStringCreateWithUTF8CString(CH_COST)); - const ScopedJSStringRef currencyStr(JSStringCreateWithUTF8CString(CH_CURRENCY)); + const ScopedJSStringRef entryIdStr(JSStringCreateWithUTF8CString(STR_ENTRY_ID)); + const ScopedJSStringRef serviceIdStr(JSStringCreateWithUTF8CString(STR_SERVICE_ID)); + const ScopedJSStringRef callTypeStr(JSStringCreateWithUTF8CString(STR_CALL_TYPE)); + const ScopedJSStringRef tagsStr(JSStringCreateWithUTF8CString(STR_TAGS)); + const ScopedJSStringRef remotePartiesStr(JSStringCreateWithUTF8CString(STR_REMOTE_PARTIES)); + const ScopedJSStringRef forwardedFromStr(JSStringCreateWithUTF8CString(STR_FORWARDEDFROM)); + const ScopedJSStringRef startTimeStr(JSStringCreateWithUTF8CString(STR_START_TIME)); + const ScopedJSStringRef durationStr(JSStringCreateWithUTF8CString(STR_DURATION)); + const ScopedJSStringRef endReasonStr(JSStringCreateWithUTF8CString(STR_END_REASON)); + const ScopedJSStringRef directionStr(JSStringCreateWithUTF8CString(STR_DIRECTION)); + const ScopedJSStringRef recordingStr(JSStringCreateWithUTF8CString(STR_RECORDING)); + const ScopedJSStringRef costStr(JSStringCreateWithUTF8CString(STR_COST)); + const ScopedJSStringRef currencyStr(JSStringCreateWithUTF8CString(STR_CURRENCY)); JSObjectRef jsObject = toJSObjectRef(jsValue); @@ -456,15 +425,15 @@ JSValueRef Converter::toJSValueRef(const Api::Account::AccountServicesArrayPtr& { std::vector<JSValueRef> callServiceList; - Api::Account::AccountServices tmpAccountServices; + Api::Account::AccountServices tmpService; for (size_t i = 0; i < (*arg).size(); i++) { - tmpAccountServices = *((*arg)[i]); + tmpService = *((*arg)[i]); - if (tmpAccountServices.getServiceTypeId().compare("tizen.tel") == 0) { - callServiceList.push_back(JSCellularCallService::createJSObject(context, tmpAccountServices)); + if (tmpService.getServiceTypeId().compare(STR_TIZEN_TEL) == 0) { + callServiceList.push_back(JSCellularCallService::createJSObject(context, tmpService)); } else { - callServiceList.push_back(JSCallService::createJSObject(context, tmpAccountServices)); + callServiceList.push_back(JSCallService::createJSObject(context, tmpService)); } } @@ -473,26 +442,26 @@ JSValueRef Converter::toJSValueRef(const Api::Account::AccountServicesArrayPtr& bool Converter::initializeAllowedProperties() { - m_allowedCallHistoryEntryProperties.push_back(CH_ENTRY_ID); - m_allowedCallHistoryEntryProperties.push_back(CH_SERVICE_ID); - m_allowedCallHistoryEntryProperties.push_back(CH_CALL_TYPE); - m_allowedCallHistoryEntryProperties.push_back(CH_TAGS); - m_allowedCallHistoryEntryProperties.push_back(CH_REMOTE_PARTIES); - m_allowedCallHistoryEntryProperties.push_back(CH_FORWARDEDFROM); - m_allowedCallHistoryEntryProperties.push_back(CH_START_TIME); - m_allowedCallHistoryEntryProperties.push_back(CH_DURATION); - m_allowedCallHistoryEntryProperties.push_back(CH_END_REASON); - m_allowedCallHistoryEntryProperties.push_back(CH_DIRECTION); - m_allowedCallHistoryEntryProperties.push_back(CH_RECORDING); - m_allowedCallHistoryEntryProperties.push_back(CH_COST); - m_allowedCallHistoryEntryProperties.push_back(CH_CURRENCY); - m_allowedRemoteParty.push_back(CH_REMOTE_PARTY); - m_allowedRemoteParty.push_back(CH_DISPLAY_NAME); - m_allowedRemoteParty.push_back(CH_CONTACT_ID); - m_allowedCallServiceFilter.push_back(CH_SERVICETYPE_ID); - m_allowedCallServiceFilter.push_back(CH_TAGS); - m_allowedCallServiceFilter.push_back(CH_SERVICENAME); - m_allowedCallServiceFilter.push_back(CH_PROVIDER_ID); + m_allowedCallHistoryEntryProperties.push_back(STR_ENTRY_ID); + m_allowedCallHistoryEntryProperties.push_back(STR_SERVICE_ID); + m_allowedCallHistoryEntryProperties.push_back(STR_CALL_TYPE); + m_allowedCallHistoryEntryProperties.push_back(STR_TAGS); + m_allowedCallHistoryEntryProperties.push_back(STR_REMOTE_PARTIES); + m_allowedCallHistoryEntryProperties.push_back(STR_FORWARDEDFROM); + m_allowedCallHistoryEntryProperties.push_back(STR_START_TIME); + m_allowedCallHistoryEntryProperties.push_back(STR_DURATION); + m_allowedCallHistoryEntryProperties.push_back(STR_END_REASON); + m_allowedCallHistoryEntryProperties.push_back(STR_DIRECTION); + m_allowedCallHistoryEntryProperties.push_back(STR_RECORDING); + m_allowedCallHistoryEntryProperties.push_back(STR_COST); + m_allowedCallHistoryEntryProperties.push_back(STR_CURRENCY); + m_allowedRemoteParty.push_back(STR_REMOTE_PARTY); + m_allowedRemoteParty.push_back(STR_DISPLAY_NAME); + m_allowedRemoteParty.push_back(STR_CONTACT_ID); + m_allowedCallServiceFilter.push_back(STR_CALL_TYPE); + m_allowedCallServiceFilter.push_back(STR_TAGS); + m_allowedCallServiceFilter.push_back(STR_SERVICE_NAME); + m_allowedCallServiceFilter.push_back(STR_PROVIDER_ID); return true; } diff --git a/src/standards/Tizen/Call/JSCallHistoryEntry.cpp b/src/standards/Tizen/Call/JSCallHistoryEntry.cpp index 9c0751d..5ce2981 100755 --- a/src/standards/Tizen/Call/JSCallHistoryEntry.cpp +++ b/src/standards/Tizen/Call/JSCallHistoryEntry.cpp @@ -24,6 +24,7 @@ #include <API/Call/CallHistoryEntryProperties.h> #include <API/Call/CallHistoryFactory.h> #include <API/Call/ICallHistoryEntry.h> +#include <API/Call/CallDefine.h> #include <Tizen/Common/JSTizenException.h> #include <Tizen/Common/JSTizenExceptionFactory.h> #include <Tizen/Common/SecurityExceptions.h> @@ -40,20 +41,6 @@ using namespace WrtDeviceApis::CommonsJavaScript; using namespace Api::Call; using namespace TizenApis::Commons; -#define STR_ENTRY_ID "entryId" -#define STR_SERVICE_ID "serviceId" -#define STR_CALL_TYPE "callType" -#define STR_TAGS "tags" -#define STR_REMOTE_PARTIES "remoteParties" -#define STR_FORWARDEDFROM "forwardedFrom" -#define STR_START_TIME "startTime" -#define STR_DURATION "duration" -#define STR_END_REASON "endReason" -#define STR_DIRECTION "direction" -#define STR_RECORDING "recording" -#define STR_COST "cost" -#define STR_CURRENCY "currency" - JSClassDefinition JSCallHistoryEntry::m_classInfo = { 0, kJSClassAttributeNone, @@ -195,9 +182,9 @@ bool JSCallHistoryEntry::setProperty(JSContextRef context, std::string direction(converter.toString(value)); if (callHistoryEntry != NULL) { - if((entryInfo->getDirection().compare("missed-new") == 0) && (direction.compare("missed") == 0)) { + if((entryInfo->getDirection().compare(STR_MISSED_NEW) == 0) && (direction.compare(STR_MISSED) == 0)) { callHistoryEntry->setMarkSeen(entryInfo->getEntryId()); - entryInfo->setDirection("missed"); + entryInfo->setDirection(STR_MISSED); } else { Throw(WrtDeviceApis::Commons::UnsupportedException); } diff --git a/src/standards/Tizen/Call/JSCallManager.cpp b/src/standards/Tizen/Call/JSCallManager.cpp index e782a8b..f0c36fd 100755 --- a/src/standards/Tizen/Call/JSCallManager.cpp +++ b/src/standards/Tizen/Call/JSCallManager.cpp @@ -22,6 +22,7 @@ #include <CommonsJavaScript/JSDOMExceptionFactory.h> #include <API/Call/ICallManager.h> #include <API/Call/CallFactory.h> +#include <API/Call/CallDefine.h> #include <API/Call/EventGetCallService.h> #include <Tizen/Common/JSTizenExceptionFactory.h> #include <Tizen/Common/JSTizenException.h> @@ -67,7 +68,7 @@ JSClassDefinition JSCallManager::m_classInfo = }; JSStaticValue JSCallManager::m_property[] = { - { "history", getProperty, NULL, kJSPropertyAttributeReadOnly }, + { STR_HISTORY, getProperty, NULL, kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -125,7 +126,7 @@ JSValueRef JSCallManager::getProperty(JSContextRef context, JSContextRef globalContext = priv->getContext(); try { Converter convert(context); - if(JSStringIsEqualToUTF8CString(propertyName, "history")) { + if(JSStringIsEqualToUTF8CString(propertyName, STR_HISTORY)) { return JSCallHistory::createJSObject(globalContext, object); } } catch(const WrtDeviceApis::Commons::Exception& ex) { @@ -198,7 +199,7 @@ JSValueRef JSCallManager::getCallServices(JSContextRef context, JSObjectRef obje if (argumentCount == 0) { StringArrayPtr tags(new StringArray()); - tags->push_back("call"); + tags->push_back(STR_CALL); filter->setTags(tags); } else { if (!JSValueIsObject(context, arguments[0])) { @@ -218,8 +219,8 @@ JSValueRef JSCallManager::getCallServices(JSContextRef context, JSObjectRef obje if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::None) { return converter.toJSValueRef(event->getResult(), gContext); } else { - if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::UnsupportedException) { - return JSTizenExceptionFactory::postException(context, exception, JSTizenException::NOT_SUPPORTED_ERROR, "Not supported value"); + if (event->getExceptionCode() == WrtDeviceApis::Commons::ExceptionCodes::InvalidArgumentException) { + return JSTizenExceptionFactory::postException(context, exception, JSTizenException::INVALID_VALUES_ERROR, "Invalid values error : CallServiceFilter"); } else { return JSTizenExceptionFactory::postException(context, exception, JSTizenException::UNKNOWN_ERROR, "Unknown error"); } diff --git a/src/standards/Tizen/Call/JSCallService.cpp b/src/standards/Tizen/Call/JSCallService.cpp index 039bb79..675002f 100755 --- a/src/standards/Tizen/Call/JSCallService.cpp +++ b/src/standards/Tizen/Call/JSCallService.cpp @@ -20,6 +20,7 @@ #include <CommonsJavaScript/JSCallbackManager.h> #include <CommonsJavaScript/Utils.h> #include <CommonsJavaScript/JSDOMExceptionFactory.h> +#include <API/Call/CallDefine.h> #include <API/Call/CallFactory.h> #include <API/Call/ICallService.h> #include <API/Call/EventLaunchDialer.h> @@ -68,7 +69,7 @@ JSClassDefinition JSCallService::m_classInfo = }; JSStaticValue JSCallService::m_property[] = { - { "voicemailNumbers", getProperty, NULL, kJSPropertyAttributeReadOnly }, + { STR_VOICEMAIL_NUMBERS, getProperty, NULL, kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -137,7 +138,7 @@ JSValueRef JSCallService::getProperty(JSContextRef context, try { Converter convert(context); - if(JSStringIsEqualToUTF8CString(propertyName, "voicemailNumbers")) { + if(JSStringIsEqualToUTF8CString(propertyName, STR_VOICEMAIL_NUMBERS)) { return convert.toJSValueRef(callService->getVoicemailNumbers(), globalContext); } } catch(WrtDeviceApis::Commons::Exception) { @@ -212,6 +213,7 @@ JSValueRef JSCallService::launchDialer(JSContextRef context, JSObjectRef object, if (argumentCount >= 4) { event ->setExtension(converter.toString(arguments[3])); } + event->setAppId(privateData->getApplicationId()); event->setPrivateData(StaticPointerCast<IEventPrivateData> (cbm)); event->setForAsynchronousCall(&ResponseDispatcher::getInstance()); diff --git a/src/standards/Tizen/Call/JSCellularCallService.cpp b/src/standards/Tizen/Call/JSCellularCallService.cpp index 311a232..c9fc802 100755 --- a/src/standards/Tizen/Call/JSCellularCallService.cpp +++ b/src/standards/Tizen/Call/JSCellularCallService.cpp @@ -20,6 +20,7 @@ #include <CommonsJavaScript/JSCallbackManager.h> #include <CommonsJavaScript/Utils.h> #include <CommonsJavaScript/JSDOMExceptionFactory.h> +#include <API/Call/CallDefine.h> #include <API/Call/CallFactory.h> #include <API/Call/ICallManager.h> #include <API/Call/EventSendUSSD.h> @@ -68,8 +69,8 @@ JSClassDefinition JSCellularCallService::m_classInfo = }; JSStaticValue JSCellularCallService::m_property[] = { - { "subscriberNumbers", getProperty, NULL, kJSPropertyAttributeReadOnly }, - { "emergencyNumbers", getProperty, NULL, kJSPropertyAttributeReadOnly }, + { STR_SUBSCRIBER_NUMBERS, getProperty, NULL, kJSPropertyAttributeReadOnly }, + { STR_EMERGENCY_NUMBERS, getProperty, NULL, kJSPropertyAttributeReadOnly }, { 0, 0, 0, 0 } }; @@ -138,9 +139,9 @@ JSValueRef JSCellularCallService::getProperty(JSContextRef context, try { Converter convert(context); - if(JSStringIsEqualToUTF8CString(propertyName, "subscriberNumbers")) { + if(JSStringIsEqualToUTF8CString(propertyName, STR_SUBSCRIBER_NUMBERS)) { return convert.toJSValueRef(callService->getSubscriberNumbers(), globalContext); - } else if(JSStringIsEqualToUTF8CString(propertyName, "emergencyNumbers")) { + } else if(JSStringIsEqualToUTF8CString(propertyName, STR_EMERGENCY_NUMBERS)) { return convert.toJSValueRef(callService->getEmergencyNumbers(), globalContext); } } catch(WrtDeviceApis::Commons::Exception) { diff --git a/src/standards/Tizen/Call/JSRemoteParty.cpp b/src/standards/Tizen/Call/JSRemoteParty.cpp index 2af67c5..de88a0a 100755 --- a/src/standards/Tizen/Call/JSRemoteParty.cpp +++ b/src/standards/Tizen/Call/JSRemoteParty.cpp @@ -21,6 +21,7 @@ #include <dpl/shared_ptr.h> #include <CommonsJavaScript/JSUtils.h> #include <CommonsJavaScript/JSDOMExceptionFactory.h> +#include <API/Call/CallDefine.h> #include <API/Call/RemoteParty.h> #include "JSRemoteParty.h" #include "Converter.h" @@ -33,10 +34,6 @@ using namespace WrtDeviceApis::Commons; using namespace WrtDeviceApis::CommonsJavaScript; using namespace Api::Call; -#define STR_REMOTE_PARTY "remoteParty" -#define STR_DISPLAY_NAME "displayName" -#define STR_CONTACT_ID "contactId" - JSClassDefinition JSRemoteParty::m_classInfo = { 0, kJSClassAttributeNone, diff --git a/src/standards/Tizen/Contact/ContactConverter.cpp b/src/standards/Tizen/Contact/ContactConverter.cpp index 259d4b8..c736d6d 100755 --- a/src/standards/Tizen/Contact/ContactConverter.cpp +++ b/src/standards/Tizen/Contact/ContactConverter.cpp @@ -580,6 +580,7 @@ ContactOrganizationPtr ContactConverter::toContactOrganizationFromInit(const JSV ThrowMsg(WrtDeviceApis::Commons::ConversionException, "Wrong attribute"); } + // NOTE: Currently not support office and logoURI fields const ScopedJSStringRef nameStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_NAME)); const ScopedJSStringRef departmentStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_DEPARTMENT)); const ScopedJSStringRef titleStr(JSStringCreateWithUTF8CString(CONTACT_ATTRIBUTE_TITLE)); diff --git a/src/standards/Tizen/Contact/JSContactAnniversary.cpp b/src/standards/Tizen/Contact/JSContactAnniversary.cpp index 403c52f..653aa63 100755 --- a/src/standards/Tizen/Contact/JSContactAnniversary.cpp +++ b/src/standards/Tizen/Contact/JSContactAnniversary.cpp @@ -218,8 +218,10 @@ JSObjectRef JSContactAnniversary::constructor(JSContextRef context, ContactAnniversaryPtr contactAnniversary(new ContactAnniversary()); contactAnniversary->setDate(date); - if(labelIsSet) - contactAnniversary->setLabel(label); + + // NOTE: Currently not support label field + //if(labelIsSet) + // contactAnniversary->setLabel(label); JSObjectRef jsobject; @@ -313,10 +315,11 @@ bool JSContactAnniversary::setLabel(JSContextRef context, { Try { - ContactAnniversaryPtr anniversary = getPrivData(object); - ContactConverterFactory::ConverterType converter = - ContactConverterFactory::getConverter(context); - anniversary->setLabel(converter->toString(value)); + // NOTE: Currently not support this field + //ContactAnniversaryPtr anniversary = getPrivData(object); + //ContactConverterFactory::ConverterType converter = + // ContactConverterFactory::getConverter(context); + //anniversary->setLabel(converter->toString(value)); return true; } Catch(WrtDeviceApis::Commons::Exception) diff --git a/src/standards/Tizen/Contact/JSContactOrganization.cpp b/src/standards/Tizen/Contact/JSContactOrganization.cpp index 462d2b7..4e09297 100755 --- a/src/standards/Tizen/Contact/JSContactOrganization.cpp +++ b/src/standards/Tizen/Contact/JSContactOrganization.cpp @@ -352,10 +352,11 @@ bool JSContactOrganization::setOffice(JSContextRef context, { Try { - ContactOrganizationPtr organization = getPrivData(object); - ContactConverterFactory::ConverterType converter = - ContactConverterFactory::getConverter(context); - organization->setOffice(converter->toString(value)); + // NOTE: Currently not support this field + //ContactOrganizationPtr organization = getPrivData(object); + //ContactConverterFactory::ConverterType converter = + // ContactConverterFactory::getConverter(context); + //organization->setOffice(converter->toString(value)); return true; } Catch(WrtDeviceApis::Commons::Exception) @@ -484,10 +485,11 @@ bool JSContactOrganization::setLogoURI(JSContextRef context, { Try { - ContactOrganizationPtr organization = getPrivData(object); - ContactConverterFactory::ConverterType converter = - ContactConverterFactory::getConverter(context); - organization->setLogoURI(converter->toString(value)); + // NOTE: Currently not support this field + //ContactOrganizationPtr organization = getPrivData(object); + //ContactConverterFactory::ConverterType converter = + // ContactConverterFactory::getConverter(context); + //organization->setLogoURI(converter->toString(value)); return true; } Catch(WrtDeviceApis::Commons::Exception) |