Moved common group item functionality to GenGroupItem. 93/82093/1
authorEugene Kurzberg <i.kurtsberg@samsung.com>
Fri, 29 Jul 2016 12:44:38 +0000 (15:44 +0300)
committerEugene Kurzberg <i.kurtsberg@samsung.com>
Fri, 29 Jul 2016 12:45:40 +0000 (15:45 +0300)
Updated Settings according to UX.

Change-Id: I10fc7daaeb558817d7295f3b73cfb5c3e0b823aa
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
16 files changed:
lib-apps-common/inc/Ui/GenGroupItem.h
lib-apps-common/src/Ui/GenGroupItem.cpp
lib-contacts/inc/Contacts/Groups/GroupsItem.h [deleted file]
lib-contacts/inc/Contacts/Groups/GroupsView.h
lib-contacts/inc/Contacts/List/ListSection.h
lib-contacts/inc/Contacts/List/MyProfileGroup.h [deleted file]
lib-contacts/src/Contacts/Groups/GroupsItem.cpp [deleted file]
lib-contacts/src/Contacts/Groups/GroupsView.cpp
lib-contacts/src/Contacts/List/ListSection.cpp
lib-contacts/src/Contacts/List/ListView.cpp
lib-contacts/src/Contacts/List/MyProfileGroup.cpp [deleted file]
lib-contacts/src/Contacts/List/RemoveFavView.cpp
lib-contacts/src/Contacts/List/ReorderView.cpp
lib-contacts/src/Contacts/Settings/MainView.cpp
lib-logs/src/Logs/Details/DetailsView.cpp
lib-logs/src/Logs/List/LogsView.cpp

index 8fe7d22..889be2c 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "Ui/GenContainer.h"
 #include "Ui/GenItem.h"
+
+#include <string>
 #include <vector>
 
 namespace Ui
@@ -27,6 +29,11 @@ namespace Ui
        class EXPORT_API GenGroupItem : virtual public GenItem
        {
        public:
+               /**
+                * @brief Create group item.
+                * @param[in]   title   Item title (can be translatable)
+                */
+               explicit GenGroupItem(const char *title = nullptr);
                virtual ~GenGroupItem() override;
 
                /**
@@ -100,11 +107,19 @@ namespace Ui
                virtual Elm_Gen_Item_Class *getItemClass() const override;
 
                /**
+                * @brief Sets item title into "elm.text" part.
+                * @see GenItem::getText()
+                */
+               virtual char *getText(Evas_Object *parent, const char *part) override;
+
+               /**
+                * @brief Inserts all subitems.
                 * @see GenItem::onInserted()
                 */
                virtual void onInserted() override;
 
                /**
+                * @brief Pops all subitems.
                 * @see GenItem::onPop()
                 */
                virtual void onPop() override;
@@ -120,6 +135,7 @@ namespace Ui
                void insertSubItems();
                void popSubItems();
 
+               std::string m_Title;
                std::vector<GenItemPtr> m_ItemsCache;
        };
 }
index 1edfba4..414f4cf 100644 (file)
 
 #include "Ui/GenGroupItem.h"
 #include <algorithm>
+#include <app_i18n.h>
 
 using namespace Ui;
 
+GenGroupItem::GenGroupItem(const char *title)
+{
+       if (title) {
+               m_Title = title;
+       }
+}
+
 GenGroupItem::~GenGroupItem()
 {
        for (auto &&itemPtr : m_ItemsCache) {
@@ -153,8 +161,20 @@ Elm_Gen_Item_Class *GenGroupItem::getItemClass() const
        return &itc;
 }
 
+char *GenGroupItem::getText(Evas_Object *parent, const char *part)
+{
+       if (strcmp(part, "elm.text") == 0) {
+               return strdup(_(m_Title.c_str()));
+       }
+
+       return nullptr;
+}
+
 void GenGroupItem::onInserted()
 {
+       if (getType() == ELM_GENLIST_ITEM_GROUP) {
+               elm_genlist_item_select_mode_set(getObjectItem(), ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+       }
        if (isExpanded()) {
                insertSubItems();
        }
diff --git a/lib-contacts/inc/Contacts/Groups/GroupsItem.h b/lib-contacts/inc/Contacts/Groups/GroupsItem.h
deleted file mode 100644 (file)
index 4f9621e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef CONTACTS_GROUPS_GROUPS_ITEM_H
-#define CONTACTS_GROUPS_GROUPS_ITEM_H
-
-#include "Ui/GenGroupItem.h"
-
-namespace Contacts
-{
-       namespace Groups
-       {
-               /**
-                * @brief Represents the group containing groups genlist items.
-                */
-               class GroupsItem : public Ui::GenGroupItem
-               {
-               public:
-                       /**
-                        * @brief Create group item.
-                        * @param[in]   title   Item's title
-                        */
-                       GroupsItem(const char *title);
-
-               private:
-                       virtual char *getText(Evas_Object *parent, const char *part) override;
-
-                       std::string m_Title;
-               };
-       }
-}
-
-
-
-#endif /* CONTACTS_GROUPS_GROUPS_ITEM_H */
index d38e024..b730956 100644 (file)
@@ -25,6 +25,7 @@ namespace Ui
 {
        class Genlist;
        class GenItem;
+       class GenGroupItem;
 }
 
 namespace Contacts
@@ -32,7 +33,6 @@ namespace Contacts
        namespace Groups
        {
                class GroupItem;
-               class GroupsItem;
                class CreateGroupItem;
 
                namespace Model
@@ -70,7 +70,7 @@ namespace Contacts
                        Ui::Genlist *m_Genlist;
                        CreateGroupItem *m_CreateItem;
                        Model::GroupsProvider m_Provider;
-                       GroupsItem *m_GroupsItem;
+                       Ui::GenGroupItem *m_GroupsItem;
 
                        bool m_IsAssignMode;
                        int m_NewGroupId;
index 577ad87..8e6928d 100644 (file)
@@ -59,7 +59,7 @@ namespace Contacts
                         * @param[in]   provider    Section provider
                         *
                         */
-                       ListSection(std::string title, Model::PersonProvider *provider,
+                       ListSection(const char *title, Model::PersonProvider *provider,
                                        SectionMode mode = DefaultMode);
                        virtual ~ListSection() override;
 
@@ -83,14 +83,9 @@ namespace Contacts
 
                protected:
                        void onPersonInserted(::Model::DataItem &person);
-                       ContactItem *createItem(Model::Person &person);
-
-               private:
-                       virtual char *getText(Evas_Object *parent, const char *part) override;
-
                        void onPersonDeleted(ContactItem *item);
+                       ContactItem *createItem(Model::Person &person);
 
-                       std::string m_Title;
                        UpdateCallback m_OnUpdated;
                        Model::PersonProvider *m_Provider;
                        SectionMode m_Mode;
diff --git a/lib-contacts/inc/Contacts/List/MyProfileGroup.h b/lib-contacts/inc/Contacts/List/MyProfileGroup.h
deleted file mode 100644 (file)
index 67c01b7..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef CONTACTS_LIST_MY_PROFILE_GROUP_H
-#define CONTACTS_LIST_MY_PROFILE_GROUP_H
-
-#include "Ui/GenGroupItem.h"
-
-namespace Contacts
-{
-       namespace List
-       {
-               /**
-                * @brief Represents the group containing "My Profile" genlist item.
-                */
-               class MyProfileGroup : public Ui::GenGroupItem
-               {
-               public:
-                       MyProfileGroup();
-
-               private:
-                       virtual char *getText(Evas_Object *parent, const char *part) override;
-               };
-       }
-}
-
-#endif /* CONTACTS_LIST_MY_PROFILE_GROUP_H */
diff --git a/lib-contacts/src/Contacts/Groups/GroupsItem.cpp b/lib-contacts/src/Contacts/Groups/GroupsItem.cpp
deleted file mode 100644 (file)
index e8a42d9..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Contacts/Groups/GroupsItem.h"
-#include <app_i18n.h>
-
-using namespace Contacts::Groups;
-
-GroupsItem::GroupsItem(const char *title)
-       : m_Title(title)
-{
-}
-
-char *GroupsItem::getText(Evas_Object *parent, const char *part)
-{
-       if (strcmp(part, "elm.text") == 0) {
-               return strdup(_(m_Title.c_str()));
-       }
-
-       return nullptr;
-}
index 057baa8..9c1e84d 100644 (file)
 
 #include "Contacts/Groups/CreateGroupItem.h"
 #include "Contacts/Groups/GroupItem.h"
-#include "Contacts/Groups/GroupsItem.h"
 #include "Contacts/Groups/InputView.h"
 #include "Contacts/Groups/Model/Group.h"
 
 #include "Common/Strings.h"
 #include "Ui/Genlist.h"
+#include "Ui/GenGroupItem.h"
 #include "Ui/Menu.h"
 #include "Ui/Navigator.h"
 
@@ -55,7 +55,7 @@ Evas_Object *GroupsView::onCreate(Evas_Object *parent)
        m_Genlist = new Ui::Genlist();
        m_Genlist->create(parent);
 
-       m_GroupsItem = new GroupsItem("IDS_PB_OPT_GROUPS");
+       m_GroupsItem = new Ui::GenGroupItem("IDS_PB_OPT_GROUPS");
        m_Genlist->insert(m_GroupsItem);
        for (auto &&data : m_Provider.getDataList()) {
                insertItem(createItem(*static_cast<Group *>(data)));
index 0b55091..70c441d 100644 (file)
 #include "Contacts/List/Model/Person.h"
 #include "Contacts/List/Model/PersonProvider.h"
 
-#include <app_i18n.h>
-
 using namespace Contacts::List;
 using namespace Contacts::List::Model;
 
-ListSection::ListSection(std::string title, PersonProvider *provider, SectionMode mode)
-       : m_Title(title), m_Provider(provider), m_Mode(mode)
+ListSection::ListSection(const char *title, PersonProvider *provider, SectionMode mode)
+       : GenGroupItem(title), m_Provider(provider), m_Mode(mode)
 {
        m_Provider->setInsertCallback(std::bind(&ListSection::onPersonInserted, this, std::placeholders::_1));
 
@@ -77,15 +75,6 @@ void ListSection::reorderItem(int reorderedId, int previousId)
        }
 }
 
-char *ListSection::getText(Evas_Object *parent, const char *part)
-{
-       if (strcmp(part, "elm.text") == 0) {
-               return strdup(_(m_Title.c_str()));
-       }
-
-       return nullptr;
-}
-
 void ListSection::onPersonInserted(::Model::DataItem &person)
 {
        ContactItem *item = createItem(static_cast<Person &>(person));
index 115e9f0..d8d2c79 100644 (file)
@@ -26,7 +26,7 @@
 #include "Contacts/List/Model/PersonProvider.h"
 #include "Contacts/List/Model/PersonSearchData.h"
 
-#include "Contacts/List/MyProfileGroup.h"
+#include "Contacts/List/MyProfileItem.h"
 #include "Contacts/List/PersonGroupItem.h"
 #include "Contacts/List/PersonSearchItem.h"
 #include "Contacts/List/SearchItem.h"
@@ -328,7 +328,8 @@ void ListView::setState(State state, bool isEnabled)
 
 Ui::GenGroupItem *ListView::createMyProfileSection()
 {
-       MyProfileGroup *section = new MyProfileGroup();
+       auto section = new Ui::GenGroupItem("IDS_PB_HEADER_ME");
+       section->insertSubItem(new MyProfileItem());
        insertSection(section, SectionMyProfile);
        return section;
 }
@@ -493,8 +494,6 @@ Ui::GenGroupItem *ListView::createSection(SectionId sectionId)
 void ListView::insertSection(Ui::GenGroupItem *section, SectionId sectionId)
 {
        m_Genlist->insert(section, nullptr, getNextSectionItem(sectionId));
-       elm_genlist_item_select_mode_set(section->getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
-
        updateSearchItem();
 }
 
@@ -666,7 +665,6 @@ PersonGroupItem *ListView::insertPersonGroupItem(const Utils::UniString &indexLe
        PersonGroupItem *item = new PersonGroupItem(indexLetter);
        item->setIndexItem(indexItem);
        m_Genlist->insert(item, nullptr, nextGroupItem);
-       elm_genlist_item_select_mode_set(item->getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
 
        return item;
 }
diff --git a/lib-contacts/src/Contacts/List/MyProfileGroup.cpp b/lib-contacts/src/Contacts/List/MyProfileGroup.cpp
deleted file mode 100644 (file)
index 06e5b60..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2015-2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include "Contacts/List/MyProfileGroup.h"
-#include "Contacts/List/MyProfileItem.h"
-#include <app_i18n.h>
-
-using namespace Contacts::List;
-
-MyProfileGroup::MyProfileGroup()
-{
-       insertSubItem(new MyProfileItem());
-}
-
-char *MyProfileGroup::getText(Evas_Object *parent, const char *part)
-{
-       if (strcmp(part, "elm.text") == 0) {
-               return strdup(_("IDS_PB_HEADER_ME"));
-       }
-
-       return nullptr;
-}
index 593fe5a..59352c8 100644 (file)
@@ -105,7 +105,6 @@ void RemoveFavView::createSections()
 void RemoveFavView::insertSection(Ui::GenGroupItem *section, SectionId sectionId)
 {
        m_Genlist->insert(section, nullptr, getNextSectionItem(sectionId));
-       elm_genlist_item_select_mode_set(section->getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
 }
 
 void RemoveFavView::updateSection(SectionId sectionId)
index 0506026..c5e14f2 100644 (file)
@@ -46,7 +46,6 @@ Evas_Object *ReorderView::onCreate(Evas_Object *parent)
                        new FavoritesProvider(), ListSection::ReorderMode);
 
        m_Genlist->insert(m_Section);
-       elm_genlist_item_select_mode_set(m_Section->getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
        evas_object_smart_callback_add(m_Genlist->getEvasObject(), "moved",
                        makeCallback(&ReorderView::onReorder), this);
 
index 3ccc13d..a2c442d 100644 (file)
@@ -20,7 +20,9 @@
 #include "Contacts/Settings/NameFormatItem.h"
 #include "Contacts/Settings/ExportItem.h"
 #include "Contacts/Settings/ImportItem.h"
+
 #include "Ui/Genlist.h"
+#include "Ui/GenGroupItem.h"
 
 using namespace Contacts::Settings;
 
@@ -33,10 +35,16 @@ Evas_Object *MainView::onCreate(Evas_Object *parent)
 {
        m_Genlist = new Ui::Genlist();
        m_Genlist->create(parent);
-       m_Genlist->insert(new SortByItem());
-       m_Genlist->insert(new NameFormatItem());
-       m_Genlist->insert(new ExportItem());
-       m_Genlist->insert(new ImportItem());
+
+       auto groupItem = new Ui::GenGroupItem("IDS_PB_HEADER_MANAGE_AND_BACK_UP_CONTACTS_ABB2");
+       m_Genlist->insert(groupItem);
+       m_Genlist->insert(new ExportItem(), groupItem);
+       m_Genlist->insert(new ImportItem(), groupItem);
+
+       groupItem = new Ui::GenGroupItem("IDS_PB_HEADER_DISPLAY");
+       m_Genlist->insert(groupItem);
+       m_Genlist->insert(new SortByItem(), groupItem);
+       m_Genlist->insert(new NameFormatItem(), groupItem);
 
        return m_Genlist->getEvasObject();
 }
index 83bfc35..4d7d231 100644 (file)
@@ -159,7 +159,7 @@ void DetailsView::insertLogGroupItem(LogGroup *group)
        Log *log = group->getLogList().back();
        LogGroupItem *groupItem = new LogGroupItem(log->getTime());
        m_Genlist->insert(groupItem, nullptr, getLastGroupItem());
-       elm_genlist_item_select_mode_set(groupItem->getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
+
        setLastGroupItem(groupItem);
        group->setLogAddCallback(std::bind(&DetailsView::onLogAdded, this, _1));
        group->addChangeCallback(std::bind(&DetailsView::onGroupChanged, this, group, groupItem, _1));
index 51a6149..4cf653c 100644 (file)
@@ -286,8 +286,6 @@ LogGroupItem *LogsView::insertGroupItem(tm date)
 {
        LogGroupItem *groupItem = new LogGroupItem(date);
        m_Genlist->insert(groupItem, nullptr, getLastGroupItem());
-       elm_genlist_item_select_mode_set(groupItem->getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE);
-
        setLastGroupItem(groupItem);
        return groupItem;
 }