← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~ubuntu-calendar-dev/ubuntu-calendar-app/new-agenda-view into lp:ubuntu-calendar-app

 

Nekhelesh Ramananthan has proposed merging lp:~ubuntu-calendar-dev/ubuntu-calendar-app/new-agenda-view into lp:ubuntu-calendar-app with lp:~renatofilho/ubuntu-calendar-app/optimize as a prerequisite.

Commit message:
Implemented new agenda view as per the new design spec at https://www.dropbox.com/sh/suo2jb5liedn1x5/AADuNFySY3wsxit0JGl9LsFAa?dl=0

Requested reviews:
  Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration
  Ubuntu Calendar Developers (ubuntu-calendar-dev)
Related bugs:
  Bug #1550299 in Ubuntu Calendar App: "Implement the new agenda view"
  https://bugs.launchpad.net/ubuntu-calendar-app/+bug/1550299

For more details, see:
https://code.launchpad.net/~ubuntu-calendar-dev/ubuntu-calendar-app/new-agenda-view/+merge/287792

Implemented new agenda view as per the new design spec at https://www.dropbox.com/sh/suo2jb5liedn1x5/AADuNFySY3wsxit0JGl9LsFAa?dl=0
-- 
Your team Ubuntu Calendar Developers is requested to review the proposed merge of lp:~ubuntu-calendar-dev/ubuntu-calendar-app/new-agenda-view into lp:ubuntu-calendar-app.
=== modified file 'AgendaView.qml'
--- AgendaView.qml	2016-03-02 14:34:14 +0000
+++ AgendaView.qml	2016-03-02 14:34:14 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2014 Canonical Ltd
+ * Copyright (C) 2013-2016 Canonical Ltd
  *
  * This file is part of Ubuntu Calendar App
  *
@@ -19,9 +19,12 @@
 import QtQuick 2.4
 import QtOrganizer 5.0
 import Ubuntu.Components 1.3
+<<<<<<< TREE
 import Ubuntu.Components.ListItems 1.0 as ListItem
 import "dateExt.js" as DateExt
 import "./3rd-party/lunar.js" as Lunar
+=======
+>>>>>>> MERGE-SOURCE
 
 PageWithBottomEdge {
     id: root
@@ -29,7 +32,7 @@
 
     property var anchorDate: new Date()
 
-    signal dateSelected(var date);
+    signal dateSelected(var date)
 
     function goToBeginning() {
         eventList.positionViewAtBeginning();
@@ -43,42 +46,28 @@
         return !!enabled_calendars.length;
     }
 
-
     Keys.forwardTo: [eventList]
     createEventAt: anchorDate
 
-    Action {
-        id: calendarTodayAction
-        objectName:"todaybutton"
-        iconName: "calendar-today"
-        text: i18n.tr("Today")
-        onTriggered: {
-            anchorDate = new Date()
-            goToBeginning()
-        }
-    }
-
+    // Page Header
     header: PageHeader {
-        id: pageHeader
-
         title: i18n.tr("Agenda")
         leadingActionBar.actions: tabs.tabsAction
         trailingActionBar.actions: [
-            calendarTodayAction,
-            commonHeaderActions.showCalendarAction,
-            commonHeaderActions.reloadAction,
-            commonHeaderActions.syncCalendarAction,
-            commonHeaderActions.settingsAction
+            commonHeaderActions.settingsAction,
         ]
         flickable: eventList
     }
 
+
+    // ListModel to hold all events for upcoming 7days.
     EventListModel {
         id: eventListModel
+        objectName: "eventListModel"
+
         startPeriod: anchorDate.midnight();
         endPeriod: anchorDate.addDays(7).endOfDay()
         filter: model.filter
-
         sortOrders: [
             SortOrder{
                 blankPolicy: SortOrder.BlanksFirst
@@ -89,35 +78,32 @@
         ]
     }
 
+    // spinner. running while agenda is loading.
     ActivityIndicator {
+        z:2
         visible: running
         running: eventListModel.isLoading
         anchors.centerIn: parent
-        z:2
     }
 
+    // Label to be shown when there is no upcoming events or if no calendar is selected.
     Label {
         id: noEventsOrCalendarsLabel
-        text: {
-            var default_title = i18n.tr( "No upcoming events" );
-
-            if ( !root.hasEnabledCalendars() ) {
-                default_title = i18n.tr("You have no calendars enabled")
-            }
-
-            return default_title;
-        }
-        visible: (eventList.count === 0) && !eventListModel.isLoading
         anchors.centerIn: parent
+        visible: (eventList.itemCount === 0) && !eventListModel.isLoading
+        text: !root.hasEnabledCalendars() ? i18n.tr("You have no calendars enabled") : i18n.tr( "No upcoming events" )
     }
 
+    // button to be shown when no calendar is selected (onClick will take user to list of all calendars)
     Button {
+        anchors {
+            top: noEventsOrCalendarsLabel.bottom;
+            horizontalCenter: noEventsOrCalendarsLabel.horizontalCenter;
+            topMargin: units.gu(1.5)
+        }
+        color: UbuntuColors.orange
+        visible: !root.hasEnabledCalendars()
         text: i18n.tr( "Enable calendars" )
-        visible: !root.hasEnabledCalendars()
-        anchors.top: noEventsOrCalendarsLabel.bottom
-        anchors.horizontalCenter: noEventsOrCalendarsLabel.horizontalCenter
-        anchors.topMargin: units.gu( 1.5 )
-        color: UbuntuColors.orange
 
         onClicked: {
             pageStack.push(Qt.resolvedUrl("CalendarChoicePopup.qml"),{"model": model});
@@ -125,29 +111,37 @@
         }
     }
 
+    // Main ListView with all upcoming events.
     ListView {
         id: eventList
         objectName: "eventList"
-        model: eventListModel
+
         anchors.fill: parent
         visible: eventListModel.itemCount > 0
-
+        model: eventListModel
         delegate: listDelegate
     }
 
+    // Scrollbar
     Scrollbar{
         flickableItem: eventList
         align: Qt.AlignTrailing
     }
 
+    // ListView delegate
     Component{
         id: listDelegate
 
+        // Main item to hold listitem delegate.
         Item {
-            id: root
             property var event: eventListModel.items[index];
+            property var prevEvent: eventListModel.items[index-1];
+            property var date: event.startDateTime.toLocaleDateString()
+            property var startTime: event.startDateTime.toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
+            property var endTime: event.endDateTime.toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
 
             width: parent.width
+<<<<<<< TREE
             height: container.height
 
             onEventChanged: {
@@ -196,34 +190,39 @@
                 }
             }
 
+=======
+            height: eventContainer.height
+
+            // main Column to hold   header-(date) and event details-(start/end time, Description and location)
+>>>>>>> MERGE-SOURCE
             Column {
-                id: container
+                id: eventContainer
                 objectName: "eventContainer" + index
 
                 width: parent.width
                 anchors.top: parent.top
 
-                //Not using ListItem.Header because of bug #1380766
-                ListItem.Standard{
-                    id: headerContainer
-
-                    height: visible ? header.height + units.gu(1) : 0
+                // header ListItem eg. ( Friday, October 29th 2015 )
+                ListItem {
                     width: parent.width
+                    height: visible ? units.gu(4) : 0
+                    color: "#F7F7F7"
+                    highlightColor: "#EDEDED"
+                    visible: index === 0 ? true : prevEvent === undefined ? false : prevEvent.startDateTime.midnight() < event.startDateTime.midnight() ? true : false
 
-                    Label{
-                        id: header
-                        fontSize: "medium"
-                        width: parent.width
-                        elide: Text.ElideRight
-                        anchors {
-                            left: parent.left
-                            leftMargin: units.gu(1)
-                            verticalCenter: parent.verticalCenter
-                        }
+                    ListItemLayout {
+                        id: listitemlayout
+                        padding.top: units.gu(1)
+                        title.text: date
+                        title.color: event.startDateTime.toLocaleDateString() === new Date().toLocaleDateString() ? UbuntuColors.orange : UbuntuColors.darkGrey
                     }
+
+                    // onClicked new page with daily view will open.
                     onClicked: {
+                        Haptics.play()
                         dateSelected(event.startDateTime);
                     }
+<<<<<<< TREE
                     showDivider: false
                 }
                 ListItem.ThinDivider {}
@@ -276,6 +275,82 @@
                         }
                     }
                 }
+=======
+
+                }
+
+                // Main ListItem to hold details about event eg. ( 19:30 -   Beer with the team )
+                //                                               ( 20:00     Hicter             )
+                ListItem {
+                    id: detailsListItem
+
+                    width: parent.width
+                    height: detailsListitemlayout.height
+                    color: "white"
+                    highlightColor: "#F7F7F7"
+
+                    ListItemLayout {
+                        id: detailsListitemlayout
+
+                        title.font.bold: true
+                        title.text: event.displayLabel ? event.displayLabel : i18n.tr("no event name set")
+                        subtitle.font.pixelSize: title.font.pixelSize
+                        subtitle.text: event.location ? event.location : i18n.tr("no location")
+                        subtitle.color: event.location ? UbuntuColors.coolGrey : "#B3B3B3"
+                        subtitle.font.italic: event.location ? false : true
+
+
+                        // item to hold SlotsLayout.Leading items: timeStart timeEnad and little calendar indication icon.
+                        Item {
+                            width: timeLabelStart.width + units.gu(2)
+                            height: parent.height
+                            SlotsLayout.overrideVerticalPositioning: true
+                            SlotsLayout.position: SlotsLayout.Leading
+
+                            // Little icon in left top corner of every event to indicate color of the calendar.
+                            UbuntuShape {
+                                id: calendarIndicator
+
+                                anchors.verticalCenter: parent.verticalCenter
+                                width: units.gu(1)
+                                height: width
+                                aspect: UbuntuShape.DropShadow
+                                backgroundColor: eventListModel.collection(event.collectionId).color
+                            }
+
+                            // start time event Label
+                            Label {
+                                id: timeLabelStart
+
+                                anchors {left: calendarIndicator.right; leftMargin: units.gu(1)}
+                                fontSize: "small"
+                                y: detailsListitemlayout.mainSlot.y + detailsListitemlayout.title.y
+                                   + detailsListitemlayout.title.baselineOffset - baselineOffset
+                                text: startTime.concat('-')
+                            }
+
+                            // finish time event Label
+                            Label {
+                                id: timeLabelEnd
+
+                                anchors {left: calendarIndicator.right; leftMargin: units.gu(1)}
+                                fontSize: "small"
+                                y: detailsListitemlayout.mainSlot.y + detailsListitemlayout.subtitle.y
+                                   + detailsListitemlayout.subtitle.baselineOffset - baselineOffset;
+                                text: endTime
+                            }
+                        }
+
+                    }
+
+                    // new page will open to edit selected event
+                    onClicked: {
+                        Haptics.play()
+                        pageStack.push(Qt.resolvedUrl("EventDetails.qml"), {"event":event,"model":eventListModel});
+                    }
+                }
+
+>>>>>>> MERGE-SOURCE
             }
         }
     }