Warning, /plasma/plasma-welcome/src/qml/footers/FooterDefault.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  *  SPDX-FileCopyrightText: 2023 Oliver Beard <olib141@outlook.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 import QtQuick
0008 import QtQuick.Controls as QQC2
0009 import QtQuick.Layouts
0010 import org.kde.kirigami as Kirigami
0011 
0012 import org.kde.plasma.welcome
0013 
0014 RowLayout {
0015     id: root
0016 
0017     spacing: Kirigami.Units.smallSpacing
0018 
0019     readonly property bool inLayer: pageStack.layers.depth > 1
0020     readonly property bool atStart: pageStack.currentIndex === 0
0021     readonly property bool atEnd: pageStack.currentIndex === pageStack.depth - 1
0022 
0023     QQC2.Button {
0024         Layout.alignment: Qt.AlignLeft
0025 
0026         action: Kirigami.Action {
0027             readonly property bool isSkip: root.atStart && !root.inLayer
0028 
0029             text: isSkip ? i18nc("@action:button", "&Skip") : i18nc("@action:button", "&Back")
0030             icon.name: isSkip ? "dialog-cancel-symbolic" : "go-previous-symbolic"
0031             shortcut: "Left"
0032 
0033             onTriggered: {
0034                 if (root.inLayer) {
0035                     pageStack.layers.pop();
0036                 } else if (!root.atStart) {
0037                     pageStack.currentIndex -= 1;
0038                 } else {
0039                     Qt.quit();
0040                 }
0041             }
0042         }
0043     }
0044 
0045     QQC2.PageIndicator {
0046         Layout.alignment: Qt.AlignHCenter
0047 
0048         enabled: !root.inLayer
0049         count: pageStack.depth
0050         currentIndex: pageStack.currentIndex
0051         onCurrentIndexChanged: pageStack.currentIndex = currentIndex
0052         interactive: true
0053     }
0054 
0055     QQC2.Button {
0056         id: nextButton
0057         Layout.alignment: Qt.AlignRight
0058 
0059         enabled: !root.inLayer
0060 
0061         action: Kirigami.Action {
0062             text: root.atEnd ? i18nc("@action:button", "&Finish") : i18nc("@action:button", "&Next")
0063             icon.name: root.atEnd ? "dialog-ok-apply-symbolic" : "go-next-symbolic"
0064             shortcut: "Right"
0065 
0066             enabled: nextButton.enabled
0067 
0068             onTriggered: {
0069                 if (!root.atEnd) {
0070                     pageStack.currentIndex += 1;
0071                 } else {
0072                     Qt.quit();
0073                 }
0074             }
0075         }
0076     }
0077 }