From: Eugene Kurzberg Date: Mon, 1 Feb 2016 16:04:28 +0000 (+0200) Subject: Renamed ContactFactory and ContactField::FillChangedCallback. X-Git-Tag: submit/tizen/20160524.113145~187^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd30cfcd82b7029742f4c4920e253952850e9b74;p=profile%2Fmobile%2Fapps%2Fnative%2Fphone-contacts.git Renamed ContactFactory and ContactField::FillChangedCallback. Change-Id: I26e69374554ec8da15708b87c0cee47ee9b2b845 Signed-off-by: Eugene Kurzberg --- diff --git a/lib-contact/inc/Contacts/Input/InputView.h b/lib-contact/inc/Contacts/Input/InputView.h index ff61f94..1615203 100644 --- a/lib-contact/inc/Contacts/Input/InputView.h +++ b/lib-contact/inc/Contacts/Input/InputView.h @@ -73,7 +73,7 @@ namespace Contacts void onAddField(Model::ContactFieldId fieldId); void onRemoveField(ContactFieldItem *item); - void onFillChanged(bool isFilled); + void onContactFilled(bool isFilled); void onDonePressed(Evas_Object *button, void *eventInfo); void onCancelPressed(Evas_Object *button, void *eventInfo); diff --git a/lib-contact/inc/Contacts/Model/ContactField.h b/lib-contact/inc/Contacts/Model/ContactField.h index fbccb78..34e5fce 100644 --- a/lib-contact/inc/Contacts/Model/ContactField.h +++ b/lib-contact/inc/Contacts/Model/ContactField.h @@ -44,7 +44,7 @@ namespace Contacts * @brief Callback to be called when the field becomes filled or not filled. * @param[in] Whether the field is filled. */ - typedef std::function FillChangedCallback; + typedef std::function FillCallback; /** * @brief Create contact field. @@ -88,10 +88,10 @@ namespace Contacts bool isRequired() const; /** - * @brief Set field fill changed callback. + * @brief Set field fill callback. * @param[in] callback Called when field fill state is changed. */ - void setFillChangedCallback(FillChangedCallback callback); + void setFillCallback(FillCallback callback); /** * @brief Cast field to derived type. @@ -160,12 +160,12 @@ namespace Contacts * @brief Should be called to report fill state change. * @param[in] isFilled Whether field is filled */ - void onFillChanged(bool isFilled); + void onFilled(bool isFilled); private: contacts_record_h m_Record; const ContactFieldMetadata &m_Metadata; - FillChangedCallback m_OnFillChanged; + FillCallback m_OnFilled; }; typedef std::unique_ptr ContactFieldPtr; diff --git a/lib-contact/inc/Contacts/Model/ContactFieldContainer.h b/lib-contact/inc/Contacts/Model/ContactFieldContainer.h index e39c593..d9d9b16 100644 --- a/lib-contact/inc/Contacts/Model/ContactFieldContainer.h +++ b/lib-contact/inc/Contacts/Model/ContactFieldContainer.h @@ -81,7 +81,7 @@ namespace Contacts void removeField(ContactField &field); private: - void onChildFillChanged(bool isChildFilled); + void onChildFilled(bool isChildFilled); ContactFields m_Fields; size_t m_FilledCount = 0; diff --git a/lib-contact/inc/Contacts/Model/ContactFactory.h b/lib-contact/inc/Contacts/Model/ContactFieldFactory.h similarity index 95% rename from lib-contact/inc/Contacts/Model/ContactFactory.h rename to lib-contact/inc/Contacts/Model/ContactFieldFactory.h index e0f245b..a4b3042 100644 --- a/lib-contact/inc/Contacts/Model/ContactFactory.h +++ b/lib-contact/inc/Contacts/Model/ContactFieldFactory.h @@ -18,7 +18,7 @@ #ifndef CONTACTS_MODEL_CONTACT_FIELD_FACTORY_H #define CONTACTS_MODEL_CONTACT_FIELD_FACTORY_H -#include "Contacts/Model/ContactObject.h" +#include "Contacts/Model/ContactField.h" namespace Contacts { @@ -27,7 +27,7 @@ namespace Contacts /** * @brief Contact adaptor objects and fields factory */ - class ContactFactory + class ContactFieldFactory { public: /** diff --git a/lib-contact/src/Contacts/Input/InputView.cpp b/lib-contact/src/Contacts/Input/InputView.cpp index 7bae0a7..203b5cb 100644 --- a/lib-contact/src/Contacts/Input/InputView.cpp +++ b/lib-contact/src/Contacts/Input/InputView.cpp @@ -89,7 +89,7 @@ void InputView::onCreated() { int err = m_Contact.initialize(m_RecordId); RETM_IF_ERR(err, "Contact::initialize() failed."); - m_Contact.setFillChangedCallback(std::bind(&InputView::onFillChanged, + m_Contact.setFillCallback(std::bind(&InputView::onContactFilled, this, std::placeholders::_1)); addFieldItem(addField(FieldImage)); @@ -247,7 +247,7 @@ void InputView::onRemoveField(ContactFieldItem *item) removeField(field); } -void InputView::onFillChanged(bool isFilled) +void InputView::onContactFilled(bool isFilled) { elm_object_disabled_set(m_DoneButton, !isFilled); } diff --git a/lib-contact/src/Contacts/Model/ContactField.cpp b/lib-contact/src/Contacts/Model/ContactField.cpp index 2336b70..c3d11e3 100644 --- a/lib-contact/src/Contacts/Model/ContactField.cpp +++ b/lib-contact/src/Contacts/Model/ContactField.cpp @@ -72,9 +72,9 @@ bool ContactField::isRequired() const return m_Metadata.isRequired; } -void ContactField::setFillChangedCallback(FillChangedCallback callback) +void ContactField::setFillCallback(FillCallback callback) { - m_OnFillChanged = std::move(callback); + m_OnFilled = std::move(callback); } unsigned ContactField::getId() const @@ -112,9 +112,9 @@ const ContactFieldMetadata &ContactField::getMetadata() const return m_Metadata; } -void ContactField::onFillChanged(bool isFilled) +void ContactField::onFilled(bool isFilled) { - if (m_OnFillChanged) { - m_OnFillChanged(isFilled); + if (m_OnFilled) { + m_OnFilled(isFilled); } } diff --git a/lib-contact/src/Contacts/Model/ContactFieldContainer.cpp b/lib-contact/src/Contacts/Model/ContactFieldContainer.cpp index ddc9d21..d03a785 100644 --- a/lib-contact/src/Contacts/Model/ContactFieldContainer.cpp +++ b/lib-contact/src/Contacts/Model/ContactFieldContainer.cpp @@ -16,7 +16,7 @@ */ #include "Contacts/Model/ContactFieldContainer.h" -#include "Contacts/Model/ContactFactory.h" +#include "Contacts/Model/ContactFieldFactory.h" #include @@ -75,13 +75,13 @@ size_t ContactFieldContainer::getFieldCount() const ContactField &ContactFieldContainer::addField(contacts_record_h record, const ContactFieldMetadata &metadata) { - ContactFieldPtr field = ContactFactory::createField(record, metadata); + ContactFieldPtr field = ContactFieldFactory::createField(record, metadata); if (field->isRequired()) { if (field->isFilled()) { - onChildFillChanged(true); + onChildFilled(true); } - field->setFillChangedCallback(std::bind(&ContactFieldContainer::onChildFillChanged, + field->setFillCallback(std::bind(&ContactFieldContainer::onChildFilled, this, std::placeholders::_1)); } @@ -96,18 +96,18 @@ void ContactFieldContainer::removeField(ContactField &field) }; if (field.isRequired() && field.isFilled()) { - onChildFillChanged(false); + onChildFilled(false); } m_Fields.erase(std::remove_if(m_Fields.begin(), m_Fields.end(), comp), m_Fields.end()); } -void ContactFieldContainer::onChildFillChanged(bool isChildFilled) +void ContactFieldContainer::onChildFilled(bool isChildFilled) { /* Equals zero if no fields were PREVIOUSLY filled or no fields are NOW filled */ size_t checkCount = isChildFilled ? m_FilledCount++ : --m_FilledCount; if (checkCount == 0) { - onFillChanged(isChildFilled); + onFilled(isChildFilled); } } diff --git a/lib-contact/src/Contacts/Model/ContactFactory.cpp b/lib-contact/src/Contacts/Model/ContactFieldFactory.cpp similarity index 92% rename from lib-contact/src/Contacts/Model/ContactFactory.cpp rename to lib-contact/src/Contacts/Model/ContactFieldFactory.cpp index 119ce44..8876090 100644 --- a/lib-contact/src/Contacts/Model/ContactFactory.cpp +++ b/lib-contact/src/Contacts/Model/ContactFieldFactory.cpp @@ -15,7 +15,7 @@ * */ -#include "Contacts/Model/ContactFactory.h" +#include "Contacts/Model/ContactFieldFactory.h" #include "Contacts/Model/ContactFieldMetadata.h" #include "Contacts/Model/ContactArray.h" @@ -30,7 +30,7 @@ using namespace Contacts::Model; -ContactFieldPtr ContactFactory::createField(contacts_record_h record, +ContactFieldPtr ContactFieldFactory::createField(contacts_record_h record, const ContactFieldMetadata &metadata) { ContactField *field = nullptr; @@ -75,7 +75,7 @@ ContactFieldPtr ContactFactory::createField(contacts_record_h record, return ContactFieldPtr(field); } -contacts_record_h ContactFactory::getObjectRecord(contacts_record_h record, +contacts_record_h ContactFieldFactory::getObjectRecord(contacts_record_h record, const ContactFieldMetadata &metadata) { contacts_record_h childRecord = nullptr; diff --git a/lib-contact/src/Contacts/Model/ContactTextField.cpp b/lib-contact/src/Contacts/Model/ContactTextField.cpp index bb91227..78ed859 100644 --- a/lib-contact/src/Contacts/Model/ContactTextField.cpp +++ b/lib-contact/src/Contacts/Model/ContactTextField.cpp @@ -63,6 +63,6 @@ void ContactTextField::setValue(const char *value) bool isFilled = value && *value; if (wasFilled != isFilled) { - onFillChanged(isFilled); + onFilled(isFilled); } } diff --git a/lib-contact/src/Contacts/Model/ContactTypedObject.cpp b/lib-contact/src/Contacts/Model/ContactTypedObject.cpp index 0f89cb9..5e0e6e6 100644 --- a/lib-contact/src/Contacts/Model/ContactTypedObject.cpp +++ b/lib-contact/src/Contacts/Model/ContactTypedObject.cpp @@ -16,7 +16,7 @@ */ #include "Contacts/Model/ContactTypedObject.h" -#include "Contacts/Model/ContactFactory.h" +#include "Contacts/Model/ContactFieldFactory.h" #include "Contacts/Model/ContactFieldMetadata.h" using namespace Contacts::Model; @@ -24,8 +24,8 @@ using namespace Contacts::Model; void ContactTypedObject::initialize() { ContactObject::initialize(); - m_TypeField = ContactFactory::createField(getRecord(), getTypedObjectMetadata().typeField); - m_LabelField = ContactFactory::createField(getRecord(), getTypedObjectMetadata().labelField); + m_TypeField = ContactFieldFactory::createField(getRecord(), getTypedObjectMetadata().typeField); + m_LabelField = ContactFieldFactory::createField(getRecord(), getTypedObjectMetadata().labelField); } void ContactTypedObject::reset()