summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJae-Hwa Shin <jaehwa.shin@samsung.com>2013-06-17 00:38:11 +0000
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>2013-06-17 00:38:11 +0000
commit6297afdb88ef84c592c8695730aff224c23a790c (patch)
tree9194e816ef8b8c9aa00670468c91bcf94c654f93
parent9280813c083c86411abcb200f234962b2b01761a (diff)
parent2586cf88c9d3322c0ab8299b651fe3da362c002d (diff)
downloadsocial-6297afdb88ef84c592c8695730aff224c23a790c.tar.gz
social-6297afdb88ef84c592c8695730aff224c23a790c.tar.bz2
social-6297afdb88ef84c592c8695730aff224c23a790c.zip
Merge "add app launch data api" into tizen_2.2
-rwxr-xr-xCMakeLists.txt2
-rw-r--r--inc/FSclContact.h27
-rw-r--r--inc/FSclContactAppLaunchData.h256
-rw-r--r--inc/FSclTypes.h1
-rw-r--r--inc/FSocial.h1
-rw-r--r--src/FSclContact.cpp19
-rw-r--r--src/FSclContactAppLaunchData.cpp165
-rw-r--r--src/FScl_ContactAppLaunchDataImpl.cpp439
-rw-r--r--src/FScl_ContactAppLaunchDataImpl.h109
-rw-r--r--src/FScl_ContactImpl.cpp506
-rw-r--r--src/inc/FScl_ContactImpl.h6
11 files changed, 1531 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 99bdf7c..1277bb8 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,8 @@ SET (${this_target}_SOURCE_FILES
src/FScl_CategoryImpl.cpp
src/FSclContact.cpp
src/FScl_ContactImpl.cpp
+ src/FSclContactAppLaunchData.cpp
+ src/FScl_ContactAppLaunchDataImpl.cpp
src/FSclContactEvent.cpp
src/FScl_ContactEventImpl.cpp
src/FSclEmail.cpp
diff --git a/inc/FSclContact.h b/inc/FSclContact.h
index 00a72d2..4d54998 100644
--- a/inc/FSclContact.h
+++ b/inc/FSclContact.h
@@ -41,6 +41,7 @@ class ImAddress;
class Organization;
class ContactEvent;
class Relationship;
+class ContactAppLaunchData;
/**
* @class Contact
@@ -461,6 +462,21 @@ public:
*/
result SetRelationshipAt(int index, const Relationship& relationship);
+ /**
+ * Sets the app launch data at the specified index.
+ *
+ * @since 2.2
+ *
+ *
+ * @return An error code
+ * @param[in] index An index to set the contact app launch data
+ * @param[in] appLaunchData The app launch data to set
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c appLaunchData has no relevant information.
+ * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the app launch data.
+ */
+ result SetContactAppLaunchDataAt(int index, const ContactAppLaunchData& appLaunchData);
+
/**
* Gets the addressbook ID.
*
@@ -611,6 +627,17 @@ public:
*/
result AddRelationship(const Relationship& relationship);
+ /**
+ * Adds the specified app launch data to the contact.
+ *
+ * @since 2.2
+ *
+ * @return An error code
+ * @param[in] appLaunchData The app launch data to add
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c appLaunchData has no relevant information.
+ */
+ result AddContactAppLaunchData(const ContactAppLaunchData& appLaunchData);
/**
* Removes the specific value at the specified index of the multi value property.
diff --git a/inc/FSclContactAppLaunchData.h b/inc/FSclContactAppLaunchData.h
new file mode 100644
index 0000000..05b9049
--- /dev/null
+++ b/inc/FSclContactAppLaunchData.h
@@ -0,0 +1,256 @@
+//
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FSclContactAppLaunchData.h
+ * @brief This is the header file for the %ContactAppLaunchData class.
+ *
+ * This header file contains the declarations of the %ContactAppLaunchData class.
+ */
+
+#ifndef _FSCL_CONTACT_APP_LAUNCH_DATA_H_
+#define _FSCL_CONTACT_APP_LAUNCH_DATA_H_
+
+#include <FBaseResult.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+namespace Tizen { namespace Base
+{
+namespace Collection
+{
+class IMap;
+}
+}}
+
+namespace Tizen { namespace Social
+{
+
+/**
+ * @class ContactAppLaunchData
+ * @brief This class provides the information needed to launch an application from a contact.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension.
+ *
+ * The %ContactAppLaunchData class represent the information needed to launch an application from a contact.
+ * The information consists of application id, operation id, mime, uri, display text, and extra data.
+ */
+
+class _OSP_EXPORT_ ContactAppLaunchData
+ :public Tizen::Base::Object
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.1
+ */
+ ContactAppLaunchData(void);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of %ContactAppLaunchData
+ */
+ ContactAppLaunchData(const ContactAppLaunchData& rhs);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.1
+ *
+ */
+ virtual ~ContactAppLaunchData(void);
+
+ /**
+ * Checks whether the value of the specified instance is equal to the value of the current instance of Tizen::Base::Object.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the value of the specified instance of Tizen::Base::Object is equal to the value of the current instance of %Tizen::Base::Object, @n
+ * else @c false
+ * @param[in] rhs An instance of Tizen::Base::Object to compare
+ */
+ virtual bool Equals(const Tizen::Base::Object& rhs) const;
+
+ /**
+ * Gets the hash value of the current instance.
+ *
+ * @since 2.1
+ *
+ * @return The hash value of the current instance
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Gets the display text.
+ *
+ * @since 2.1
+ *
+ * @return The text which describes this contact app launch data
+ */
+ Tizen::Base::String GetDisplayText(void) const;
+
+ /**
+ * Gets the application ID.
+ *
+ * @since 2.1
+ *
+ * @return The application ID
+ */
+ Tizen::Base::String GetAppId(void) const;
+
+ /**
+ * Gets the operation ID.
+ *
+ * @since 2.1
+ *
+ * @return The operation ID
+ */
+ Tizen::Base::String GetOperationId(void) const;
+
+ /**
+ * Gets the uri.
+ *
+ * @since 2.1
+ *
+ * @return The uri
+ */
+ Tizen::Base::String GetUri(void) const;
+
+ /**
+ * Gets the mime.
+ *
+ * @since 2.1
+ *
+ * @return The mime
+ */
+ Tizen::Base::String GetMime(void) const;
+
+ /**
+ * Gets the extra data.
+ *
+ * @since 2.1
+ *
+ * @return The key-value map of the extended data where the key and value are of type Tizen::Base::String, @n
+ * else and empty map if there is no extra data, or null if an exception occurs.
+ * @remarks The specific error code can be accessed using the GetlastResult() method.
+ */
+ Tizen::Base::Collection::IMap* GetExtraDataN(void) const;
+
+ /**
+ * Sets the display text.
+ *
+ * @since 2.1
+ *
+ * @param[in] displayText The text which describes this contact app launch data
+ */
+ void SetDisplayText(const Tizen::Base::String& displayText);
+
+ /**
+ * Sets the application ID.
+ *
+ * @since 2.1
+ *
+ * @param[in] appId The application ID
+ */
+ void SetAppId(const Tizen::Base::String& appId);
+
+ /**
+ * Sets the operation ID.
+ *
+ * @since 2.1
+ *
+ * @param[in] operationId The operation ID
+ */
+ void SetOperationId(const Tizen::Base::String& operationId);
+
+ /**
+ * Sets the uri.
+ *
+ * @since 2.1
+ *
+ * @param[in] uri The uri
+ */
+ void SetUri(const Tizen::Base::String& uri);
+
+ /**
+ * Sets the mime.
+ *
+ * @since 2.1
+ *
+ * @param[in] mime The mime
+ */
+ void SetMime(const Tizen::Base::String& mime);
+
+ /**
+ * Sets the extra data to be delivered to the application.
+ *
+ * @since 2.1
+ *
+ * @param[in] pExtraData A pointer to an argument map of key and value pair where the key is of type Tizen::Base::String and the value is of type Tizen::Base::String
+ * If null is passed the current extra data is removed.
+ */
+ result SetExtraData(const Tizen::Base::Collection::IMap* pExtraData);
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.1
+ *
+ * @param[in] rhs An instance of %ContactAppLaunchData
+ */
+ ContactAppLaunchData& operator =(const ContactAppLaunchData& rhs);
+
+ friend bool operator ==(const ContactAppLaunchData& lhs, const ContactAppLaunchData& rhs);
+
+private:
+ friend class _ContactAppLaunchDataImpl;
+ class _ContactAppLaunchDataImpl* __pContactAppLaunchDataImpl;
+
+}; // ContactAppLaunchData
+
+/**
+ * Compares the specified two instances of %ContactAppLaunchData.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the data of the specified two instances are equal, @n
+ * else @c false
+ * @param[in] lhs An instance of %ContactAppLaunchData
+ * @param[in] rhs An instance of %ContactAppLaunchData
+ */
+_OSP_EXPORT_ bool operator ==(const ContactAppLaunchData& lhs, const ContactAppLaunchData& rhs);
+
+/**
+ * Compares the specified two instances of %ContactAppLaunchData for inequality.
+ *
+ * @since 2.1
+ *
+ * @return @c true if the data of the specified two instances are not equal, @n
+ * else @c false
+ * @param[in] lhs An instance of %ContactAppLaunchData
+ * @param[in] rhs An instance of %ContactAppLaunchData
+ */
+_OSP_EXPORT_ bool operator !=(const ContactAppLaunchData& lhs, const ContactAppLaunchData& rhs);
+
+}} // Tizen::Social
+
+#endif // _FSCL_CONTACT_APP_LAUNCH_DATA_H_
diff --git a/inc/FSclTypes.h b/inc/FSclTypes.h
index e482b95..7c36697 100644
--- a/inc/FSclTypes.h
+++ b/inc/FSclTypes.h
@@ -338,6 +338,7 @@ enum ContactMultiPropertyId
CONTACT_MPROPERTY_ID_NOTES, /**< The note property ID (String type) */
CONTACT_MPROPERTY_ID_NICKNAMES, /**< The nickname property ID (String type) */
CONTACT_MPROPERTY_ID_RELATIONSHIPS, /**< The relationship property ID (Relationship type) */
+ CONTACT_MPROPERTY_ID_APP_LAUNCH_DATA, /**< The app launch data property ID (ContactAppLaunchData type) @b Since: @b 2.1 */
};
/**
diff --git a/inc/FSocial.h b/inc/FSocial.h
index 5977e23..4b1c290 100644
--- a/inc/FSocial.h
+++ b/inc/FSocial.h
@@ -57,6 +57,7 @@
#include <FSclContactEvent.h>
#include <FSclOrganization.h>
#include <FSclRelationship.h>
+#include <FSclContactAppLaunchData.h>
#include <FSclPerson.h>
#include <FSclAddressbookFilter.h>
#include <FSclAccount.h>
diff --git a/src/FSclContact.cpp b/src/FSclContact.cpp
index c5dde0f..ebbb563 100644
--- a/src/FSclContact.cpp
+++ b/src/FSclContact.cpp
@@ -29,6 +29,7 @@
#include <FSclOrganization.h>
#include <FSclContactEvent.h>
#include <FSclRelationship.h>
+#include <FSclContactAppLaunchData.h>
#include <FSclContact.h>
#include "FScl_ContactImpl.h"
@@ -264,6 +265,15 @@ Contact::AddRelationship(const Relationship& relationship)
}
result
+Contact::AddContactAppLaunchData(const ContactAppLaunchData& appLaunchData)
+{
+ result r = __pContactImpl->AddContactAppLaunchData(appLaunchData);
+ SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
+result
Contact::RemoveAt(ContactMultiPropertyId id, int index)
{
result r = __pContactImpl->RemoveAt(id, index);
@@ -371,6 +381,15 @@ Contact::SetImAddressAt(int index, const ImAddress& imAddress)
return E_SUCCESS;
}
+result
+Contact::SetContactAppLaunchDataAt(int index, const ContactAppLaunchData& appLaunchData)
+{
+ result r = __pContactImpl->SetContactAppLaunchDataAt(index, appLaunchData);
+ SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return E_SUCCESS;
+}
+
bool
Contact::IsFavorite(void) const
{
diff --git a/src/FSclContactAppLaunchData.cpp b/src/FSclContactAppLaunchData.cpp
new file mode 100644
index 0000000..acf7a51
--- /dev/null
+++ b/src/FSclContactAppLaunchData.cpp
@@ -0,0 +1,165 @@
+//
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FSclContactAppLaunchData.cpp
+ * @brief This is the implementation for ContactAppLaunchData class.
+ *
+ * This file contains definitions of @e ContactAppLaunchData class.
+ */
+
+#include <FBaseSysLog.h>
+#include <FSclContactAppLaunchData.h>
+#include "FScl_ContactAppLaunchDataImpl.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Social
+{
+
+ContactAppLaunchData::ContactAppLaunchData(void)
+{
+ __pContactAppLaunchDataImpl = new (std::nothrow) _ContactAppLaunchDataImpl();
+ SysTryReturnVoidResult(NID_SCL, __pContactAppLaunchDataImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+ContactAppLaunchData::ContactAppLaunchData(const ContactAppLaunchData& rhs)
+:__pContactAppLaunchDataImpl(null)
+{
+ __pContactAppLaunchDataImpl = new (std::nothrow) _ContactAppLaunchDataImpl(*rhs.__pContactAppLaunchDataImpl);
+ SysTryReturnVoidResult(NID_SCL, __pContactAppLaunchDataImpl != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+}
+
+ContactAppLaunchData::~ContactAppLaunchData(void)
+{
+ delete __pContactAppLaunchDataImpl;
+}
+
+ContactAppLaunchData&
+ContactAppLaunchData::operator =(const ContactAppLaunchData& rhs)
+{
+ if (this == &rhs)
+ {
+ return *this;
+ }
+
+ *__pContactAppLaunchDataImpl = *rhs.__pContactAppLaunchDataImpl;
+
+ return *this;
+}
+
+bool operator ==(const ContactAppLaunchData& lhs, const ContactAppLaunchData& rhs)
+{
+ return *lhs.__pContactAppLaunchDataImpl == *rhs.__pContactAppLaunchDataImpl;
+}
+
+bool operator !=(const ContactAppLaunchData& lhs, const ContactAppLaunchData& rhs)
+{
+ return !(lhs == rhs);
+}
+
+bool
+ContactAppLaunchData::Equals(const Object& rhs) const
+{
+ const ContactAppLaunchData* pContactAppLaunchData = dynamic_cast<const ContactAppLaunchData*>(&rhs);
+ if (pContactAppLaunchData == null)
+ {
+ return false;
+ }
+
+ return __pContactAppLaunchDataImpl->Equals(*pContactAppLaunchData->__pContactAppLaunchDataImpl);
+}
+
+int
+ContactAppLaunchData::GetHashCode(void) const
+{
+ return __pContactAppLaunchDataImpl->GetHashCode();
+}
+
+String
+ContactAppLaunchData::GetDisplayText(void) const
+{
+ return __pContactAppLaunchDataImpl->GetDisplayText();
+}
+
+String
+ContactAppLaunchData::GetAppId(void) const
+{
+ return __pContactAppLaunchDataImpl->GetAppId();
+}
+
+String
+ContactAppLaunchData::GetOperationId(void) const
+{
+ return __pContactAppLaunchDataImpl->GetOperationId();
+}
+
+String
+ContactAppLaunchData::GetUri(void) const
+{
+ return __pContactAppLaunchDataImpl->GetUri();
+}
+
+String
+ContactAppLaunchData::GetMime(void) const
+{
+ return __pContactAppLaunchDataImpl->GetMime();
+}
+
+IMap*
+ContactAppLaunchData::GetExtraDataN(void) const
+{
+ return __pContactAppLaunchDataImpl->GetExtraDataN();
+}
+
+void
+ContactAppLaunchData::SetDisplayText(const String& displayText)
+{
+ __pContactAppLaunchDataImpl->SetDisplayText(displayText);
+}
+
+void
+ContactAppLaunchData::SetAppId(const String& appId)
+{
+ __pContactAppLaunchDataImpl->SetAppId(appId);
+}
+
+void
+ContactAppLaunchData::SetOperationId(const String& operationId)
+{
+ __pContactAppLaunchDataImpl->SetOperationId(operationId);
+}
+
+void
+ContactAppLaunchData::SetUri(const String& uri)
+{
+ __pContactAppLaunchDataImpl->SetUri(uri);
+}
+
+void
+ContactAppLaunchData::SetMime(const String& mime)
+{
+ __pContactAppLaunchDataImpl->SetMime(mime);
+}
+
+result
+ContactAppLaunchData::SetExtraData(const IMap* pExtraData)
+{
+ return __pContactAppLaunchDataImpl->SetExtraData(pExtraData);
+}
+
+}} // Tizen::Social
diff --git a/src/FScl_ContactAppLaunchDataImpl.cpp b/src/FScl_ContactAppLaunchDataImpl.cpp
new file mode 100644
index 0000000..08b157b
--- /dev/null
+++ b/src/FScl_ContactAppLaunchDataImpl.cpp
@@ -0,0 +1,439 @@
+//
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FScl_ContactAppLaunchDataImpl.cpp
+ * @brief This is the header file for the %_ContactAppLaunchData class.
+ *
+ * This header file contains the declarations of the %_ContactAppLaunchData class.
+ */
+
+#include <FBaseSysLog.h>
+#include "FScl_ContactAppLaunchDataImpl.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Social
+{
+
+_ContactAppLaunchDataImpl::_ContactAppLaunchDataImpl(void)
+{
+ std::unique_ptr<HashMap, AllElementsDeleter> pExtraData(new (std::nothrow) HashMap());
+ SysTryReturnVoidResult(NID_SCL, pExtraData != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pExtraData->Construct();
+ SysTryReturnVoidResult(NID_SCL, !IsFailed(r), r, "[%s] Failed to construct pExtraData.", GetErrorMessage(r));
+
+ __pExtraData = std::move(pExtraData);
+}
+
+_ContactAppLaunchDataImpl::_ContactAppLaunchDataImpl(const _ContactAppLaunchDataImpl& rhs)
+{
+ std::unique_ptr<HashMap, AllElementsDeleter> pExtraData(new (std::nothrow) HashMap());
+ SysTryReturnVoidResult(NID_SCL, pExtraData != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pExtraData->Construct();
+ SysTryReturnVoidResult(NID_SCL, !IsFailed(r), r, "[%s] Failed to construct pExtraData.", GetErrorMessage(r));
+
+ std::unique_ptr<IMapEnumerator> pMapEnum((rhs.__pExtraData)->GetMapEnumeratorN());
+ SysTryReturnVoidResult(NID_SCL, pMapEnum != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<String> pKey(null);
+ std::unique_ptr<String> pVal(null);
+ String* pStr = null;
+
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pStr = static_cast<String*> (pMapEnum->GetKey());
+ pKey.reset(new (std::nothrow) String(*pStr));
+ SysTryReturnVoidResult(NID_SCL, pKey != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pStr = static_cast<String*> (pMapEnum->GetValue());
+ pVal.reset(new (std::nothrow) String(*pStr));
+ SysTryReturnVoidResult(NID_SCL, pVal != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pExtraData->Add(pKey.get(), pVal.get());
+ SysTryReturnVoidResult(NID_SCL, !IsFailed(r), r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+ pVal.release();
+ }
+
+ __pExtraData = std::move(pExtraData);
+
+ __displayText = rhs.__displayText;
+ __uid = rhs.__uid;
+ __appId = rhs.__appId;
+ __operationId = rhs.__operationId;
+ __uri = rhs.__uri;
+ __category = rhs.__category;
+ __mime = rhs.__mime;
+}
+
+_ContactAppLaunchDataImpl::~_ContactAppLaunchDataImpl(void)
+{
+}
+
+_ContactAppLaunchDataImpl&
+_ContactAppLaunchDataImpl::operator =(const _ContactAppLaunchDataImpl& rhs)
+{
+ if (this == &rhs)
+ {
+ return *this;
+ }
+
+ std::unique_ptr<HashMap, AllElementsDeleter> pExtraData(new (std::nothrow) HashMap());
+ SysTryReturn(NID_SCL, pExtraData != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pExtraData->Construct();
+ SysTryReturn(NID_SCL, !IsFailed(r), *this, r, "[%s] Failed to construct pExtraData.", GetErrorMessage(r));
+
+ std::unique_ptr<IMapEnumerator> pMapEnum((rhs.__pExtraData)->GetMapEnumeratorN());
+ SysTryReturn(NID_SCL, pMapEnum != null, *this, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<String> pKey(null);
+ std::unique_ptr<String> pVal(null);
+ String* pStr = null;
+
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pStr = static_cast<String*> (pMapEnum->GetKey());
+ pKey.reset(new (std::nothrow) String(*pStr));
+ SysTryReturn(NID_SCL, pKey != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pStr = static_cast<String*> (pMapEnum->GetValue());
+ pVal.reset(new (std::nothrow) String(*pStr));
+ SysTryReturn(NID_SCL, pVal != null, *this, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pExtraData->Add(pKey.get(), pVal.get());
+ SysTryReturn(NID_SCL, !IsFailed(r), *this, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+ pVal.release();
+ }
+
+ __pExtraData = std::move(pExtraData);
+
+ __displayText = rhs.__displayText;
+ __uid = rhs.__uid;
+ __appId = rhs.__appId;
+ __operationId = rhs.__operationId;
+ __uri = rhs.__uri;
+ __category = rhs.__category;
+ __mime = rhs.__mime;
+
+ return *this;
+}
+
+bool operator ==(const _ContactAppLaunchDataImpl& lhs, const _ContactAppLaunchDataImpl& rhs)
+{
+ if (lhs.__displayText != rhs.__displayText)
+ {
+ return false;
+ }
+
+ if (lhs.__uid != rhs.__uid)
+ {
+ return false;
+ }
+
+ if (lhs.__appId != rhs.__appId)
+ {
+ return false;
+ }
+
+ if (lhs.__operationId != rhs.__operationId)
+ {
+ return false;
+ }
+
+ if (lhs.__uri != rhs.__uri)
+ {
+ return false;
+ }
+
+ if (lhs.__category != rhs.__category)
+ {
+ return false;
+ }
+
+ if (lhs.__mime != rhs.__mime)
+ {
+ return false;
+ }
+
+ if (!lhs.__pExtraData->Equals(*rhs.__pExtraData))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool operator !=(const _ContactAppLaunchDataImpl& lhs, const _ContactAppLaunchDataImpl& rhs)
+{
+ return !(lhs == rhs);
+}
+
+bool
+_ContactAppLaunchDataImpl::Equals(const Object& rhs) const
+{
+ const _ContactAppLaunchDataImpl* pContactAppLaunchData = dynamic_cast<const _ContactAppLaunchDataImpl*>(&rhs);
+ if (pContactAppLaunchData == null)
+ {
+ return false;
+ }
+
+ return *this == *pContactAppLaunchData;
+}
+
+int
+_ContactAppLaunchDataImpl::GetHashCode(void) const
+{
+ int hash = __displayText.GetHashCode();
+ hash += __uid.GetHashCode();
+ hash += __appId.GetHashCode();
+ hash += __operationId.GetHashCode();
+ hash += __uri.GetHashCode();
+ hash += __category.GetHashCode();
+ hash += __mime.GetHashCode();
+
+ return hash;
+}
+
+String
+_ContactAppLaunchDataImpl::GetDisplayText(void) const
+{
+ return __displayText;
+}
+
+String
+_ContactAppLaunchDataImpl::GetUid(void) const
+{
+ return __uid;
+}
+
+String
+_ContactAppLaunchDataImpl::GetAppId(void) const
+{
+ return __appId;
+}
+
+String
+_ContactAppLaunchDataImpl::GetOperationId(void) const
+{
+ return __operationId;
+}
+
+String
+_ContactAppLaunchDataImpl::GetUri(void) const
+{
+ return __uri;
+}
+
+String
+_ContactAppLaunchDataImpl::GetCategory(void) const
+{
+ return __category;
+}
+
+String
+_ContactAppLaunchDataImpl::GetMime(void) const
+{
+ return __mime;
+}
+
+IMap*
+_ContactAppLaunchDataImpl::GetExtraDataN(void) const
+{
+ ClearLastResult();
+
+ std::unique_ptr<HashMap, AllElementsDeleter> pExtraData(new (std::nothrow) HashMap());
+ SysTryReturn(NID_SCL, pExtraData != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pExtraData->Construct();
+ SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Failed to construct pExtraData.", GetErrorMessage(r));
+
+ std::unique_ptr<IMapEnumerator> pMapEnum(__pExtraData->GetMapEnumeratorN());
+ SysTryReturn(NID_SCL, pMapEnum != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<String> pKey(null);
+ std::unique_ptr<String> pVal(null);
+ String* pStr = null;
+
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pStr = static_cast<String*> (pMapEnum->GetKey());
+ pKey.reset(new (std::nothrow) String(*pStr));
+ SysTryReturn(NID_SCL, pKey != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pStr = static_cast<String*> (pMapEnum->GetValue());
+ pVal.reset(new (std::nothrow) String(*pStr));
+ SysTryReturn(NID_SCL, pVal != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pExtraData->Add(pKey.get(), pVal.get());
+ SysTryReturn(NID_SCL, !IsFailed(r), null, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+ pVal.release();
+ }
+
+ return pExtraData.release();
+}
+
+void
+_ContactAppLaunchDataImpl::SetDisplayText(const String& displayText)
+{
+ __displayText = displayText;
+}
+
+void
+_ContactAppLaunchDataImpl::SetUid(const String& uid)
+{
+ __uid = uid;
+}
+
+void
+_ContactAppLaunchDataImpl::SetAppId(const String& appId)
+{
+ __appId = appId;
+}
+
+void
+_ContactAppLaunchDataImpl::SetOperationId(const String& operationId)
+{
+ __operationId = operationId;
+}
+
+void
+_ContactAppLaunchDataImpl::SetUri(const String& uri)
+{
+ __uri = uri;
+}
+
+void
+_ContactAppLaunchDataImpl::SetCategory(const String& category)
+{
+ __category = category;
+}
+
+void
+_ContactAppLaunchDataImpl::SetMime(const String& mime)
+{
+ __mime = mime;
+}
+
+result
+_ContactAppLaunchDataImpl::SetExtraData(const IMap* pExtraData)
+{
+ std::unique_ptr<HashMap, AllElementsDeleter> pNewExtraData(new (std::nothrow) HashMap());
+ SysTryReturn(NID_SCL, pNewExtraData != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ result r = pNewExtraData->Construct();
+ SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Failed to construct pExtraData.", GetErrorMessage(r));
+
+ if (pExtraData != null)
+ {
+ std::unique_ptr<IMapEnumerator> pMapEnum(pExtraData->GetMapEnumeratorN());
+ SysTryReturn(NID_SCL, pMapEnum != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ std::unique_ptr<String> pKey(null);
+ std::unique_ptr<String> pVal(null);
+ String* pStr = null;
+
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pStr = static_cast<String*> (pMapEnum->GetKey());
+ pKey.reset(new (std::nothrow) String(*pStr));
+ SysTryReturn(NID_SCL, pKey != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pStr = static_cast<String*> (pMapEnum->GetValue());
+ pVal.reset(new (std::nothrow) String(*pStr));
+ SysTryReturn(NID_SCL, pVal != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pNewExtraData->Add(pKey.get(), pVal.get());
+ SysTryReturn(NID_SCL, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pKey.release();
+ pVal.release();
+ }
+ }
+
+ __pExtraData = std::move(pNewExtraData);
+
+ return E_SUCCESS;
+}
+
+bool
+_ContactAppLaunchDataImpl::IsEmpty(void) const
+{
+ if (!__displayText.IsEmpty())
+ {
+ return false;
+ }
+
+ if (!__uid.IsEmpty())
+ {
+ return false;
+ }
+
+ if (!__appId.IsEmpty())
+ {
+ return false;
+ }
+
+ if (!__operationId.IsEmpty())
+ {
+ return false;
+ }
+
+ if (!__uri.IsEmpty())
+ {
+ return false;
+ }
+
+ if (!__category.IsEmpty())
+ {
+ return false;
+ }
+
+ if (!__mime.IsEmpty())
+ {
+ return false;
+ }
+
+ if (__pExtraData->GetCount() != 0)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+const _ContactAppLaunchDataImpl*
+_ContactAppLaunchDataImpl::GetInstance(const ContactAppLaunchData& appLaunchData)
+{
+ return appLaunchData.__pContactAppLaunchDataImpl;
+}
+
+_ContactAppLaunchDataImpl*
+_ContactAppLaunchDataImpl::GetInstance(ContactAppLaunchData& appLaunchData)
+{
+ return appLaunchData.__pContactAppLaunchDataImpl;
+}
+
+}} // Tizen::Social
diff --git a/src/FScl_ContactAppLaunchDataImpl.h b/src/FScl_ContactAppLaunchDataImpl.h
new file mode 100644
index 0000000..986eb10
--- /dev/null
+++ b/src/FScl_ContactAppLaunchDataImpl.h
@@ -0,0 +1,109 @@
+//
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FScl_ContactAppLaunchDataImpl.h
+ * @brief This is the header file for the %_ContactAppLaunchData class.
+ *
+ * This header file contains the declarations of the %_ContactAppLaunchData class.
+ */
+#ifndef _FSCL_INTERNAL_CONTACT_APP_LAUNCH_DATA_IMPL_H_
+#define _FSCL_INTERNAL_CONTACT_APP_LAUNCH_DATA_IMPL_H_
+
+#include <unique_ptr.h>
+#include <FBaseColAllElementsDeleter.h>
+#include <FBaseColHashMap.h>
+#include <FBaseObject.h>
+#include <FBaseString.h>
+#include <FSclContactAppLaunchData.h>
+
+namespace Tizen { namespace Social
+{
+class _OSP_EXPORT_ _ContactAppLaunchDataImpl
+ :public Tizen::Base::Object
+{
+public:
+ _ContactAppLaunchDataImpl(void);
+
+ _ContactAppLaunchDataImpl(const _ContactAppLaunchDataImpl& rhs);
+
+ virtual ~_ContactAppLaunchDataImpl(void);
+
+ _ContactAppLaunchDataImpl& operator =(const _ContactAppLaunchDataImpl& rhs);
+
+ virtual bool Equals(const Tizen::Base::Object& rhs) const;
+
+ virtual int GetHashCode(void) const;
+
+ Tizen::Base::String GetDisplayText(void) const;
+
+ Tizen::Base::String GetUid(void) const;
+
+ Tizen::Base::String GetAppId(void) const;
+
+ Tizen::Base::String GetOperationId(void) const;
+
+ Tizen::Base::String GetUri(void) const;
+
+ Tizen::Base::String GetCategory(void) const;
+
+ Tizen::Base::String GetMime(void) const;
+
+ Tizen::Base::Collection::IMap* GetExtraDataN(void) const;
+
+ void SetDisplayText(const Tizen::Base::String& displayText);
+
+ void SetUid(const Tizen::Base::String& uid);
+
+ void SetAppId(const Tizen::Base::String& appId);
+
+ void SetOperationId(const Tizen::Base::String& operationId);
+
+ void SetUri(const Tizen::Base::String& uri);
+
+ void SetCategory(const Tizen::Base::String& category);
+
+ void SetMime(const Tizen::Base::String& mime);
+
+ result SetExtraData(const Tizen::Base::Collection::IMap* pExtraData);
+
+ bool IsEmpty(void) const;
+
+ static const _ContactAppLaunchDataImpl* GetInstance(const ContactAppLaunchData& appLaunchData);
+
+ static _ContactAppLaunchDataImpl* GetInstance(ContactAppLaunchData& appLaunchData);
+
+ friend bool operator ==(const _ContactAppLaunchDataImpl& lhs, const _ContactAppLaunchDataImpl& rhs);
+
+private:
+ Tizen::Base::String __displayText;
+ Tizen::Base::String __uid;
+ Tizen::Base::String __appId;
+ Tizen::Base::String __operationId;
+ Tizen::Base::String __uri;
+ Tizen::Base::String __category;
+ Tizen::Base::String __mime;
+ std::unique_ptr<Tizen::Base::Collection::HashMap, Tizen::Base::Collection::AllElementsDeleter> __pExtraData;
+}; // _ContactAppLaunchDataImpl
+
+bool operator ==(const _ContactAppLaunchDataImpl& lhs, const _ContactAppLaunchDataImpl& rhs);
+
+bool operator !=(const _ContactAppLaunchDataImpl& lhs, const _ContactAppLaunchDataImpl& rhs);
+
+
+}} // Tizen::Social
+
+#endif // _FSCL_INTERNAL_CONTACT_APP_LAUNCH_DATA_IMPL_H_
diff --git a/src/FScl_ContactImpl.cpp b/src/FScl_ContactImpl.cpp
index d48ca3f..f67d06c 100644
--- a/src/FScl_ContactImpl.cpp
+++ b/src/FScl_ContactImpl.cpp
@@ -32,6 +32,7 @@
#include <FSclOrganization.h>
#include <FSclContactEvent.h>
#include <FSclRelationship.h>
+#include <FSclContactAppLaunchData.h>
#include <FSclContact.h>
#include <FApp_AppInfo.h>
#include <FBase_StringConverter.h>
@@ -45,9 +46,11 @@
#include "FScl_ImAddressImpl.h"
#include "FScl_OrganizationImpl.h"
#include "FScl_ContactEventImpl.h"
+#include "FScl_ContactAppLaunchDataImpl.h"
using namespace Tizen::App;
using namespace Tizen::Base;
+using namespace Tizen::Base::Utility;
using namespace Tizen::Base::Collection;
using namespace Tizen::Graphics;
using namespace Tizen::Media;
@@ -1873,6 +1876,150 @@ _ContactImpl::AddRelationship(const Relationship& relationship)
}
result
+_ContactImpl::AddContactAppLaunchData(const ContactAppLaunchData& appLaunchData)
+{
+ SysTryReturn(NID_SCL, !_ContactAppLaunchDataImpl::GetInstance(appLaunchData)->IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified app launch data does not have any property.", GetErrorMessage(E_INVALID_ARG));
+
+ String strValue = L"";
+
+ std::unique_ptr<ContactRecord, ContactRecordDeleter> pProfileRecord(_AddressbookUtil::CreateContactRecordN(_contacts_profile._uri));
+ SysTryReturn(NID_SCL, pProfileRecord != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ strValue = appLaunchData.GetDisplayText();
+ if (!strValue.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.text, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetUid();
+ if (!strValue.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.uid, pCharArray.get());
+ }
+
+ strValue = appLaunchData.GetAppId();
+ if (!strValue.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.app_id, pCharArray.get());
+ }
+
+ strValue = appLaunchData.GetOperationId();
+ if (!strValue.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.service_operation, pCharArray.get());
+ }
+
+ strValue = appLaunchData.GetUri();
+ if (!strValue.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.uri, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetCategory();
+ if (!strValue.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.category, pCharArray.get());
+ }
+
+ strValue = appLaunchData.GetMime();
+ if (!strValue.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.mime, pCharArray.get());
+ }
+
+ // extra data
+ std::unique_ptr<IMap, AllElementsDeleter> pExtraData(appLaunchData.GetExtraDataN());
+ SysTryReturn(NID_SCL, pExtraData != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ std::unique_ptr<IMapEnumerator> pMapEnum(pExtraData->GetMapEnumeratorN());
+ SysTryReturn(NID_SCL, pMapEnum != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ result r = E_SUCCESS;
+ int limit = 0;
+ bool isFirst = true;
+ String extraData(L"");
+ String encodedString(L"");
+ std::unique_ptr<ByteBuffer> pByteBuffer(null);
+
+ String* pKey = null;
+ String* pVal = null;
+
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ if (!isFirst)
+ {
+ extraData.Append(L",");
+ }
+ else
+ {
+ isFirst = false;
+ }
+
+ pKey = static_cast<String*> (pMapEnum->GetKey());
+ pVal = static_cast<String*> (pMapEnum->GetValue());
+
+ pByteBuffer.reset(StringUtil::StringToUtf8N(*pKey));
+ SysTryReturn(NID_SCL, pByteBuffer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ limit = pByteBuffer->GetLimit();
+ pByteBuffer->SetLimit(limit - 1);
+
+ r = StringUtil::EncodeToBase64String(*pByteBuffer, encodedString);
+ SysTryReturn(NID_SCL, !IsFailed(r), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argutmnet is used.", GetErrorMessage(E_INVALID_ARG));
+
+ extraData.Append(encodedString);
+ extraData.Append(L":");
+
+ pByteBuffer.reset(StringUtil::StringToUtf8N(*pVal));
+ SysTryReturn(NID_SCL, pByteBuffer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ limit = pByteBuffer->GetLimit();
+ pByteBuffer->SetLimit(limit - 1);
+
+ r = StringUtil::EncodeToBase64String(*pByteBuffer, encodedString);
+ SysTryReturn(NID_SCL, !IsFailed(r), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argutmnet is used.", GetErrorMessage(E_INVALID_ARG));
+
+ extraData.Append(encodedString);
+ }
+
+ if (!extraData.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(extraData));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(pProfileRecord.get(), _contacts_profile.extra_data, pCharArray.get());
+ }
+
+ int ret = contacts_record_add_child_record(__contactHandle, _contacts_contact.profile, pProfileRecord.get());
+ SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pProfileRecord.release();
+
+ return E_SUCCESS;
+}
+
+result
_ContactImpl::AddEvent(const ContactEvent& event)
{
SysTryReturn(NID_SCL, !__isRemoved || !IsFailed(Invalidate()), E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
@@ -2183,6 +2330,15 @@ _ContactImpl::RemoveAt(ContactMultiPropertyId id, int index)
contacts_record_destroy(recordHandle, true);
break;
+ case CONTACT_MPROPERTY_ID_APP_LAUNCH_DATA:
+ contacts_record_get_child_record_count(__contactHandle, _contacts_contact.profile, &count);
+ SysTryReturn(NID_SCL, count > (unsigned int) index, E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] index %d must be less than the current count of nicknames %d.", GetErrorMessage(E_OUT_OF_RANGE), index, count);
+
+ contacts_record_get_child_record_at_p(__contactHandle, _contacts_contact.profile, index, &recordHandle);
+ contacts_record_remove_child_record(__contactHandle, _contacts_contact.profile, recordHandle);
+ contacts_record_destroy(recordHandle, true);
+
+ break;
default:
SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. id=%d.", GetErrorMessage(E_INVALID_ARG), id);
return E_INVALID_ARG;
@@ -2239,6 +2395,9 @@ _ContactImpl::GetValuesN(const ContactMultiPropertyId id)
case CONTACT_MPROPERTY_ID_NICKNAMES:
pList = GetNicknamesN();
break;
+ case CONTACT_MPROPERTY_ID_APP_LAUNCH_DATA:
+ pList = GetContactAppLaunchDataN();
+ break;
default:
SysLogException(NID_SCL, E_INVALID_ARG, "[%s] Invalid argument is used. id=%d.", GetErrorMessage(E_INVALID_ARG), id);
return null;
@@ -3128,6 +3287,192 @@ _ContactImpl::SetImAddressAt(int index, const ImAddress& imAddress)
return E_SUCCESS;
}
+result
+_ContactImpl::SetContactAppLaunchDataAt(int index, const ContactAppLaunchData& appLaunchData)
+{
+ SysTryReturn(NID_SCL, index >= 0, E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] index %d must be greater than or equal to 0.", GetErrorMessage(E_OUT_OF_RANGE), index);
+ SysTryReturn(NID_SCL, !_ContactAppLaunchDataImpl::GetInstance(appLaunchData)->IsEmpty(), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The specified app launch data does not have any property.", GetErrorMessage(E_INVALID_ARG));
+
+ unsigned int count = 0;
+ String strValue;
+
+ contacts_record_get_child_record_count(__contactHandle, _contacts_contact.profile, &count);
+ SysTryReturn(NID_SCL, count > (unsigned int) index, E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[%s] index %d must be less than the current count of contact profile %d.", GetErrorMessage(E_OUT_OF_RANGE), index, count);
+
+ contacts_record_h profileRecord = null;
+ contacts_record_get_child_record_at_p(__contactHandle, _contacts_contact.profile, index, &profileRecord);
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetDisplayText();
+ if (strValue.IsEmpty())
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.text, null);
+ }
+
+ else
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.text, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetUid();
+ if (strValue.IsEmpty())
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.uid, null);
+ }
+
+ else
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.uid, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetAppId();
+ if (strValue.IsEmpty())
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.app_id, null);
+ }
+
+ else
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.app_id, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetOperationId();
+ if (strValue.IsEmpty())
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.service_operation, null);
+ }
+
+ else
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.service_operation, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetUri();
+ if (strValue.IsEmpty())
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.uri, null);
+ }
+
+ else
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.uri, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetCategory();
+ if (strValue.IsEmpty())
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.category, null);
+ }
+
+ else
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.category, pCharArray.get());
+ }
+
+ strValue = _ContactAppLaunchDataImpl::GetInstance(appLaunchData)->GetMime();
+ if (strValue.IsEmpty())
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.mime, null);
+ }
+
+ else
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(strValue));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.mime, pCharArray.get());
+ }
+
+ // extra data
+ std::unique_ptr<IMap, AllElementsDeleter> pExtraData(appLaunchData.GetExtraDataN());
+ SysTryReturn(NID_SCL, pExtraData != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ std::unique_ptr<IMapEnumerator> pMapEnum(pExtraData->GetMapEnumeratorN());
+ SysTryReturn(NID_SCL, pMapEnum != null, GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+ result r = E_SUCCESS;
+ int limit = 0;
+ bool isFirst = true;
+ String extraData(L"");
+ String encodedString(L"");
+ std::unique_ptr<ByteBuffer> pByteBuffer(null);
+
+ String* pKey = null;
+ String* pVal = null;
+
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ if (!isFirst)
+ {
+ extraData.Append(L",");
+ }
+ else
+ {
+ isFirst = false;
+ }
+
+ pKey = static_cast<String*> (pMapEnum->GetKey());
+ pVal = static_cast<String*> (pMapEnum->GetValue());
+
+ pByteBuffer.reset(StringUtil::StringToUtf8N(*pKey));
+ SysTryReturn(NID_SCL, pByteBuffer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ limit = pByteBuffer->GetLimit();
+ pByteBuffer->SetLimit(limit - 1);
+
+ r = StringUtil::EncodeToBase64String(*pByteBuffer, encodedString);
+ SysTryReturn(NID_SCL, !IsFailed(r), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argutmnet is used.", GetErrorMessage(E_INVALID_ARG));
+
+ extraData.Append(encodedString);
+ extraData.Append(L":");
+
+ pByteBuffer.reset(StringUtil::StringToUtf8N(*pVal));
+ SysTryReturn(NID_SCL, pByteBuffer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ limit = pByteBuffer->GetLimit();
+ pByteBuffer->SetLimit(limit - 1);
+
+ r = StringUtil::EncodeToBase64String(*pByteBuffer, encodedString);
+ SysTryReturn(NID_SCL, !IsFailed(r), E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argutmnet is used.", GetErrorMessage(E_INVALID_ARG));
+
+ extraData.Append(encodedString);
+ }
+
+ if (!extraData.IsEmpty())
+ {
+ std::unique_ptr<char[]> pCharArray(_StringConverter::CopyToCharArrayN(extraData));
+ SysTryReturn(NID_SCL, pCharArray != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_set_str(profileRecord, _contacts_profile.extra_data, pCharArray.get());
+ }
+ else
+ {
+ contacts_record_set_str(profileRecord, _contacts_profile.extra_data, null);
+ }
+
+
+ return E_SUCCESS;
+
+}
+
+
int
_ContactImpl::GetMaxLength(ContactPropertyId id)
{
@@ -3493,6 +3838,122 @@ _ContactImpl::GetNicknamesN(void) const
return pList.release();
}
+IList*
+_ContactImpl::GetContactAppLaunchDataN(void) const
+{
+ std::unique_ptr<ArrayList, AllElementsDeleter> pContactAppLaunchDataList(new (std::nothrow) ArrayList());
+ SysTryReturn(NID_SCL, pContactAppLaunchDataList != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ unsigned int count = 0;
+ char* pCharValue = null;
+ contacts_record_h profileRecord = null;
+ std::unique_ptr<ContactAppLaunchData> pContactAppLaunchData(null);
+
+ contacts_record_get_child_record_count(__contactHandle, _contacts_contact.profile, &count);
+
+ result r = pContactAppLaunchDataList->Construct(count);
+ SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ for (unsigned int i = 0; i < count; i++)
+ {
+ contacts_record_get_child_record_at_p(__contactHandle, _contacts_contact.profile, i, &profileRecord);
+
+ pContactAppLaunchData.reset(new (std::nothrow) ContactAppLaunchData());
+ SysTryReturn(NID_SCL, pContactAppLaunchData != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.text, &pCharValue);
+ pContactAppLaunchData->SetDisplayText(pCharValue);
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.uid, &pCharValue);
+ _ContactAppLaunchDataImpl::GetInstance(*pContactAppLaunchData)->SetUid(pCharValue);
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.app_id, &pCharValue);
+ pContactAppLaunchData->SetAppId(pCharValue);
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.service_operation, &pCharValue);
+ pContactAppLaunchData->SetOperationId(pCharValue);
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.uri, &pCharValue);
+ pContactAppLaunchData->SetUri(pCharValue);
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.category, &pCharValue);
+ _ContactAppLaunchDataImpl::GetInstance(*pContactAppLaunchData)->SetCategory(pCharValue);
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.mime, &pCharValue);
+ pContactAppLaunchData->SetMime(pCharValue);
+
+ contacts_record_get_str_p(profileRecord, _contacts_profile.extra_data, &pCharValue);
+ if (pCharValue != null)
+ {
+ result r = E_SUCCESS;
+ String delim(L":,");
+ String extraData(pCharValue);
+ String decodedString(L"");
+ std::unique_ptr<ByteBuffer> pByteBuffer(null);
+
+ std::unique_ptr<HashMap, AllElementsDeleter> pHashMap(new (std::nothrow) HashMap());
+ SysTryReturn(NID_SCL, pHashMap != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ r = pHashMap->Construct();
+ SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ StringTokenizer tokerizer(extraData, delim);
+ String token(L"");
+
+ while (tokerizer.HasMoreTokens())
+ {
+ // key
+ r = tokerizer.GetNextToken(token);
+ if (r != E_SUCCESS)
+ {
+ break;
+ }
+
+ pByteBuffer.reset(StringUtil::DecodeBase64StringN(token));
+ SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ std::unique_ptr<String> pKey(new (std::nothrow) String());
+ SysTryReturn(NID_SCL, pKey != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ StringUtil::Utf8ToString((const char*)pByteBuffer->GetPointer(), *pKey);
+
+ // value
+ r = tokerizer.GetNextToken(token);
+ if (r != E_SUCCESS)
+ {
+ break;
+ }
+
+ pByteBuffer.reset(StringUtil::DecodeBase64StringN(token));
+ SysTryReturn(NID_SCL, pByteBuffer != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ std::unique_ptr<String> pValue(new (std::nothrow) String());
+ SysTryReturn(NID_SCL, pValue != null, null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+ StringUtil::Utf8ToString((const char*)pByteBuffer->GetPointer(), *pValue);
+
+ r = pHashMap->Add(pKey.get(), pValue.get());
+ SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pKey.release();
+ pValue.release();
+ }
+
+ if (pHashMap->GetCount() > 0)
+ {
+ pContactAppLaunchData->SetExtraData(pHashMap.get());
+ }
+ }
+
+ r = pContactAppLaunchDataList->Add(*pContactAppLaunchData);
+ SysTryReturn(NID_SCL, !IsFailed(r), null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pContactAppLaunchData.release();
+ }
+
+ return pContactAppLaunchDataList.release();
+
+}
+
PhoneNumberType
_ContactImpl::GetNativePhoneNumberType(int coreType) const
{
@@ -4455,6 +4916,51 @@ _ContactImpl::Invalidate(void)
relationshipHandle.Release();
}
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // app launch data
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ contacts_record_get_child_record_count(__contactHandle, _contacts_contact.profile, &count);
+ for (i = 0; i < count; i++)
+ {
+ contacts_record_get_child_record_at_p(__contactHandle, _contacts_contact.profile, i, &sourceRecordHandle);
+
+ ret = contacts_record_create(_contacts_profile._uri, &destRecordHandle);
+ SysTryReturn(NID_SCL, ret == CONTACTS_ERROR_NONE, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __ContactsRecordHandle profileHandle(destRecordHandle);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_relationship.name, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_relationship.name, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.text, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.text, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.uid, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.uid, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.app_id, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.app_id, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.service_operation, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.service_operation, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.uri, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.uri, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.category, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.category, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.mime, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.mime, pCharValue);
+
+ contacts_record_get_str_p(sourceRecordHandle, _contacts_profile.extra_data, &pCharValue);
+ contacts_record_set_str(destRecordHandle, _contacts_profile.extra_data, pCharValue);
+
+ contacts_record_add_child_record(contactHandle, _contacts_contact.profile, destRecordHandle);
+
+ profileHandle.Release();
+ }
+
contacts_record_destroy(__contactHandle, true);
__contactHandle = contactHandle;
diff --git a/src/inc/FScl_ContactImpl.h b/src/inc/FScl_ContactImpl.h
index 7566641..6ad90e4 100644
--- a/src/inc/FScl_ContactImpl.h
+++ b/src/inc/FScl_ContactImpl.h
@@ -57,6 +57,7 @@ class ImAddress;
class Organization;
class ContactEvent;
class Relationship;
+class ContactAppLaunchData;
/**
* @class _ContactImpl
@@ -128,6 +129,8 @@ public:
result AddRelationship(const Relationship& relationship);
+ result AddContactAppLaunchData(const ContactAppLaunchData& appLaunchData);
+
result RemoveAt(ContactMultiPropertyId id, int index);
Tizen::Base::Collection::IList* GetValuesN(const ContactMultiPropertyId id);
@@ -152,6 +155,8 @@ public:
result SetOrganizationAt(int index, const Tizen::Social::Organization& organization);
+ result SetContactAppLaunchDataAt(int index, const Tizen::Social::ContactAppLaunchData& appLaunchData);
+
bool IsEmpty(void) const;
AddressbookId GetAddressbookId(void) const;
@@ -196,6 +201,7 @@ private:
Tizen::Base::Collection::IList* GetEventsN(void) const;
Tizen::Base::Collection::IList* GetNotesN(void) const;
Tizen::Base::Collection::IList* GetNicknamesN(void) const;
+ Tizen::Base::Collection::IList* GetContactAppLaunchDataN(void) const;
private:
contacts_record_h __contactHandle;