worldclock: custom locations list layout created. 71/90171/3
authorRadoslaw Czerski <r.czerski@samsung.com>
Fri, 30 Sep 2016 12:40:02 +0000 (14:40 +0200)
committerRadoslaw Czerski <r.czerski@samsung.com>
Fri, 30 Sep 2016 12:40:02 +0000 (14:40 +0200)
The list is connected to Map
which shows timezone related to clicked list item.

MVP patter is not implemented yet(will be added in next commit)

Change-Id: Ia8be8f6ab05371a3bc0218eacd489c9622679e61
Signed-off-by: Radoslaw Czerski <r.czerski@samsung.com>
clock/inc/Internal/WorldClockDefs.h
clock/inc/Model/Location.h
clock/inc/Model/WorldClock.h
clock/inc/Utils/Time.h
clock/inc/View/WorldClockView.h
clock/res/edje/CitiesListItem.edc [new file with mode: 0644]
clock/res/edje/WorldClock.edc
clock/src/Model/WorldClock.cpp
clock/src/Utils/Time.cpp
clock/src/View/WorldClockView.cpp

index f2c2995..ab68ffc 100644 (file)
@@ -45,6 +45,8 @@
 #define TIMEZONE_DETAILS_FIRST_LINE_PART "main.timezone.details:timezone.details.first.line.content"
 #define TIMEZONE_DETAILS_SECOND_LINE_PART "main.timezone.details:timezone.details.second.line.cities"
 
+#define TIMEZONE_CUSTOM_LOCATIONS_LIST_PART "main.locations.list:custom.locations.list"
+
 /* Styles names*/
 
 #define TIMEZONE_DETAILS_FIRST_LINE_TIME_STYLE(x) "<font=Tizen:style=Thin color=#fafafaff font_size=70 align=right ellipsis=-1.0>" x "</font>"
@@ -53,5 +55,8 @@
 
 #define TIMEZONE_DETAILS_SECOND_LINE_CITIES(x) "<font=Tizen:style=Regular color=#fafafa font_size=36 align=center wrap=word ellipsis=1.0>" x "</font>"
 
+#define CUSTOM_LIST_TIME_STYLE(x) "<font=font=Tizen:style=Light color=#000000ff font_size=50 align=left>" x "</font>"
+#define CUSTOM_LIST_AMPM_STYLE(x) "<font=Tizen:style=Medium color=#000000ff font_size=30 align=left>" x "</font>"
+
 
 #endif /* WORLDCLOCKDEFS_H_ */
index 420723c..0fad842 100644 (file)
@@ -4,16 +4,16 @@
 #include <string>
 
 namespace model {
-struct Location {
-       std::string name;
-       std::string country;
+       struct Location {
+               std::string name;
+               std::string country;
 
-       int gmt_offset_;
-       int x;
-       int y;
+               int gmt_offset_;
+               int x;
+               int y;
 
-       bool summertime;
-};
+               bool summertime;
+       };
 } /* model */
 
 #endif
index d560a42..6aa24fe 100644 (file)
@@ -24,14 +24,17 @@ namespace model {
 
                        void InitTimeZones();
                        void InitLocations();
-                       int GetCurrentTimezoneNo();
-                       Timezone *GetCurrentTimezone();
-                       const char *GetCurrentTzString();
-                       char *OffsetToString(int offset);
+                       int GetCurrentTimezoneNo() const;
+                       int GetTimezoneNo(const Timezone *timezone) const;
+                       Timezone *GetCurrentTimezone() const;
+                       const char *GetCurrentTzString() const;
+                       char *OffsetToString(int offset) const;
                        void SetCurrentTimezone(int tz);
-                       int GetTimezonesCount();
-                       int GetLocationsCount();
-                       const Timezone *GetTimezoneByOffset(int offset);
+                       int GetTimezonesCount() const;
+                       int GetLocationsCount() const;
+                       const Timezone *GetTimezoneByOffset(int offset) const;
+                       const model::Location *GetLocation(int no) const;
+
                private:
                        int current_tz_;
                        model::Location user_location_;
index 4e0b7f7..14c4323 100644 (file)
@@ -24,6 +24,9 @@ namespace utils {
                        std::string GetFormattedTime(const char *icu_format) const;
                        std::string GetFormattedTimeByTimezoneOffset(const char *icu_format, int timezone_offset) const;
                        int GetLocalTimezoneOffset(void) const;
+                       const std::string GetTimezoneRelativeToLocalString(int timezone_offset);
+                       std::string GetTimezoneDate(int timezone_offset);
+
                        std::string GetDate() const;
 
                        static Time Now(void);
index 58af59e..2b1ba87 100644 (file)
@@ -28,35 +28,43 @@ namespace view {
 
                        Evas_Object *GetEvasObject(){return world_clock_;};
 
-                       void UpdateTimezoneDetails(model::Timezone *timezone);
+                       void UpdateMapAndTimezoneDetails(const model::Timezone *timezone);
 
-               private:
-                       //TODO use function
-                       static void ChangeTimezoneCb(void *data, Evas_Object *obj,
-                               const char *emission, const char *source);
+                       void AppendItemToCustomList(const model::Location *location);
 
-                       void UpdateTimezoneLocationsDots();
-                       void UpdateGmtOffset();
-                       void UpdateTimezoneArea();
+               private:
                        void CreateTimezoneDetails();
-
-                       Evas_Object *CreateTimezoneTime();
-                       Evas_Object *CreateTimezoneXMeridiem();
-                       Evas_Object *CreateTimezoneRelativeToLocalObject();
-
-                       Evas_Object *CreatePadding(int width);
+                       void CreateCustomLocationsList();
                        void CreateTimezoneCitiesList();
 
+                       void UpdateTimezoneLocationsDots(const model::Timezone *timezone);
+                       void UpdateGmtOffset(const model::Timezone *timezone);
+                       void UpdateTimezoneArea(const model::Timezone *timezone);
                        void UpdateTimezoneTime(int timezone_offset);
                        void UpdateTimezoneXMeridiem(int timezone_offset);
                        void UpdateTimezoneRelativeToLocal(int timezone_offset);
+                       void UpdateTimezoneCitiesList(const model::Timezone *timezone);
+
+                       static void ChangeTimezoneCb(void *data, Evas_Object *obj,
+                               const char *emission, const char *source);
+                       static void ItemClicked(void *data, Evas_Object *obj, void *event_info);
+
+                       static Evas_Object *CreateTimezoneTime(Evas_Object *parent);
+                       static Evas_Object *CreateTimezoneXMeridiem(Evas_Object *parent);
+                       static Evas_Object *CreateTimezoneRelativeToLocalObject(Evas_Object *parent);
+                       static Evas_Object *CreatePadding(Evas_Object *parent, int width);
+
+                       static Evas_Object *ContentGet(void *data, Evas_Object *obj, const char *part);
+                       static char *TextGet(void *data, Evas_Object *obj, const char *part);
+                       static void Del(void *data, Evas_Object *obj);
 
-                       void UpdateTimezoneCitiesList(model::Timezone *timezone);
+                       static Elm_Genlist_Item_Class world_clock_itc_;
 
                        model::WorldClock *world_clock_data_;
                        Evas_Object *world_clock_;
                        Evas_Object *timezone_details_;
                        Evas_Object *timezone_cities_;
+                       Evas_Object *custom_locations_list_;
        };
 }
 
diff --git a/clock/res/edje/CitiesListItem.edc b/clock/res/edje/CitiesListItem.edc
new file mode 100644 (file)
index 0000000..7a52d50
--- /dev/null
@@ -0,0 +1,162 @@
+
+collections {
+       base_scale: 2.6;
+
+       group { name: "elm/genlist/item/worldclock.custom.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";
+                       }
+                       style { name: "gmt_offset_desc_ATO044";
+                               base: "font=Tizen:style=Regular color=#808080ff font_size=40 align=left";
+                       }
+               }
+               data.item: "banded_bg_area" "elm.swallow.bg";
+               data.item: "texts" "ampm date city.country gmt.offset.desc";
+               data.item: "contents" "time";
+               parts {
+                       spacer { "base"; scale;
+                               desc { "default";
+                               min: 0 22+53+43+26;
+                               }
+                       }
+                       swallow { "elm.swallow.bg";
+                               desc { "default";
+                                       rel1.to: "base";
+                                       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;
+                                       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 {
+                                       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;
+                                       }
+                               }
+                       }
+                       textblock { "city.country"; scale;
+                               desc { "default";
+                                       min: 405 53;
+                                       max: 405 53;
+                                       fixed: 1 1;
+                                       align: 0.0 0.0;
+                                       rel1 {
+                                               relative: 1.0 1.0;
+                                               to_x: "padding.middle";
+                                               to_y: "padding.top.right";
+                                       }
+                                       text {
+                                               style: "city_country_ATO043";
+                                               ellipsis: 1;
+                                       }
+                               }
+                       }
+                       textblock { "gmt.offset.desc"; scale;
+                               desc { "default";
+                                       min: 405 43;
+                                       max: 405 43;
+                                       fixed: 1 1;
+                                       align: 0.0 0.0;
+                                       rel1 {
+                                               relative: 0.0 1.0;
+                                               to_x: "city.country";
+                                               to_y: "city.country";
+                                       }
+                                       text {
+                                               style: "gmt_offset_desc_ATO044";
+                                               ellipsis: 1;
+                                       }
+                               }
+                       }
+               }
+       }
+}
index 312b04d..54d2853 100644 (file)
@@ -402,104 +402,112 @@ collections {
                }
        }
 
-group { "timezone.details";
+       group { "timezone.details";
 
-               styles {
-                       style {
-                       name: "time_style";
-                       base: "font=Tizen:style=Thin color=#fafafa font_size=70 align=right ellipsis=-1.0";
-                       }
-                       style {
-                       name: "ampm_style";
-                       base: "font=Tizen:style=Regular color=#fafafa font_size=36";
-                       }
-                       style {
-                       name: "relative_to_local_style";
-                       base: "font=Tizen:style=Regular color=#fafafa font_size=36";
-                       }
-                       style {
-                       name: "timezone_cities_style";
-                       base: "font=Tizen:style=Regular color=#fafafa font_size=36 wrap=word ellipsis=1.0";
+                       styles {
+                               style {
+                               name: "time_style";
+                               base: "font=Tizen:style=Thin color=#fafafa font_size=70 align=right ellipsis=-1.0";
+                               }
+                               style {
+                               name: "ampm_style";
+                               base: "font=Tizen:style=Regular color=#fafafa font_size=36";
+                               }
+                               style {
+                               name: "relative_to_local_style";
+                               base: "font=Tizen:style=Regular color=#fafafa font_size=36";
+                               }
+                               style {
+                               name: "timezone_cities_style";
+                               base: "font=Tizen:style=Regular color=#fafafa font_size=36 wrap=word ellipsis=1.0";
+                               }
                        }
-               }
 
-               parts {
-                       rect { "timezone.details.container"; scale;
-                               desc { "default";
-                                       color: 0 0 0 0;
+                       parts {
+                               rect { "timezone.details.container";
+                                       desc { "default";
+                                               color: 0 0 0 0;
+                                       }
                                }
-                       }
-                       rect { "timezone.details.first.line"; scale;
-                               desc { "default";
-                                       align: 0.5 0.0;
-                                       min: 0 94;
-                                       max: 720 94;
-                                       color: 0 0 0 0;
-                                       rel1 {
-                                               offset: 0 50;
-                                               to: "timezone.details.container";
+                               rect { "timezone.details.first.line"; scale;
+                                       desc { "default";
+                                               align: 0.5 0.0;
+                                               min: 0 94;
+                                               max: 720 94;
+                                               color: 0 0 0 0;
+                                               rel1 {
+                                                       offset: 0 50;
+                                                       to: "timezone.details.container";
+                                               }
+                                               rel2.to_x: "timezone.details.container";
                                        }
-                                       rel2.to_x: "timezone.details.container";
                                }
-                       }
 
-                       swallow { "timezone.details.first.line.content"; scale;
-                               desc { "default";
-                                       align: 0.5 1.0;
-                                       rel1.to: "timezone.details.first.line";
-                                       rel2.to: "timezone.details.first.line";
+                               swallow { "timezone.details.first.line.content";
+                                       desc { "default";
+                                               align: 0.5 1.0;
+                                               rel1.to: "timezone.details.first.line";
+                                               rel2.to: "timezone.details.first.line";
+                                       }
                                }
-                       }
 
-                       rect { "timezone.details.second.line"; scale;
-                               desc { "default";
-                                       align: 0.5 0.0;
-                                       min: 0 51;
-                                       max: -1 51;
-                                       color: 0 0 0 0;
-                                       rel1 {
-                                               relative: 0.0 1.0;
-                                               to_x: "timezone.details.container";
-                                               to_y: "timezone.details.first.line.content";
+                               rect { "timezone.details.second.line"; scale;
+                                       desc { "default";
+                                               align: 0.5 0.0;
+                                               min: 0 51;
+                                               max: -1 51;
+                                               color: 0 0 0 0;
+                                               rel1 {
+                                                       relative: 0.0 1.0;
+                                                       to_x: "timezone.details.container";
+                                                       to_y: "timezone.details.first.line.content";
+                                               }
+                                               rel2.to_x: "timezone.details.container";
                                        }
-                                       rel2.to_x: "timezone.details.container";
                                }
-                       }
 
-                       swallow { "timezone.details.second.line.cities"; scale;
-                               desc { "default";
-                                       rel1.to: "timezone.details.second.line";
-                                       rel2.to: "timezone.details.second.line";
+                               swallow { "timezone.details.second.line.cities"; scale;
+                                       desc { "default";
+                                               rel1.to: "timezone.details.second.line";
+                                               rel2.to: "timezone.details.second.line";
+                                       }
                                }
                        }
                }
-       }
-group { "locations.list";
-
-       styles {
-               style {
-                       name: "ATO044";
-                       base: "font=Tizen:style=Regular color=#808080aa font_size=34 align=center";
-                       //TODO Update it when   GUI designer will reply
-               }
-       }
+       group { "locations.list";
 
-       parts {
-               rect { "location.bg";
+               styles {
+                       style {
+                               name: "ATO044";
+                               base: "font=Tizen:style=Regular color=#808080aa font_size=34 align=center";
+                               //TODO Update it when   GUI designer will reply
+                       }
                }
 
-               textblock{ "locations.list.empty";
-                       desc { "default";
-                               text {
-                                       style: "ATO044";
-                                       text: "After you add cities, they<br>will be shown here.";
-                                       min: 1.0 1.0;
-                                       ellipsis: -1;
+               parts {
+                       textblock { "locations.list.empty";
+                               desc { "default";
+                                       text {
+                                               style: "ATO044";
+                                               text: "After you add cities, they<br>will be shown here.";
+                                               min: 1.0 1.0;
+                                               ellipsis: -1;
+                                       }
+                                       hid;
+                               }
+                               desc { "hidden";
+                                       hid;
                                }
                        }
-                       desc { "hidden";
-                               hid;
+                       swallow { "custom.locations.list";
+                               desc { "default";
+                                       vis;
+                               }
+                               desc { "hidden";
+                                       hid;
+                               }
                        }
                }
        }
-}
\ No newline at end of file
+}
+
index fa7d462..a17cfb7 100644 (file)
@@ -35,7 +35,7 @@ std::vector<model::Location> WorldClock::locations_ = {
                              { "Chicago", "USA", -6 * 60, 187, 181 },
                              { "Guatemala City", "Guatemala", -6 * 60, 181, 233 },
                              { "Mexico City", "Mexico", -6 * 60, 167, 244 },
-                             { "Bogota", "Colombia" - 5 * 60, 212, 253 },
+                             { "Bogota", "Colombia", -5 * 60, 212, 253 },
                              { "Lima", "Peru", -5 * 60, 206, 286 },
                              { "Miami", "USA", -5 * 60, 200, 211 },
                              { "New York", "USA", -5 * 60, 211, 184 },
@@ -135,12 +135,23 @@ WorldClock::WorldClock()
        SetCurrentTimezone(12); // Need to load and store currently set tz to file or any app_data if possible
 }
 
-int WorldClock::GetCurrentTimezoneNo()
+int WorldClock::GetCurrentTimezoneNo() const
 {
        return current_tz_;
 }
 
-const Timezone *WorldClock::GetTimezoneByOffset(int offset)
+int WorldClock::GetTimezoneNo(const model::Timezone *timezone) const
+{
+       for (int i = timezone->gmt_offset / 60 + 11; i < time_zones_.size() - 1; i++) {
+                       if (time_zones_.at(i).gmt_offset == timezone->gmt_offset) {
+                               return i;
+                       }
+               }
+
+       return current_tz_;
+}
+
+const Timezone *WorldClock::GetTimezoneByOffset(int offset) const
 {
        for (int i = offset / 60 + 11; i < time_zones_.size() - 1; i++) {
                if (time_zones_.at(i).gmt_offset == offset) {
@@ -150,17 +161,17 @@ const Timezone *WorldClock::GetTimezoneByOffset(int offset)
        return NULL;
 }
 
-Timezone *WorldClock::GetCurrentTimezone()
+Timezone *WorldClock::GetCurrentTimezone() const
 {
        return &time_zones_.at(GetCurrentTimezoneNo());
 }
 
-const char *WorldClock::GetCurrentTzString()
+const char *WorldClock::GetCurrentTzString() const
 {
        return OffsetToString(GetCurrentTimezone()->gmt_offset);
 }
 
-char *WorldClock::OffsetToString(int offset)
+char *WorldClock::OffsetToString(int offset) const
 {
        int remainder;
        char remainder_str[6];
@@ -179,12 +190,17 @@ void WorldClock::SetCurrentTimezone(int tz)
        current_tz_ = tz;
 }
 
-int WorldClock::GetTimezonesCount()
+int WorldClock::GetTimezonesCount() const
 {
        return time_zones_.size();
 }
 
-int WorldClock::GetLocationsCount()
+int WorldClock::GetLocationsCount() const
 {
        return locations_.size();
 }
+
+const model::Location *WorldClock::GetLocation(int no) const
+{
+       return &locations_.at(no);
+}
index 9b8be01..4c66053 100644 (file)
@@ -1,4 +1,6 @@
 #include "Utils/Time.h"
+#include "log.h"
+
 #include <utils_i18n.h>
 #include <cstring>
 #include <ctime>
@@ -60,11 +62,56 @@ std::string Time::GetFormattedTimeByTimezoneOffset(const char *icu_format, int t
 {
        return "15:01";
 }
+
 int Time::GetLocalTimezoneOffset(void) const
 {
        return 60;
 }
 
+const std::string Time::GetTimezoneRelativeToLocalString(int timezone_offset)
+{
+       char *pattern;
+       static char relative[128] = { 0, };
+       std::string s;
+
+       int local_timezone_offset = GetLocalTimezoneOffset();
+       int offset_integer = (abs(timezone_offset - local_timezone_offset)) / 60;
+       int offset_remainder = (abs(timezone_offset - local_timezone_offset)) % 60;
+
+       DBG("passed offset:%d, local:%d, remainder:%d", timezone_offset,
+               local_timezone_offset, offset_remainder);
+
+       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 &relative[0];
+}
+
+std::string Time::GetTimezoneDate(int timezone_offset)
+{
+       return "Mon 32 Aug";
+}
+
 std::string Time::GetDate() const
 {
        time_t now;
index bf3a2f2..abbbb88 100644 (file)
@@ -15,6 +15,9 @@
  */
 
 #include <vector>
+#include <sstream>
+
+#include <efl_extension.h>
 
 #include "View/WorldClockView.h"
 #include "View/MainView.h"
 using namespace view;
 using namespace utils;
 
+struct LocationItemData {
+               WorldClockView *wc_view;
+               Evas_Object *time;
+
+               char *ampm;
+               char *date;
+               char *city_country;
+               char *gmt_offset_relative;
+               int gmt_offset;
+               Elm_Object_Item *it;
+};
+
+
+/* Custom list View */
+
+Elm_Genlist_Item_Class WorldClockView::world_clock_itc_= {
+       .item_style = "worldclock.custom.list",
+       .func.content_get = WorldClockView::ContentGet,
+       .func.text_get = WorldClockView::TextGet,
+       .func.del = WorldClockView::Del,
+};
+
+
+void WorldClockView::CreateCustomLocationsList()
+{
+       custom_locations_list_ = elm_genlist_add(MainView::GetInstance().GetEvasObject());
+       evas_object_size_hint_expand_set(custom_locations_list_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(custom_locations_list_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       elm_genlist_homogeneous_set(custom_locations_list_, EINA_TRUE);
+       elm_layout_content_set(world_clock_, TIMEZONE_CUSTOM_LOCATIONS_LIST_PART, custom_locations_list_);
+}
+
+void WorldClockView::AppendItemToCustomList(const model::Location *location)
+{
+       LocationItemData *data = new LocationItemData;
+       Time t;
+       std::stringstream ss;
+
+       data->wc_view = this;
+       ss << location->name << ", " << location->country;
+       data->city_country = strdup(ss.str().c_str());
+
+       data->ampm = strdup(t.GetMeridiemByOffset(location->gmt_offset_).c_str());
+       data->gmt_offset_relative = strdup(t.GetTimezoneRelativeToLocalString(location->gmt_offset_).c_str());
+       data->gmt_offset = location->gmt_offset_;
+       data->date = strdup(t.GetTimezoneDate(location->gmt_offset_).c_str());
+
+       data->it = elm_genlist_item_append(custom_locations_list_,
+                       &world_clock_itc_,
+                       data,
+                       NULL,
+                       ELM_GENLIST_ITEM_NONE,
+                       WorldClockView::ItemClicked,
+                       data);
+
+       return;
+}
+
+void WorldClockView::ItemClicked(void *data, Evas_Object *obj, void *event_info)
+{
+       LocationItemData *lid = static_cast<LocationItemData *>(data);
+
+       /* TODO send event to WC model to update 'Current' timezone.
+       (Model need to fire event(view refresh update) when data are updated.)*/
+
+       const model::Timezone *tz = lid->wc_view->world_clock_data_->GetTimezoneByOffset(lid->gmt_offset);
+       lid->wc_view->world_clock_data_->SetCurrentTimezone(lid->wc_view->world_clock_data_->GetTimezoneNo(tz));
+       lid->wc_view->UpdateMapAndTimezoneDetails(tz);
+
+       elm_genlist_item_selected_set(lid->it, EINA_FALSE);
+}
+
+Evas_Object *WorldClockView::ContentGet(void *data, Evas_Object *obj, const char *part)
+{
+       LocationItemData *lid = static_cast<LocationItemData *>(data);
+
+       if (!strcmp(part, "time")) {
+
+               lid->time = elm_table_add(obj);
+               evas_object_size_hint_align_set(lid->time, 0.0, 0.0);
+
+               Evas_Object *time = CreateTimezoneTime(lid->time);
+               Evas_Object *padding = CreatePadding(lid->time, 8);
+               Evas_Object *ampm = CreateTimezoneXMeridiem(lid->time);
+
+               Evas_Object *dynamic_padding = elm_bg_add(lid->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(lid->time, time, 0, 0, 1, 1);
+               elm_table_pack(lid->time, padding, 1, 0, 1, 1);
+               elm_table_pack(lid->time, ampm, 2, 0, 1, 1);
+               elm_table_pack(lid->time, dynamic_padding, 3, 0, 1, 1);
+
+               //TODO Time need to be set as current for specific timezone
+               Time t;
+
+               std::string timezone_time = t.GetFormattedTimeByTimezoneOffset("HH:MM", lid->gmt_offset);
+               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.GetMeridiemByOffset(lid->gmt_offset);
+               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 lid->time;
+       }
+       return NULL;
+}
+
+char *WorldClockView::TextGet(void *data, Evas_Object *obj, const char *part)
+{
+       LocationItemData *lid = static_cast<LocationItemData *>(data);
+       if (!strcmp(part, "ampm"))
+               return strdup(lid->ampm);
+       if (!strcmp(part, "date"))
+               return strdup(lid->date);
+       if (!strcmp(part, "city.country"))
+               return strdup(lid->city_country);
+       if (!strcmp(part, "gmt.offset.desc"))
+               return strdup(lid->gmt_offset_relative);
+       return NULL;
+}
+
+void WorldClockView::Del(void *data, Evas_Object *obj)
+{
+       LocationItemData *lid = static_cast<LocationItemData *>(data);
+
+       free(lid->ampm);
+       free(lid->city_country);
+       free(lid->date);
+       free(lid->gmt_offset_relative);
+
+       delete lid;
+}
+/*[END] Custom list View */
+
+
 void WorldClockView::ChangeTimezoneCb(void *data, Evas_Object *obj, const char *emission,
         const char *source)
 {
+       /* TODO send event to WC presenter to update 'Current' timezone.
+       (Model need to fire event(view refresh update) when data are updated.)*/
+
        WorldClockView *world_clock_view = static_cast<WorldClockView *>(data);
        model::WorldClock *world_clock_data = world_clock_view->world_clock_data_;
 
@@ -48,7 +196,7 @@ void WorldClockView::ChangeTimezoneCb(void *data, Evas_Object *obj, const char *
                else
                        world_clock_data->SetCurrentTimezone(current_tz + 1);
        }
-       world_clock_view->UpdateTimezoneDetails(world_clock_data->GetCurrentTimezone());
+       world_clock_view->UpdateMapAndTimezoneDetails(world_clock_data->GetCurrentTimezone());
 }
 
 // TODO FOR DEBUGING ONLY - need to be removed when application is ready
@@ -68,7 +216,7 @@ void message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, int id, vo
 
 WorldClockView::WorldClockView()
 {
-       world_clock_data_ = new model::WorldClock(); // TODO Move to controller and create Presenter for WorldClock
+       world_clock_data_ = new model::WorldClock(); // TODO create Presenter for WorldClock
        world_clock_ = elm_layout_add(MainView::GetInstance().GetEvasObject());
 
        if(!elm_layout_file_set(world_clock_,
@@ -77,13 +225,23 @@ WorldClockView::WorldClockView()
                FAT("Failed to load layout file");
        }
 
-
        evas_object_size_hint_align_set(world_clock_, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(world_clock_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
        edje_object_message_handler_set(elm_layout_edje_get(world_clock_), message_cb, NULL);
 
        CreateTimezoneDetails();
+       CreateCustomLocationsList();
+
+       elm_theme_extension_add(NULL,
+                       Utils::GetAppResourcePath(Utils::APP_DIR_RESOURCE, "edje/CitiesListItem.edj"));
+
+       /* Temporary hardcoded list items */
+       AppendItemToCustomList(world_clock_data_->GetLocation(0));
+       AppendItemToCustomList(world_clock_data_->GetLocation(12));
+       AppendItemToCustomList(world_clock_data_->GetLocation(32));
+       AppendItemToCustomList(world_clock_data_->GetLocation(54));
+       AppendItemToCustomList(world_clock_data_->GetLocation(70));
 
        elm_layout_signal_callback_add(world_clock_, "timezone,go,left",
                "main.world.map:arrow.left", WorldClockView::ChangeTimezoneCb,
@@ -93,23 +251,21 @@ WorldClockView::WorldClockView()
                static_cast<void *>(this));
 }
 
-void WorldClockView::UpdateTimezoneLocationsDots()
+void WorldClockView::UpdateTimezoneLocationsDots(const model::Timezone *timezone)
 {
-       int current_tz = world_clock_data_->GetCurrentTimezoneNo();
-
        for (int i = 0; i < 8; i++) {
                Edje_Message_Int_Set *msg;
                msg = (Edje_Message_Int_Set *) malloc(
                        sizeof(Edje_Message_Int_Set) + 3 * sizeof(int));
                msg->count = 4;
 
-               if (i >= world_clock_data_->GetCurrentTimezone()->places.size()) {
+               if (i >= timezone->places.size()) {
                        msg->val[0] = 100;
                        msg->val[1] = 100;
                        msg->val[2] = PART_NOT_VISIBLE;
 
                } else {
-                       model::Location loc = world_clock_data_->GetCurrentTimezone()->places.at(i);
+                       model::Location loc = timezone->places.at(i);
                        msg->val[0] = loc.x;
                        msg->val[1] = loc.y;
                        msg->val[2] = PART_VISIBLE;
@@ -122,36 +278,35 @@ void WorldClockView::UpdateTimezoneLocationsDots()
        }
 }
 
-void WorldClockView::UpdateGmtOffset()
+void WorldClockView::UpdateGmtOffset(const model::Timezone *timezone)
 {
-       const char *offset = world_clock_data_->GetCurrentTzString();
+       const char *offset = world_clock_data_->OffsetToString(timezone->gmt_offset);
        elm_object_part_text_set(world_clock_, "main.world.map:timezone_offset", offset);
 }
 
-void WorldClockView::UpdateTimezoneArea()
+void WorldClockView::UpdateTimezoneArea(const model::Timezone *timezone)
 {
-       Edje_Message_Int_Set *msg;
-
-       msg = static_cast<Edje_Message_Int_Set *>(malloc(
-               sizeof(Edje_Message_Int_Set) + sizeof(int)));
+       Edje_Message_Int_Set *msg = static_cast<Edje_Message_Int_Set *>
+               (malloc(sizeof(Edje_Message_Int_Set) + sizeof(int)));
 
        msg->count = 2;
-       msg->val[0] = world_clock_data_->GetCurrentTimezone()->x_coord;
-       msg->val[1] = world_clock_data_->GetCurrentTimezone()->zone_width;
+       msg->val[0] = timezone->x_coord;
+       msg->val[1] = timezone->zone_width;
 
        edje_object_message_send(elm_layout_edje_get(world_clock_), EDJE_MESSAGE_INT_SET,
                MESSAGE_ID_SET_TIMEZONE, (void *) msg);
+       free(msg);
 }
 
 void WorldClockView::CreateTimezoneDetails()
 {
        timezone_details_ = elm_table_add(world_clock_);
 
-       Evas_Object *time = CreateTimezoneTime();
-       Evas_Object *padding_1 = CreatePadding(12);
-       Evas_Object *ampm = CreateTimezoneXMeridiem();
-       Evas_Object *padding_2 = CreatePadding(20);
-       Evas_Object *relative = CreateTimezoneRelativeToLocalObject();
+       Evas_Object *time = CreateTimezoneTime(world_clock_);
+       Evas_Object *padding_1 = CreatePadding(timezone_details_, 12);
+       Evas_Object *ampm = CreateTimezoneXMeridiem(world_clock_);
+       Evas_Object *padding_2 = CreatePadding(timezone_details_, 20);
+       Evas_Object *relative = CreateTimezoneRelativeToLocalObject(world_clock_);
 
        elm_table_pack(timezone_details_, time, 0, 0, 1, 1);
        elm_table_pack(timezone_details_, padding_1, 1, 0, 1, 1);
@@ -164,14 +319,15 @@ void WorldClockView::CreateTimezoneDetails()
 
        CreateTimezoneCitiesList();
 
-       UpdateTimezoneDetails(world_clock_data_->GetCurrentTimezone());
+       // TODO load timezone to display on map from app preferences(it must be saved on app temination)
+       UpdateMapAndTimezoneDetails(world_clock_data_->GetCurrentTimezone());
 }
 
-void WorldClockView::UpdateTimezoneDetails(model::Timezone *timezone)
+void WorldClockView::UpdateMapAndTimezoneDetails(const model::Timezone *timezone)
 {
-       UpdateTimezoneLocationsDots();
-       UpdateTimezoneArea();
-       UpdateGmtOffset();
+       UpdateTimezoneLocationsDots(timezone);
+       UpdateTimezoneArea(timezone);
+       UpdateGmtOffset(timezone);
 
        UpdateTimezoneTime(timezone->gmt_offset);
        UpdateTimezoneXMeridiem(timezone->gmt_offset);
@@ -179,9 +335,9 @@ void WorldClockView::UpdateTimezoneDetails(model::Timezone *timezone)
        UpdateTimezoneCitiesList(timezone);
 }
 
-Evas_Object *WorldClockView::CreateTimezoneTime()
+Evas_Object *WorldClockView::CreateTimezoneTime(Evas_Object *parent)
 {
-       Evas_Object *label = elm_label_add(world_clock_);
+       Evas_Object *label = elm_label_add(parent);
        evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
        evas_object_show(label);
@@ -191,7 +347,7 @@ Evas_Object *WorldClockView::CreateTimezoneTime()
 
 void WorldClockView::UpdateTimezoneTime(int timezone_offset)
 {
-       utils::Time t;
+       Time t;
 
        //TODO This must be formated according to global device settings
        std::string timezone_time = t.GetFormattedTimeByTimezoneOffset("HH:MM", timezone_offset);
@@ -202,9 +358,9 @@ void WorldClockView::UpdateTimezoneTime(int timezone_offset)
        elm_object_text_set(elm_table_child_get(timezone_details_, 0, 0), time_formatted);
 }
 
-Evas_Object *WorldClockView::CreateTimezoneXMeridiem()
+Evas_Object *WorldClockView::CreateTimezoneXMeridiem(Evas_Object *parent)
 {
-       Evas_Object *ampm = elm_label_add(world_clock_);
+       Evas_Object *ampm = elm_label_add(parent);
        evas_object_size_hint_align_set(ampm, EVAS_HINT_FILL, 0.75);
 
        evas_object_show(ampm);
@@ -214,7 +370,7 @@ Evas_Object *WorldClockView::CreateTimezoneXMeridiem()
 
 void WorldClockView::UpdateTimezoneXMeridiem(int timezone_offset)
 {
-       utils::Time t;
+       Time t;
 
        //TODO This must be formated according to global device settings
        std::string meridiem = t.GetMeridiemByOffset(timezone_offset);
@@ -225,9 +381,9 @@ void WorldClockView::UpdateTimezoneXMeridiem(int timezone_offset)
        elm_object_text_set(elm_table_child_get(timezone_details_, 2, 0), ampm_formatted);
 }
 
-Evas_Object *WorldClockView::CreateTimezoneRelativeToLocalObject()
+Evas_Object *WorldClockView::CreateTimezoneRelativeToLocalObject(Evas_Object *parent)
 {
-       Evas_Object *relative = elm_label_add(world_clock_);
+       Evas_Object *relative = elm_label_add(parent);
        evas_object_size_hint_align_set(relative, EVAS_HINT_FILL, 0.75);
 
        evas_object_show(relative);
@@ -237,51 +393,19 @@ Evas_Object *WorldClockView::CreateTimezoneRelativeToLocalObject()
 
 void WorldClockView::UpdateTimezoneRelativeToLocal(int timezone_offset)
 {
-       char *message_pattern;
-       char message[64] = { 0, };
-       utils::Time t;
-
-       int local_timezone_offset = t.GetLocalTimezoneOffset();
-       int offset_integer = (abs(timezone_offset - local_timezone_offset)) / 60;
-       int offset_remainder = (abs(timezone_offset - local_timezone_offset)) % 60;
-
-       DBG("passed offset:%d, local:%d, remainder:%d", timezone_offset,
-               local_timezone_offset, offset_remainder);
-
-       if (timezone_offset < local_timezone_offset) {
-               if (offset_remainder > 0) {
-                       message_pattern = gettext("IDS_CLOCK_BODY_PS1D_H_P2SD_M_BEHIND_ABB");
-                       snprintf(message, sizeof(message), message_pattern, offset_integer,
-                               offset_remainder);
-               } else {
-                       message_pattern = gettext("IDS_CLOCK_BODY_PD_H_BEHIND_ABB");
-                       snprintf(message, sizeof(message), message_pattern, offset_integer);
-               }
-
-       } else if (timezone_offset > local_timezone_offset) {
-               if (offset_remainder > 0) {
-                       message_pattern = gettext("IDS_CLOCK_BODY_PS1D_H_P2SD_M_AHEAD_ABB");
-                       snprintf(message, sizeof(message), message_pattern, offset_integer,
-                               offset_remainder);
-               } else {
-                       message_pattern = gettext("IDS_CLOCK_BODY_PD_H_AHEAD_ABB");
-                       snprintf(message, sizeof(message), message_pattern, offset_integer);
-               }
-
-       } else {
-               snprintf(message, sizeof(message), "Same as local time");
-       }
+       Time t;
 
        char relative_formatted[MAX_STYLE_LEN] = { 0, };
        snprintf(relative_formatted, sizeof(relative_formatted),
-               TIMEZONE_DETAILS_FIRST_LINE_RELATIVE_TO_LOCAL_STYLE("%s"), message);
+               TIMEZONE_DETAILS_FIRST_LINE_RELATIVE_TO_LOCAL_STYLE("%s"),
+               t.GetTimezoneRelativeToLocalString(timezone_offset).c_str());
 
        elm_object_text_set(elm_table_child_get(timezone_details_, 4, 0), relative_formatted);
 }
 
-Evas_Object *WorldClockView::CreatePadding(int width)
+Evas_Object *WorldClockView::CreatePadding(Evas_Object *parent, int width)
 {
-       Evas_Object *padding = elm_bg_add(timezone_details_);
+       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);
@@ -301,10 +425,9 @@ void WorldClockView::CreateTimezoneCitiesList()
                timezone_cities_);
 }
 
-void WorldClockView::UpdateTimezoneCitiesList(model::Timezone *timezone)
+void WorldClockView::UpdateTimezoneCitiesList(const model::Timezone *timezone)
 {
-
-       std::vector < model::Location > *cities_list = ( (timezone) ?
+       const std::vector < model::Location > *cities_list = ( (timezone) ?
                        &timezone->places : &world_clock_data_->GetCurrentTimezone()->places);
 
        char cities[MAX_CITIES_LEN];
@@ -322,3 +445,4 @@ void WorldClockView::UpdateTimezoneCitiesList(model::Timezone *timezone)
 
        elm_object_text_set(timezone_cities_, cities_formatted);
 }
+