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

« back to all changes in this revision

Viewing changes to calendar.qml

  • Committer: Tarmac
  • Author(s): Mihir Soni, Nekhelesh Ramananthan
  • Date: 2014-09-19 11:02:21 UTC
  • mfrom: (455.3.6 1-RemovedDuplicateHeaders)
  • Revision ID: tarmac-20140919110221-lxuhy6y4b7kigyz7
Removed duplicate header section from views and added common header.

Approved by Ubuntu Phone Apps Jenkins Bot, Nekhelesh Ramananthan.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * You should have received a copy of the GNU General Public License
16
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
17
 */
18
 
import QtQuick 2.0
 
18
import QtQuick 2.3
19
19
import Ubuntu.Components 1.1
20
20
import Ubuntu.Components.Popups 1.0
21
21
import QtOrganizer 5.0
28
28
    useDeprecatedToolbar: false
29
29
 
30
30
    // Work-around until this branch lands:
31
 
    // https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer/+merge/212496 
 
31
    // https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer/+merge/212496
32
32
    //property bool windowActive: typeof window != 'undefined'
33
33
    //onWindowActiveChanged: window.title = i18n.tr("Calendar")
34
34
 
294
294
                }
295
295
            } // End of Component.onCompleted:
296
296
 
297
 
            ToolbarItems {
298
 
                id: commonToolBar
299
 
 
300
 
                ToolbarButton {
301
 
                    action: Action {
302
 
                        iconName: "calendar-today"
303
 
 
304
 
                        text: i18n.tr("Today");
305
 
                        objectName: "todaybutton"
306
 
                        onTriggered: {
307
 
                            tabs.currentDay = (new Date()).midnight();
308
 
                            if(yearViewLoader.item ) yearViewLoader.item.currentYear = tabs.currentDay.getFullYear();
309
 
                            if(monthViewLoader.item ) monthViewLoader.item.currentMonth = tabs.currentDay.midnight();
310
 
                            if(weekViewLoader.item ) weekViewLoader.item.dayStart = tabs.currentDay;
311
 
                            if(dayViewLoader.item ) dayViewLoader.item.currentDay = tabs.currentDay;
312
 
                            if(agendaViewLoader.item ) {
313
 
                                agendaViewLoader.item.currentDay = tabs.currentDay;
314
 
                                agendaViewLoader.item.goToBeginning();
315
 
                            }
316
 
                        }
317
 
                    }
318
 
                }
319
 
                ToolbarButton {
320
 
                    action: Action {
321
 
                        objectName: "neweventbutton"
322
 
                        iconName: "new-event"
323
 
                        text: i18n.tr("New Event");
324
 
                        onTriggered: {
325
 
                            pageStack.push(Qt.resolvedUrl("NewEvent.qml"),{"date":tabs.currentDay,"model":eventModel});
326
 
                        }
327
 
                    }
328
 
                }
329
 
                ToolbarButton{
330
 
                    action:Action{
331
 
                        iconName: "new-event"
332
 
                        text: i18n.tr("Calendars");
333
 
                        onTriggered: {
334
 
                            pageStack.push(Qt.resolvedUrl("CalendarChoicePopup.qml"),{"model":eventModel});
335
 
                            pageStack.currentPage.collectionUpdated.connect(eventModel.delayedApplyFilter);
336
 
                        }
337
 
                    }
338
 
                }
339
 
                ToolbarButton {
340
 
                    objectName: "syncbutton"
341
 
                    visible: syncMonitor.enabledServices ? syncMonitor.serviceIsEnabled("calendar") : false
342
 
                    action: Action {
343
 
                        text: enabled ? i18n.tr("Sync") : i18n.tr("Syncing")
344
 
                        iconName: "reload"
345
 
                        onTriggered: syncMonitor.sync(["calendar"])
346
 
                        enabled: (syncMonitor.state !== "syncing")
347
 
                    }
348
 
                }
 
297
            EventActions {
 
298
                id: commonHeaderActions
349
299
            }
350
300
 
351
301
            Keys.onTabPressed: {
379
329
                    objectName: "yearViewLoader"
380
330
                    source: tabs.selectedTab == yearTab ? Qt.resolvedUrl("YearView.qml"):""
381
331
                    onLoaded: {
382
 
                        item.tools = Qt.binding(function() { return commonToolBar })
383
332
                        item.currentYear = tabs.currentDay.getFullYear();
384
333
                    }
385
334
 
414
363
                    objectName: "monthViewLoader"
415
364
                    source: tabs.selectedTab == monthTab ? Qt.resolvedUrl("MonthView.qml"):""
416
365
                    onLoaded: {
417
 
                        item.tools = Qt.binding(function() { return commonToolBar })
418
366
                        item.currentMonth = tabs.currentDay.midnight();
419
367
                    }
420
368
 
443
391
                    objectName: "weekViewLoader"
444
392
                    source: tabs.selectedTab == weekTab ? Qt.resolvedUrl("WeekView.qml"):""
445
393
                    onLoaded: {
446
 
                        item.tools = Qt.binding(function() { return commonToolBar })
447
394
                        item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == weekTab })
448
395
                        item.dayStart = tabs.currentDay;
449
396
                    }
477
424
                    objectName: "dayViewLoader"
478
425
                    source: tabs.selectedTab == dayTab ? Qt.resolvedUrl("DayView.qml"):""
479
426
                    onLoaded: {
480
 
                        item.tools = Qt.binding(function() { return commonToolBar })
481
427
                        item.isCurrentPage= Qt.binding(function() { return tabs.selectedTab == dayTab })
482
428
                        item.currentDay = tabs.currentDay;
483
429
                    }
507
453
                    source: tabs.selectedTab == agendaTab ? Qt.resolvedUrl("AgendaView.qml"):""
508
454
 
509
455
                    onLoaded: {
510
 
                        item.tools = Qt.binding(function() { return commonToolBar })
511
456
                        item.currentDay = tabs.currentDay;
512
457
                    }
513
458