TSAM-11695 Still able to create a new group with name field is empty 10/105310/1
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Fri, 16 Dec 2016 08:05:41 +0000 (10:05 +0200)
committerEugene Kurzberg <i.kurtsberg@samsung.com>
Fri, 16 Dec 2016 08:05:41 +0000 (10:05 +0200)
Change-Id: I5362940d724ea262a7ba2300a1452cb4534e5800
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
lib-contacts/src/Contacts/Groups/InputView.cpp
lib-contacts/src/Contacts/Groups/NameItem.cpp

index 13ad7ae..a0427d5 100644 (file)
@@ -76,7 +76,9 @@ void InputView::onPageAttached(Ui::NavigatorPage *page)
 
        m_DoneButton = page->addTitleButton(Ui::ButtonRight, "IDS_TPLATFORM_ACBUTTON_DONE_ABB",
                        makeCallback(&InputView::onDonePressed), this);
-       elm_object_disabled_set(m_DoneButton, EINA_TRUE);
+
+       const char *name = m_Group.getName();
+       elm_object_disabled_set(m_DoneButton, !(name && *name));
 
        page->setTitle(m_Group.getId() == 0 ? "IDS_PB_HEADER_CREATE" : "IDS_PB_HEADER_EDIT");
 }
index 0ac3f27..fc3ffd3 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "Ui/Editfield.h"
 #include "Utils/Callback.h"
+#include "Utils/String.h"
 
 #include "GroupItemLayout.h"
 
@@ -102,10 +103,12 @@ void NameItem::onChanged(Evas_Object *entry, void *eventInfo)
 {
        if (m_Group.getType() == GroupCustom) {
                char *text = elm_entry_markup_to_utf8(elm_entry_entry_get(entry));
-               contacts_record_set_str(m_Group.getRecord(), _contacts_group.name, text ? text : "");
+               bool isEmpty = Utils::isStrEmpty(text);
+               contacts_record_set_str(m_Group.getRecord(), _contacts_group.name, !isEmpty ? text : "");
                free(text);
+
+               m_OnFilled(!isEmpty);
        }
-       m_OnFilled(!elm_entry_is_empty(entry));
 }
 
 void NameItem::onActivated(Evas_Object *entry, void *eventInfo)