~renatofilho/ubuntu-calendar-app/optimize

« back to all changes in this revision

Viewing changes to calendar.qml

  • Committer: Renato Araujo Oliveira Filho
  • Date: 2016-01-25 19:19:30 UTC
  • Revision ID: renato.filho@canonical.com-20160125191930-l5owmspnu1x4c5dq
Fixed wrong merge.

Show diffs side-by-side

added added

removed removed

Lines of Context:
443
443
 
444
444
                    asynchronous: true
445
445
                    sourceComponent: agendaViewComp
 
446
                    active : false
446
447
                    // Load page on demand and keep it on memory until the application is closed
447
448
                    enabled: tabs.isReady && (tabs.selectedTab == agendaTab)
448
449
                    onEnabledChanged: {
453
454
                }
454
455
            }
455
456
        }
456
 
 
457
 
        Component {
458
 
            id: yearViewComp
459
 
 
460
 
            YearView {
461
 
                onMonthSelected: {
462
 
                    var now = DateExt.today();
463
 
                    if ((date.getMonth() === now.getMonth()) &&
464
 
                        (date.getFullYear() === now.getFullYear())) {
465
 
                        tabs.currentDay = now;
466
 
                    } else {
467
 
                        tabs.currentDay = date.midnight();
468
 
                    }
469
 
                    tabs.selectedTabIndex = monthTab.index;
470
 
                }
471
 
                onActiveChanged: {
472
 
                    if (active) {
473
 
                        refreshCurrentYear(tabs.currentDay.getFullYear())
474
 
                    }
475
 
                }
476
 
            }
477
 
        }
478
 
 
479
 
        Component {
480
 
            id: monthViewComp
481
 
 
482
 
            MonthView {
483
 
                onDateSelected: {
484
 
                    tabs.currentDay = date
485
 
                    tabs.selectedTabIndex = dayTab.index
486
 
                }
487
 
                onActiveChanged: {
488
 
                    if (active) {
489
 
                        anchorDate = tabs.currentDay.midnight()
490
 
                    }
491
 
                }
492
 
            }
493
 
        }
494
 
 
495
 
        Component {
496
 
            id: weekViewComp
497
 
 
498
 
            WeekView {
499
 
                onCurrentDateChanged: {
500
 
                    tabs.currentDay = currentDate
501
 
                }
502
 
                onDateSelected: {
503
 
                    tabs.currentDay = date;
504
 
                    tabs.selectedTabIndex = dayTab.index;
505
 
                }
506
 
                onActiveChanged: {
507
 
                    if (active) {
508
 
                        anchorDate = tabs.currentDay.midnight()
509
 
                    }
510
 
                }
511
 
            }
512
 
        }
513
 
 
514
 
        Component {
515
 
            id: dayViewComp
516
 
 
517
 
            DayView {
518
 
                onCurrentDateChanged: {
519
 
                    tabs.currentDay = currentDate;
520
 
                }
521
 
 
522
 
                onDateSelected: {
523
 
                    tabs.currentDay = date
524
 
                }
525
 
 
526
 
                onActiveChanged: {
527
 
                    if (active) {
528
 
                        anchorDate = tabs.currentDay
529
 
                    }
530
 
                }
531
 
            }
532
 
        }
533
 
 
534
 
        Component {
535
 
            id: agendaViewComp
536
 
 
537
 
            AgendaView {
538
 
                onDateSelected: {
539
 
                    tabs.currentDay = date;
540
 
                    tabs.selectedTabIndex = dayTab.index;
541
 
                }
 
457
    }
 
458
 
 
459
    Component {
 
460
        id: yearViewComp
 
461
 
 
462
        YearView {
 
463
            onMonthSelected: {
 
464
                var now = DateExt.today();
 
465
                if ((date.getMonth() === now.getMonth()) &&
 
466
                    (date.getFullYear() === now.getFullYear())) {
 
467
                    tabs.currentDay = now;
 
468
                } else {
 
469
                    tabs.currentDay = date.midnight();
 
470
                }
 
471
                tabs.selectedTabIndex = monthTab.index;
 
472
            }
 
473
            onActiveChanged: {
 
474
                if (active) {
 
475
                    refreshCurrentYear(tabs.currentDay.getFullYear())
 
476
                }
 
477
            }
 
478
        }
 
479
    }
 
480
 
 
481
    Component {
 
482
        id: monthViewComp
 
483
 
 
484
        MonthView {
 
485
            onDateSelected: {
 
486
                tabs.currentDay = date
 
487
                tabs.selectedTabIndex = dayTab.index
 
488
            }
 
489
            onActiveChanged: {
 
490
                if (active) {
 
491
                    anchorDate = tabs.currentDay.midnight()
 
492
                }
 
493
            }
 
494
        }
 
495
    }
 
496
 
 
497
    Component {
 
498
        id: weekViewComp
 
499
 
 
500
        WeekView {
 
501
            onCurrentDateChanged: {
 
502
                tabs.currentDay = currentDate
 
503
            }
 
504
            onDateSelected: {
 
505
                tabs.currentDay = date;
 
506
                tabs.selectedTabIndex = dayTab.index;
 
507
            }
 
508
            onActiveChanged: {
 
509
                if (active) {
 
510
                    anchorDate = tabs.currentDay.midnight()
 
511
                }
 
512
            }
 
513
        }
 
514
    }
 
515
 
 
516
    Component {
 
517
        id: dayViewComp
 
518
 
 
519
        DayView {
 
520
            onCurrentDateChanged: {
 
521
                tabs.currentDay = currentDate;
 
522
            }
 
523
 
 
524
            onDateSelected: {
 
525
                tabs.currentDay = date
 
526
            }
 
527
 
 
528
            onActiveChanged: {
 
529
                if (active) {
 
530
                    anchorDate = tabs.currentDay
 
531
                }
 
532
            }
 
533
        }
 
534
    }
 
535
 
 
536
    Component {
 
537
        id: agendaViewComp
 
538
 
 
539
        AgendaView {
 
540
            onDateSelected: {
 
541
                tabs.currentDay = date;
 
542
                tabs.selectedTabIndex = dayTab.index;
542
543
            }
543
544
        }
544
545
    }