3 import "../../LichViet/main.js" as Script
8 // Year item dimensions
9 property int yearWidth: (width-2*spacing)*0.4
10 property int yearHeight: height
11 // Month item dimensions
12 property int monthWidth: (width-2*spacing)*0.3
13 property int monthHeight: height
14 // Day item dimensions
15 property int dayWidth: (width-2*spacing)*0.3
16 property int dayHeight: height
18 property string fontName: 'Helvetica'
19 property int fontSize: 22
20 property color fontColor: "#666666"
21 // Spacing between items
22 property int spacing: 8
24 property Component itemBackground: Component {
26 border { top: 8; bottom: 8; left: 8; right: 8 }
27 source: theme_manager.theme.datepicker.button
30 property Component itemBackgroundPressed: Component {
32 border { top: 8; bottom: 8; left: 8; right: 8 }
33 source: theme_manager.theme.datepicker.button_pressed
40 Component.onCompleted: {
46 width: container.dayWidth
47 height: container.dayHeight
49 fontColor: container.fontColor
50 fontName: container.fontName
51 fontSize: container.fontSize
53 bgPressed: itemBackgroundPressed
54 opacity: (index+1 < days.start || index+1 > days.end) ? 0.5 : 1.0
61 width: container.monthWidth
62 height: container.monthHeight
64 fontColor: container.fontColor
65 fontName: container.fontName
66 fontSize: container.fontSize
68 bgPressed: itemBackgroundPressed
76 width: container.yearWidth
77 height: container.yearHeight
79 fontColor: container.fontColor
80 fontName: container.fontName
81 fontSize: container.fontSize
83 bgPressed: itemBackgroundPressed
90 spacing: container.spacing
94 width: container.dayWidth
95 height: container.dayHeight
101 if (day.index+1 < days.start) day.index = days.start-1;
102 else if (day.index+1 > days.end ) day.index = days.end-1;
105 datePicker.mDay = day.index + 1;
106 datePicker.mMonth = month.index + 1;
107 datePicker.mYear = year.index + 1900;
113 width: container.monthWidth
114 height: container.monthHeight
116 delegate: monthDelegate
121 datePicker.mDay = day.index + 1;
122 datePicker.mMonth = month.index + 1;
123 datePicker.mYear = year.index + 1900;
129 width: container.yearWidth
130 height: container.yearHeight
132 delegate: yearDelegate
137 datePicker.mDay = day.index + 1;
138 datePicker.mMonth = month.index + 1;
139 datePicker.mYear = year.index + 1900;
149 property int start: 1
152 Component.onCompleted: {
154 day.index = Script.curDay - 1
155 end = Script.calDaysX(month.index+1,year.index+1900);
159 var howmanydays = Script.calDaysX(month.index+1,year.index+1900);
162 if (day.index+1 < days.start) day.index = days.start-1;
163 else if (day.index+1 > days.end ) day.index = days.end-1;
167 for(var j=1;j<=31;j++){
169 append({number:"0"+j})
176 day.index = Script.curDay-1;
182 Component.onCompleted: {
183 for(var j=1;j<=12;j++){
185 append({number:"0"+j})
189 month.index = Script.curMonth - 1
193 month.index = Script.curMonth - 1;
199 Component.onCompleted: {
200 for(var i=1900;i<2099;i++){
203 year.index = Script.curYear - 1900
207 year.index = Script.curYear - 1900
211 function day_reset(){
212 datePicker.mDay = Script.curDay
216 function month_reset(){
217 datePicker.mMonth = Script.curMonth
221 function year_reset(){
222 datePicker.mYear = Script.curYear