Revert "World Clock: Delete Items view implemented." 78/92978/1
authorRadoslaw Czerski <r.czerski@samsung.com>
Wed, 19 Oct 2016 16:22:45 +0000 (09:22 -0700)
committerRadoslaw Czerski <r.czerski@samsung.com>
Wed, 19 Oct 2016 16:22:45 +0000 (09:22 -0700)
This reverts commit 697cb03187efd569449a46c8a77ca4e605a618de.

Merged by accident.

Change-Id: If8d751f40ab474bbff68c97e5cefd6ea53583aaf

17 files changed:
clock/inc/Controller/MainController.h
clock/inc/Model/WorldClock.h
clock/inc/Model/WorldClockEvents.h [deleted file]
clock/inc/Presenter/WorldClockDeletePresenter.h [deleted file]
clock/inc/Presenter/WorldClockPresenter.h
clock/inc/Utils/WorldClock.h [deleted file]
clock/inc/View/WorldClockDeleteItemsView.h [deleted file]
clock/inc/View/WorldClockView.h
clock/res/edje/CitiesListItem.edc
clock/res/edje/WorldClockDeleteList.edc [deleted file]
clock/src/Controller/MainController.cpp
clock/src/Model/WorldClock.cpp
clock/src/Presenter/WorldClockDeletePresenter.cpp [deleted file]
clock/src/Presenter/WorldClockPresenter.cpp
clock/src/Utils/WorldClock.cpp [deleted file]
clock/src/View/WorldClockDeleteItemsView.cpp [deleted file]
clock/src/View/WorldClockView.cpp

index 0dd0a82..fa11c51 100644 (file)
@@ -40,7 +40,6 @@
 #include "Presenter/StopWatchPresenter.h"
 #include "Presenter/TimerPresenter.h"
 #include "Presenter/WorldClockPresenter.h"
-#include "Presenter/WorldClockDeletePresenter.h"
 
 
 /**
@@ -122,12 +121,6 @@ namespace controller {
                         */
                        void CreateNewDeleteAlarmsPage(utils::Event &e);
 
-                       /**
-                        * @brief Creates new "Delete" page in world clock;
-                        * @param e event data
-                        */
-                       void CreateNewWorldClockDeletePage(utils::Event &e);
-
                        model::WorldClock *world_clock_model_;
                        model::StopWatch *stop_watch_model_;
                        model::Timer *timer_model_;
@@ -138,13 +131,11 @@ namespace controller {
                        presenter::TimerPresenter *timer_presenter_;
                        presenter::EditAlarmPresenter *edit_presenter_;
                        presenter::DeleteAlarmPresenter *delete_presenter_;
-                       presenter::WorldClockDeletePresenter *world_clock_delete_presenter_;
 
                        view::MainView main_view_;
 
                        view::EditAlarmView edit_page_;
                        view::DeleteAlarmView delete_page_;
-                       view::WorldClockDeleteItemsView world_clock_delete_page_;
 
                        /**
                         * @brief Creates new "Edit" alarm page.
index f6a34d6..25c0e92 100644 (file)
@@ -18,7 +18,6 @@
 #define _CLOCK_WORLDCLOCK_H_
 
 #include <vector>
-#include <functional>
 
 #include "Model/Location.h"
 
@@ -38,11 +37,6 @@ namespace model {
        class WorldClock {
                public:
 
-                       enum class Signals {
-                               CUSTOM_LIST_ITEMS_DELETED,
-                               MAX
-                       };
-
                        /**
                         * @brief Enumeration for direction of time zone shift.
                         */
@@ -71,17 +65,15 @@ namespace model {
                         * @remarks The location is retrieved from called Worldclock-efl app
                         *
                         * @param[in] l location to add
-                        *
-                        * @return true if l not exists yet in user_locations_ list, false otherwise
                         */
-                       bool AddUserLocation(const model::Location *l);
+                       void AddUserLocation(model::Location l);
 
                        /**
-                        * @brief Deletes locations from UserLocations list
+                        * @brief Deletes location from UserLocations list
                         *
-                        * @param[in] deleted locations list to remove from UserLocation list
+                        * @param[in] l location to remove from UserLocation list
                         */
-                       void RemoveUserLocations(const std::vector<const model::Location *> &deleted);
+                       void RemoveUserLocation(model::Location l);
 
                        /**
                         * @brief Gets current time zone set to display
@@ -135,7 +127,7 @@ namespace model {
                         */
                        const Timezone *GetTimezoneByOffset(int offset) const;
 
-                       /**
+                       /*
                         * @brief Gets location using its no in locations_ list
                         * @remarks This function is for temporary usage and will be removed before final version
                         *
@@ -151,26 +143,12 @@ namespace model {
                         */
                        void MoveCurrentTimezone(Direction direction);
 
-                       /**
-                        * @brief register function to be invoked when specified signal will be emitted
-                        *
-                        * @param[in] function to register
-                        * @param[in] signal signal
-                        */
-                       void RegisterSignalHandler(std::function<void(void)>func, Signals signal);
-
-                       /**
-                        * @brief Sets items to be deleted.
+                       /*
+                        * @brief Adds item to custom list
                         *
-                        * @param locations list of locations that need to be removed from user_locations_ list.
-                        */
-                       void SetItemsToDelete(const std::vector<const model::Location *> &locations);
-
-                       /**
-                        * @brief Gets items to be deleted.
-                        * @return list of locations that need to be removed from user_locations_ list
+                        * param[in] l location to add
                         */
-                       std::vector<const model::Location *> GetItemsToDelete() const;
+                       bool AddItemToCustomList(const model::Location *l);
 
                private:
 
@@ -181,6 +159,11 @@ namespace model {
                        };
 
                        /**
+                        * @brief Gets time zone by its no in time_zone_ list
+                        */
+                       const Timezone *GetTimezone(int no) const;
+
+                       /**
                         * @brief Currently set time zone.
                         * It means the time zone to be displayed on world map and its details will be displayed below the map
                         */
@@ -197,17 +180,6 @@ namespace model {
                        static std::vector<Timezone> time_zones_;
 
                        /**
-                        * @brief List of function registered for particular signal type
-                        */
-                       std::vector<std::function<void(void)>> signals_
-                                               = std::vector<std::function<void(void)>>((int)Signals::MAX, nullptr);
-
-                       /**
-                        *@brief List of locations to be deleted
-                        */
-                       std::vector<const model::Location *> user_locations_to_delete_;
-
-                       /**
                         * @brief Saves items list state using app_preferences API
                         * @details It saves every particular item(location)
                         */
@@ -242,17 +214,6 @@ namespace model {
                         */
                        const model::Location *LoadItem(int i);
 
-                       /**
-                        * @brief Gets time zone by its no in time_zone_ list
-                        */
-                       const Timezone *GetTimezone(int no) const;
-
-                       /**
-                        * @brief Emits signal
-                        * @param type signal type
-                        */
-                       void EmitSignal(Signals type);
-
        };
 } /* model */
 
diff --git a/clock/inc/Model/WorldClockEvents.h b/clock/inc/Model/WorldClockEvents.h
deleted file mode 100644 (file)
index aa5f9fb..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 _CLOCK_MODEL_WORLDCLOCKEVENT_H_
-#define _CLOCK_MODEL_WORLDCLOCKEVENT_H_
-
-#include "Utils/EventBus.h"
-#include "Model/Location.h"
-
-namespace model {
-
-       class WorldClockDeleteRequestEvent: public utils::Event {
-       };
-}
-
-#endif /* _CLOCK_MODEL_WORLDCLOCKEVENT_H_ */
diff --git a/clock/inc/Presenter/WorldClockDeletePresenter.h b/clock/inc/Presenter/WorldClockDeletePresenter.h
deleted file mode 100644 (file)
index bb1bc6f..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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 _CLOCK_PRESENTER_WORLDCLOCKDELETE_H_
-#define _CLOCK_PRESENTER_WORLDCLOCKDELETE_H_
-
-#include "View/WorldClockDeleteItemsView.h"
-#include "Model/WorldClock.h"
-
-namespace presenter {
-
-       class WorldClockDeletePresenter {
-               public:
-
-                       /**
-                        * @brief Creates presenter for Delete view
-                        *
-                        * @param view the view
-                        * @param model world clock data model
-                        */
-                       WorldClockDeletePresenter(view::WorldClockDeleteItemsView *view, model::WorldClock *model);
-
-                       /**
-                        * @brief Destructor
-                        */
-                       ~WorldClockDeletePresenter();
-               private:
-
-                       /**
-                        * @brief Data model
-                        */
-                       model::WorldClock *model_;
-
-                       /**
-                        * @brief Delete view genlist Item data
-                        */
-                       view::WorldClockDeleteItemsView *delete_view_;
-
-                       /**
-                        * @brief Invoked when "Cancel" button is clicked.
-                        * @details Pops page.
-                        */
-                       void OnCancelClicked();
-
-                       /**
-                        * @brief Invoked when "Delete" button is clicked.
-                        * @details Deletes selected items. Pops page.
-                        */
-                       void OnDeleteClicked();
-
-                       /**
-                        * @brief Applies proper state to checkbox of all items and updates page label
-                        */
-                       void OnSelectAllClicked();
-                       /**
-                        * @brief Updates page title and "Select All" item state.
-                        */
-                       void OnListItemClicked();
-       };
-}
-
-
-#endif /* _CLOCK_PRESENTER_WORLDCLOCKDELETE_H_ */
index 9463ef7..5c60afe 100644 (file)
@@ -18,8 +18,6 @@
 #define _CLOCK_PRESENTER_WORLDCLOCK_H_
 
 #include "View/WorldClockView.h"
-#include "View/WorldClockDeleteItemsView.h"
-#include "Utils/EventBus.h"
 #include "Model/WorldClock.h"
 
 namespace presenter {
@@ -39,25 +37,9 @@ namespace presenter {
                        void OnRightArrowButtonClicked();
                        void OnCustomListItemClicked();
 
-                       /**
-                        * @brief Invoked when more button is clicked. Shows popup
-                        */
-                       void OnMoreButtonClicked();
-
-                       /**
-                        * @brief Invoked when Delete option is chosen on "more" popup.
-                        * @details Created Delete View
-                        */
-                       void OnMoreDeleteButtonClicked();
-
                        void OnMapViewUpdateRequest();
                        void OnItemAdded();
 
-                       /**
-                        * @brief Deletes locations chosen in delete view from user locations list.
-                        */
-                       void OnItemsDeleted();
-
        };
 }
 
diff --git a/clock/inc/Utils/WorldClock.h b/clock/inc/Utils/WorldClock.h
deleted file mode 100644 (file)
index 0280d0d..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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 _CLOCK_UTILS_WORLDCLOCK_H_
-#define _CLOCK_UTILS_WORLDCLOCK_H_
-
-#include <vector>
-#include <string>
-#include <sstream>
-
-namespace utils {
-
-/**
- * @brief Creates description regarding offset between offsets (e.g "5 h behind")
- * @param local_timezeone_offset offset in minutes between GMT+0 and local timezone
- * @param timezone_offset offset in minutes between GMT+0 and a timezone
- *
- * @return description regarding offset between offsets (e.g "5 h behind")
- */
-std::string GetTimezoneDiffDescription(int local_timezone_offset, int timezone_offset);
-
-}
-#endif /* _CLOCK_UTILS_WORLDCLOCK_H_ */
-
-
diff --git a/clock/inc/View/WorldClockDeleteItemsView.h b/clock/inc/View/WorldClockDeleteItemsView.h
deleted file mode 100644 (file)
index 666bd4d..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * 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 _CLOCK_VIEW_WORLDCLOCKDELETEITEMS_H_
-#define _CLOCK_VIEW_WORLDCLOCKDELETEITEMS_H_
-
-#include "View/PageView.h"
-#include "Model/Location.h"
-
-namespace view {
-
-       class WorldClockDeleteItemsView: public PageView {
-
-               public:
-
-                       /**
-                        * @brief Enumeration for callbacks signals
-                        */
-                       enum class SignalType {
-                               BUTTON_CANCEL_CLICKED,      //!< BUTTON_CANCEL_CLICKED
-                               BUTTON_DELETE_CLICKED,      //!< BUTTON_DELETE_CLICKED
-                               BUTTON_BACK_CLICKED,        //!< BUTTON_BACK_CLICKED
-                               CHECKBOX_SELECT_ALL_CLICKED,//!< CHECKBOX_SELECT_ALL_CLICKED
-                               LIST_ITEM_CLICKED,          //!< LIST_ITEM_CLICKED
-                               MAX                         //!< MAX
-                       };
-
-                       /**
-                        * @brief Creates Class object, push new page and invokes CreateContent().
-                        */
-                       WorldClockDeleteItemsView(ui::IView &main);
-
-                       /**
-                        * @brief Destroy all resources that can not be deleted automatically
-                        */
-                       ~WorldClockDeleteItemsView();
-
-                       /**
-                        * @brief Gets evas object of the page content -> genlist
-                        * @return the object
-                        */
-                       Evas_Object *GetEvasObject() override;
-
-                       /**
-                        * @brief Registers signals
-                        * @param s signal enumerator
-                        * @param func function invoked when the signal will be emitted
-                        */
-                       void RegisterSignal(SignalType s, std::function<void(void)>func);
-
-                       /**
-                        * @brief Appends items(Locations) from given list to delete View genlist
-                        * @details The list is identical with user_locations_ list
-                        * @param locations list of locations
-                        */
-                       void AppendItems(std::vector<const model::Location *> locations);
-
-                       /**
-                        * @brief Updates title of the page(# Selected)
-                        */
-                       void UpdateTitle();
-
-                       /**
-                        * @brief Sets items checkbox state
-                        * @param state state to set
-                        */
-                       void SetAllItems(bool state);
-
-                       /**
-                        * @brief Sets state of "Select All" checkbox
-                        * @details It is useful when all items are selected manually
-                        * @param state state to set
-                        */
-                       void SetSelectAllCheckbox(bool state);
-
-                       /**
-                        * @brief Gets list of items selected to be deleted from user_locations_ list
-                        * @return
-                        */
-                       std::vector<const model::Location *> GetSelectedItems();
-
-                       /**
-                        * @brief Gets state of "Select All" item checkbox
-                        * @return state of "Select All" item checkbox
-                        */
-                       bool GetSelectAllState();
-
-               protected:
-                       /**
-                        * @brief Creates main content of the Destroy View page
-                        */
-                       void CreateContent(Evas_Object *parent) override;
-
-                       /**
-                        * @brief Destroys main content of the Destroy View page
-                        */
-                       void DestroyContent() override;
-               private:
-
-                       /**
-                        * @brief Main content - genlist
-                        */
-                       Evas_Object *content_;
-
-                       /**
-                        * @brief Evas object of "Cancel" button
-                        */
-                       Evas_Object *left_button_;
-
-                       /**
-                        * @brief Evas object of "Delete" button
-                        */
-                       Evas_Object *right_button_;
-
-                       /**
-                        * @brief Evas object of "select All" checkbox
-                        */
-                       Evas_Object *select_all_checkbox_;
-
-                       /**
-                        * @brief Item class for the main content genlist
-                        */
-                       static Elm_Genlist_Item_Class world_clock_delete_view_itc_;
-
-                       /**
-                        * @brief Flag for state of "select All" checkbox state
-                        */
-                       bool all_selected_;
-
-                       /**
-                        * @brief list of signals
-                        */
-                       std::vector<std::function<void(void)>> signals_
-                                       = std::vector<std::function<void(void)>>((int)SignalType::MAX, nullptr);
-
-                       /**
-                        * @brief Callback invoked when any item of list is clicked
-                        * @param data user data
-                        * @param obj obj
-                        * @param event_info event_info
-                        */
-                       static void ItemClicked(void *data, Evas_Object *obj, void *event_info);
-
-                       /**
-                        * @brief Gets content for genlist item part
-                        * @param data user data
-                        * @param obj item object
-                        * @param part part related to content to get
-                        * @return Object of content that will be swallowed to the part
-                        */
-                       static Evas_Object *ContentGet(void *data, Evas_Object *obj, const char *part);
-
-                       /**
-                        * @brief Gets text for genlist item part
-                        * @param data user data
-                        * @param obj item object
-                        * @param part part related to text to get
-                        * @return text to set to the textblock part
-                        */
-                       static char *TextGet(void *data, Evas_Object *obj, const char *part);
-
-                       /**
-                        * @brief Deletes all resources of the item that cannot be deleted automatically
-                        * @param data user data
-                        * @param obj item object
-                        */
-                       static void Del(void *data, Evas_Object *obj);
-
-                       /**
-                        * @brief Creates evas object for time
-                        * @param parent parent
-                        * @return the object
-                        */
-                       static Evas_Object *CreateTimeObject(Evas_Object *parent);
-
-                       /**
-                        * @brief Creates evas object for meridiem
-                        * @param parent parent
-                        * @return the object
-                        */
-                       static Evas_Object *CreateXMeridiemObject(Evas_Object *parent);
-
-                       /**
-                        * @brief Creates evas object for padding
-                        * @param parent parent
-                        * @return the object
-                        */
-                       static Evas_Object *CreatePaddingObject(Evas_Object *parent, int width);
-
-                       /**
-                        * @brief Creates genlist item of "Select all"
-                        */
-                       void CreateSelectAll();
-
-                       /**
-                        * @brief emits signal
-                        * @details it cause invocation of registered function
-                        * @param s signal enumerator
-                        */
-                       void EmitSignal(SignalType s);
-
-                       /**
-                        * @brief Emits BUTTON_CANCEL_CLICKED signal.
-                        * @details Invoked when "Cancel" button is clicked
-                        */
-                       static void OnCancelButtonClicked(void *data, Evas_Object *obj, void *event_info);
-
-                       /**
-                        * @brief Emits BUTTON_DELETE_CLICKED signal.
-                        * @details Invoked when "Delete" button is clicked
-                        */
-                       static void OnDeleteButtonClicked(void *data, Evas_Object *obj, void *event_info);
-
-                       /**
-                        * @brief Emits CHECKBOX_SELECT_ALL_CLICKED signal and toggle "Select all" checkbox state.
-                        * @details Invoked when "Select all" item or checkbox is clicked
-                        */
-                       static void OnSelectAllClicked(void *data, Evas_Object *obj, void *event_info);
-
-                       /**
-                        * @brief Emits LIST_ITEM_CLICKED signal and toggle checkbox state.
-                        */
-                       static void ItemSelectToggle(void *data, Evas_Object *obj, void *event_info);
-       };
-
-} /* view */
-
-
-#endif /* _CLOCK_VIEW_WORLDCLOCKDELETEITEMS_H_ */
index 0da0ead..b06a6a3 100644 (file)
@@ -30,12 +30,12 @@ namespace view {
        enum class WorldClockSignals {
                BUTTON_LEFT_ARROW_CLICKED,
                BUTTON_RIGHT_ARROW_CLICKED,
-               BUTTON_MORE_CLICKED,
-               BUTTON_MORE_DELETE_CLICKED,
 
                CUSTOM_LIST_ITEM_CLICKED,
                CUSTOM_LIST_ITEM_ADD,
 
+               UPDATE_MAP_VIEW,
+
                MAX
        };
 
@@ -51,14 +51,14 @@ namespace view {
                        void UpdateMapAndTimezoneDetails(const model::Timezone *timezone);
 
                        void AppendItemToCustomList(const model::Location *location);
-                       void RemoveItem(const model::Location *location);
+
                        const model::Location *GetLastClickedItem();
                        const model::Location *GetLocationToAdd();
 
                        void ShowEmptyListLabel();
                        void HideEmptyListLabel();
+
                        void PostItemExistMessage();
-                       void ShowMorePopup();
 
                private:
                        void CreateTimezoneDetails();
@@ -94,6 +94,8 @@ namespace view {
                        static void MorePopupDeleteItemCallback(void *data, Evas_Object *obj, void *event_info);
                        static void MorePopupReorderItemCallback(void *data, Evas_Object *obj, void *event_info);
 
+                       void ShowMorePopup();
+
                        static void AddLocationReplayCb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data);
 
                        void SetItemLastClicked(const model::Location *location);
index f294415..7a52d50 100644 (file)
@@ -35,6 +35,16 @@ collections {
                                        rel2.to: "base";
                                }
                        }
+                       rect { "bg";
+                               desc { "default"
+                                       rel1.to: "base";
+                                       rel2.to: "base";
+                                       color: 0 0 0 0;
+                               }
+                               desc { "pressed"; inherit: "default";
+                                       color: 0 0 0 20;
+                               }
+                       }
                        spacer { "padding.top.left"; scale;
                                desc { "default";
                                        min: 205 17;
diff --git a/clock/res/edje/WorldClockDeleteList.edc b/clock/res/edje/WorldClockDeleteList.edc
deleted file mode 100644 (file)
index d249ca2..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-
-collections {
-       base_scale: 2.6;
-
-       group { name: "elm/genlist/item/worldclock.delete.list/default";
-               styles {
-                       style { name: "time_ATO040";
-                               base: "font=Tizen:style=Light color=#000000ff font_size=50 align=left";
-                       }
-                       style { name: "ampm_ATO041";
-                               base: "font=Tizen:style=Medium color=#000000ff font_size=30 align=left";
-                       }
-                       style { name: "date_ATO042";
-                               base: "font=Tizen:style=Regular color=#808080ff font_size=30 align=left";
-                       }
-                       style { name: "city_country_ATO043";
-                               base: "font=Tizen:style=Regular color=#000000ff font_size=40 align=left ellipsis=1.0";
-                       }
-                       style { name: "gmt_offset_desc_ATO044";
-                               base: "font=Tizen:style=Regular color=#808080ff font_size=40 align=left ellipsis=1.0";
-                       }
-               }
-               data.item: "banded_bg_area" "elm.swallow.bg";
-               data.item: "texts" "ampm date city.country gmt.offset.desc";
-               data.item: "contents" "time check";
-               parts {
-                       spacer { "base"; scale;
-                               desc { "default";
-                                       min: 0 22+53+43+26;
-                               }
-                       }
-                       swallow { "elm.swallow.bg";
-                               desc { "default";
-                                       rel1.to: "base";
-                                       rel2.to: "base";
-                               }
-                       }
-                       spacer { "padding.top.left"; scale;
-                               desc { "default";
-                                       min: 205 17;
-                                       max: 205 17;
-                                       fixed: 1 1;
-                                       align: 0.0 0.0;
-                                       rel1.to: "base";
-                               }
-                       }
-                       spacer { "padding.left"; scale;
-                               desc { "default";
-                                       min: 32 0;
-                                       max: 32 -1;
-                                       fixed: 1 0;
-                                       align: 0.0 0.0;
-                                       rel1.to: "base";
-                               }
-                       }
-                       swallow { "time"; scale;
-                               desc { "default";
-                                       min: 173 67;
-                                       max: 173 67;
-                                       fixed: 1 1;
-                                       align: 0.0 0.0;
-                                       rel1 {
-                                               relative: 1.0 1.0;
-                                               to_x: "padding.left";
-                                               to_y: "padding.top.left";
-                                       }
-                               }
-                       }
-                       spacer { "padding.middle"; scale;
-                               desc { "default";
-                                       min: 82 0;
-                                       max: 82 -1;
-                                       fixed: 1 0;
-                                       align: 0.0 0.0;
-                                       rel1 {
-                                               relative: 1.0 0.0;
-                                               to: "padding.top.left";
-                                       }
-                               }
-                       }
-                       spacer { "padding.top.right"; scale;
-                               desc { "default";
-                                       min: 405 22;
-                                       max: 405 22;
-                                       fixed: 1 1;
-                                       align: 0.0 0.0;
-                                       rel1 {
-                                               relative: 1.0 0.0;
-                                               to: "padding.middle";
-                                       }
-                               }
-                       }
-                       textblock { "date"; scale;
-                               desc { "default";
-                                       min: 173 40;
-                                       max: 173 40;
-                                       fixed: 1 1;
-                                       align: 0.0 0.0;
-                                       rel1 {
-                                               relative: 1.0 1.0;
-                                               to_x: "padding.left";
-                                               to_y: "time";
-                                       }
-                                       rel2 {
-                                               relative: 0.0 1.0;
-                                               to_x: "padding.middle";
-                                       }
-                                       text {
-                                               style: "date_ATO042";
-                                               min: 1 1;
-                                               ellipsis: -1;
-                                       }
-                               }
-                       }
-                       spacer { "padding.right"; scale;
-                               desc { "default";
-                                       fixed: 1 0;
-                                       min: 32 0;
-                                       max: 32 -1;
-                                       align: 1.0 0.5;
-                                       rel1.to: "base";
-                                       rel2.to: "base";
-                               }
-                       }
-                       swallow { "check";
-                               desc { "default";
-                                       min: 80 80;
-                                       max: 80 80;
-                                       fixed: 1 1;
-                                       align: 1.0 0.5;
-                                       rel1.to: "base";
-                                       rel2 {
-                                               relative: 0.0 1.0;
-                                               to: "padding.right";
-                                       }
-                               }
-                       }
-                       textblock { "city.country"; scale;
-                               desc { "default";
-                                       min: 0 53;
-                                       max: -1 53;
-                                       fixed: 0 1;
-                                       align: 0.0 0.0;
-                                       rel1 {
-                                               relative: 1.0 1.0;
-                                               to_x: "padding.middle";
-                                               to_y: "padding.top.right";
-                                       }
-                                       rel2 {
-                                               relative: 0.0 1.0;
-                                               to_x: "check";
-                                       }
-                                       text {
-                                               style: "city_country_ATO043";
-                                       }
-                               }
-                       }
-                       textblock { "gmt.offset.desc"; scale;
-                               desc { "default";
-                                       min: 0 43;
-                                       max: -1 43;
-                                       fixed: 0 1;
-                                       align: 0.0 0.0;
-                                       rel1 {
-                                               relative: 0.0 1.0;
-                                               to_x: "city.country";
-                                               to_y: "city.country";
-                                       }
-                                       rel2 {
-                                               relative: 0.0 1.0;
-                                               to_x: "check";
-                                       }
-                                       text {
-                                               style: "gmt_offset_desc_ATO044";
-                                               ellipsis: 1;
-                                       }
-                               }
-                       }
-               }
-       }
-}
index 296e22c..16e7a22 100644 (file)
 #include "View/DeleteAlarmView.h"
 #include "Presenter/DeleteAlarmPresenter.h"
 
-#include "Model/WorldClockEvents.h"
-#include "View/WorldClockDeleteItemsView.h"
-#include "Presenter/WorldClockDeletePresenter.h"
-
 using namespace controller;
 using namespace view;
 using namespace utils;
@@ -42,9 +38,8 @@ MainController &MainController::GetInstance()
 }
 
 MainController::MainController() :
-       edit_page_(main_view_), delete_page_(main_view_), world_clock_delete_page_(main_view_),
-       delete_presenter_(nullptr), edit_presenter_(nullptr),
-       world_clock_delete_presenter_(nullptr)
+       edit_page_(main_view_), delete_page_(main_view_),
+       delete_presenter_(nullptr), edit_presenter_(nullptr)
 {
 }
 
@@ -81,9 +76,6 @@ int MainController::Init()
        listeners_.push_back(utils::EventBus::AddListener<AlarmEditRequestEvent>(
                        std::bind(&MainController::CreateEditAlarmPage, this, _1)));
 
-       listeners_.push_back(utils::EventBus::AddListener<WorldClockDeleteRequestEvent>(
-                       std::bind(&MainController::CreateNewWorldClockDeletePage, this, _1)));
-
        return 0;
 }
 
@@ -125,11 +117,3 @@ void MainController::CreateNewDeleteAlarmsPage(Event &e)
 
        delete_presenter_ = new DeleteAlarmPresenter(&delete_page_, AlarmProvider::GetInstance());
 }
-
-void MainController::CreateNewWorldClockDeletePage(utils::Event &e)
-{
-       delete world_clock_delete_presenter_;
-
-       world_clock_delete_presenter_ = new WorldClockDeletePresenter(&world_clock_delete_page_, world_clock_model_);
-
-}
index 3625e69..03e081d 100644 (file)
@@ -233,7 +233,7 @@ void model::WorldClock::MoveCurrentTimezone(Direction direction)
        }
 }
 
-bool WorldClock::AddUserLocation(const model::Location *l)
+bool WorldClock::AddItemToCustomList(const model::Location *l)
 {
        if (!user_locations_.empty()) {
                for (auto it = user_locations_.begin(); it != user_locations_.end(); it++) {
@@ -248,23 +248,6 @@ bool WorldClock::AddUserLocation(const model::Location *l)
        return true;
 }
 
-void WorldClock::RemoveUserLocations(const std::vector<const model::Location *> &deleted)
-{
-       SetItemsToDelete(deleted);
-
-       for (auto d_it = user_locations_to_delete_.begin(); d_it != user_locations_to_delete_.end(); ++d_it) {
-
-               for (auto it = user_locations_.begin(); it != user_locations_.end(); ++it) {
-
-                       if (!((*it)->name.compare((*d_it)->name)) && !((*it)->country.compare((*d_it)->country))) {
-                               user_locations_.erase(it);
-                               break;
-                       }
-               }
-       }
-       EmitSignal(Signals::CUSTOM_LIST_ITEMS_DELETED);
-}
-
 void WorldClock::SaveItemsList()
 {
        int ret = preference_remove_all();
@@ -399,26 +382,3 @@ const model::Location *WorldClock::LoadItem(int i)
 
        return location;
 }
-
-void WorldClock::RegisterSignalHandler(std::function<void(void)> func,
-               Signals signal)
-{
-       signals_.at((int)signal) = func;
-}
-
-void WorldClock::EmitSignal(Signals signal)
-{
-       if (signals_.at((int)signal) != nullptr)
-               signals_.at((int)signal)();
-}
-
-void WorldClock::SetItemsToDelete(const std::vector<const model::Location *> &locations)
-{
-       user_locations_to_delete_.clear();
-       user_locations_to_delete_ = locations;
-}
-
-std::vector<const model::Location *> WorldClock::GetItemsToDelete() const
-{
-       return user_locations_to_delete_;
-}
diff --git a/clock/src/Presenter/WorldClockDeletePresenter.cpp b/clock/src/Presenter/WorldClockDeletePresenter.cpp
deleted file mode 100644 (file)
index 24cd75a..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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 "Presenter/WorldClockDeletePresenter.h"
-#include "Model/WorldClockEvents.h"
-#include "Utils/EventBus.h"
-#include "Utils/Log.h"
-
-using namespace presenter;
-using namespace view;
-using namespace utils;
-using namespace model;
-
-
-WorldClockDeletePresenter::WorldClockDeletePresenter(
-        WorldClockDeleteItemsView *view, WorldClock *model) :
-               delete_view_(view), model_(model)
-{
-       DBG("");
-       delete_view_->RegisterSignal(view::WorldClockDeleteItemsView::SignalType::BUTTON_CANCEL_CLICKED,
-                       std::bind(&WorldClockDeletePresenter::OnCancelClicked, this));
-       delete_view_->RegisterSignal(view::WorldClockDeleteItemsView::SignalType::BUTTON_DELETE_CLICKED,
-                       std::bind(&WorldClockDeletePresenter::OnDeleteClicked, this));
-       delete_view_->RegisterSignal(view::WorldClockDeleteItemsView::SignalType::CHECKBOX_SELECT_ALL_CLICKED,
-                       std::bind(&WorldClockDeletePresenter::OnSelectAllClicked, this));
-       delete_view_->RegisterSignal(view::WorldClockDeleteItemsView::SignalType::LIST_ITEM_CLICKED,
-                       std::bind(&WorldClockDeletePresenter::OnListItemClicked, this));
-
-       delete_view_->PushPage();
-       delete_view_->AppendItems(model_->user_locations_);
-}
-
-WorldClockDeletePresenter::~WorldClockDeletePresenter()
-{
-}
-void WorldClockDeletePresenter::OnCancelClicked()
-{
-       delete_view_->PopPage();
-}
-
-void WorldClockDeletePresenter::OnDeleteClicked()
-{
-       const std::vector<const model::Location *> deleted = delete_view_->GetSelectedItems();
-
-       model_->RemoveUserLocations(deleted);
-
-       delete_view_->PopPage();
-}
-
-void WorldClockDeletePresenter::OnSelectAllClicked()
-{
-       delete_view_->SetAllItems(delete_view_->GetSelectAllState());
-       delete_view_->UpdateTitle();
-}
-
-void WorldClockDeletePresenter::OnListItemClicked()
-{
-       delete_view_->UpdateTitle();
-       if (model_->user_locations_.size() == delete_view_->GetSelectedItems().size()) {
-               delete_view_->SetSelectAllCheckbox(true);
-       }
-}
index 7c20fea..e5fd81f 100644 (file)
  */
 
 #include "Presenter/WorldClockPresenter.h"
-#include "Presenter/WorldClockDeletePresenter.h"
-#include "Model/WorldClockEvents.h"
-#include "Utils/EventBus.h"
 #include "Utils/Log.h"
 
-using namespace utils;
-using namespace model;
-using namespace view;
-using std::placeholders::_1;
-
 namespace presenter {
 
-WorldClockPresenter::WorldClockPresenter(WorldClockView *view, WorldClock *model)
+WorldClockPresenter::WorldClockPresenter(view::WorldClockView *view, model::WorldClock *model)
                        : view_(view), model_(model)
 {
        view_->RegisterSignal(std::bind(&WorldClockPresenter::OnLeftArrowButtonClicked, this),
-                       WorldClockSignals::BUTTON_LEFT_ARROW_CLICKED);
+                       view::WorldClockSignals::BUTTON_LEFT_ARROW_CLICKED);
        view_->RegisterSignal(std::bind(&WorldClockPresenter::OnRightArrowButtonClicked, this),
-                               WorldClockSignals::BUTTON_RIGHT_ARROW_CLICKED);
+                               view::WorldClockSignals::BUTTON_RIGHT_ARROW_CLICKED);
        view_->RegisterSignal(std::bind(&WorldClockPresenter::OnCustomListItemClicked, this),
-                               WorldClockSignals::CUSTOM_LIST_ITEM_CLICKED);
+                               view::WorldClockSignals::CUSTOM_LIST_ITEM_CLICKED);
        view_->RegisterSignal(std::bind(&WorldClockPresenter::OnItemAdded, this),
-                               WorldClockSignals::CUSTOM_LIST_ITEM_ADD);
-       view_->RegisterSignal(std::bind(&WorldClockPresenter::OnMoreButtonClicked, this),
-                               WorldClockSignals::BUTTON_MORE_CLICKED);
-       view_->RegisterSignal(std::bind(&WorldClockPresenter::OnMoreDeleteButtonClicked, this),
-                               WorldClockSignals::BUTTON_MORE_DELETE_CLICKED);
-
-       model_->RegisterSignalHandler(std::bind(&WorldClockPresenter::OnItemsDeleted, this),
-                               WorldClock::Signals::CUSTOM_LIST_ITEMS_DELETED);
+                               view::WorldClockSignals::CUSTOM_LIST_ITEM_ADD);
 
        view_->UpdateMapAndTimezoneDetails(model_->GetCurrentTimezone());
 
@@ -60,7 +45,7 @@ WorldClockPresenter::~WorldClockPresenter()
 
 void WorldClockPresenter::UpdateEmptyListBackground()
 {
-       if (model_->user_locations_.empty())
+       if (model_->user_locations_.size() == 0)
                view_->ShowEmptyListLabel();
        else
                view_->HideEmptyListLabel();
@@ -99,7 +84,7 @@ void WorldClockPresenter::OnItemAdded()
                ERR("Invalid Location object");
                return;
        }
-       bool attached = model_->AddUserLocation(l);
+       bool attached = model_->AddItemToCustomList(l);
        if (attached) {
                const model::Timezone *t = model_->GetTimezoneByOffset(l->gmt_offset_);
                if (!t) {
@@ -117,24 +102,4 @@ void WorldClockPresenter::OnItemAdded()
        UpdateEmptyListBackground();
 }
 
-void WorldClockPresenter::OnItemsDeleted()
-{
-       std::vector<const model::Location *> locations = model_->GetItemsToDelete();
-       for (auto it = locations.begin(); it != locations.end(); it++)
-               view_->RemoveItem(*it);
-
-       UpdateEmptyListBackground();
-}
-
-void WorldClockPresenter::OnMoreButtonClicked()
-{
-       view_->ShowMorePopup();
-}
-
-void WorldClockPresenter::OnMoreDeleteButtonClicked()
-{
-       WorldClockDeleteRequestEvent ev;
-       EventBus::FireEvent(ev);
-}
-
 } /* presenter */
diff --git a/clock/src/Utils/WorldClock.cpp b/clock/src/Utils/WorldClock.cpp
deleted file mode 100644 (file)
index d2d00f2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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 "Utils/WorldClock.h"
-#include "Utils/Log.h"
-
-namespace utils {
-// local_timezone_offset and timezone_offset should be relative to GMT
-std::string GetTimezoneDiffDescription(int local_timezone_offset, int timezone_offset)
-{
-       char *pattern;
-       char relative[128] = { 0, };
-
-       int offset_integer = (abs(timezone_offset - local_timezone_offset)) / 60;
-       int offset_remainder = (abs(timezone_offset - local_timezone_offset)) % 60;
-
-       if (timezone_offset < local_timezone_offset) {
-               if (offset_remainder > 0) {
-                               pattern = _("IDS_CLOCK_BODY_PS1D_H_P2SD_M_BEHIND_ABB");
-                               snprintf(relative, sizeof(relative), pattern, offset_integer,
-                               offset_remainder);
-               } else {
-                       pattern = _("IDS_CLOCK_BODY_PD_H_BEHIND_ABB");
-                       snprintf(relative, sizeof(relative), pattern, offset_integer);
-               }
-       } else if (timezone_offset > local_timezone_offset) {
-               if (offset_remainder > 0) {
-                       pattern = _("IDS_CLOCK_BODY_PS1D_H_P2SD_M_AHEAD_ABB");
-                       snprintf(relative, sizeof(relative), pattern, offset_integer,
-                       offset_remainder);
-               } else {
-                       pattern = _("IDS_CLOCK_BODY_PD_H_AHEAD_ABB");
-                       snprintf(relative, sizeof(relative), pattern, offset_integer);
-               }
-       } else {
-               snprintf(relative, sizeof(relative), "Same as local time");
-       }
-       return std::string(&relative[0]);
-}
-
-} /* utils */
diff --git a/clock/src/View/WorldClockDeleteItemsView.cpp b/clock/src/View/WorldClockDeleteItemsView.cpp
deleted file mode 100644 (file)
index 07881f6..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * 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 <efl_extension.h>
-#include <vector>
-#include <sstream>
-#include "View/WorldClockDeleteItemsView.h"
-#include "Internal/WorldClockDefs.h"
-#include "Model/Location.h"
-#include "Utils/Time.h"
-#include "Utils/Log.h"
-#include "Utils/WorldClock.h"
-
-using namespace view;
-using namespace utils;
-
-struct LocationDeleteItemData {
-
-               WorldClockDeleteItemsView *view;
-               Evas_Object *time;
-               Evas_Object *checkbox;
-
-               const model::Location *location;
-               char *ampm;
-               char *date;
-               char *city_country;
-               char *gmt_offset_relative;
-
-               int gmt_offset;
-               bool selected;
-               Elm_Object_Item *it;
-};
-
-
-/* Delete list View */
-
-Elm_Genlist_Item_Class WorldClockDeleteItemsView::world_clock_delete_view_itc_= {
-       .item_style = "worldclock.delete.list",
-       .func.content_get = WorldClockDeleteItemsView::ContentGet,
-       .func.text_get = WorldClockDeleteItemsView::TextGet,
-       .func.del = WorldClockDeleteItemsView::Del
-};
-
-void WorldClockDeleteItemsView::AppendItems(std::vector<const model::Location *> locations)
-{
-       std::stringstream ss;
-
-       for (auto it = locations.begin(); it != locations.end(); it++) {
-               DBG();
-               LocationDeleteItemData *data = new LocationDeleteItemData;
-               Time t = Time::Now().InTimezone(Time::GetTimezoneNameByOffset((*it)->gmt_offset_).c_str());
-               int local_timezone_offset = Time::GetTimezoneOffset(Time::GetCurrentTimezone().c_str());
-               ss.str(std::string());
-               ss.clear();
-               ss << (*it)->name << ", " << (*it)->country;
-               data->city_country = strdup(ss.str().c_str());
-
-               data->location = *it;
-               data->view = this;
-               data->ampm = strdup(t.Format("a").c_str());
-               data->gmt_offset_relative = strdup(GetTimezoneDiffDescription(local_timezone_offset,
-                               (*it)->gmt_offset_).c_str());
-               data->gmt_offset = (*it)->gmt_offset_;
-               data->date = strdup(t.Format("E d MMM").c_str());
-               data->selected = false;
-               data->it = elm_genlist_item_append(content_,
-                               &world_clock_delete_view_itc_,
-                               data,
-                               NULL,
-                               ELM_GENLIST_ITEM_NONE,
-                               WorldClockDeleteItemsView::ItemClicked,
-                               data);
-               if (!data->it)
-                       FAT("Item append failed");
-       }
-}
-
-void WorldClockDeleteItemsView::ItemClicked(void *data, Evas_Object *obj, void *event_info)
-{
-       LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *>(data);
-
-       ldid->selected = !ldid->selected;
-       if (!ldid->selected) {
-               ldid->view->all_selected_ = false;
-               elm_check_state_set(ldid->view->select_all_checkbox_, ldid->view->all_selected_);
-       }
-       ldid->view->UpdateTitle();
-
-       ldid->view->EmitSignal(SignalType::LIST_ITEM_CLICKED);
-
-       elm_genlist_item_selected_set(ldid->it, EINA_FALSE);
-       elm_check_state_set(ldid->checkbox, ldid->selected);
-}
-
-Evas_Object *WorldClockDeleteItemsView::ContentGet(void *data, Evas_Object *obj, const char *part)
-{
-       LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *>(data);
-
-       if (!strcmp(part, "time")) {
-               Time t = Time::Now().InTimezone(Time::GetTimezoneNameByOffset(ldid->gmt_offset).c_str());
-
-               ldid->time = elm_table_add(obj);
-               evas_object_size_hint_align_set(ldid->time, 0.0, 0.0);
-
-               Evas_Object *time = CreateTimeObject(ldid->time);
-               Evas_Object *padding = CreatePaddingObject(ldid->time, 8);
-               Evas_Object *ampm = CreateXMeridiemObject(ldid->time);
-
-               Evas_Object *dynamic_padding = elm_bg_add(ldid->time);
-               evas_object_color_set(dynamic_padding, 0, 0, 0, 0);
-               evas_object_size_hint_weight_set(dynamic_padding, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
-               elm_table_pack(ldid->time, time, 0, 0, 1, 1);
-               elm_table_pack(ldid->time, padding, 1, 0, 1, 1);
-               elm_table_pack(ldid->time, ampm, 2, 0, 1, 1);
-               elm_table_pack(ldid->time, dynamic_padding, 3, 0, 1, 1);
-
-
-               std::string timezone_time = t.Format("HH:mm");
-               char time_formatted[MAX_STYLE_LEN] = { 0, };
-               snprintf(time_formatted, sizeof(time_formatted),
-                               CUSTOM_LIST_TIME_STYLE("%s"), timezone_time.c_str());
-               elm_object_text_set(time, time_formatted);
-
-               std::string meridiem = t.Format("a").c_str();
-               char ampm_formatted[MAX_STYLE_LEN] = { 0, };
-               snprintf(ampm_formatted, sizeof(ampm_formatted),
-                               CUSTOM_LIST_AMPM_STYLE("%s"), meridiem.c_str());
-               elm_object_text_set(ampm, ampm_formatted);
-
-               return ldid->time;
-
-       } else if (!strcmp(part, "check")) {
-               ldid->checkbox = elm_check_add(obj);
-               evas_object_propagate_events_set(ldid->checkbox, EINA_FALSE);
-               elm_check_state_set(ldid->checkbox, ldid->selected ? EINA_TRUE : EINA_FALSE);
-               evas_object_smart_callback_add(ldid->checkbox, "changed",
-                               WorldClockDeleteItemsView::ItemSelectToggle, ldid);
-               evas_object_show(ldid->checkbox);
-               return ldid->checkbox;
-       }
-       return nullptr;
-}
-
-char *WorldClockDeleteItemsView::TextGet(void *data, Evas_Object *obj, const char *part)
-{
-       LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *>(data);
-       if (!strcmp(part, "ampm"))
-               return strdup(ldid->ampm);
-       if (!strcmp(part, "date"))
-               return strdup(ldid->date);
-       if (!strcmp(part, "city.country"))
-               return strdup(ldid->city_country);
-       if (!strcmp(part, "gmt.offset.desc"))
-               return strdup(ldid->gmt_offset_relative);
-
-       return nullptr;
-}
-
-void WorldClockDeleteItemsView::Del(void *data, Evas_Object *obj)
-{
-       LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *>(data);
-       free(ldid->ampm);
-       free(ldid->city_country);
-       free(ldid->date);
-       free(ldid->gmt_offset_relative);
-       evas_object_del(ldid->checkbox);
-       delete ldid;
-}
-
-Evas_Object *WorldClockDeleteItemsView::CreateTimeObject(Evas_Object *parent)
-{
-       Evas_Object *label = elm_label_add(parent);
-       evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
-       evas_object_show(label);
-
-       return label;
-}
-
-Evas_Object *WorldClockDeleteItemsView::CreateXMeridiemObject(Evas_Object *parent)
-{
-       Evas_Object *ampm = elm_label_add(parent);
-       evas_object_size_hint_align_set(ampm, EVAS_HINT_FILL, 0.75);
-
-       evas_object_show(ampm);
-
-       return ampm;
-}
-
-Evas_Object *WorldClockDeleteItemsView::CreatePaddingObject(Evas_Object *parent, int width)
-{
-       Evas_Object *padding = elm_bg_add(parent);
-       evas_object_size_hint_min_set(padding, width, 10);
-       evas_object_size_hint_max_set(padding, width, 10);
-       evas_object_color_set(padding, 0, 0, 0, 0);
-       evas_object_show(padding);
-
-       return padding;
-}
-
-/*[END] Delete list View */
-
-WorldClockDeleteItemsView::WorldClockDeleteItemsView(ui::IView &main):
-               PageView(main), all_selected_(false)
-{
-}
-
-WorldClockDeleteItemsView::~WorldClockDeleteItemsView()
-{
-
-}
-
-Evas_Object *WorldClockDeleteItemsView::GetEvasObject()
-{
-       return content_;
-}
-
-void WorldClockDeleteItemsView::CreateContent(Evas_Object *parent)
-{
-       elm_object_item_style_set(navi_item_, "basic");
-
-       left_button_ = elm_button_add(parent);
-       elm_object_text_set(left_button_, "CANCEL");
-       elm_object_style_set(left_button_, "naviframe/title_left");
-       evas_object_smart_callback_add(left_button_, "clicked", WorldClockDeleteItemsView::OnCancelButtonClicked, this);
-       evas_object_show(left_button_);
-
-       right_button_ = elm_button_add(parent);
-       elm_object_text_set(right_button_, "DELETE");
-       elm_object_style_set(right_button_, "naviframe/title_left");
-       evas_object_smart_callback_add(right_button_, "clicked", WorldClockDeleteItemsView::OnDeleteButtonClicked, this);
-       evas_object_show(right_button_);
-
-       content_ = elm_genlist_add(parent);
-       evas_object_size_hint_align_set(content_, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       evas_object_size_hint_weight_set(content_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_genlist_mode_set(content_, ELM_LIST_COMPRESS);
-       elm_genlist_homogeneous_set(content_, EINA_TRUE);
-       evas_object_show(content_);
-
-       elm_object_item_part_text_set(navi_item_, "elm.text.title", "Select cities");
-       elm_object_item_part_content_set(navi_item_, "title_left_btn", left_button_);
-       elm_object_item_part_content_set(navi_item_, "title_right_btn", right_button_);
-       elm_object_item_content_set(navi_item_, content_);
-
-       CreateSelectAll();
-}
-
-void WorldClockDeleteItemsView::CreateSelectAll()
-{
-       Elm_Genlist_Item_Class *itc = elm_genlist_item_class_new();
-       Elm_Genlist_Item *item;
-
-       itc->item_style = "select_all";
-
-       itc->func.text_get = [](void *data, Evas_Object *obj, const char *part) -> char* {
-               if (!strcmp(part, "elm.text")) {
-                       return strdup("Select all");
-               }
-               return nullptr;
-       };
-       itc->func.content_get = [](void *data, Evas_Object *obj, const char *part) -> Evas_Object* {
-               WorldClockDeleteItemsView *view = static_cast<WorldClockDeleteItemsView *>(data);
-               if (!strcmp(part, "sw.check")) {
-                       view->select_all_checkbox_ = elm_check_add(obj);
-                       elm_check_state_set(view->select_all_checkbox_, view->all_selected_);
-                       evas_object_propagate_events_set(view->select_all_checkbox_, EINA_FALSE);
-                       evas_object_smart_callback_add(view->select_all_checkbox_, "changed",
-                                       WorldClockDeleteItemsView::OnSelectAllClicked, view);
-                       evas_object_show(view->select_all_checkbox_);
-                       return view->select_all_checkbox_;
-               }
-               return nullptr;
-       };
-       item = elm_genlist_item_append(content_, itc, this, NULL, ELM_GENLIST_ITEM_NONE,
-                       WorldClockDeleteItemsView::OnSelectAllClicked, this);
-       elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_ALWAYS);
-
-       elm_genlist_item_class_unref(itc);
-}
-
-void WorldClockDeleteItemsView::DestroyContent()
-{
-       evas_object_del(content_);
-       evas_object_del(left_button_);
-       evas_object_del(right_button_);
-}
-
-void WorldClockDeleteItemsView::RegisterSignal(SignalType s, std::function<void(void)>func)
-{
-       signals_.at((int)s) = func;
-}
-
-void WorldClockDeleteItemsView::EmitSignal(SignalType s)
-{
-       if (signals_.at((int)s) != nullptr)
-               signals_.at((int)s)();
-}
-
-void WorldClockDeleteItemsView::OnCancelButtonClicked(void *data, Evas_Object *obj, void *event_data)
-{
-       WorldClockDeleteItemsView * view = static_cast<WorldClockDeleteItemsView *>(data);
-       view->EmitSignal(SignalType::BUTTON_CANCEL_CLICKED);
-}
-
-void WorldClockDeleteItemsView::OnDeleteButtonClicked(void *data, Evas_Object *obj, void *event_data)
-{
-       WorldClockDeleteItemsView * view = static_cast<WorldClockDeleteItemsView *>(data);
-       view->EmitSignal(SignalType::BUTTON_DELETE_CLICKED);
-}
-
-void WorldClockDeleteItemsView::OnSelectAllClicked(void *data, Evas_Object *obj, void *event_info)
-{
-       Elm_Object_Item *it = static_cast<Elm_Object_Item*>(event_info);
-       WorldClockDeleteItemsView *view = static_cast<WorldClockDeleteItemsView *>(data);
-       elm_genlist_item_selected_set(it, EINA_FALSE);
-       view->all_selected_ = !view->all_selected_;
-       elm_check_state_set(view->select_all_checkbox_, view->all_selected_);
-
-       view->EmitSignal(SignalType::CHECKBOX_SELECT_ALL_CLICKED);
-}
-
-void WorldClockDeleteItemsView::ItemSelectToggle(void *data, Evas_Object *obj, void *event_info)
-{
-       LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *>(data);
-
-       ldid->selected = !ldid->selected;
-       if (!ldid->selected)
-               ldid->view->SetSelectAllCheckbox(false);
-
-       ldid->view->EmitSignal(SignalType::LIST_ITEM_CLICKED);
-}
-
-std::vector<const model::Location *> WorldClockDeleteItemsView::GetSelectedItems()
-{
-       static std::vector<const model::Location *> removed;
-       removed.clear();
-
-       Elm_Genlist_Item *it = elm_genlist_nth_item_get(content_, 1);
-       while (it) {
-               LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *> (elm_object_item_data_get(it));
-               if (ldid->selected)
-                       removed.push_back(ldid->location);
-
-               it = elm_genlist_item_next_get(it);
-       }
-       return removed;
-}
-
-void WorldClockDeleteItemsView::UpdateTitle()
-{
-       int cnt = 0;
-       std::stringstream ss;
-
-       cnt = GetSelectedItems().size();
-       ss << cnt << " selected";
-       elm_object_item_part_text_set(navi_item_, "elm.text.title", ss.str().c_str());
-}
-
-void WorldClockDeleteItemsView::SetAllItems(bool state)
-{
-       Elm_Genlist_Item *it = elm_genlist_nth_item_get(content_, 1);
-       while (it) {
-               LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *> (elm_object_item_data_get(it));
-               ldid->selected = state;
-               elm_check_state_set(ldid->checkbox, ldid->selected);
-               it = elm_genlist_item_next_get(it);
-       }
-}
-
-void WorldClockDeleteItemsView::SetSelectAllCheckbox(bool state)
-{
-       all_selected_ = state;
-       elm_check_state_set(select_all_checkbox_, all_selected_);
-}
-
-bool WorldClockDeleteItemsView::GetSelectAllState()
-{
-       return elm_check_state_get(select_all_checkbox_);
-}
index a7c8675..953a67f 100644 (file)
@@ -28,7 +28,6 @@
 #include "Internal/WorldClockDefs.h"
 #include "Utils/Log.h"
 #include "Utils/Time.h"
-#include "Utils/WorldClock.h"
 
 using namespace view;
 using namespace utils;
@@ -67,11 +66,44 @@ void WorldClockView::CreateCustomLocationsList(Evas_Object *parent)
        elm_layout_content_set(world_clock_, TIMEZONE_CUSTOM_LOCATIONS_LIST_PART, custom_locations_list_);
 }
 
+// local_timezone_offset and timezone_offset should be relative to GMT
+std::string GetTimezoneDiffDescription(int local_timezone_offset, int timezone_offset)
+{
+       char *pattern;
+       char relative[128] = { 0, };
+
+       int offset_integer = (abs(timezone_offset - local_timezone_offset)) / 60;
+       int offset_remainder = (abs(timezone_offset - local_timezone_offset)) % 60;
+
+       if (timezone_offset < local_timezone_offset) {
+               if (offset_remainder > 0) {
+                               pattern = _("IDS_CLOCK_BODY_PS1D_H_P2SD_M_BEHIND_ABB");
+                               snprintf(relative, sizeof(relative), pattern, offset_integer,
+                               offset_remainder);
+               } else {
+                       pattern = _("IDS_CLOCK_BODY_PD_H_BEHIND_ABB");
+                       snprintf(relative, sizeof(relative), pattern, offset_integer);
+               }
+       } else if (timezone_offset > local_timezone_offset) {
+               if (offset_remainder > 0) {
+                       pattern = _("IDS_CLOCK_BODY_PS1D_H_P2SD_M_AHEAD_ABB");
+                       snprintf(relative, sizeof(relative), pattern, offset_integer,
+                       offset_remainder);
+               } else {
+                       pattern = _("IDS_CLOCK_BODY_PD_H_AHEAD_ABB");
+                       snprintf(relative, sizeof(relative), pattern, offset_integer);
+               }
+       } else {
+               snprintf(relative, sizeof(relative), "Same as local time");
+       }
+       return std::string(&relative[0]);
+}
+
 void WorldClockView::AppendItemToCustomList(const model::Location *location)
 {
        LocationItemData *data = new LocationItemData;
        Time t = Time::Now().InTimezone(
-                       Time::GetTimezoneNameByOffset(location->gmt_offset_).c_str());
+                       Time::GetTimezoneNameByOffset(location->gmt_offset_).c_str());;
        int local_timezone_offset = Time::GetTimezoneOffset(Time::GetCurrentTimezone().c_str());
        std::stringstream ss;
 
@@ -97,21 +129,6 @@ void WorldClockView::AppendItemToCustomList(const model::Location *location)
        return;
 }
 
-void WorldClockView::RemoveItem(const model::Location *location)
-{
-       Elm_Genlist_Item *it = elm_genlist_nth_item_get(custom_locations_list_, 0);
-
-       while (it) {
-               LocationItemData *lid = static_cast<LocationItemData *> (elm_object_item_data_get(it));
-
-               if (!(location->name.compare(lid->location->name)) && !(location->country.compare(lid->location->country))) {
-                       elm_object_item_del(it);
-                       break;
-               }
-               it = elm_genlist_item_next_get(it);
-       }
-}
-
 void WorldClockView::ItemClicked(void *data, Evas_Object *obj, void *event_info)
 {
        LocationItemData *lid = static_cast<LocationItemData *>(data);
@@ -264,7 +281,7 @@ WorldClockView::WorldClockView(ui::IView &main)
 void WorldClockView::MoreButtonClicked(void *data, Evas_Object *obj, void *info)
 {
        WorldClockView *view = static_cast<WorldClockView *>(data);
-       view->EmitSignal(view::WorldClockSignals::BUTTON_MORE_CLICKED);
+       view->ShowMorePopup();
 }
 
 void WorldClockView::ShowMorePopup()
@@ -290,10 +307,7 @@ void WorldClockView::ShowMorePopup()
 void WorldClockView::MorePopupDeleteItemCallback(void *data, Evas_Object *obj, void *event_info)
 {
        WorldClockView *view = static_cast<WorldClockView *>(data);
-       elm_theme_extension_add(NULL,
-                       Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/WorldClockDeleteList.edj"));
 
-       view->EmitSignal(view::WorldClockSignals::BUTTON_MORE_DELETE_CLICKED);
        evas_object_del(view->more_popup_);
        view->more_popup_ = nullptr;
 }
@@ -499,6 +513,11 @@ void WorldClockView::CreateTimezoneDetails()
                timezone_details_);
 
        CreateTimezoneCitiesList();
+
+       EmitSignal(view::WorldClockSignals::UPDATE_MAP_VIEW);
+
+       /* TODO load timezone to display on map from app preferences(it must be saved on app temination)*/
+
 }
 
 void WorldClockView::UpdateMapAndTimezoneDetails(const model::Timezone *timezone)