2023-03-20 15:33:32 +08:00
|
|
|
/*
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-04-04 09:33:06 +08:00
|
|
|
import QtQuick 2.12
|
2023-03-06 09:37:06 +08:00
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import QtQuick.Controls 2.5
|
|
|
|
import AppControls2 1.0 as AppControls2
|
|
|
|
import org.ukui.menu.core 1.0
|
|
|
|
|
2023-03-31 16:20:05 +08:00
|
|
|
SwipeView {
|
|
|
|
id: root
|
|
|
|
interactive: false
|
2023-04-03 15:58:05 +08:00
|
|
|
// 5.15
|
|
|
|
// required property AppPageHeader appPageHeader
|
|
|
|
// 5.12
|
|
|
|
property AppPageHeader appPageHeader: null
|
2023-08-14 11:15:54 +08:00
|
|
|
property bool isAppListShow: appList.visible
|
2023-03-31 16:20:05 +08:00
|
|
|
|
2023-04-26 17:04:22 +08:00
|
|
|
function resetFocus() {
|
2023-08-14 11:15:54 +08:00
|
|
|
if (appList.visible) {
|
|
|
|
appList.resetListFocus();
|
|
|
|
} else {
|
|
|
|
selectionPage.viewFocusEnable();
|
|
|
|
}
|
2023-04-26 17:04:22 +08:00
|
|
|
}
|
|
|
|
|
2023-03-31 16:20:05 +08:00
|
|
|
Item {
|
|
|
|
id: appListBase
|
2023-12-05 16:22:10 +08:00
|
|
|
AppControls2.StyleBackground {
|
|
|
|
anchors.top: parent.top
|
|
|
|
width: parent.width
|
|
|
|
height: 1
|
|
|
|
useStyleTransparent: false
|
|
|
|
alpha: 0.15
|
|
|
|
paletteRole: Palette.Text
|
|
|
|
visible: appList.viewContentY > 0 && appList.visible
|
|
|
|
}
|
|
|
|
|
2023-03-31 16:20:05 +08:00
|
|
|
AppList {
|
|
|
|
id: appList
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: 4
|
|
|
|
onLabelItemClicked: {
|
|
|
|
appList.visible = false;
|
|
|
|
selectionPage.viewShowStart();
|
|
|
|
}
|
2023-05-17 14:03:33 +08:00
|
|
|
onTitleChanged: {
|
|
|
|
appPageHeader.title = title;
|
|
|
|
}
|
2023-03-31 16:20:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SelectionPage {
|
|
|
|
id: selectionPage
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.bottomMargin: 54
|
|
|
|
visible: !appList.visible
|
|
|
|
onViewHideFinished: appList.visible = true
|
|
|
|
onLabelSelected: appList.labelSelection(labelId)
|
2023-03-06 09:37:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-31 16:20:05 +08:00
|
|
|
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) {
|
2023-05-06 09:20:34 +08:00
|
|
|
menuManager.showMenu(id, MenuInfo.FolderPage);
|
2023-03-31 16:20:05 +08:00
|
|
|
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;
|
2023-11-21 16:02:22 +08:00
|
|
|
EventTrack.sendClickEvent("enter_folder_page", "AppView");
|
2023-03-31 16:20:05 +08:00
|
|
|
}
|
|
|
|
function hideFolderPage() {
|
|
|
|
root.currentIndex = appListBase.SwipeView.index;
|
|
|
|
appPageHeader.title = appList.title;
|
|
|
|
appPageHeader.content = null;
|
|
|
|
//active = false;
|
2023-11-21 16:02:22 +08:00
|
|
|
EventTrack.sendClickEvent("exit_folder_page", "AppView");
|
2023-03-31 16:20:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
appList.openFolderPageSignal.connect(showFolderPage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: folderPageHeader
|
|
|
|
Item {
|
|
|
|
RowLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.leftMargin: 12
|
2023-04-04 09:33:06 +08:00
|
|
|
anchors.rightMargin: 30
|
|
|
|
spacing: 2
|
2023-03-31 16:20:05 +08:00
|
|
|
|
2023-04-04 09:33:06 +08:00
|
|
|
ThemeIcon {
|
2023-03-31 16:20:05 +08:00
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
2023-04-04 09:33:06 +08:00
|
|
|
|
2023-04-08 14:12:11 +08:00
|
|
|
EditText {
|
2023-03-31 16:20:05 +08:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-06 09:37:06 +08:00
|
|
|
}
|
|
|
|
}
|