Moved Contacts object types to Common for future use in other modules. 64/88164/2
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Wed, 14 Sep 2016 06:30:00 +0000 (09:30 +0300)
committerAleksandr Sapozhnik <a.sapozhnik@samsung.com>
Wed, 14 Sep 2016 12:08:58 +0000 (05:08 -0700)
Change-Id: I103b8c183840c9083e2b6cf7c2fdc5a802ed24d5
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
13 files changed:
lib-common/inc/Common/DataTypes.h
lib-contacts/inc/Contacts/Common/ContactSelectTypes.h
lib-contacts/inc/Contacts/Details/DetailsView.h
lib-contacts/inc/Contacts/Details/SharePopup.h
lib-contacts/inc/Contacts/Input/InputView.h
lib-contacts/inc/Contacts/Model/Contact.h
lib-contacts/inc/Contacts/Model/ContactFieldMetadata.h
lib-contacts/inc/Contacts/Model/ContactTypes.h
lib-contacts/src/Contacts/Details/DetailsView.cpp
lib-contacts/src/Contacts/Input/InputView.cpp
lib-contacts/src/Contacts/Model/Contact.cpp
lib-contacts/src/Contacts/Model/ContactFieldFactory.cpp
lib-contacts/src/Contacts/Model/ContactFieldMetadata.cpp

index eee7af7..7251621 100644 (file)
@@ -33,18 +33,44 @@ namespace Common
        };
 
        /**
+        * @brief Designates Contacts API model object types and their adapters.
+        */
+       enum ObjectType
+       {
+               ObjectTypePerson,       /**< _contacts_person record */
+               ObjectTypeContact,      /**< _contacts_contact record */
+               ObjectTypeMyProfile,    /**< _contacts_my_profile record */
+               ObjectTypeImage,        /**< _contacts_image record */
+               ObjectTypeName,         /**< _contacts_name record (partial) */
+               ObjectTypeNumber,       /**< _contacts_number record */
+               ObjectTypeEmail,        /**< _contacts_email record */
+               ObjectTypeNote,         /**< _contacts_note record */
+               ObjectTypeAddress,      /**< _contacts_address record */
+               ObjectTypeEvent,        /**< _contacts_event record */
+               ObjectTypeRelationship, /**< _contacts_relationship record */
+               ObjectTypeUrl,          /**< _contacts_url record */
+               ObjectTypeMessenger,    /**< _contacts_messenger record */
+               ObjectTypeNickname,     /**< _contacts_nickname record */
+               ObjectTypeCompany,      /**< _contacts_company record */
+               ObjectTypePhoneticName, /**< _contacts_name record (partial) */
+               ObjectTypeRingtone,     /**< _contacts_contact.ringtone_path adapter */
+               ObjectTypeGroups,       /**< _contacts_contact.group_relation adapter */
+               ObjectTypeGroupRel      /**< _contacts_group_relation record */
+       };
+
+       /**
         * @brief Designates Contacts API model enumeration types.
         */
        enum EnumType
        {
-               EnumNumberType,       /**< contacts_number_type_e */
-               EnumEmailType,        /**< contacts_email_type_e */
-               EnumAddressType,      /**< contacts_address_type_e */
-               EnumEventType,        /**< contacts_event_type_e */
-               EnumRelationshipType, /**< contacts_relationship_type_e */
-               EnumUrlType,          /**< contacts_url_type_e */
-               EnumMessengerType,    /**< contacts_messenger_type_e */
-               EnumLogType           /**< contacts_phone_log_type_e */
+               EnumNumberType,         /**< contacts_number_type_e */
+               EnumEmailType,          /**< contacts_email_type_e */
+               EnumAddressType,        /**< contacts_address_type_e */
+               EnumEventType,          /**< contacts_event_type_e */
+               EnumRelationshipType,   /**< contacts_relationship_type_e */
+               EnumUrlType,            /**< contacts_url_type_e */
+               EnumMessengerType,      /**< contacts_messenger_type_e */
+               EnumLogType             /**< contacts_phone_log_type_e */
        };
 
        /**
index 02172fc..a552ca3 100644 (file)
@@ -18,8 +18,8 @@
 #ifndef CONTACTS_COMMON_CONTACT_SELECT_TYPES_H
 #define CONTACTS_COMMON_CONTACT_SELECT_TYPES_H
 
+#include "Common/DataTypes.h"
 #include "Ux/SelectTypes.h"
-#include "Contacts/Model/ContactTypes.h"
 
 namespace Contacts
 {
@@ -29,8 +29,8 @@ namespace Contacts
        enum FilterType
        {
                FilterNone   = -1,                           /**< All items are displayed */
-               FilterNumber = 1 << Model::ObjectTypeNumber, /**< Only items with number */
-               FilterEmail  = 1 << Model::ObjectTypeEmail   /**< Only items with email */
+               FilterNumber = 1 << Common::ObjectTypeNumber, /**< Only items with number */
+               FilterEmail  = 1 << Common::ObjectTypeEmail   /**< Only items with email */
        };
 
        /**
@@ -38,10 +38,10 @@ namespace Contacts
         */
        enum ResultType
        {
-               ResultMyProfile = Model::ObjectTypeMyProfile, /**< My Profile ID is the result */
-               ResultPerson    = Model::ObjectTypeContact,   /**< Person ID is the result */
-               ResultNumber    = Model::ObjectTypeNumber,    /**< Number ID is the result */
-               ResultEmail     = Model::ObjectTypeEmail,     /**< Email ID is the result */
+               ResultMyProfile = Common::ObjectTypeMyProfile, /**< My Profile ID is the result */
+               ResultPerson    = Common::ObjectTypeContact,   /**< Person ID is the result */
+               ResultNumber    = Common::ObjectTypeNumber,    /**< Number ID is the result */
+               ResultEmail     = Common::ObjectTypeEmail,     /**< Email ID is the result */
                ResultVcard,    /**< vCard file path is the result */
                ResultAction    /**< @ref ActionType is the result*/
        };
index ce8b426..465bf4b 100644 (file)
@@ -44,8 +44,8 @@ namespace Contacts
                         */
                        enum Type
                        {
-                               TypeContact = Model::ObjectTypeContact,
-                               TypeMyProfile = Model::ObjectTypeMyProfile
+                               TypeContact = Common::ObjectTypeContact,
+                               TypeMyProfile = Common::ObjectTypeMyProfile
                        };
 
                        /**
index b71bc98..a1060c1 100644 (file)
@@ -51,7 +51,7 @@ namespace Contacts
                        void formatTypedObject(std::string &text, Contacts::Model::ContactObject &object);
 
                        int m_PersonId;
-                       Contacts::Model::ContactObjectType m_Type;
+                       Common::ObjectType m_Type;
                };
        }
 }
index 0510972..b058d7f 100644 (file)
@@ -51,8 +51,8 @@ namespace Contacts
                         */
                        enum Type
                        {
-                               TypeContact = Model::ObjectTypeContact,
-                               TypeMyProfile = Model::ObjectTypeMyProfile
+                               TypeContact = Common::ObjectTypeContact,
+                               TypeMyProfile = Common::ObjectTypeMyProfile
                        };
 
                        /**
index 3f0952a..09762b3 100644 (file)
@@ -34,7 +34,7 @@ namespace Contacts
                         * @brief Create contact object.
                         * @param[in]   type    Contact object type (ObjectTypeContact or ObjectTypeMyProfile)
                         */
-                       Contact(ContactObjectType type);
+                       Contact(Common::ObjectType type);
                        Contact(const Contact &that) = delete;
                        virtual ~Contact() override;
 
index a493ecb..6e91a66 100644 (file)
@@ -101,7 +101,7 @@ namespace Contacts
                 * @param[in]   type    Contact object type (ObjectTypeContact or ObjectTypeMyProfile)
                 * @return Contact root object metadata.
                 */
-               const ContactFieldMetadata *getContactMetadata(ContactObjectType type);
+               const ContactFieldMetadata *getContactMetadata(Common::ObjectType type);
        }
 }
 
index bc0f20d..9d36e6b 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef CONTACTS_MODEL_CONTACT_TYPES_H
 #define CONTACTS_MODEL_CONTACT_TYPES_H
 
+#include "Common/DataTypes.h"
+
 namespace Contacts
 {
        namespace Model
@@ -47,31 +49,6 @@ namespace Contacts
                };
 
                /**
-                * @brief Subtype for field of TypeObject type
-                */
-               enum ContactObjectType
-               {
-                       ObjectTypeContact,
-                       ObjectTypeMyProfile,
-                       ObjectTypeImage,
-                       ObjectTypeName,
-                       ObjectTypeNumber,
-                       ObjectTypeEmail,
-                       ObjectTypeNote,
-                       ObjectTypeAddress,
-                       ObjectTypeEvent,
-                       ObjectTypeRelationship,
-                       ObjectTypeUrl,
-                       ObjectTypeMessenger,
-                       ObjectTypeNickname,
-                       ObjectTypeCompany,
-                       ObjectTypePhoneticName,
-                       ObjectTypeRingtone,
-                       ObjectTypeGroups,
-                       ObjectTypeGroupRel
-               };
-
-               /**
                 * @brief Subtype for field of TypeText type
                 */
                enum ContactTextType
index cde820e..e0783a8 100644 (file)
@@ -42,6 +42,7 @@
 
 #define TITLE_SIZE 32
 
+using namespace Common;
 using namespace Contacts::Details;
 using namespace Contacts::Model;
 using namespace std::placeholders;
@@ -70,7 +71,7 @@ namespace
 }
 
 DetailsView::DetailsView(int recordId, Type type)
-       : m_RecordId(recordId), m_Contact(ContactObjectType(type)),
+       : m_RecordId(recordId), m_Contact(ObjectType(type)),
          m_Genlist(nullptr), m_BasicInfoItem(nullptr), m_Items{nullptr}
 {
 }
index 33792ec..518952a 100644 (file)
@@ -43,7 +43,7 @@
 #include "AppsCommonButtons.h"
 #include "InputPath.h"
 
-using namespace Contacts;
+using namespace Common;
 using namespace Contacts::Input;
 using namespace Contacts::Model;
 using namespace std::placeholders;
@@ -72,7 +72,7 @@ namespace
 }
 
 InputView::InputView(int recordId, Type type)
-       : m_Contact(ContactObjectType(type)),
+       : m_Contact(ObjectType(type)),
          m_DoneButton(nullptr), m_Genlist(nullptr),
          m_Items{nullptr}, m_AddFieldsItem(nullptr)
 {
index 90c789d..fe6b385 100644 (file)
 #include "Utils/Callback.h"
 #include "Utils/Logger.h"
 
+using namespace Common;
 using namespace Contacts::Model;
 
-Contact::Contact(ContactObjectType type)
+Contact::Contact(ObjectType type)
        : ContactObject(nullptr, *getContactMetadata(type)),
          m_IsNew(true), m_DbVersion(0)
 {
index 79f72ce..dd93c8d 100644 (file)
@@ -29,6 +29,7 @@
 #include "Contacts/Model/ContactName.h"
 #include "Contacts/Model/ContactPhoneticName.h"
 
+using namespace Common;
 using namespace Contacts::Model;
 
 ContactFieldPtr ContactFieldFactory::createField(ContactFieldContainer *parent,
index afa8eaf..f5eb51a 100644 (file)
@@ -377,7 +377,7 @@ const ContactFieldMetadata myProfile = { 0, 0, true, UPCAST(&myProfileObject) };
 } /* Anonymous namespace */
 
 
-const ContactFieldMetadata *Model::getContactMetadata(ContactObjectType type)
+const ContactFieldMetadata *Model::getContactMetadata(ObjectType type)
 {
        if (type == ObjectTypeContact) {
                return &contact;