Merge lp:~gary-wzl77/ubuntu-calendar-app/lunar_calendar_support into lp:ubuntu-calendar-app

Proposed by Gary.Wang
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 754
Merged at revision: 755
Proposed branch: lp:~gary-wzl77/ubuntu-calendar-app/lunar_calendar_support
Merge into: lp:ubuntu-calendar-app
Prerequisite: lp:~gary-wzl77/ubuntu-calendar-app/show-week-number
Diff against target: 1170 lines (+776/-35)
17 files modified
3rd-party/lunar.js (+515/-0)
AgendaView.qml (+11/-3)
AllDayEventComponent.qml (+0/-3)
CMakeLists.txt (+2/-0)
DayView.qml (+15/-0)
EventDetails.qml (+42/-7)
HeaderDateComponent.qml (+14/-0)
MonthComponent.qml (+4/-1)
MonthComponentDateDelegate.qml (+52/-2)
MonthView.qml (+21/-2)
Settings.qml (+38/-7)
ViewHeader.qml (+21/-2)
WeekView.qml (+15/-0)
YearView.qml (+13/-1)
YearViewDelegate.qml (+1/-0)
calendar.qml (+1/-1)
po/zh_CN.po (+11/-6)
To merge this branch: bzr merge lp:~gary-wzl77/ubuntu-calendar-app/lunar_calendar_support
Reviewer Review Type Date Requested Status
Jenkins Bot continuous-integration Approve
Nicholas Skaggs (community) Needs Fixing
Alan Pope 🍺🐧🐱 🦄 (community) Approve
Yuan-Chen Cheng Pending
Review via email: mp+278288@code.launchpad.net

Commit message

Add lunar calendar support

Description of the change

Add lunar calendar support

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :

LGTM. Thanks Gary!

review: Approve
Revision history for this message
Ethan Chang (ethan.chang) wrote :

Verified with com.ubuntu.calendar 0.4.
The lunar calendar works well on Arale and also compared result with baidu lunar calendar.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/12/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1427/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/148/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1478/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/226/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1536/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/228/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1540/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/229/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1541/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/230/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1542/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/231/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1543/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/232/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1544/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
Approved revid is not set in launchpad. This is most likely a launchpad issue and re-approve should fix it. There is also a chance (although a very small one) this is a permission problem of the ps-jenkins bot.
https://core-apps-jenkins.ubuntu.com/job/run-ap-tests-autolanding/830/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1545/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :

FAILED: Autolanding.
More details in the following jenkins job:
https://core-apps-jenkins.ubuntu.com/job/calendar-app-autolanding/235/
Executed test runs:
    None: https://core-apps-jenkins.ubuntu.com/job/generic-land-mp/1547/console

review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

I'm not sure what is wrong with the branch, but bzr REALLY REALLY doesn't like it. It also doesn't merge cleanly anymore :-(

Text conflict in DayView.qml
Text conflict in HeaderDateComponent.qml
Text conflict in MonthComponentDateDelegate.qml
Text conflict in MonthView.qml
Text conflict in ViewHeader.qml
Text conflict in WeekView.qml
Text conflict in YearView.qml
Text conflict in calendar.qml
Text conflict in po/com.ubuntu.calendar.pot
9 conflicts encountered.

Can you fix the conflicts or better -- create a fresh branch from trunk and submit?

review: Needs Fixing
752. By Renato Araujo Oliveira Filho

Simplify Tab loading, declaring individual components for each tab.
Make sure that year view is not loaded on app startup without request.

Approved by Jenkins Bot, Alan Pope .

753. By Kunal Parmar

resolves Bug #1476032. Fixes: https://bugs.launchpad.net/bugs/1369543, https://bugs.launchpad.net/bugs/1476032.

Approved by Jenkins Bot.

754. By Gary.Wang

Merge from trunk and resolve the conflict

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory '3rd-party'
2=== added file '3rd-party/lunar.js'
3--- 3rd-party/lunar.js 1970-01-01 00:00:00 +0000
4+++ 3rd-party/lunar.js 2016-02-03 08:08:26 +0000
5@@ -0,0 +1,515 @@
6+/**
7+* @1900-2100区间内的公历、农历互转
8+* @charset UTF-8
9+* @Author Ajing(JJonline@JJonline.Cn)
10+* @Time 2014-7-21
11+* @Version $ID$
12+* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
13+* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
14+* http://blog.jjonline.cn/userInterFace/173.html
15+*/
16+var calendar = {
17+
18+ /**
19+ * 农历1900-2100的润大小信息表
20+ * @Array Of Property
21+ * @return Hex
22+ */
23+ lunarInfo:[0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,//1900-1909
24+ 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,//1910-1919
25+ 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,//1920-1929
26+ 0x06566,0x0d4a0,0x0ea50,0x06e95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,//1930-1939
27+ 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,//1940-1949
28+ 0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,//1950-1959
29+ 0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,//1960-1969
30+ 0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,//1970-1979
31+ 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,//1980-1989
32+ 0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x055c0,0x0ab60,0x096d5,0x092e0,//1990-1999
33+ 0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,//2000-2009
34+ 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,//2010-2019
35+ 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,//2020-2029
36+ 0x05aa0,0x076a3,0x096d0,0x04bd7,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,//2030-2039
37+ 0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,//2040-2049
38+ /**Add By JJonline@JJonline.Cn**/
39+ 0x14b63,0x09370,0x049f8,0x04970,0x064b0,0x168a6,0x0ea50, 0x06b20,0x1a6c4,0x0aae0,//2050-2059
40+ 0x0a2e0,0x0d2e3,0x0c960,0x0d557,0x0d4a0,0x0da50,0x05d55,0x056a0,0x0a6d0,0x055d4,//2060-2069
41+ 0x052d0,0x0a9b8,0x0a950,0x0b4a0,0x0b6a6,0x0ad50,0x055a0,0x0aba4,0x0a5b0,0x052b0,//2070-2079
42+ 0x0b273,0x06930,0x07337,0x06aa0,0x0ad50,0x14b55,0x04b60,0x0a570,0x054e4,0x0d160,//2080-2089
43+ 0x0e968,0x0d520,0x0daa0,0x16aa6,0x056d0,0x04ae0,0x0a9d4,0x0a2d0,0x0d150,0x0f252,//2090-2099
44+ 0x0d520],//2100
45+
46+
47+ /**
48+ * 公历每个月份的天数普通表
49+ * @Array Of Property
50+ * @return Number
51+ */
52+ solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31],
53+
54+
55+ /**
56+ * 天干地支之天干速查表
57+ * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
58+ * @return Cn string
59+ */
60+ Gan:["\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"],
61+
62+
63+ /**
64+ * 天干地支之地支速查表
65+ * @Array Of Property
66+ * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
67+ * @return Cn string
68+ */
69+ Zhi:["\u5b50","\u4e11","\u5bc5","\u536f","\u8fb0","\u5df3","\u5348","\u672a","\u7533","\u9149","\u620c","\u4ea5"],
70+
71+
72+ /**
73+ * 天干地支之地支速查表<=>生肖
74+ * @Array Of Property
75+ * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
76+ * @return Cn string
77+ */
78+ Animals:["\u9f20","\u725b","\u864e","\u5154","\u9f99","\u86c7","\u9a6c","\u7f8a","\u7334","\u9e21","\u72d7","\u732a"],
79+
80+
81+ /**
82+ * 24节气速查表
83+ * @Array Of Property
84+ * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
85+ * @return Cn string
86+ */
87+ solarTerm:["\u5c0f\u5bd2","\u5927\u5bd2","\u7acb\u6625","\u96e8\u6c34","\u60ca\u86f0","\u6625\u5206","\u6e05\u660e","\u8c37\u96e8","\u7acb\u590f","\u5c0f\u6ee1","\u8292\u79cd","\u590f\u81f3","\u5c0f\u6691","\u5927\u6691","\u7acb\u79cb","\u5904\u6691","\u767d\u9732","\u79cb\u5206","\u5bd2\u9732","\u971c\u964d","\u7acb\u51ac","\u5c0f\u96ea","\u5927\u96ea","\u51ac\u81f3"],
88+
89+
90+ /**
91+ * 1900-2100各年的24节气日期速查表
92+ * @Array Of Property
93+ * @return 0x string For splice
94+ */
95+ sTermInfo:[ '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f',
96+ '97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
97+ '97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa',
98+ '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f',
99+ 'b027097bd097c36b0b6fc9274c91aa','9778397bd19801ec9210c965cc920e','97b6b97bd19801ec95f8c965cc920f',
100+ '97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2','9778397bd197c36c9210c9274c91aa',
101+ '97b6b97bd19801ec95f8c965cc920e','97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2',
102+ '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec95f8c965cc920e','97bcf97c3598082c95f8e1cfcc920f',
103+ '97bd097bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e',
104+ '97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
105+ '97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722',
106+ '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f',
107+ '97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
108+ '97bcf97c359801ec95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa',
109+ '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722',
110+ '9778397bd097c36b0b6fc9210c8dc2','9778397bd19801ec9210c9274c920e','97b6b97bd19801ec95f8c965cc920f',
111+ '97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
112+ '97b6b97bd19801ec95f8c965cc920f','97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2',
113+ '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e','97bd07f1487f595b0b0bc920fb0722',
114+ '7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
115+ '97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
116+ '97b6b97bd19801ec9210c965cc920e','97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
117+ '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf7f1487f531b0b0bb0b6fb0722',
118+ '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e',
119+ '97bcf7f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
120+ '97b6b97bd19801ec9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
121+ '9778397bd097c36b0b6fc9210c91aa','97b6b97bd197c36c9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722',
122+ '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e',
123+ '97b6b7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2',
124+ '9778397bd097c36b0b70c9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
125+ '7f0e397bd097c35b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
126+ '7f0e27f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
127+ '97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
128+ '9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
129+ '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721',
130+ '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa',
131+ '97b6b7f0e47f531b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
132+ '9778397bd097c36b0b6fc9210c91aa','97b6b7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
133+ '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','977837f0e37f149b0723b0787b0721',
134+ '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c35b0b6fc9210c8dc2',
135+ '977837f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722',
136+ '7f0e397bd097c35b0b6fc9210c8dc2','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
137+ '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','977837f0e37f14998082b0787b06bd',
138+ '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722',
139+ '977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722',
140+ '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
141+ '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd',
142+ '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722',
143+ '977837f0e37f14998082b0723b06bd','7f07e7f0e37f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
144+ '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b0721',
145+ '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f595b0b0bb0b6fb0722','7f0e37f0e37f14898082b0723b02d5',
146+ '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f531b0b0bb0b6fb0722',
147+ '7f0e37f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
148+ '7f0e37f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd',
149+ '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35',
150+ '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722',
151+ '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f149b0723b0787b0721',
152+ '7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0723b06bd',
153+ '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722','7f0e37f0e366aa89801eb072297c35',
154+ '7ec967f0e37f14998082b0723b06bd','7f07e7f0e37f14998083b0787b0721','7f0e27f0e47f531b0723b0b6fb0722',
155+ '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14898082b0723b02d5','7f07e7f0e37f14998082b0787b0721',
156+ '7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5',
157+ '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35',
158+ '665f67f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721',
159+ '7f0e36665b66a449801e9808297c35','665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd',
160+ '7f07e7f0e47f531b0723b0b6fb0721','7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35',
161+ '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722'],
162+
163+
164+ /**
165+ * 数字转中文速查表
166+ * @Array Of Property
167+ * @trans ['日','一','二','三','四','五','六','七','八','九','十']
168+ * @return Cn string
169+ */
170+ nStr1:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341"],
171+
172+
173+ /**
174+ * 日期转农历称呼速查表
175+ * @Array Of Property
176+ * @trans ['初','十','廿','卅']
177+ * @return Cn string
178+ */
179+ nStr2:["\u521d","\u5341","\u5eff","\u5345"],
180+
181+
182+ /**
183+ * 月份转农历称呼速查表
184+ * @Array Of Property
185+ * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
186+ * @return Cn string
187+ */
188+ nStr3:["\u6b63","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u51ac","\u814a"],
189+
190+
191+ /**
192+ * 返回农历y年一整年的总天数
193+ * @param lunar Year
194+ * @return Number
195+ * @eg:var count = calendar.lYearDays(1987) ;//count=387
196+ */
197+ lYearDays:function(y) {
198+ var i, sum = 348;
199+ for(i=0x8000; i>0x8; i>>=1) { sum += (calendar.lunarInfo[y-1900] & i)? 1: 0; }
200+ return(sum+calendar.leapDays(y));
201+ },
202+
203+
204+ /**
205+ * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
206+ * @param lunar Year
207+ * @return Number (0-12)
208+ * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
209+ */
210+ leapMonth:function(y) { //闰字编码 \u95f0
211+ return(calendar.lunarInfo[y-1900] & 0xf);
212+ },
213+
214+
215+ /**
216+ * 返回农历y年闰月的天数 若该年没有闰月则返回0
217+ * @param lunar Year
218+ * @return Number (0、29、30)
219+ * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
220+ */
221+ leapDays:function(y) {
222+ if(calendar.leapMonth(y)) {
223+ return((calendar.lunarInfo[y-1900] & 0x10000)? 30: 29);
224+ }
225+ return(0);
226+ },
227+
228+
229+ /**
230+ * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
231+ * @param lunar Year
232+ * @return Number (-1、29、30)
233+ * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
234+ */
235+ monthDays:function(y,m) {
236+ if(m>12 || m<1) {return -1}//月份参数从1至12,参数错误返回-1
237+ return( (calendar.lunarInfo[y-1900] & (0x10000>>m))? 30: 29 );
238+ },
239+
240+
241+ /**
242+ * 返回公历(!)y年m月的天数
243+ * @param solar Year
244+ * @return Number (-1、28、29、30、31)
245+ * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
246+ */
247+ solarDays:function(y,m) {
248+ if(m>12 || m<1) {return -1} //若参数错误 返回-1
249+ var ms = m-1;
250+ if(ms==1) { //2月份的闰平规律测算后确认返回28或29
251+ return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28);
252+ }else {
253+ return(calendar.solarMonth[ms]);
254+ }
255+ },
256+
257+
258+ /**
259+ * 传入offset偏移量返回干支
260+ * @param offset 相对甲子的偏移量
261+ * @return Cn string
262+ */
263+ toGanZhi:function(offset) {
264+ return(calendar.Gan[offset%10]+calendar.Zhi[offset%12]);
265+ },
266+
267+
268+ /**
269+ * 传入公历(!)y年获得该年第n个节气的公历日期
270+ * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
271+ * @return day Number
272+ * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
273+ */
274+ getTerm:function(y,n) {
275+ if(y<1900 || y>2100) {return -1;}
276+ if(n<1 || n>24) {return -1;}
277+ var _table = calendar.sTermInfo[y-1900];
278+ var _info = [
279+ parseInt('0x'+_table.substr(0,5)).toString() ,
280+ parseInt('0x'+_table.substr(5,5)).toString(),
281+ parseInt('0x'+_table.substr(10,5)).toString(),
282+ parseInt('0x'+_table.substr(15,5)).toString(),
283+ parseInt('0x'+_table.substr(20,5)).toString(),
284+ parseInt('0x'+_table.substr(25,5)).toString()
285+ ];
286+ var _calday = [
287+ _info[0].substr(0,1),
288+ _info[0].substr(1,2),
289+ _info[0].substr(3,1),
290+ _info[0].substr(4,2),
291+
292+ _info[1].substr(0,1),
293+ _info[1].substr(1,2),
294+ _info[1].substr(3,1),
295+ _info[1].substr(4,2),
296+
297+ _info[2].substr(0,1),
298+ _info[2].substr(1,2),
299+ _info[2].substr(3,1),
300+ _info[2].substr(4,2),
301+
302+ _info[3].substr(0,1),
303+ _info[3].substr(1,2),
304+ _info[3].substr(3,1),
305+ _info[3].substr(4,2),
306+
307+ _info[4].substr(0,1),
308+ _info[4].substr(1,2),
309+ _info[4].substr(3,1),
310+ _info[4].substr(4,2),
311+
312+ _info[5].substr(0,1),
313+ _info[5].substr(1,2),
314+ _info[5].substr(3,1),
315+ _info[5].substr(4,2),
316+ ];
317+ return parseInt(_calday[n-1]);
318+ },
319+
320+
321+ /**
322+ * 传入农历数字月份返回汉语通俗表示法
323+ * @param lunar month
324+ * @return Cn string
325+ * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
326+ */
327+ toChinaMonth:function(m) { // 月 => \u6708
328+ if(m>12 || m<1) {return -1} //若参数错误 返回-1
329+ var s = calendar.nStr3[m-1];
330+ s+= "\u6708";//加上月字
331+ return s;
332+ },
333+
334+
335+ /**
336+ * 传入农历日期数字返回汉字表示法
337+ * @param lunar day
338+ * @return Cn string
339+ * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
340+ */
341+ toChinaDay:function(d){ //日 => \u65e5
342+ var s;
343+ switch (d) {
344+ case 10:
345+ s = '\u521d\u5341'; break;
346+ case 20:
347+ s = '\u4e8c\u5341'; break;
348+ break;
349+ case 30:
350+ s = '\u4e09\u5341'; break;
351+ break;
352+ default :
353+ s = calendar.nStr2[Math.floor(d/10)];
354+ s += calendar.nStr1[d%10];
355+ }
356+ return(s);
357+ },
358+
359+
360+ /**
361+ * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
362+ * @param y year
363+ * @return Cn string
364+ * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
365+ */
366+ getAnimal: function(y) {
367+ return calendar.Animals[(y - 4) % 12]
368+ },
369+
370+
371+ /**
372+ * 传入公历年月日获得详细的公历、农历object信息 <=>JSON
373+ * @param y solar year
374+ * @param m solar month
375+ * @param d solar day
376+ * @return JSON object
377+ * @eg:console.log(calendar.solar2lunar(1987,11,01));
378+ */
379+ solar2lunar:function (y,m,d) { //参数区间1900.1.31~2100.12.31
380+ if(y<1900 || y>2100) {return -1;}//年份限定、上限
381+ if(y==1900&&m==1&&d<31) {return -1;}//下限
382+ if(!y) { //未传参 获得当天
383+ var objDate = new Date();
384+ }else {
385+ var objDate = new Date(y,parseInt(m)-1,d)
386+ }
387+ var i, leap=0, temp=0;
388+ //修正ymd参数
389+ var y = objDate.getFullYear(),m = objDate.getMonth()+1,d = objDate.getDate();
390+ var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - Date.UTC(1900,0,31))/86400000;
391+ for(i=1900; i<2101 && offset>0; i++) { temp=calendar.lYearDays(i); offset-=temp; }
392+ if(offset<0) { offset+=temp; i--; }
393+
394+ //是否今天
395+ var isTodayObj = new Date(),isToday=false;
396+ if(isTodayObj.getFullYear()==y && isTodayObj.getMonth()+1==m && isTodayObj.getDate()==d) {
397+ isToday = true;
398+ }
399+ //星期几
400+ var nWeek = objDate.getDay(),cWeek = calendar.nStr1[nWeek];
401+ if(nWeek==0) {nWeek =7;}//数字表示周几顺应天朝周一开始的惯例
402+ //农历年
403+ var year = i;
404+
405+ var leap = calendar.leapMonth(i); //闰哪个月
406+ var isLeap = false;
407+
408+ //效验闰月
409+ for(i=1; i<13 && offset>0; i++) {
410+ //闰月
411+ if(leap>0 && i==(leap+1) && isLeap==false){
412+ --i;
413+ isLeap = true; temp = calendar.leapDays(year); //计算农历闰月天数
414+ }
415+ else{
416+ temp = calendar.monthDays(year, i);//计算农历普通月天数
417+ }
418+ //解除闰月
419+ if(isLeap==true && i==(leap+1)) { isLeap = false; }
420+ offset -= temp;
421+ }
422+
423+ if(offset==0 && leap>0 && i==leap+1)
424+ if(isLeap){
425+ isLeap = false;
426+ }else{
427+ isLeap = true; --i;
428+ }
429+ if(offset<0){ offset += temp; --i; }
430+ //农历月
431+ var month = i;
432+ //农历日
433+ var day = offset + 1;
434+
435+ //天干地支处理
436+ var sm = m-1;
437+ var term3 = calendar.getTerm(year,3); //该农历年立春日期
438+ var gzY = calendar.toGanZhi(year-4);//普通按年份计算,下方尚需按立春节气来修正
439+
440+ //依据立春日进行修正gzY
441+ if(sm<2 && d<term3) {
442+ gzY = calendar.toGanZhi(year-5);
443+ }else {
444+ gzY = calendar.toGanZhi(year-4);
445+ }
446+
447+ //月柱 1900年1月小寒以前为 丙子月(60进制12)
448+ var firstNode = calendar.getTerm(y,(m*2-1));//返回当月「节」为几日开始
449+ var secondNode = calendar.getTerm(y,(m*2));//返回当月「节」为几日开始
450+
451+ //依据12节气修正干支月
452+ var gzM = calendar.toGanZhi((y-1900)*12+m+11);
453+ if(d>=firstNode) {
454+ gzM = calendar.toGanZhi((y-1900)*12+m+12);
455+ }
456+
457+ //传入的日期的节气与否
458+ var isTerm = false;
459+ var Term = null;
460+ if(firstNode==d) {
461+ isTerm = true;
462+ Term = calendar.solarTerm[m*2-2];
463+ }
464+ if(secondNode==d) {
465+ isTerm = true;
466+ Term = calendar.solarTerm[m*2-1];
467+ }
468+ //日柱 当月一日与 1900/1/1 相差天数
469+ var dayCyclical = Date.UTC(y,sm,1,0,0,0,0)/86400000+25567+10;
470+ var gzD = calendar.toGanZhi(dayCyclical+d-1);
471+
472+ return {'lYear':year,'lMonth':month,'lDay':day,'Animal':calendar.getAnimal(year),'IMonthCn':(isLeap?"\u95f0":'')+calendar.toChinaMonth(month),'IDayCn':calendar.toChinaDay(day),'cYear':y,'cMonth':m,'cDay':d,'gzYear':gzY,'gzMonth':gzM,'gzDay':gzD,'isToday':isToday,'isLeap':isLeap,'nWeek':nWeek,'ncWeek':"\u661f\u671f"+cWeek,'isTerm':isTerm,'Term':Term};
473+ },
474+
475+
476+ /**
477+ * 传入公历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
478+ * @param y lunar year
479+ * @param m lunar month
480+ * @param d lunar day
481+ * @param isLeapMonth lunar month is leap or not.
482+ * @return JSON object
483+ * @eg:console.log(calendar.lunar2solar(1987,9,10));
484+ */
485+ lunar2solar:function(y,m,d,isLeapMonth) { //参数区间1900.1.31~2100.12.1
486+ var leapOffset = 0;
487+ var leapMonth = calendar.leapMonth(y);
488+ var leapDay = calendar.leapDays(y);
489+ if(isLeapMonth&&(leapMonth!=m)) {return -1;}//传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同
490+ if(y==2100&&m==12&&d>1 || y==1900&&m==1&&d<31) {return -1;}//超出了最大极限值
491+ var day = calendar.monthDays(y,m);
492+ if(y<1900 || y>2100 || d>day) {return -1;}//参数合法性效验
493+
494+ //计算农历的时间差
495+ var offset = 0;
496+ for(var i=1900;i<y;i++) {
497+ offset+=calendar.lYearDays(i);
498+ }
499+ var leap = 0,isAdd= false;
500+ for(var i=1;i<m;i++) {
501+ leap = calendar.leapMonth(y);
502+ if(!isAdd) {//处理闰月
503+ if(leap<=i && leap>0) {
504+ offset+=calendar.leapDays(y);isAdd = true;
505+ }
506+ }
507+ offset+=calendar.monthDays(y,i);
508+ }
509+ //转换闰月农历 需补充该年闰月的前一个月的时差
510+ if(isLeapMonth) {offset+=day;}
511+ //1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
512+ var stmap = Date.UTC(1900,1,30,0,0,0);
513+ var calObj = new Date((offset+d-31)*86400000+stmap);
514+ var cY = calObj.getUTCFullYear();
515+ var cM = calObj.getUTCMonth()+1;
516+ var cD = calObj.getUTCDate();
517+
518+ return calendar.solar2lunar(cY,cM,cD);
519+ }
520+};
521
522=== modified file 'AgendaView.qml'
523--- AgendaView.qml 2016-02-01 12:08:51 +0000
524+++ AgendaView.qml 2016-02-03 08:08:26 +0000
525@@ -21,6 +21,7 @@
526 import Ubuntu.Components 1.3
527 import Ubuntu.Components.ListItems 1.0 as ListItem
528 import "dateExt.js" as DateExt
529+import "./3rd-party/lunar.js" as Lunar
530
531 Page{
532 id: root
533@@ -175,7 +176,16 @@
534 // while the second one (%2) refers to the end time
535 var timeString = i18n.tr("%1 - %2").arg(startTime).arg(endTime)
536
537- header.text = date
538+ if (mainView.displayLunarCalendar) {
539+ var lunarDate = Lunar.calendar.solar2lunar(event.startDateTime.getFullYear(),
540+ event.startDateTime.getMonth() + 1,
541+ event.startDateTime.getDate())
542+ header.text = i18n.tr("%1 %2 %3 %4 %5").arg(lunarDate.gzYear).arg(lunarDate .IMonthCn).arg(lunarDate.IDayCn)
543+ .arg(lunarDate.gzDay).arg(lunarDate.isTerm ? lunarDate.Term : "")
544+ } else {
545+ header.text = date
546+ }
547+
548 timeLabel.text = timeString
549 header.color = event.startDateTime.toLocaleDateString() === new Date().toLocaleDateString() ? UbuntuColors.orange : UbuntuColors.darkGrey
550 detailsContainer.color = eventListModel.collection(event.collectionId).color
551@@ -228,8 +238,6 @@
552 height: detailsColumn.height + units.gu(1)
553
554 ListItem.Standard{
555-
556-
557 showDivider:false
558 Column{
559 id: detailsColumn
560
561=== modified file 'AllDayEventComponent.qml'
562--- AllDayEventComponent.qml 2016-01-29 14:35:14 +0000
563+++ AllDayEventComponent.qml 2016-02-03 08:08:26 +0000
564@@ -40,9 +40,6 @@
565 for(var i = 0 ; i < items.length ; ++i) {
566 var event = items[(i)];
567 if( event && event.allDay ) {
568-
569- console.log("event.startDateTime", event.startDateTime," event.endDateTime",event.endDateTime);
570-
571 for(var d = event.startDateTime; d < event.endDateTime; d = d.addDays(1)) {
572 var key = Qt.formatDateTime(d, "dd-MMM-yyyy");
573 if( !(key in map)) {
574
575=== modified file 'CMakeLists.txt'
576--- CMakeLists.txt 2014-09-25 21:34:16 +0000
577+++ CMakeLists.txt 2016-02-03 08:08:26 +0000
578@@ -75,6 +75,8 @@
579
580 install(FILES ${APPLICATION_FILE} DESTINATION ${APPLICATION_DIR})
581
582+install(DIRECTORY "3rd-party" DESTINATION ${DATA_DIR})
583+
584 # Tests
585 enable_testing()
586
587
588=== modified file 'DayView.qml'
589--- DayView.qml 2016-02-01 12:08:51 +0000
590+++ DayView.qml 2016-02-03 08:08:26 +0000
591@@ -20,6 +20,7 @@
592 import Ubuntu.Components 1.3
593 import "dateExt.js" as DateExt
594 import "ViewType.js" as ViewType
595+import "./3rd-party/lunar.js" as Lunar
596
597 Page{
598 id: dayViewPage
599@@ -144,4 +145,18 @@
600 }
601 }
602 }
603+
604+ Component.onCompleted: {
605+ pageHeader.title = Qt.binding(function(){
606+ if(mainView.displayLunarCalendar){
607+ var lunarDate = Lunar.calendar.solar2lunar(currentDay.getFullYear(),
608+ currentDay.getMonth() + 1,
609+ currentDay.getDate())
610+ return i18n.tr("%1 %2").arg(lunarDate .IMonthCn).arg(lunarDate.gzYear)
611+ } else {
612+ var monthName = currentDay.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
613+ return monthName[0].toUpperCase() + monthName.substr(1, monthName.length - 1)
614+ }
615+ })
616+ }
617 }
618
619=== modified file 'EventDetails.qml'
620--- EventDetails.qml 2016-01-29 14:35:14 +0000
621+++ EventDetails.qml 2016-02-03 08:08:26 +0000
622@@ -24,6 +24,7 @@
623
624 import "Defines.js" as Defines
625 import "dateExt.js" as DateExt
626+import "./3rd-party/lunar.js" as Lunar
627
628 Page {
629 id: root
630@@ -123,21 +124,55 @@
631 var startTime = e.startDateTime.toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
632 var endTime = e.endDateTime.toLocaleTimeString(Qt.locale(), Locale.ShortFormat)
633
634+ var lunarStartDate = null;
635+ var lunarEndDate = null;
636+ if (mainView.displayLunarCalendar) {
637+ lunarStartDate = Lunar.calendar.solar2lunar(e.startDateTime.getFullYear(),
638+ e.startDateTime.getMonth() + 1,
639+ e.startDateTime.getDate())
640+
641+ lunarEndDate = Lunar.calendar.solar2lunar(e.endDateTime.getFullYear(),
642+ e.endDateTime.getMonth() + 1,
643+ e.endDateTime.getDate())
644+ }
645+
646 if( e.allDay ) {
647 var days = Math.floor((e.endDateTime - e.startDateTime) / Date.msPerDay);
648 if( days !== 1 ) {
649- dateLabel.text = i18n.tr("%1 - %2 (All Day)")
650- .arg( e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat))
651- .arg( e.endDateTime.addDays(-1).toLocaleDateString(Qt.locale(), Locale.LongFormat))
652+ if (mainView.displayLunarCalendar) {
653+ dateLabel.text = i18n.tr("%1 %2 %3 - %4 %5 %6 (All Day)")
654+ .arg(lunarStartDate.gzYear).arg(lunarStartDate .IMonthCn).arg(lunarStartDate.IDayCn)
655+ .arg(lunarEndDate.gzYear).arg(lunarEndDate .IMonthCn).arg(lunarEndDate.IDayCn)
656+ } else {
657+ dateLabel.text = i18n.tr("%1 - %2 (All Day)")
658+ .arg( e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat))
659+ .arg( e.endDateTime.addDays(-1).toLocaleDateString(Qt.locale(), Locale.LongFormat))
660+ }
661 } else {
662- dateLabel.text = i18n.tr("%1 (All Day)").arg( e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat))
663+ if (mainView.displayLunarCalendar) {
664+ dateLabel.text = i18n.tr("%1 %2 %3 (All Day)")
665+ .arg(lunarStartDate.gzYear).arg(lunarStartDate .IMonthCn).arg(lunarStartDate.IDayCn)
666+ } else {
667+ dateLabel.text = i18n.tr("%1 (All Day)").arg( e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat))
668+ }
669 }
670 } else {
671 if (e.endDateTime.getDate() !== e.startDateTime.getDate()) {
672- dateLabel.text = e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat) + ", " +startTime + " - "
673- + e.endDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat) + ", " + endTime;
674+ if (mainView.displayLunarCalendar) {
675+ dateLabel.text = i18n.tr("%1 %2 %3, %4 - %5 %6 %7, %8")
676+ .arg(lunarStartDate.gzYear).arg(lunarStartDate .IMonthCn).arg(lunarStartDate.IDayCn).arg(startTime)
677+ .arg(lunarEndDate.gzYear).arg(lunarEndDate .IMonthCn).arg(lunarEndDate.IDayCn).arg(endTime);
678+ } else {
679+ dateLabel.text = e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat) + ", " +startTime + " - "
680+ + e.endDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat) + ", " + endTime;
681+ }
682 } else {
683- dateLabel.text = e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat) + ", " +startTime + " - " + endTime;
684+ if (mainView.displayLunarCalendar) {
685+ dateLabel.text = i18n.tr("%1 %2 %3, %4 - %5")
686+ .arg(lunarStartDate.gzYear).arg(lunarStartDate .IMonthCn).arg(lunarStartDate.IDayCn).arg(startTime).arg(endTime);
687+ } else {
688+ dateLabel.text = e.startDateTime.toLocaleDateString(Qt.locale(), Locale.LongFormat) + ", " +startTime + " - " + endTime;
689+ }
690 }
691 }
692
693
694=== modified file 'HeaderDateComponent.qml'
695--- HeaderDateComponent.qml 2016-01-29 14:35:14 +0000
696+++ HeaderDateComponent.qml 2016-02-03 08:08:26 +0000
697@@ -18,6 +18,7 @@
698
699 import QtQuick 2.4
700 import Ubuntu.Components 1.3
701+import "./3rd-party/lunar.js" as Lunar
702
703 Item {
704 id: root
705@@ -79,4 +80,17 @@
706 root.dateSelected(date);
707 }
708 }
709+
710+ Component.onCompleted: {
711+ dateLabel.text = Qt.binding(function(){
712+ if(mainView.displayLunarCalendar){
713+ var lunarDate = Lunar.calendar.solar2lunar(date.getFullYear(),
714+ date.getMonth() + 1,
715+ date.getDate())
716+ return i18n.tr("%1 %2 %3").arg(lunarDate.IDayCn).arg(lunarDate.gzDay).arg(lunarDate.isTerm ? lunarDate.Term : "")
717+ } else {
718+ return date.getDate();
719+ }
720+ })
721+ }
722 }
723
724=== modified file 'MonthComponent.qml'
725--- MonthComponent.qml 2016-01-29 14:35:14 +0000
726+++ MonthComponent.qml 2016-02-03 08:08:26 +0000
727@@ -32,7 +32,9 @@
728 property var isYearView;
729 property var selectedDay;
730 property bool displayWeekNumber:false;
731+ property bool displayLunarCalendar: false;
732
733+ property string subLabelFontSize: "small"
734 property string dayLabelFontSize: "medium"
735 property string dateLabelFontSize: "large"
736 property string monthLabelFontSize: "large"
737@@ -93,7 +95,6 @@
738 property int todayMonth: today.getMonth()
739 property int todayYear: today.getFullYear()
740
741-
742 //date from month will start, this date might be from previous month
743 property var monthStart: currentMonth.weekStart( Qt.locale().firstDayOfWeek )
744 property int monthStartDate: monthStart.getDate()
745@@ -167,6 +168,7 @@
746 anchors.fill: parent
747 month: intern.curMonth
748 year: intern.curMonthYear
749+ daysInMonth: intern.daysInCurMonth
750
751 monthLabelFontSize: root.monthLabelFontSize
752 yearLabelFontSize: root.yearLabelFontSize
753@@ -334,6 +336,7 @@
754 width: parent.dayWidth
755 height: parent.dayHeight
756 fontSize: intern.dateFontSize
757+ showLunarCalendar: displayLunarCalendar
758 showEvent: showEvents
759 && intern.eventStatus !== undefined
760 && intern.eventStatus[index] !== undefined
761
762=== modified file 'MonthComponentDateDelegate.qml'
763--- MonthComponentDateDelegate.qml 2016-01-29 14:35:14 +0000
764+++ MonthComponentDateDelegate.qml 2016-02-03 08:08:26 +0000
765@@ -1,5 +1,6 @@
766 import QtQuick 2.4
767 import Ubuntu.Components 1.3
768+import "./3rd-party/lunar.js" as Lunar
769
770 Item{
771 id: dateRootItem
772@@ -8,6 +9,7 @@
773 property bool isCurrentMonth;
774 property bool isToday;
775 property bool showEvent;
776+ property bool showLunarCalendar;
777 property alias fontSize: dateLabel.font.pixelSize
778
779 property bool isSelected: false
780@@ -48,6 +50,50 @@
781 }
782
783 Loader{
784+ sourceComponent: showLunarCalendar ? reservedFiled : undefined
785+ onSourceComponentChanged: {
786+ if (item != undefined) {
787+ item.reservedData = Qt.binding(function(){
788+ var lunarDate = Lunar.calendar.solar2lunar(intern.monthStartYear,
789+ intern.monthStartMonth + 1,
790+ intern.monthStartDate + index)
791+ if (lunarDate.isTerm) {
792+ return {"lunarText": lunarDate.Term, "isTerm" :lunarDate.isTerm};
793+ } else {
794+ return {"lunarText": lunarDate.IDayCn, "isTerm" :lunarDate.isTerm};
795+ }
796+ })
797+ }
798+
799+ width = Qt.binding( function() { return units.gu(0.8)})
800+ height = Qt.binding( function() { return width })
801+ anchors.horizontalCenter = Qt.binding( function() { return parent.horizontalCenter })
802+ anchors.top = Qt.binding( function() { return parent.verticalCenter })
803+ anchors.topMargin = Qt.binding( function() {
804+ return (dateRootItem.height > dateRootItem.width ? dateRootItem.width :dateRootItem.height)/ 4.0 + units.gu(0.25)
805+ });
806+ }
807+ }
808+
809+ //this component is reserved for extra information display
810+ Component {
811+ id: reservedFiled
812+ Label {
813+ id: reservedLabel
814+ property var reservedData
815+ onReservedDataChanged: {
816+ text = reservedData.lunarText
817+ if (reservedData.isTerm)
818+ color = "red";
819+ }
820+
821+ horizontalAlignment: Text.AlignHCenter
822+ fontSize: root.subLabelFontSize
823+ color: "#5D5D5D"
824+ }
825+ }
826+
827+ Loader{
828 sourceComponent: showEvent ? eventIndicatorComp : undefined
829 onSourceComponentChanged: {
830 width = Qt.binding( function() { return units.gu(0.8)})
831@@ -55,8 +101,12 @@
832 anchors.horizontalCenter = Qt.binding( function() { return parent.horizontalCenter })
833 anchors.top = Qt.binding( function() { return parent.verticalCenter })
834 anchors.topMargin = Qt.binding( function() {
835- var w = (dateRootItem.height > dateRootItem.width ? dateRootItem.width :dateRootItem.height)/1.3
836- return (w/2) + units.gu(0.1)
837+ if (showLunarCalendar) {
838+ return (dateRootItem.height > dateRootItem.width ? dateRootItem.width :dateRootItem.height) / 2 + units.gu(1.5)
839+ } else {
840+ var w = (dateRootItem.height > dateRootItem.width ? dateRootItem.width :dateRootItem.height)/1.3
841+ return (w/2) + units.gu(0.1)
842+ }
843 });
844 }
845 }
846
847=== modified file 'MonthView.qml'
848--- MonthView.qml 2016-02-01 15:04:36 +0000
849+++ MonthView.qml 2016-02-03 08:08:26 +0000
850@@ -19,6 +19,7 @@
851 import Ubuntu.Components 1.3
852 import "dateExt.js" as DateExt
853 import "colorUtils.js" as Color
854+import "./3rd-party/lunar.js" as Lunar
855
856 Page {
857 id: monthViewPage
858@@ -111,8 +112,8 @@
859
860 showEvents: true
861
862- displayWeekNumber: mainView.displayWeekNumber;
863-
864+ displayWeekNumber: mainView.displayWeekNumber
865+ displayLunarCalendar: mainView.displayLunarCalendar
866 anchors.fill: parent
867
868 currentMonth: monthViewPath.addMonth(monthViewPath.startMonth,
869@@ -132,4 +133,22 @@
870 }
871 }
872 }
873+
874+ Component.onCompleted: {
875+ pageHeader.title = Qt.binding(function(){
876+ if(mainView.displayLunarCalendar){
877+ var year = currentMonth.getFullYear()
878+ var month = currentMonth.getMonth()
879+ var day = Math.floor(Date.daysInMonth(year, month) / 2.0)
880+ var lunarDate = Lunar.calendar.solar2lunar( year, month + 1, day)
881+ return i18n.tr("%1 %2").arg(lunarDate .IMonthCn).arg(lunarDate.gzYear)
882+ } else {
883+ // TRANSLATORS: this is a time formatting string,
884+ // see http://qt-project.org/doc/qt-5/qml-qtqml-date.html#details for valid expressions.
885+ // It's used in the header of the month and week views
886+ var monthName = currentMonth.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
887+ return monthName[0].toUpperCase() + monthName.substr(1, monthName.length - 1)
888+ }
889+ })
890+ }
891 }
892
893=== modified file 'Settings.qml'
894--- Settings.qml 2016-01-29 14:35:14 +0000
895+++ Settings.qml 2016-02-03 08:08:26 +0000
896@@ -52,29 +52,60 @@
897
898 Item{
899 width: parent.width;
900- height: Math.max(weekNumber.height, weekCheckBox.height)
901+ height: Math.max(weekNumber.height, weekCheckbox.height)
902
903 Label{
904 id: weekNumber;
905 objectName: "weekNumber"
906 text: i18n.tr("Show week numbers");
907 elide: Text.ElideRight
908- opacity: weekCheckBox.checked ? 1.0 : 0.8
909+ opacity: weekCheckbox.checked ? 1.0 : 0.8
910 color: UbuntuColors.midAubergine
911 anchors {
912 left: parent.left
913- right: weekCheckBox.left;
914+ right: weekCheckbox.left;
915 margins: units.gu(2)
916 verticalCenter: parent.verticalCenter
917 }
918 }
919
920 CheckBox {
921- id: weekCheckBox
922+ id: weekCheckbox
923 objectName: "weekCheckBox"
924 anchors.right:parent.right;
925 onCheckedChanged: {
926- mainView.displayWeekNumber = weekCheckBox.checked;
927+ mainView.displayWeekNumber = weekCheckbox.checked;
928+ }
929+ }
930+ }
931+
932+ ListItem.ThinDivider {}
933+
934+ Item{
935+ width: parent.width;
936+ height: Math.max(lunarCal.height, lunarCalCheckbox.height)
937+
938+ Label{
939+ id: lunarCal;
940+ objectName: "lunarCalendar"
941+ text: i18n.tr("Show lunar calendar");
942+ elide: Text.ElideRight
943+ opacity: lunarCalCheckbox.checked ? 1.0 : 0.8
944+ color: UbuntuColors.midAubergine
945+ anchors {
946+ left: parent.left
947+ right: lunarCalCheckbox.left;
948+ margins: units.gu(2)
949+ verticalCenter: parent.verticalCenter
950+ }
951+ }
952+
953+ CheckBox {
954+ id: lunarCalCheckbox
955+ objectName: "lunarCalCheckbox"
956+ anchors.right:parent.right;
957+ onCheckedChanged: {
958+ mainView.displayLunarCalendar = lunarCalCheckbox.checked
959 }
960 }
961 }
962@@ -83,7 +114,7 @@
963 }
964
965 Component.onCompleted: {
966- weekCheckBox.checked = mainView.displayWeekNumber;
967+ weekCheckbox.checked = mainView.displayWeekNumber
968+ lunarCalCheckbox.checked = mainView.displayLunarCalendar
969 }
970 }
971-
972
973=== modified file 'ViewHeader.qml'
974--- ViewHeader.qml 2016-01-29 14:35:14 +0000
975+++ ViewHeader.qml 2016-02-03 08:08:26 +0000
976@@ -17,6 +17,7 @@
977 */
978 import QtQuick 2.4
979 import Ubuntu.Components 1.3
980+import "./3rd-party/lunar.js" as Lunar
981
982 Item{
983 id: header
984@@ -25,6 +26,7 @@
985
986 property int month;
987 property int year;
988+ property int daysInMonth;
989
990 property string monthLabelFontSize: "large"
991 property string yearLabelFontSize: "large"
992@@ -33,7 +35,6 @@
993 id: monthLabel
994 objectName: "monthLabel"
995 fontSize: monthLabelFontSize
996- text: Qt.locale().standaloneMonthName(month)
997 anchors.leftMargin: units.gu(1)
998 anchors.left: parent.left
999 color:"black"
1000@@ -44,10 +45,28 @@
1001 id: yearLabel
1002 objectName: "yearLabel"
1003 fontSize: yearLabelFontSize
1004- text: year
1005 anchors.right: parent.right
1006 anchors.rightMargin: units.gu(1)
1007 color:"black"
1008 anchors.verticalCenter: parent.verticalCenter
1009 }
1010+
1011+ Component.onCompleted: {
1012+ yearLabel.text = Qt.binding(function(){
1013+ if (mainView.displayLunarCalendar) {
1014+ var lunarDate = Lunar.calendar.solar2lunar(year, month + 1, daysInMonth)
1015+ return lunarDate.gzYear
1016+ } else {
1017+ return year
1018+ }
1019+ })
1020+ monthLabel.text = Qt.binding(function(){
1021+ if (mainView.displayLunarCalendar) {
1022+ var lunarDate = Lunar.calendar.solar2lunar(year, month + 1, daysInMonth)
1023+ return lunarDate.IMonthCn
1024+ } else {
1025+ return Qt.locale().standaloneMonthName(month)
1026+ }
1027+ })
1028+ }
1029 }
1030
1031=== modified file 'WeekView.qml'
1032--- WeekView.qml 2016-02-01 12:08:51 +0000
1033+++ WeekView.qml 2016-02-03 08:08:26 +0000
1034@@ -20,6 +20,7 @@
1035 import Ubuntu.Components 1.3
1036 import "dateExt.js" as DateExt
1037 import "ViewType.js" as ViewType
1038+import "./3rd-party/lunar.js" as Lunar
1039
1040 Page{
1041 id: weekViewPage
1042@@ -167,4 +168,18 @@
1043 }
1044 }
1045 }
1046+
1047+ Component.onCompleted: {
1048+ pageHeader.title = Qt.binding(function(){
1049+ if(mainView.displayLunarCalendar){
1050+ var lunarDate = Lunar.calendar.solar2lunar(dayStart.getFullYear(),
1051+ dayStart.getMonth() + 1,
1052+ dayStart.getDate())
1053+ return i18n.tr("%1 %2").arg(lunarDate .IMonthCn).arg(lunarDate.gzYear)
1054+ } else {
1055+ var monthName = dayStart.toLocaleString(Qt.locale(),i18n.tr("MMMM yyyy"))
1056+ return monthName[0].toUpperCase() + monthName.substr(1, monthName.length - 1)
1057+ }
1058+ })
1059+ }
1060 }
1061
1062=== modified file 'YearView.qml'
1063--- YearView.qml 2016-02-01 12:08:51 +0000
1064+++ YearView.qml 2016-02-03 08:08:26 +0000
1065@@ -18,8 +18,9 @@
1066
1067 import QtQuick 2.4
1068 import Ubuntu.Components 1.3
1069-
1070 import "dateExt.js" as DateExt
1071+import "./3rd-party/lunar.js" as Lunar
1072+
1073 Page {
1074 id: yearViewPage
1075 objectName: "yearViewPage"
1076@@ -101,4 +102,15 @@
1077 }
1078 }
1079 }
1080+
1081+ Component.onCompleted: {
1082+ pageHeader.title = Qt.binding(function(){
1083+ if(mainView.displayLunarCalendar){
1084+ var lunarDate = Lunar.calendar.solar2lunar(currentYear, 6, 0)
1085+ return lunarDate.gzYear +" "+ lunarDate.Animal
1086+ } else {
1087+ return i18n.tr("Year %1").arg(currentYear)
1088+ }
1089+ })
1090+ }
1091 }
1092
1093=== modified file 'YearViewDelegate.qml'
1094--- YearViewDelegate.qml 2016-01-29 14:35:14 +0000
1095+++ YearViewDelegate.qml 2016-02-03 08:08:26 +0000
1096@@ -79,6 +79,7 @@
1097 showEvents: false
1098 currentMonth: new Date(yearView.year, index, 1, 0, 0, 0, 0)
1099 displayWeekNumber: mainView.displayWeekNumber;
1100+ displayLunarCalendar: false; //we disable lunar calendar display in yeaer view due to space
1101 isCurrentItem: yearView.focus
1102
1103 isYearView: true
1104
1105=== modified file 'calendar.qml'
1106--- calendar.qml 2016-02-02 01:55:55 +0000
1107+++ calendar.qml 2016-02-03 08:08:26 +0000
1108@@ -26,6 +26,7 @@
1109 id: mainView
1110
1111 property bool displayWeekNumber: false;
1112+ property bool displayLunarCalendar: false;
1113
1114 // Work-around until this branch lands:
1115 // https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer/+merge/212496
1116@@ -382,7 +383,6 @@
1117 tabs.isReady = true
1118 } // End of Component.onCompleted:
1119
1120-
1121 Keys.onTabPressed: {
1122 if( event.modifiers & Qt.ControlModifier) {
1123 var currentTab = tabs.selectedTabIndex;
1124
1125=== modified file 'po/zh_CN.po'
1126--- po/zh_CN.po 2016-01-30 05:42:26 +0000
1127+++ po/zh_CN.po 2016-02-03 08:08:26 +0000
1128@@ -6,17 +6,18 @@
1129 msgid ""
1130 msgstr ""
1131 "Project-Id-Version: ubuntu-calendar-app\n"
1132-"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
1133+"Report-Msgid-Bugs-To: \n"
1134 "POT-Creation-Date: 2015-11-01 10:45+0900\n"
1135 "PO-Revision-Date: 2015-07-23 03:38+0000\n"
1136 "Last-Translator: Ian Li <Unknown>\n"
1137 "Language-Team: Chinese (Simplified) <zh_CN@li.org>\n"
1138+"Language: \n"
1139 "MIME-Version: 1.0\n"
1140 "Content-Type: text/plain; charset=UTF-8\n"
1141 "Content-Transfer-Encoding: 8bit\n"
1142 "Plural-Forms: nplurals=1; plural=0;\n"
1143-"X-Launchpad-Export-Date: 2016-01-30 05:42+0000\n"
1144-"X-Generator: Launchpad (build 17908)\n"
1145+"X-Launchpad-Export-Date: 2015-11-08 05:43+0000\n"
1146+"X-Generator: Launchpad (build 17838)\n"
1147
1148 #: ../AgendaView.qml:51 ../DayView.qml:40 ../MonthView.qml:39
1149 #: ../WeekView.qml:44 ../YearView.qml:36
1150@@ -413,8 +414,8 @@
1151 "eventid. They will be managed by system. See the source for a full comment "
1152 "about them"
1153 msgstr ""
1154-"日历软件有四个参数:--starttime, --endtime, --newevent 和 --"
1155-"eventid,这些参数由系统管理,请查阅源代码了解更多信息"
1156+"日历软件有四个参数:--starttime, --endtime, --newevent 和 --eventid,这些参数"
1157+"由系统管理,请查阅源代码了解更多信息"
1158
1159 #: ../calendar.qml:354
1160 msgid "Year"
1161@@ -442,4 +443,8 @@
1162
1163 #: com.ubuntu.calendar_calendar.desktop.in.in.h:3
1164 msgid "calendar;event;day;week;year;appointment;meeting;"
1165-msgstr "calendar;event;day;week;year;appointment;meeting;日历;会;天;月;年;星期;周;"
1166+msgstr ""
1167+"calendar;event;day;week;year;appointment;meeting;日历;会;天;月;年;星期;周;"
1168+
1169+#~ msgid "Settings"
1170+#~ msgstr "设置"

Subscribers

People subscribed via source and target branches

to status/vote changes: