Refactored Contacts-Groups navigator pages.
Change-Id: I72907c109cbcf9f4e29e240303a64f86b082692a
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
virtual ~TabPage() override;
/**
+ * @brief Set tab item title to be different from page title.
+ * @param[in] title Tab item title text
+ */
+ void setTabTitle(const char *title);
+
+ /**
+ * @brief Set tab item title to be the same as page title.
+ */
+ void unsetTabTitle();
+
+ /**
* @see NavigatorPage::setTitle()
*/
virtual void setTitle(const char *title) override;
Elm_Object_Item *m_TabItem;
Evas_Object *m_Page;
+ bool m_HasTabTitle;
};
}
using namespace Ui;
TabPage::TabPage(Elm_Object_Item *tabItem)
- : m_TabItem(tabItem), m_Page(nullptr)
+ : m_TabItem(tabItem), m_Page(nullptr), m_HasTabTitle(false)
{
elm_object_item_data_set(tabItem, this);
elm_object_item_del_cb_set(tabItem, makeCallback(&TabPage::onTabItemDestroy));
elm_object_item_del(m_TabItem);
}
-Evas_Object *TabPage::onCreate(Evas_Object *parent)
+void TabPage::setTabTitle(const char *title)
{
- m_Page = elm_layout_add(parent);
- elm_layout_theme_set(m_Page, "naviframe", "item", "basic/default");
- elm_layout_signal_emit(m_Page, "elm,state,title,hide", "elm");
- elm_layout_signal_emit(m_Page, "elm,state,toolbar,hide", "elm");
+ elm_object_item_translatable_text_set(m_TabItem, title);
+ m_HasTabTitle = true;
+}
- return m_Page;
+void TabPage::unsetTabTitle()
+{
+ const char *title = elm_object_translatable_part_text_get(m_Page, "elm.text.title");
+ elm_object_item_translatable_text_set(m_TabItem, title);
+ m_HasTabTitle = false;
}
void TabPage::setTitle(const char *title)
{
- elm_object_item_translatable_text_set(m_TabItem, title);
+ if (!m_HasTabTitle) {
+ elm_object_item_translatable_text_set(m_TabItem, title);
+ }
elm_object_translatable_part_text_set(m_Page, "elm.text.title", title);
}
return m_TabItem;
}
+Evas_Object *TabPage::onCreate(Evas_Object *parent)
+{
+ m_Page = elm_layout_add(parent);
+ elm_layout_theme_set(m_Page, "naviframe", "item", "basic/default");
+ elm_layout_signal_emit(m_Page, "elm,state,title,hide", "elm");
+ elm_layout_signal_emit(m_Page, "elm,state,toolbar,hide", "elm");
+
+ return m_Page;
+}
+
void TabPage::onTabItemDestroy(Evas_Object *obj, void *eventInfo)
{
m_TabItem = nullptr;
virtual void setTitle(const char *title) override;
/**
- * @see NavigatorPage::setTitleVisibility()
- */
- virtual void setTitleVisibility(bool isVisible) override;
-
- /**
* @see NavigatorPage::setContent()
*/
virtual void setContent(const char *part, Evas_Object *content) override;
#include "Contacts/Chooser/ContactsGroupsNavigator.h"
#include "Contacts/Chooser/ContactsPage.h"
-#include "Contacts/List/PersonSearchItem.h"
+#include "Contacts/List/PersonItem.h"
+#include "Contacts/List/Model/Person.h"
#include "App/Path.h"
#include "Ui/Hoversel.h"
elm_object_part_content_set(m_TitleLayout, PART_MULTI_BTN, m_MultiBtn);
}
- const char *name = static_cast<List::PersonSearchItem *>(item)->getPerson().getName();
+ const char *name = static_cast<List::PersonItem *>(item)->getPerson().getName();
elm_multibuttonentry_item_append(m_MultiBtn, name, nullptr, item);
}
Ui::TabPage *ContactsGroupsNavigator::createPage(Ui::View *view, Elm_Object_Item *item)
{
+ Ui::TabPage *page = nullptr;
if (view == m_ContactsView) {
- return new ContactsPage(getNavigator()->getPage(), item);
+ page = new ContactsPage(getNavigator()->getPage(), item);
+ page->setTabTitle("IDS_PB_BODY_ALL_CONTACTS");
+ } else if (view == m_GroupsView) {
+ page = TabNavigator::createPage(view, item);
+ page->setTabTitle("IDS_PB_BODY_GROUPS");
+ } else {
+ page = TabNavigator::createPage(view, item);
}
- return TabNavigator::createPage(view, item);
+ page->setTitleVisibility(false);
+ return page;
}
void ContactsGroupsNavigator::onButtonPressed(Evas_Object *obj, Elm_Object_Item *button)
ContactsPage::ContactsPage(Ui::NavigatorPage *titlePage, Elm_Object_Item *tabItem)
: TabPage(tabItem), m_TitlePage(titlePage)
{
- TabPage::setTitle("IDS_PB_BODY_ALL_CONTACTS");
- TabPage::setTitleVisibility(false);
}
void ContactsPage::setTitle(const char *title)
m_TitlePage->setTitle(title);
}
-void ContactsPage::setTitleVisibility(bool isVisible)
-{
- m_TitlePage->setTitleVisibility(isVisible);
-}
-
void ContactsPage::setContent(const char *part, Evas_Object *content)
{
if (strcmp(part, "title_right_btn") == 0