/* * Copyright (C) 2023, KylinSoft Co., Ltd. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ import QtQuick 2.12 import QtQuick.Layouts 1.12 import QtQuick.Controls 2.5 import AppControls2 1.0 as AppControls2 import org.ukui.menu.core 1.0 SwipeView { id: root interactive: false // 5.15 // required property AppPageHeader appPageHeader // 5.12 property AppPageHeader appPageHeader: null function resetFocus() { appList.resetListFocus(); } Item { id: appListBase AppList { id: appList anchors.fill: parent anchors.leftMargin: 4 onLabelItemClicked: { appList.visible = false; selectionPage.viewShowStart(); } onTitleChanged: { appPageHeader.title = title; } } SelectionPage { id: selectionPage anchors.fill: parent anchors.bottomMargin: 54 visible: !appList.visible onViewHideFinished: appList.visible = true onLabelSelected: appList.labelSelection(labelId) } } Loader { id: folderPageLoader active: false sourceComponent: Component { AppListView { model: modelManager.getFolderModel() delegate: Component { Loader { width: ListView.view ? ListView.view.width : 0; height: 40 property string id: model.id property string name: model.name property string icon: model.icon sourceComponent: AppControls2.AppItem { acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { if (mouse.button === Qt.RightButton) { menuManager.showMenu(id, MenuInfo.FolderPage); return; } if (mouse.button === Qt.LeftButton) { appManager.launchApp(id); return; } } } } } } } function showFolderPage(folderId, folderName) { active = true; item.model.setFolderId(folderId); appPageHeader.title = folderName; appPageHeader.content = folderPageHeader; root.currentIndex = SwipeView.index; } function hideFolderPage() { root.currentIndex = appListBase.SwipeView.index; appPageHeader.title = appList.title; appPageHeader.content = null; //active = false; } Component.onCompleted: { appList.openFolderPageSignal.connect(showFolderPage); } } Component { id: folderPageHeader Item { RowLayout { anchors.fill: parent anchors.leftMargin: 12 anchors.rightMargin: 30 spacing: 2 ThemeIcon { Layout.fillWidth: true Layout.fillHeight: true Layout.maximumWidth: 16 Layout.maximumHeight: 16 Layout.alignment: Qt.AlignVCenter source: "image://appicon/ukui-start-symbolic" MouseArea { anchors.fill: parent onClicked: folderPageLoader.hideFolderPage(); } } EditText { Layout.fillWidth: true Layout.fillHeight: true } } } } }