/*************************************************************/ /* */ /* Copyright (C) Microsoft Corporation. All rights reserved. */ /* */ /*************************************************************/ import Colors 1.0 import QtQuick 2.7 import QtQuick.Window 2.2 import QtQml 2.2 import "palettes.js" as Palettes; // Footer on the bottom of the ActivityCenter. Rectangle { id: footerBar property bool isOnlineMode property bool isPaused property bool isNoNetwork property bool isRTL // Keying off on the visible property creates a binding loop. // Instead use this property to determine whether we need to show this object. // When showing the old activity center, this activity center footer should have a height of 0 color: Colors.activity_center.footer2.background // If button text needs two lines, the footer height will increase property var maxButtonHeight: Math.max(openFolderButton.height, viewOnlineButton.height, recycleBinButton.height, premiumButton.height ) height: Math.max(84, Math.min(100, maxButtonHeight + 16)); property int iconWidth: premiumButton.visible ? 80 : 105 function shown() { if (premiumButton.isAnimated) { premiumButton.startAnimation(2 /* numLoops */); } } function hidden() { premiumButton.stopAnimation(); } // Rule - A line above the top of the footer to provide visual separation Rectangle { anchors.bottom: parent.top anchors.left: parent.left anchors.right: parent.right height: 1 color: Colors.activity_center.footer.rule } Row { id: iconRow height: parent.height anchors.bottom: parent.bottom anchors.horizontalCenter: parent.horizontalCenter spacing: 4 // All three buttons need to have same height // If button text needs two lines, button will use tallest button height // Left Button - "Open Folder" IconAndTextButton { id: openFolderButton enabled: isOnlineMode || isNoNetwork || isPaused height: Math.max(openFolderButton.implicitHeight, viewOnlineButton.implicitHeight, recycleBinButton.implicitHeight, premiumButton.implicitHeight, 68) width: iconWidth KeyNavigation.right: viewOnlineButton Keys.onReturnPressed: openFolderButton.clicked() Keys.onEnterPressed: openFolderButton.clicked() Accessible.onPressAction: openFolderButton.clicked() Accessible.name: footerModel.accessibleText_OpenFolder onClicked: footerModel.OpenFolder_Clicked() imageControl.source: "file:///" + imageLocation + footerModel.iconName_OpenFolder textControl.text: footerModel.buttonText_OpenFolder } // Center Button - "View Online" or "Go Premium" IconAndTextButton { id: viewOnlineButton height: Math.max(openFolderButton.implicitHeight, viewOnlineButton.implicitHeight, recycleBinButton.implicitHeight, premiumButton.implicitHeight, 68) width: iconWidth KeyNavigation.left: openFolderButton KeyNavigation.right: recycleBinButton Keys.onReturnPressed: viewOnlineButton.clicked() Keys.onEnterPressed: viewOnlineButton.clicked() Accessible.onPressAction: viewOnlineButton.clicked() enabled: isOnlineMode onClicked: footerModel.ViewOnline_Clicked() imageControl.source: "file:///" + imageLocation + footerModel.iconName_ViewOnline textControl.text: footerModel.buttonText_ViewOnline Accessible.role: Accessible.Link } IconAndTextButton { id: recycleBinButton height: Math.max(openFolderButton.implicitHeight, viewOnlineButton.implicitHeight, recycleBinButton.implicitHeight, premiumButton.implicitHeight, 68) width: iconWidth KeyNavigation.left: viewOnlineButton KeyNavigation.right: premiumButton onClicked: footerModel.RecycleBin_Clicked() Keys.onReturnPressed: recycleBinButton.onClicked() Keys.onEnterPressed: recycleBinButton.onClicked() Accessible.onPressAction: recycleBinButton.onClicked() enabled: isOnlineMode imageControl.source: "file:///" + imageLocation + footerModel.iconName_RecycleBin textControl.text: footerModel.buttonText_RecycleBin Accessible.role: Accessible.Link Accessible.name: footerModel.accessibleText_RecycleBin } IconAndTextButton { id: premiumButton // determine if button should be "Go Premium" or "View Online" (Always "View Online" if disabled) property bool hasPremiumUpsell: footerModel.hasPremiumUpsell // determine if the in-line DIME upsell purchase experience is enabled property bool isDimeEnabled: footerModel.isDimeEnabled visible: hasPremiumUpsell height: Math.max(openFolderButton.implicitHeight, viewOnlineButton.implicitHeight, recycleBinButton.implicitHeight, premiumButton.implicitHeight, 68) width: visible ? iconWidth : 0 KeyNavigation.left: recycleBinButton Keys.onReturnPressed: premiumButton.clicked() Keys.onEnterPressed: premiumButton.clicked() Accessible.onPressAction: premiumButton.clicked() enabled: hasPremiumUpsell || isOnlineMode onClicked: footerModel.GoPremium_Clicked() imageControl.source: "file:///" + imageLocation + footerModel.iconName_GoPremium textControl.text: footerModel.buttonText_GoPremium isAnimated: footerModel.isAnimated_GoPremium animateOnHover: isAnimated // If Dime is enabled for the 'Go Premium' button, ensure that it uses the Button accessibility role since its // action launches the in-line DIME premium upsell purchase flow, which opens a native window in OneDrive. Accessible.role: isDimeEnabled ? Accessible.Button : Accessible.Link } } }