*/
Evas_Object *getClearButton();
+ /**
+ * @brief Set whether entry is enabled or not.
+ * @param[in] isEnabled Whether input will be inserted in the entry
+ */
+ void setEnabled(bool isEnabled);
+
+ /**
+ * @brief Set Clear button visibility.
+ * @param[in] isVisible Whether Clear button is visible
+ */
+ void setClearButtonVisible(bool isVisible);
+
private:
virtual Evas_Object *onCreate(Evas_Object *parent) override;
- static void onChanged(Evas_Object *layout, Evas_Object *entry, void *eventInfo);
+ static void onChanged(Editfield *editfield, Evas_Object *entry, void *eventInfo);
static void onFocused(Evas_Object *layout, Evas_Object *entry, void *eventInfo);
static void onUnfocused(Evas_Object *layout, Evas_Object *entry, void *eventInfo);
static void onClearPressed(Evas_Object *entry, Evas_Object *button, void *eventInfo);
+
};
}
elm_entry_scrollable_set(entry, EINA_TRUE);
elm_object_part_content_set(layout, "elm.swallow.content", entry);
- evas_object_smart_callback_add(entry, "changed", (Evas_Smart_Cb) onChanged, layout);
+ evas_object_smart_callback_add(entry, "changed", (Evas_Smart_Cb) onChanged, this);
evas_object_smart_callback_add(entry, "focused", (Evas_Smart_Cb) onFocused, layout);
evas_object_smart_callback_add(entry, "unfocused", (Evas_Smart_Cb) onUnfocused, layout);
return elm_object_part_content_get(getEvasObject(), "elm.swallow.button");
}
-void Editfield::onChanged(Evas_Object *layout, Evas_Object *entry, void *eventInfo)
+void Editfield::setEnabled(bool isEnabled)
{
- if (elm_entry_is_empty(entry)) {
- elm_object_signal_emit(layout, "elm,action,hide,button", "");
+ elm_object_disabled_set(getEntry(), !isEnabled);
+ setClearButtonVisible(isEnabled);
+}
+
+void Editfield::setClearButtonVisible(bool isVisible)
+{
+ if (isVisible) {
+ elm_object_signal_emit(getEvasObject(), "elm,action,show,button", "");
} else {
- elm_object_signal_emit(layout, "elm,action,show,button", "");
+ elm_object_signal_emit(getEvasObject(), "elm,action,hide,button", "");
+ }
+}
+
+void Editfield::onChanged(Editfield *editfield, Evas_Object *entry, void *eventInfo)
+{
+ if (!elm_object_disabled_get(entry)) {
+ editfield->setClearButtonVisible(!elm_entry_is_empty(entry));
}
}
using namespace Common::Database;
using namespace Contacts::Groups;
+using namespace Utils;
NameItem::NameItem(contacts_record_h record)
: m_Record(record)
Ui::Editfield *edit = Ui::Editfield::create(parent, "IDS_PB_MBODY_GROUP_NAME_ABB");
char *name = elm_entry_utf8_to_markup(getRecordStr(m_Record, _contacts_group.name));
elm_entry_entry_set(edit->getEntry(), name);
+ if (safeCmp(name, "Co-workers")
+ || safeCmp(name, "Family")
+ || safeCmp(name, "Friends")) {
+ edit->setEnabled(false);
+ }
free(name);
evas_object_smart_callback_add(edit->getEntry(), "changed",
makeCallback(&NameItem::onChanged), this);