~pkunal-parmar/ubuntu-calendar-app/ICalImport

1 by Michael Hall
Initial code template
1
import QtQuick 2.0
2
import Ubuntu.Components 0.1
12.1.3 by Frank Mertens
Added the NewEvent component from the EventAPI_EventView branch
3
import Ubuntu.Components.Popups 0.1
212.4.23 by Kunal Parmar
review comment
4
import QtOrganizer 5.0
238.1.18 by Kunal Parmar
reverted un-necessary changes
5
import Ubuntu.SyncMonitor 0.1
12.2.5 by Kunal Parmar
Resolving the layout issue, temp commit for merging latest trunk code
6
72.2.22 by Kunal Parmar
temp merge
7
import "dateExt.js" as DateExt
8
1 by Michael Hall
Initial code template
9
MainView {
3 by Frank Mertens
Initial code for the month view. Also bootstrapped a small extension library for JS::Date.
10
    id: mainView
275.1.1 by Kunal Parmar
New Header transition
11
    useDeprecatedToolbar: false
246.1.1 by David Planella
Workaround for bug 1308343 to show the app's name in the title bar on the desktop
12
246.1.2 by David Planella
Fixed the comment for the app's title workaround
13
    // Work-around until this branch lands:
14
    // https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer/+merge/212496 
212.4.16 by Kunal Parmar
temp commit
15
    //property bool windowActive: typeof window != 'undefined'
16
    //onWindowActiveChanged: window.title = i18n.tr("Calendar")
246.1.1 by David Planella
Workaround for bug 1308343 to show the app's name in the title bar on the desktop
17
122.2.6 by Riccardo Padovani
Updated with last indication
18
    // Argument during startup
122.2.1 by Riccardo Padovani
Add support for Arguments
19
    Arguments {
20
        id: args;
21
122.2.6 by Riccardo Padovani
Updated with last indication
22
        // Example of argument: calendar:///new-event
23
24
        // IMPORTANT
25
        // Due to bug #1231558 you have to pass arguments BEFORE app:
26
        // qmlscene calendar:///new-event calendar.qml
27
277.2.1 by Riccardo Padovani
Started to work on support to launch the app on an event page
28
        defaultArgument.help: i18n.tr("Calendar app accept four arguments: --starttime, --endtime, --newevent and --eventid. They will be managed by system. See the source for a full comment about them");
122.2.6 by Riccardo Padovani
Updated with last indication
29
        //defaultArgument.required: false;
30
        defaultArgument.valueNames: ["URL"]
31
32
        /* ARGUMENTS on startup
33
         * (no one is required)
34
         *
35
         * Create a new event
36
         * Keyword: newevent
37
         *
38
         * Create a new event. If starttime or endtime are set they are used to set start and end time of the new event.
39
         * It accepts no value.
40
         *
41
         *
42
         * Choose the view
43
         * Keyword: starttime
44
         *
45
         * If newevent has been called, starttime is the start time of event. Otherwise is the day on which app is focused on startup.
46
         * It accepts an integer value of the number of seconds since UNIX epoch in the UTC timezone.
47
         * 0 means today.
48
         *
49
         * Keyword: endtime
50
         *
51
         * If newevent is set it's the end time of the event, has to be > of starttime.
52
         * If newevent isn't set and startime is set, its value is used to choose the right view.
53
         * If neither of precendet flags are set, endtime is ignored.
54
         * It accepts an integer value of the number of seconds since UNIX epoch in the UTC timezone.
277.2.1 by Riccardo Padovani
Started to work on support to launch the app on an event page
55
         *
56
         *
57
         * Open an existing event
58
         * Keyword: eventid (provisional)
59
         *
60
         * It takes a id of an event and open that event on full page
122.2.1 by Riccardo Padovani
Add support for Arguments
61
         */
277.2.3 by Riccardo Padovani
Working implementation following Kunal guidelines
62
        Argument {
63
            name: "eventid"
64
            required: false
65
            valueNames: ["EVENT_ID"]
66
        }
122.2.1 by Riccardo Padovani
Add support for Arguments
67
    }
68
8.2.1 by Zoltán Balogh
fix desktop file name and add application name property
69
    objectName: "calendar"
137.1.1 by Sergio Schvezov
Fixing namespace issues and adding calendar apparmor profile
70
    applicationName: "com.ubuntu.calendar"
8.2.1 by Zoltán Balogh
fix desktop file name and add application name property
71
224.1.1 by Marcin Lesniowski
fix #1297463, simply changed default window size
72
    width: units.gu(100)
3 by Frank Mertens
Initial code for the month view. Also bootstrapped a small extension library for JS::Date.
73
    height: units.gu(80)
183.1.1 by Kunal Parmar
Key Navigation implemented
74
    focus: true
234.1.4 by Kunal Parmar
Merge from trunk
75
    Keys.forwardTo: [pageStack.currentPage]
4.2.8 by Frank Mertens
Allow to select the current month with the tab bar.
76
279.2.1 by Alan Pope
start moving to new colours
77
    headerColor: "#E8E8E8"
78
    backgroundColor: "#f5f5f5"
79
    footerColor: "#ECECEC"
110.1.12 by Kunal Parmar
MainView anchoring to keyboard
80
    anchorToKeyboard: true
96.2.5 by Kunal Parmar
Theme and some other modification
81
238.1.18 by Kunal Parmar
reverted un-necessary changes
82
    SyncMonitor {
83
        id: syncMonitor
84
    }
253.5.1 by Renato Araujo Oliveira Filho
Integrated with SyncMonitor.
85
12.2.1 by Kunal Parmar
Details view changed to use DataService, pagestack used to push Details View
86
    PageStack {
87
        id: pageStack
12.2.6 by Kunal Parmar
Layout issue due to new page stack change resolved
88
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
89
        Component.onCompleted: push(tabs)
72.2.1 by Kunal Parmar
minor modification in dayview
90
234.1.4 by Kunal Parmar
Merge from trunk
91
        // This is for wait that the app is load when newEvent is invoked by argument
92
        Timer {
93
            id: timer
94
            interval: 200; running: false; repeat: false
95
            onTriggered: {
96
                tabs.newEvent();
97
            }
98
        }
99
212.4.28 by Kunal Parmar
Timer approach
100
        Timer {
101
            id: applyFilterTimer
102
            interval: 200; running: false; repeat: false
103
            onTriggered: {
104
                eventModel.applyFilterFinal();
105
            }
106
        }
107
354.1.1 by Kunal Parmar
intersaction filter used
108
        UnionFilter {
109
            id: itemTypeFilter
110
            DetailFieldFilter{
111
                id: eventFilter
112
                detail: Detail.ItemType;
113
                field: Type.FieldType
114
                value: Type.Event
115
                matchFlags: Filter.MatchExactly
116
            }
212.4.28 by Kunal Parmar
Timer approach
117
354.1.1 by Kunal Parmar
intersaction filter used
118
            DetailFieldFilter{
119
                id: eventOccurenceFilter
120
                detail: Detail.ItemType;
121
                field: Type.FieldType
122
                value: Type.EventOccurrence
123
                matchFlags: Filter.MatchExactly
124
            }
212.4.28 by Kunal Parmar
Timer approach
125
        }
126
127
        CollectionFilter{
128
            id: collectionFilter
129
        }
130
234.1.4 by Kunal Parmar
Merge from trunk
131
        EventListModel{
132
            id: eventModel
212.4.26 by Kunal Parmar
merge from trunk
133
212.4.12 by Kunal Parmar
review comment addressed
134
            autoUpdate: true
135
            startPeriod: tabs.currentDay
136
            endPeriod: tabs.currentDay
137
354.1.1 by Kunal Parmar
intersaction filter used
138
            filter: IntersectionFilter {
139
                filters: [ collectionFilter, itemTypeFilter]
212.4.28 by Kunal Parmar
Timer approach
140
            }
141
142
            function delayedApplyFilter() {
143
                applyFilterTimer.restart();
144
            }
145
146
            function applyFilterFinal() {
212.4.12 by Kunal Parmar
review comment addressed
147
                var collectionIds = [];
148
                var collections = eventModel.getCollections();
149
                for(var i=0; i < collections.length ; ++i) {
150
                    var collection = collections[i]
151
                    if(collection.extendedMetaData("collection-selected") === true) {
152
                        collectionIds.push(collection.collectionId);
153
                    }
154
                }
212.4.28 by Kunal Parmar
Timer approach
155
                collectionFilter.ids = collectionIds;
212.4.12 by Kunal Parmar
review comment addressed
156
            }
277.2.3 by Riccardo Padovani
Working implementation following Kunal guidelines
157
158
            Component.onCompleted: {
212.4.28 by Kunal Parmar
Timer approach
159
                delayedApplyFilter();
160
277.2.3 by Riccardo Padovani
Working implementation following Kunal guidelines
161
                if (args.values.eventid) {
162
                    var requestId = "";
163
                    eventModel.onItemsFetched.connect( function(id,fetchedItems) {
164
                        if( requestId === id && fetchedItems.length > 0 ) {
165
                            var event = fetchedItems[0];
166
                            pageStack.push(Qt.resolvedUrl("EventDetails.qml"),{"event":event,"model": eventModel});
167
                        }
168
                    });
169
                    requestId = eventModel.fetchItems([args.values.eventid]);
170
                }
171
            }
234.1.4 by Kunal Parmar
Merge from trunk
172
        }
173
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
174
        Tabs{
175
            id: tabs
234.1.7 by Kunal Parmar
Loader used to load page
176
            Keys.forwardTo: [tabs.currentPage.item]
72.2.1 by Kunal Parmar
minor modification in dayview
177
72.2.22 by Kunal Parmar
temp merge
178
            property var currentDay: DateExt.today();
124.3.2 by Kunal Parmar
Global model date init
179
122.2.6 by Riccardo Padovani
Updated with last indication
180
            // Arguments on startup
181
            property bool newevent: false;
182
            property int starttime: -1;
183
            property int endtime: -1;
184
249.1.1 by Kunal Parmar
MonthView to default View
185
            selectedTabIndex: monthTab.index
186
72.2.3 by Kunal Parmar
ToolbarActions to ToolbarItems
187
            function newEvent() {
122.2.10 by Riccardo Padovani
Updated to last version
188
                var startDate = new Date();
189
                var endDate = new Date();
122.2.1 by Riccardo Padovani
Add support for Arguments
190
                var startTime;
191
                var endTime;
192
122.2.10 by Riccardo Padovani
Updated to last version
193
                if (starttime === 0) { // startime 0 means now
194
                    if (endtime !== -1) { // If also endtime has been invoked
195
                        endTime = parseInt(endtime);
196
                        if (endTime > startDate) // If endtime is after startime
197
                            endDate = new Date(endTime);
198
                    }
199
                }
200
                else if (starttime !== -1) { // If starttime has been invoked
201
                    startTime = parseInt(starttime);
202
                    startDate = new Date(startTime);
203
                    if (endtime !== -1) { // If --endtime has been invoked
204
                        endTime = parseInt(endtime);
205
                        if (endTime > startDate)
206
                            endDate = new Date(endTime);
207
                    }
208
                }
233.1.6 by Kunal Parmar
Command line argument case handled
209
                pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"startDate": startDate, "endDate": endDate, "model":eventModel});
122.2.1 by Riccardo Padovani
Add support for Arguments
210
            }
211
212
            // This function calculate the difference between --endtime and --starttime and choose the better view
213
            function calculateDifferenceStarttimeEndtime(startTime, endTime) {
214
                var minute = 60 * 1000;
215
                var hour = 60 * minute;
216
                var day = 24 * hour;
217
                var month = 30 * day;
218
219
                var difference = endTime - startTime;
220
221
                if (difference > month)
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
222
                    return yearTab.index;   // Year view
122.2.1 by Riccardo Padovani
Add support for Arguments
223
                else if (difference > 7 * day)
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
224
                    return monthTab.index;   // Month view}
122.2.1 by Riccardo Padovani
Add support for Arguments
225
                else if (difference > day)
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
226
                    return weekTab.index;   // Week view
122.2.1 by Riccardo Padovani
Add support for Arguments
227
                else
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
228
                    return dayTab.index;   // Day view
72.2.3 by Kunal Parmar
ToolbarActions to ToolbarItems
229
            }
230
122.2.6 by Riccardo Padovani
Updated with last indication
231
            // This function parse the argument
232
            function parseArguments(url) {
233
                var newevenpattern= new RegExp ("newevent");
234
                var starttimepattern = new RegExp ("starttime=\\d+");
235
                var endtimepattern = new RegExp ("endtime=\\d+");
236
237
                newevent = newevenpattern.test(url);
238
239
                if (starttimepattern.test(url))
240
                    starttime = url.match(/starttime=(\d+)/)[0].replace("starttime=", '');
241
242
                if (endtimepattern.test(url))
243
                    endtime = url.match(/endtime=(\d+)/)[0].replace("endtime=", '');
244
            }
245
72.2.5 by Kunal Parmar
goto today changed
246
            Component.onCompleted: {
122.2.6 by Riccardo Padovani
Updated with last indication
247
                // If an url has been set
248
                if (args.defaultArgument.at(0)) {
249
                    parseArguments(args.defaultArgument.at(0))
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
250
                    tabs.currentDay = new Date()
122.2.6 by Riccardo Padovani
Updated with last indication
251
                    // If newevent has been called on startup
252
                    if (newevent) {
122.2.12 by Riccardo Padovani
Fixed newEvent argument, thanks to Kunal
253
                        timer.running = true;
122.2.6 by Riccardo Padovani
Updated with last indication
254
                    }
255
                    else if (starttime !== -1) { // If no newevent has been setted, but starttime
256
                        var startTime = parseInt(starttime);
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
257
                        tabs.currentDay = new Date(startTime);
122.2.6 by Riccardo Padovani
Updated with last indication
258
259
                        // If also endtime has been settend
260
                        if (endtime !== -1) {
261
                            var endTime = parseInt(endtime);
262
                            tabs.selectedTabIndex = calculateDifferenceStarttimeEndtime(startTime, endTime);
263
                        }
264
                        else {
265
                            // If no endtime has been setted, open the starttime date in day view
212.1.2 by nskaggs
revert to 211
266
                            tabs.selectedTabIndex = 3;
122.2.6 by Riccardo Padovani
Updated with last indication
267
                        }
268
                    } // End of else if (starttime)
122.2.8 by Riccardo Padovani
Set Month View as startup view
269
                    else {
180.1.1 by nskaggs
Tweak for swipe timing and slower device issues
270
                        // Due to bug #1231558 {if (args.defaultArgument.at(0))} is always true
271
                        // After the fix we can delete this else
212.1.2 by nskaggs
revert to 211
272
                        tabs.selectedTabIndex= 1;
122.2.8 by Riccardo Padovani
Set Month View as startup view
273
                    }
122.2.6 by Riccardo Padovani
Updated with last indication
274
                } // End of if about args.values
122.2.1 by Riccardo Padovani
Add support for Arguments
275
                else {
212.1.2 by nskaggs
revert to 211
276
                    tabs.selectedTabIndex= 1;
122.2.1 by Riccardo Padovani
Add support for Arguments
277
                }
278
            } // End of Component.onCompleted:
72.2.5 by Kunal Parmar
goto today changed
279
72.2.18 by Kunal Parmar
tabs uses the page now
280
            ToolbarItems {
72.2.19 by Kunal Parmar
Typo resolved
281
                id: commonToolBar
72.2.5 by Kunal Parmar
goto today changed
282
79.1.2 by Olivier Tilloy
Replace the deprecated ToolbarActions with the newer ToolbarItems API.
283
                ToolbarButton {
284
                    action: Action {
142.1.1 by Kunal Parmar
Icons added
285
                        iconSource: Qt.resolvedUrl("calendar-today.svg");
79.1.2 by Olivier Tilloy
Replace the deprecated ToolbarActions with the newer ToolbarItems API.
286
                        text: i18n.tr("Today");
275.1.10 by Kunal Parmar
object name moved to action to resolve AP
287
                        objectName: "todaybutton"
79.1.2 by Olivier Tilloy
Replace the deprecated ToolbarActions with the newer ToolbarItems API.
288
                        onTriggered: {
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
289
                            tabs.currentDay = (new Date()).midnight();
234.1.7 by Kunal Parmar
Loader used to load page
290
                            if(yearViewLoader.item ) yearViewLoader.item.currentYear = tabs.currentDay.getFullYear();
291
                            if(monthViewLoader.item ) monthViewLoader.item.currentMonth = tabs.currentDay.midnight();
292
                            if(weekViewLoader.item ) weekViewLoader.item.dayStart = tabs.currentDay;
293
                            if(dayViewLoader.item ) dayViewLoader.item.currentDay = tabs.currentDay;
279.1.2 by Kunal Parmar
review comment
294
                            if(agendaViewLoader.item ) {
295
                                agendaViewLoader.item.currentDay = tabs.currentDay;
296
                                agendaViewLoader.item.goToBeginning();
297
                            }
79.1.2 by Olivier Tilloy
Replace the deprecated ToolbarActions with the newer ToolbarItems API.
298
                        }
299
                    }
300
                }
110.1.1 by Kunal Parmar
NewEventPage created
301
                ToolbarButton {
302
                    action: Action {
275.1.10 by Kunal Parmar
object name moved to action to resolve AP
303
                        objectName: "neweventbutton"
308.1.2 by Mihir Soni
using SDK icon for New Event
304
                        iconName: "new-event"
110.1.14 by Kunal Parmar
NewEvent to Event Name
305
                        text: i18n.tr("New Event");
110.1.1 by Kunal Parmar
NewEventPage created
306
                        onTriggered: {
212.4.13 by Kunal Parmar
Newevent fix
307
                            pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"date":tabs.currentDay,"model":eventModel});
110.1.1 by Kunal Parmar
NewEventPage created
308
                        }
309
                    }
310
                }
212.4.1 by Kunal Parmar
Initial version of Cal Management
311
                ToolbarButton{
312
                    action:Action{
212.4.27 by Kunal Parmar
merge issue resolved
313
                        iconName: "new-event"
212.4.1 by Kunal Parmar
Initial version of Cal Management
314
                        text: i18n.tr("Calendars");
315
                        onTriggered: {
212.4.10 by Kunal Parmar
merge from trunk
316
                            pageStack.push(Qt.resolvedUrl("CalendarChoicePopup.qml"),{"model":eventModel});
212.4.28 by Kunal Parmar
Timer approach
317
                            pageStack.currentPage.collectionUpdated.connect(eventModel.delayedApplyFilter);
212.4.1 by Kunal Parmar
Initial version of Cal Management
318
                        }
319
                    }
320
                }
253.5.1 by Renato Araujo Oliveira Filho
Integrated with SyncMonitor.
321
                ToolbarButton {
322
                    objectName: "syncbutton"
323
                    visible: syncMonitor.enabledServices ? syncMonitor.serviceIsEnabled("calendar") : false
324
                    action: Action {
325
                        text: enabled ? i18n.tr("Sync") : i18n.tr("Syncing")
326
                        iconName: "reload"
327
                        onTriggered: syncMonitor.sync(["calendar"])
328
                        enabled: (syncMonitor.state !== "syncing")
329
                    }
330
                }
69.1.1 by Kunal Parmar
Initial WeekRibbon and WeekView implementation
331
            }
332
183.1.1 by Kunal Parmar
Key Navigation implemented
333
            Keys.onTabPressed: {
334
                if( event.modifiers & Qt.ControlModifier) {
335
                    var currentTab = tabs.selectedTabIndex;
336
                    currentTab ++;
337
                    if( currentTab >= tabs.tabChildren.length){
338
                        currentTab = 0;
339
                    }
340
                    tabs.selectedTabIndex = currentTab;
341
                }
342
            }
343
183.1.4 by Kunal Parmar
YearView jump resolved and backtab implemented
344
            Keys.onBacktabPressed: {
345
                if( event.modifiers & Qt.ControlModifier) {
346
                    var currentTab = tabs.selectedTabIndex;
347
                    currentTab --;
348
                    if( currentTab < 0){
349
                        currentTab = tabs.tabChildren.length -1;
350
                    }
351
                    tabs.selectedTabIndex = currentTab;
352
                }
353
            }
354
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
355
            Tab{
356
                id: yearTab
357
                objectName: "yearTab"
358
                title: i18n.tr("Year")
234.1.7 by Kunal Parmar
Loader used to load page
359
                page: Loader{
360
                    id: yearViewLoader
361
                    objectName: "yearViewLoader"
362
                    source: tabs.selectedTab == yearTab ? Qt.resolvedUrl("YearView.qml"):""
363
                    onLoaded: {
364
                        item.tools = Qt.binding(function() { return commonToolBar })
365
                        item.currentYear = tabs.currentDay.getFullYear();
366
                    }
367
368
                    anchors{
369
                        left: parent.left
370
                        right: parent.right
371
                        bottom: parent.bottom
372
                    }
373
374
                    Connections{
375
                        target: yearViewLoader.item
376
                        onMonthSelected: {
377
                            var now = DateExt.today();
378
                            if( date.getMonth() === now.getMonth()
379
                                    && date.getFullYear() === now.getFullYear()) {
380
                                tabs.currentDay = now;
381
                            } else {
382
                                tabs.currentDay = date.midnight();
383
                            }
384
                            tabs.selectedTabIndex = monthTab.index;
72.2.1 by Kunal Parmar
minor modification in dayview
385
                        }
174.1.16 by Kunal Parmar
Connections used
386
                    }
72.2.1 by Kunal Parmar
minor modification in dayview
387
                }
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
388
            }
234.1.5 by Kunal Parmar
merge issue fixed
389
234.1.7 by Kunal Parmar
Loader used to load page
390
            Tab{
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
391
                id: monthTab
392
                objectName: "monthTab"
393
                title: i18n.tr("Month")
234.1.7 by Kunal Parmar
Loader used to load page
394
                page: Loader{
395
                    id: monthViewLoader
396
                    objectName: "monthViewLoader"
397
                    source: tabs.selectedTab == monthTab ? Qt.resolvedUrl("MonthView.qml"):""
398
                    onLoaded: {
399
                        item.tools = Qt.binding(function() { return commonToolBar })
400
                        item.currentMonth = tabs.currentDay.midnight();
401
                    }
402
403
                    anchors{
404
                        left: parent.left
405
                        right: parent.right
406
                        bottom: parent.bottom
407
                    }
408
409
                    Connections{
410
                        target: monthViewLoader.item
411
                        onDateSelected: {
412
                            tabs.currentDay = date;
413
                            tabs.selectedTabIndex = dayTab.index;
414
                        }
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
415
                    }
416
                }
417
            }
234.1.5 by Kunal Parmar
merge issue fixed
418
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
419
            Tab{
420
                id: weekTab
421
                objectName: "weekTab"
422
                title: i18n.tr("Week")
234.1.7 by Kunal Parmar
Loader used to load page
423
                page: Loader{
424
                    id: weekViewLoader
425
                    objectName: "weekViewLoader"
426
                    source: tabs.selectedTab == weekTab ? Qt.resolvedUrl("WeekView.qml"):""
427
                    onLoaded: {
428
                        item.tools = Qt.binding(function() { return commonToolBar })
429
                        item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == weekTab })
430
                        item.dayStart = tabs.currentDay;
431
                    }
432
433
                    anchors{
434
                        left: parent.left
435
                        right: parent.right
436
                        bottom: parent.bottom
437
                    }
438
439
                    Connections{
440
                        target: weekViewLoader.item
441
                        onDayStartChanged: {
442
                            tabs.currentDay = weekViewLoader.item.dayStart;
443
                        }
444
445
                        onDateSelected: {
446
                            tabs.currentDay = date;
447
                            tabs.selectedTabIndex = dayTab.index;
448
                        }
234.1.1 by Kunal Parmar
Unnecessary Top Page removed
449
                    }
450
                }
451
            }
452
453
            Tab{
454
                id: dayTab
455
                objectName: "dayTab"
456
                title: i18n.tr("Day")
234.1.7 by Kunal Parmar
Loader used to load page
457
                page: Loader{
458
                    id: dayViewLoader
459
                    objectName: "dayViewLoader"
460
                    source: tabs.selectedTab == dayTab ? Qt.resolvedUrl("DayView.qml"):""
461
                    onLoaded: {
462
                        item.tools = Qt.binding(function() { return commonToolBar })
463
                        item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == dayTab })
464
                        item.currentDay = tabs.currentDay;
465
                    }
466
467
                    anchors{
468
                        left: parent.left
469
                        right: parent.right
470
                        bottom: parent.bottom
471
                    }
472
473
                    Connections{
474
                        target: dayViewLoader.item
475
                        onCurrentDayChanged: {
476
                            tabs.currentDay = dayViewLoader.item.currentDay;
477
                        }
63.1.1 by Kunal Parmar
year view implementation
478
                    }
479
                }
480
            }
279.1.1 by Kunal Parmar
Agenda view created
481
482
            Tab {
483
                id: agendaTab
484
                objectName: "agendaTab"
485
                title: i18n.tr("Agenda")
486
                page: Loader {
487
                    id: agendaViewLoader
488
                    objectName: "agendaViewLoader"
489
                    source: tabs.selectedTab == agendaTab ? Qt.resolvedUrl("AgendaView.qml"):""
490
491
                    onLoaded: {
492
                        item.tools = Qt.binding(function() { return commonToolBar })
493
                        item.currentDay = tabs.currentDay;
494
                    }
495
496
                    anchors{
497
                        left: parent.left
498
                        right: parent.right
499
                        bottom: parent.bottom
500
                    }
501
                }
502
            }
12.2.4 by Kunal Parmar
Broken layout fixes, due to new pagestack changes
503
        }
504
    }
1 by Michael Hall
Initial code template
505
}