Warning, /plasma/plasma-welcome/src/qml/Main.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Felipe Kinoshita <kinofhek@gmail.com> 0003 * SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 import QtQuick 0009 import QtQuick.Controls as QQC2 0010 import QtQuick.Layouts 0011 import org.kde.kirigami as Kirigami 0012 0013 import org.kde.plasma.welcome 0014 0015 Kirigami.ApplicationWindow { 0016 id: root 0017 0018 minimumWidth: Kirigami.Units.gridUnit * 20 0019 minimumHeight: Kirigami.Units.gridUnit * 30 0020 width: Kirigami.Units.gridUnit * 36 0021 height: Kirigami.Units.gridUnit * 32 0022 0023 pageStack.globalToolBar.showNavigationButtons: Kirigami.ApplicationHeaderStyle.NoNavigationButtons 0024 pageStack.defaultColumnWidth: width 0025 0026 footer: Footer { 0027 width: root.width 0028 contentSource: { 0029 switch (Controller.mode) { 0030 case Controller.Welcome: 0031 case Controller.Live: 0032 default: 0033 return "FooterDefault.qml"; 0034 case Controller.Update: 0035 case Controller.Beta: 0036 return "FooterUpdate.qml"; 0037 } 0038 } 0039 } 0040 0041 function createPage(page) { 0042 let component = Qt.createComponent(page); 0043 if (component.status !== Component.Error) { 0044 return component.createObject(null); 0045 } else { 0046 console.warn("Couldn't load page '" + page + "'"); 0047 console.warn(" " + component.errorString()) 0048 component.destroy(); 0049 // TODO: Instead create and return a placeholder page with error info 0050 return null; 0051 } 0052 } 0053 0054 function pushPage(page) { 0055 if (page !== null) { 0056 if (pageStack.currentIndex === -1) { 0057 pageStack.push(page); 0058 } else { 0059 pageStack.insertPage(pageStack.depth, page); 0060 } 0061 } 0062 } 0063 0064 Component.onCompleted: { 0065 // Push pages dynamically 0066 switch (Controller.mode) { 0067 case Controller.Update: 0068 case Controller.Beta: 0069 pushPage(createPage("PlasmaUpdate.qml")); 0070 0071 break; 0072 0073 case Controller.Live: 0074 pushPage(createPage("Live.qml")); 0075 // Fallthrough 0076 0077 case Controller.Welcome: 0078 pushPage(createPage("Welcome.qml")); 0079 0080 if (!Controller.networkAlreadyConnected() || Controller.patchVersion === 80) { 0081 pushPage(createPage("Network.qml")); 0082 } 0083 0084 pushPage(createPage("SimpleByDefault.qml")); 0085 pushPage(createPage("PowerfulWhenNeeded.qml")); 0086 0087 let discover = createPage("Discover.qml"); 0088 if (discover.application.exists) { 0089 pushPage(discover); 0090 } else { 0091 discover.destroy(); 0092 } 0093 0094 // KCMs 0095 if (Controller.mode !== Controller.Live) { 0096 if (Controller.userFeedbackAvailable()) { 0097 pushPage(createPage("Feedback.qml")); 0098 } 0099 } 0100 0101 // Append any distro-specific pages that were found 0102 let distroPages = Controller.distroPages(); 0103 for (let i in distroPages) { 0104 pushPage(createPage(distroPages[i])); 0105 } 0106 0107 pushPage(createPage("Contribute.qml")); 0108 pushPage(createPage("Donate.qml")); 0109 0110 break; 0111 } 0112 } 0113 }