Warning, /plasma-mobile/plasma-settings/src/qml/KCMContainer.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 0003 SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.6 0009 import QtQuick.Controls 2.2 as Controls 0010 import org.kde.kirigami 2.5 as Kirigami 0011 0012 import org.kde.plasma.settings 0.1 0013 0014 Kirigami.Page { 0015 id: container 0016 property QtObject kcm 0017 property Item internalPage 0018 property bool suppressDeletion: false 0019 0020 title: internalPage.title 0021 0022 topPadding: 0 0023 leftPadding: 0 0024 rightPadding: 0 0025 bottomPadding: 0 0026 0027 flickable: internalPage.flickable 0028 actions: [ 0029 internalPage.actions.main, 0030 internalPage.contextualActions 0031 ] 0032 0033 onInternalPageChanged: { 0034 internalPage.parent = contentItem; 0035 internalPage.anchors.fill = contentItem; 0036 } 0037 onActiveFocusChanged: { 0038 if (activeFocus) { 0039 internalPage.forceActiveFocus(); 0040 } 0041 } 0042 0043 Component.onCompleted: { 0044 // setting a binding seems to not work, add them manually 0045 for (let action of internalPage.actions) { 0046 actions.push(action); 0047 } 0048 if (kcm.load !== undefined) { 0049 kcm.load(); 0050 } 0051 } 0052 0053 data: [ 0054 Connections { 0055 target: internalPage 0056 function onActionsChanged() { 0057 root.actions.clear(); 0058 for (let action of internalPage.actions) { 0059 root.actions.push(action); 0060 } 0061 } 0062 }, 0063 Connections { 0064 target: kcm 0065 function onPagePushed(page) { 0066 pageStack.push(kcmContainer.createObject(pageStack, {"internalPage": page})); 0067 } 0068 function onPageRemoved() { 0069 pageStack.pop(); 0070 } 0071 function onNeedsSaveChanged () { 0072 if (kcm.needsSave) { 0073 kcm.save() 0074 } 0075 } 0076 }, 0077 Connections { 0078 target: pageStack 0079 function onPageRemoved(page) { 0080 if (kcm.needsSave) { 0081 kcm.save() 0082 } 0083 if (page == container && !container.suppressDeletion) { 0084 page.destroy(); 0085 } 0086 } 0087 }, 0088 Connections { 0089 target: kcm 0090 function onCurrentIndexChanged(index) { 0091 const index_with_offset = index + 1; 0092 if (index_with_offset !== pageStack.currentIndex) { 0093 pageStack.currentIndex = index_with_offset; 0094 } 0095 } 0096 } 0097 ] 0098 }