Fixed group members list title while initialization is in progress.
Change-Id: I9aa6999020fc259a8abef2a0d2d028aee1b358d4
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
EXPORT_API const Ux::SelectView::Strings &getSelectViewStrings();
/**
- * @brief Get default group name.
- * @param[in] type Group type
- * @return Group translatable name.
+ * @brief Get translated group name.
+ * @param[in] name Original group name
+ * @return Translated group name.
*/
- EXPORT_API const char *getDefaultGroupName(GroupType type);
+ EXPORT_API const char *getGroupName(const char *name);
}
#endif /* COMMON_STRINGS_H */
*/
#include "Common/Strings.h"
+
+#include <app_i18n.h>
#include <contacts.h>
using namespace Common;
};
const char *defaultGroupName[] = {
- /* [TypeCoWorkers] = */ "IDS_PB_BODY_CO_WORKERS",
- /* [TypeFamily] = */ "IDS_PB_BODY_DEFAULT_GROUP_FAMILY",
- /* [TypeFriends] = */ "IDS_PB_BODY_DEFAULT_GROUP_FRIENDS"
+ /* [GroupCoWorkers] = */ "IDS_PB_BODY_CO_WORKERS",
+ /* [GroupFamily] = */ "IDS_PB_BODY_DEFAULT_GROUP_FAMILY",
+ /* [GroupFriends] = */ "IDS_PB_BODY_DEFAULT_GROUP_FRIENDS"
};
}
return selectViewStrings;
}
-const char *Common::getDefaultGroupName(GroupType type)
+const char *Common::getGroupName(const char *name)
{
- return Utils::at(defaultGroupName, type);
+ GroupType type = getGroupType(name);
+ if (type != GroupCustom) {
+ return _(Utils::at(defaultGroupName, type));
+ }
+
+ return name;
}
std::string groups;
for (auto &&field : *getObject().getField<ContactArray>(0)) {
const char *name = getRecordStr(field.getRecord(), _contacts_group_relation.name);
- GroupType type = getGroupType(name);
- const char *groupName = (type == GroupCustom) ? name : _(getDefaultGroupName(type));
if (!groups.empty()) {
groups.append(", ");
}
- groups.append(groupName);
+ groups.append(getGroupName(name));
}
return groups;
char *GroupItem::getText(Evas_Object *parent, const char *part)
{
if (strcmp(part, PART_GROUP_NAME) == 0) {
- char title[BUFFER_SIZE] = { 0, };
- const char *name = (m_Group.getType() == GroupCustom) ? m_Group.getName()
- : _(getDefaultGroupName(m_Group.getType()));
- snprintf(title, sizeof(title), "%s (%d)", name, m_Group.getMembersCount());
+ char title[BUFFER_SIZE];
+ snprintf(title, sizeof(title), "%s (%d)",
+ getGroupName(m_Group.getName()), m_Group.getMembersCount());
return strdup(title);
}
return nullptr;
void MembersListView::onPageAttached(NavigatorPage *page)
{
- SelectView::onPageAttached(page);
- updateTitle();
+ if (getSelectMode() == SelectNone) {
+ page->setTitle(getGroupName(m_Group.getName()));
+ } else {
+ SelectView::onPageAttached(page);
+ }
}
void MembersListView::onMenuPressed()
return;
}
- const char *name = (m_Group.getType() == GroupCustom) ?
- m_Group.getName() : _(getDefaultGroupName(m_Group.getType()));
-
+ const char *name = getGroupName(m_Group.getName());
int count = getProvider()->getDataList().size();
if (count == 0) {
page->setTitle(name);
{
if (strcmp(part, PART_GROUP_NAME_VALUE) == 0) {
Ui::Editfield *edit = Ui::Editfield::create(parent, "IDS_PB_MBODY_GROUP_NAME_ABB");
-
- const char *name = m_Group.getName();
if (m_Group.getType() != GroupCustom) {
edit->setEnabled(false);
- name = _(getDefaultGroupName(m_Group.getType()));
}
- char *markupName = elm_entry_utf8_to_markup(name);
+ char *markupName = elm_entry_utf8_to_markup(getGroupName(m_Group.getName()));
elm_entry_entry_set(edit->getEntry(), markupName);
free(markupName);
std::string groups;
for (auto &&field : m_GroupRels) {
const char *name = getRecordStr(field.getRecord(), _contacts_group_relation.name);
- GroupType type = getGroupType(name);
- const char *groupName = (type == GroupCustom) ? name : _(getDefaultGroupName(type));
if (!groups.empty()) {
groups.append(", ");
}
- groups.append(groupName);
+ groups.append(getGroupName(name));
}
return groups;