Implemented manage favorites controller 00/63000/6
authorAleksandr Sapozhnik <a.sapozhnik@samsung.com>
Mon, 21 Mar 2016 12:04:03 +0000 (14:04 +0200)
committerAleksandr Sapozhnik <a.sapozhnik@samsung.com>
Tue, 22 Mar 2016 10:51:56 +0000 (12:51 +0200)
Change-Id: Ide47995f44715c2247924f8a10357e711a809616
Signed-off-by: Aleksandr Sapozhnik <a.sapozhnik@samsung.com>
lib-contact/inc/Contacts/List/ManageFavoritesPopup.h [new file with mode: 0644]
lib-contact/src/Contacts/List/ListView.cpp
lib-contact/src/Contacts/List/ManageFavoritesPopup.cpp [new file with mode: 0644]

diff --git a/lib-contact/inc/Contacts/List/ManageFavoritesPopup.h b/lib-contact/inc/Contacts/List/ManageFavoritesPopup.h
new file mode 100644 (file)
index 0000000..82c6648
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 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_MANAGE_FAVORITES_POPUP_H
+#define CONTACTS_LIST_MANAGE_FAVORITES_POPUP_H
+
+#include "Ui/ListPopup.h"
+
+namespace Ui
+{
+       class Navigator;
+}
+
+namespace Contacts
+{
+       namespace List
+       {
+               /**
+                * @brief The popup provides ability to add/reorder favorites and
+                * remove most frequent and favorites contacts
+                */
+               class ManageFavoritesPopup : public Ui::ListPopup
+               {
+               public:
+                       /**
+                        * @brief Creates new popup
+                        * @param[in]   navigator   Current navigator. Is needed to move to the next view.
+                        */
+                       ManageFavoritesPopup(Ui::Navigator *navigator);
+
+               protected:
+                       /**
+                        * @see Control::onCreated()
+                        */
+                       virtual void onCreated() override;
+
+               private:
+                       ManageFavoritesPopup(const ManageFavoritesPopup &that) = delete;
+                       ManageFavoritesPopup & operator=(const ManageFavoritesPopup &that) = delete;
+
+                       void onAdd();
+                       void onReorder();
+                       void onRemove();
+
+                       Ui::Navigator *m_Navigator;
+               };
+       }
+}
+
+#endif /* CONTACTS_LIST_MANAGE_FAVORITES_POPUP_H */
index e7dc046b95ad536fc618fbd57fe5a523b82ace93..803fc964803244fb7300985f63bda699ff1b9d60 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "Contacts/List/ListView.h"
 #include "Contacts/List/GroupItem.h"
+#include "Contacts/List/ManageFavoritesPopup.h"
 #include "Contacts/List/Model/Person.h"
 #include "Contacts/List/MyProfileItem.h"
 #include "Contacts/List/PersonGroupItem.h"
@@ -105,6 +106,11 @@ void ListView::onMenuPressed()
                getNavigator()->navigateTo(view);
        });
 
+       menu->addItem("IDS_PB_OPT_MANAGE_FAVOURITES_ABB", [this] {
+               auto manageFavPopup = new ManageFavoritesPopup(getNavigator());
+               manageFavPopup->create(getEvasObject());
+       });
+
        menu->addItem("IDS_PB_OPT_SETTINGS", [this] {
                getNavigator()->navigateTo(new Settings::MainView());
        });
diff --git a/lib-contact/src/Contacts/List/ManageFavoritesPopup.cpp b/lib-contact/src/Contacts/List/ManageFavoritesPopup.cpp
new file mode 100644 (file)
index 0000000..2ac5882
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 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/ListView.h"
+#include "Contacts/List/ManageFavoritesPopup.h"
+
+#include "Ui/Navigator.h"
+
+using namespace Contacts::List;
+using namespace Ui;
+
+ManageFavoritesPopup::ManageFavoritesPopup(Navigator *navigator)
+       : m_Navigator(navigator)
+{
+}
+
+void ManageFavoritesPopup::onCreated()
+{
+       ListPopup::onCreated();
+
+       setTitle("IDS_PB_HEADER_MANAGE_FAVOURITES_ABB");
+
+       addItem("IDS_PB_OPT_ADD", std::bind(&ManageFavoritesPopup::onAdd, this));
+       addItem("IDS_PB_OPT_REORDER", std::bind(&ManageFavoritesPopup::onReorder, this));
+       addItem("IDS_PB_OPT_REMOVE", std::bind(&ManageFavoritesPopup::onRemove, this));
+}
+
+void ManageFavoritesPopup::onAdd()
+{
+       ListView *view = new ListView();
+       view->setSelectMode(SelectMulti);
+       view->setSelectCallback([](SelectResults results) {
+               //todo
+               return true;
+       });
+       m_Navigator->navigateTo(view);
+}
+
+void ManageFavoritesPopup::onReorder()
+{
+       //todo
+}
+
+void ManageFavoritesPopup::onRemove()
+{
+       //todo
+}