Gary.Wang has proposed merging 
lp:~gary-wzl77/ubuntu-calendar-app/show-week-number into lp:ubuntu-calendar-app.

Commit message:
Show week number in monthly and yearly view.

Requested reviews:
  Alan Pope  (popey)

For more details, see:
https://code.launchpad.net/~gary-wzl77/ubuntu-calendar-app/show-week-number/+merge/264153

Show week number in monthly and yearly view.
1.Navigate to day view when clicking weeknum in monthly view
2.Navigate to monthly view when clicking weeknum in yearly view 
-- 
Your team Ubuntu Calendar Developers is subscribed to branch 
lp:ubuntu-calendar-app.
=== modified file 'MonthComponent.qml'
--- MonthComponent.qml	2015-06-11 14:07:51 +0000
+++ MonthComponent.qml	2015-07-08 14:06:30 +0000
@@ -30,6 +30,7 @@
 
     property var currentMonth;
     property var isYearView;
+    property bool showWeekNumber:true;
 
     property string dayLabelFontSize: "medium"
     property string dateLabelFontSize: "large"
@@ -123,7 +124,10 @@
         id: column
 
         anchors {
-            fill: parent
+            left: weekNumLoader.right;
+            right: parent.right;
+            top: parent.top;
+            bottom: parent.bottom;
             topMargin: units.gu(1.5)
             bottomMargin: units.gu(1)
         }
@@ -191,6 +195,60 @@
         }
     }
 
+    Loader {
+        id: weekNumLoader;
+        anchors.left: parent.left;
+        width: showWeekNumber ? parent.width / 8:0;
+        height: parent.height;
+        visible: showWeekNumber;
+        sourceComponent: showWeekNumber ? weekNumComp : undefined;
+    }
+
+    Component {
+        id: weekNumComp
+
+        Column {
+            id: weekNumColumn;
+
+            anchors {
+                fill: parent
+                topMargin: monthGrid.y + units.gu(1.5)
+                bottomMargin: units.gu(1)
+            }
+
+            Repeater {
+                id: weekNumrepeater;
+                model: 6;
+
+                Label{
+                    id: weekNum
+                    objectName: "weekNum" + index
+                    width: height;
+                    height: weekNumColumn.height / 6;
+                    text: isYearView ? i18n.tr("W") + intern.monthStart.addDays(index * 7).weekNumber(Qt.locale().firstDayOfWeek) :
+                                       i18n.tr("Wk") + intern.monthStart.addDays(index * 7).weekNumber(Qt.locale().firstDayOfWeek)
+                    horizontalAlignment: Text.AlignLeft;
+                    verticalAlignment: Text.AlignVCenter;
+                    font.pixelSize: intern.dayFontSize - 3;
+                    font.bold: true
+                    color: "black"
+
+                    MouseArea {
+                        anchors.fill: parent
+                        onClicked: {
+                            var selectedDate = new Date(intern.monthStart.addDays(index * 7))
+                            if( isYearView ) {
+                                root.monthSelected(selectedDate);
+                            } else {
+                                root.dateSelected(selectedDate);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     Component{
         id: defaultDateLabelComponent
         MonthComponentDateDelegate{

=== modified file 'po/com.ubuntu.calendar.pot'
--- po/com.ubuntu.calendar.pot	2015-06-23 15:59:08 +0000
+++ po/com.ubuntu.calendar.pot	2015-07-08 14:06:30 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-06-23 23:57+0800\n"
+"POT-Creation-Date: 2015-07-08 21:59+0800\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <l...@li.org>\n"
@@ -132,11 +132,11 @@
 msgid "Delete this"
 msgstr ""
 
-#: ../DeleteConfirmationDialog.qml:51 ../EventDetails.qml:188
+#: ../DeleteConfirmationDialog.qml:51 ../NewEvent.qml:68
 msgid "Delete"
 msgstr ""
 
-#: ../EditEventConfirmationDialog.qml:29 ../NewEvent.qml:304
+#: ../EditEventConfirmationDialog.qml:29 ../NewEvent.qml:319
 msgid "Edit Event"
 msgstr ""
 
@@ -154,7 +154,7 @@
 msgid "Edit this"
 msgstr ""
 
-#: ../EventActions.qml:50 ../NewEvent.qml:304
+#: ../EventActions.qml:50 ../NewEvent.qml:319
 msgid "New Event"
 msgstr ""
 
@@ -165,7 +165,7 @@
 msgid "%1 <b>%2</b>"
 msgstr ""
 
-#: ../EventDetails.qml:42 ../NewEvent.qml:415
+#: ../EventDetails.qml:42 ../NewEvent.qml:430
 msgid "Event Details"
 msgstr ""
 
@@ -185,15 +185,15 @@
 msgid "%1 (All Day)"
 msgstr ""
 
-#: ../EventDetails.qml:201
+#: ../EventDetails.qml:192
 msgid "Edit"
 msgstr ""
 
-#: ../EventDetails.qml:352 ../NewEvent.qml:517
+#: ../EventDetails.qml:343 ../NewEvent.qml:532
 msgid "Guests"
 msgstr ""
 
-#: ../EventDetails.qml:395 ../EventReminder.qml:35 ../NewEvent.qml:614
+#: ../EventDetails.qml:386 ../EventReminder.qml:35 ../NewEvent.qml:629
 msgid "Reminder"
 msgstr ""
 
@@ -216,7 +216,7 @@
 #. TRANSLATORS: this refers to how often a recurrent event repeats
 #. and it is shown as the header of the option selector to choose
 #. its repetition
-#: ../EventRepetition.qml:237 ../NewEvent.qml:598
+#: ../EventRepetition.qml:237 ../NewEvent.qml:613
 msgid "Repeats"
 msgstr ""
 
@@ -259,51 +259,59 @@
 msgid "After Date"
 msgstr ""
 
-#: ../NewEvent.qml:68
+#: ../MonthComponent.qml:228
+msgid "W"
+msgstr ""
+
+#: ../MonthComponent.qml:229
+msgid "Wk"
+msgstr ""
+
+#: ../NewEvent.qml:84
 msgid "Save"
 msgstr ""
 
-#: ../NewEvent.qml:177
+#: ../NewEvent.qml:192
 msgid "End time can't be before start time"
 msgstr ""
 
-#: ../NewEvent.qml:314
+#: ../NewEvent.qml:329
 msgid "Error"
 msgstr ""
 
-#: ../NewEvent.qml:316
+#: ../NewEvent.qml:331
 msgid "OK"
 msgstr ""
 
-#: ../NewEvent.qml:369
+#: ../NewEvent.qml:384
 msgid "From"
 msgstr ""
 
-#: ../NewEvent.qml:382
+#: ../NewEvent.qml:397
 msgid "To"
 msgstr ""
 
-#: ../NewEvent.qml:399
+#: ../NewEvent.qml:414
 msgid "All day event"
 msgstr ""
 
-#: ../NewEvent.qml:428
+#: ../NewEvent.qml:443
 msgid "Event Name"
 msgstr ""
 
-#: ../NewEvent.qml:446
+#: ../NewEvent.qml:461
 msgid "Description"
 msgstr ""
 
-#: ../NewEvent.qml:464
+#: ../NewEvent.qml:479
 msgid "Location"
 msgstr ""
 
-#: ../NewEvent.qml:479 com.ubuntu.calendar_calendar.desktop.in.in.h:1
+#: ../NewEvent.qml:494 com.ubuntu.calendar_calendar.desktop.in.in.h:1
 msgid "Calendar"
 msgstr ""
 
-#: ../NewEvent.qml:521
+#: ../NewEvent.qml:536
 msgid "Add Guest"
 msgstr ""
 

-- 
Mailing list: https://launchpad.net/~ubuntu-touch-coreapps-reviewers
Post to     : ubuntu-touch-coreapps-reviewers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ubuntu-touch-coreapps-reviewers
More help   : https://help.launchpad.net/ListHelp

Reply via email to