~artmello/ubuntu-calendar-app/ubuntu-calendar-app-adaptive_layout

« back to all changes in this revision

Viewing changes to calendar.qml

  • Committer: Arthur Mello
  • Date: 2016-10-17 07:36:01 UTC
  • Revision ID: arthur.mello@canonical.com-20161017073601-8th27q0gvue264oc
Fix tab menu to work properly with wide mode view

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
    // Read-only properties
49
49
    readonly property bool syncInProgress: commonHeaderActions.syncInProgress
 
50
    readonly property bool wideModeView: mainView.width >= units.gu(90)
50
51
 
51
52
    // Properties stored using Settings
52
53
    property bool displayWeekNumber: false
442
443
               iconName: !enabled ? "tick" : ""
443
444
               enabled: (adaptivePageLayout.selectedPageIndex != 4)
444
445
               onTriggered: adaptivePageLayout.selectedPageIndex = 4
 
446
               visible: !mainView.wideModeView
445
447
           }
446
448
        ]
447
449
 
448
450
        anchors.fill: parent
449
451
        primaryPage: loadingPage
450
452
 
451
 
        //layouts: PageColumnsLayout {
452
 
        //    when: true 
453
 
        //    PageColumn {
454
 
        //        fillWidth: true
455
 
        //    }
456
 
        //}
 
453
        layouts: PageColumnsLayout {
 
454
            when: mainView.wideModeView
 
455
            PageColumn {
 
456
                fillWidth: true
 
457
            }
457
458
 
 
459
            PageColumn {
 
460
                maximumWidth: units.gu(50)
 
461
                minimumWidth: units.gu(40)
 
462
                preferredWidth: units.gu(40)
 
463
            }
 
464
        }
458
465
 
459
466
        Keys.forwardTo: [adaptivePageLayout.currentPage]
460
467
 
483
490
        onSelectedPageIndexChanged: {
484
491
            adaptivePageLayout.removePages(loadingPage)
485
492
 
486
 
            if (selectedPageIndex === 0 ) {
487
 
                adaptivePageLayout.addPageToCurrentColumn(loadingPage, yearView)
488
 
                adaptivePageLayout.currentPage = yearView
489
 
 
490
 
            } else if (selectedPageIndex === 1 ) {
 
493
            if (selectedPageIndex === 1 ) {
491
494
                adaptivePageLayout.addPageToCurrentColumn(loadingPage, monthView)
492
495
                adaptivePageLayout.currentPage = monthView
493
496
 
499
502
                adaptivePageLayout.addPageToCurrentColumn(loadingPage, dayView)
500
503
                adaptivePageLayout.currentPage = dayView
501
504
 
502
 
            } else if (selectedPageIndex === 4 ) {
 
505
            } else if (selectedPageIndex === 4 && !mainView.wideModeView) {
503
506
                adaptivePageLayout.addPageToCurrentColumn(loadingPage, agendaView)
504
507
                adaptivePageLayout.currentPage = agendaView
 
508
            } else {
 
509
                selectedPageIndex = 0
 
510
                adaptivePageLayout.addPageToCurrentColumn(loadingPage, yearView)
 
511
                adaptivePageLayout.currentPage = yearView
 
512
            }
 
513
 
 
514
            if (mainView.wideModeView) {
 
515
                adaptivePageLayout.addPageToNextColumn(adaptivePageLayout.currentPage, agendaView)
505
516
            }
506
517
        }
507
518