diff --git a/qml/AppControls2/AppItem.qml b/qml/AppControls2/AppItem.qml
index 8274c88..66ec400 100644
--- a/qml/AppControls2/AppItem.qml
+++ b/qml/AppControls2/AppItem.qml
@@ -3,35 +3,25 @@ import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
-StyleBackground {
- radius: 4
- useStyleTransparent: false
- alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
- ToolTip.visible: content.textTruncated && control.containsMouse
- ToolTip.text: name
+MouseArea {
+ id: control
+ hoverEnabled: true
- IconLabel {
- id: content
+ StyleBackground {
anchors.fill: parent
- iconHeight: 32; iconWidth: iconHeight
- appName: name; appIcon: icon
- display: Display.TextBesideIcon
- spacing: 12
- }
- MouseArea {
- id: control
- anchors.fill: parent
- hoverEnabled: true
- acceptedButtons: Qt.LeftButton | Qt.RightButton
+ radius: 4
+ useStyleTransparent: false
+ alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
+ ToolTip.visible: content.textTruncated && control.containsMouse
+ ToolTip.text: name
- onClicked: {
- if (mouse.button === Qt.RightButton) {
- appListView.model.openMenu(index);
- return
- }
- if (mouse.button === Qt.LeftButton) {
- appListView.model.appClicked(index);
- }
+ IconLabel {
+ id: content
+ anchors.fill: parent
+ iconHeight: 32; iconWidth: iconHeight
+ appName: name; appIcon: icon
+ display: Display.TextBesideIcon
+ spacing: 12
}
}
}
diff --git a/qml/AppControls2/FolderItem.qml b/qml/AppControls2/FolderItem.qml
index 8274c88..66ec400 100644
--- a/qml/AppControls2/FolderItem.qml
+++ b/qml/AppControls2/FolderItem.qml
@@ -3,35 +3,25 @@ import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
import org.ukui.menu.core 1.0
-StyleBackground {
- radius: 4
- useStyleTransparent: false
- alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
- ToolTip.visible: content.textTruncated && control.containsMouse
- ToolTip.text: name
+MouseArea {
+ id: control
+ hoverEnabled: true
- IconLabel {
- id: content
+ StyleBackground {
anchors.fill: parent
- iconHeight: 32; iconWidth: iconHeight
- appName: name; appIcon: icon
- display: Display.TextBesideIcon
- spacing: 12
- }
- MouseArea {
- id: control
- anchors.fill: parent
- hoverEnabled: true
- acceptedButtons: Qt.LeftButton | Qt.RightButton
+ radius: 4
+ useStyleTransparent: false
+ alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
+ ToolTip.visible: content.textTruncated && control.containsMouse
+ ToolTip.text: name
- onClicked: {
- if (mouse.button === Qt.RightButton) {
- appListView.model.openMenu(index);
- return
- }
- if (mouse.button === Qt.LeftButton) {
- appListView.model.appClicked(index);
- }
+ IconLabel {
+ id: content
+ anchors.fill: parent
+ iconHeight: 32; iconWidth: iconHeight
+ appName: name; appIcon: icon
+ display: Display.TextBesideIcon
+ spacing: 12
}
}
}
diff --git a/qml/AppControls2/LabelItem.qml b/qml/AppControls2/LabelItem.qml
index ec7d9cb..2294a46 100644
--- a/qml/AppControls2/LabelItem.qml
+++ b/qml/AppControls2/LabelItem.qml
@@ -2,42 +2,40 @@ import QtQuick 2.0
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.5
-StyleBackground {
- radius: 4
- useStyleTransparent: false
- alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
+MouseArea {
+ id: control
+ hoverEnabled: true
ToolTip.text: qsTr("Open the label selection interface")
ToolTip.visible: control.containsMouse
- RowLayout {
+ StyleBackground {
anchors.fill: parent
- StyleText {
- Layout.preferredHeight: parent.height
- Layout.preferredWidth: contentWidth
- Layout.leftMargin: 12
+ radius: 4
+ useStyleTransparent: false
+ alpha: control.containsPress ? 0.82 : control.containsMouse ? 0.55 : 0.00
- horizontalAlignment: Qt.AlignLeft
- verticalAlignment: Qt.AlignVCenter
- font.pixelSize: 14
- font.bold: true
- text: name
- }
+ RowLayout {
+ anchors.fill: parent
+ StyleText {
+ Layout.preferredHeight: parent.height
+ Layout.preferredWidth: contentWidth
+ Layout.leftMargin: 12
- Image {
- visible: control.containsMouse
- Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
- Layout.preferredWidth: 24
- Layout.preferredHeight: 24
- Layout.rightMargin: 16
- source: "image://appicon/open-menu-symbolic"
- }
- }
- MouseArea {
- id: control
- hoverEnabled: true
- anchors.fill: parent
- onClicked: {
- appList.labelItemClicked();
+ horizontalAlignment: Qt.AlignLeft
+ verticalAlignment: Qt.AlignVCenter
+ font.pixelSize: 14
+ font.bold: true
+ text: name
+ }
+
+ Image {
+ visible: control.containsMouse
+ Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
+ Layout.preferredWidth: 24
+ Layout.preferredHeight: 24
+ Layout.rightMargin: 16
+ source: "image://appicon/open-menu-symbolic"
+ }
}
}
}
diff --git a/qml/AppUI/AppList.qml b/qml/AppUI/AppList.qml
index d7eca94..0c574f2 100644
--- a/qml/AppUI/AppList.qml
+++ b/qml/AppUI/AppList.qml
@@ -25,85 +25,79 @@ import org.ukui.menu.core 1.0
Item {
property string title: ""
+ signal labelItemClicked()
+ signal openFolderPageSignal(string folderId, string folderName);
function labelSelection(labelId) {
- appListView.positionViewAtIndex(appListView.model.getLabelIndex(labelId), ListView.Beginning)
+ appListView.view.positionViewAtIndex(appListView.model.getLabelIndex(labelId), ListView.Beginning)
}
- MouseArea {
- id: appListArea
- hoverEnabled: true
+ AppListView {
+ id: appListView
anchors.fill: parent
-
- AppControls2.StyleBackground {
- anchors.top: parent.top
- width: parent.width; height: 1
- useStyleTransparent: false
- alpha: 0.15
- paletteRole: Palette.Text
- visible: appListView.contentY > 0
- }
-
- RowLayout {
- anchors.fill: parent
- spacing: 0
- anchors.leftMargin: 4
-
- ListView {
- id: appListView
- spacing: 4
- Layout.fillHeight: true
- Layout.fillWidth: true
- ScrollBar.vertical: appListScrollBar
-
- highlightMoveDuration: 0
- boundsBehavior: Flickable.StopAtBounds
-
- model: modelManager.getAppModel()
- delegate: Component {
- Loader {
- width: ListView.view ? ListView.view.width : 0
- height: 40
- property int index: model.index
- property int type: model.type
- property string name: model.name
- property string icon: model.icon
- sourceComponent: {
- if (type === DataType.Normal) {
- return appItem;
- }
- if (type === DataType.Folder) {
- return folderItem;
- }
- if (type === DataType.Label) {
- return labelItem;
- }
- }
+ model: modelManager.getAppModel()
+ delegate: Component {
+ Loader {
+ width: ListView.view ? ListView.view.width : 0
+ height: 40
+ property int index: model.index
+ property int type: model.type
+ property string id: model.id
+ property string name: model.name
+ property string icon: model.icon
+ sourceComponent: {
+ if (type === DataType.Normal) {
+ return appItem;
+ }
+ if (type === DataType.Folder) {
+ return folderItem;
+ }
+ if (type === DataType.Label) {
+ return labelItem;
}
}
}
-
- AppControls2.ScrollBar {
- id: appListScrollBar
- Layout.fillHeight: true
- Layout.preferredWidth: 14
- visual: appListArea.containsMouse
- }
}
}
Component {
id: appItem
- AppControls2.AppItem {}
+ AppControls2.AppItem {
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button === Qt.RightButton) {
+ appListView.model.openMenu(index);
+ return;
+ }
+ if (mouse.button === Qt.LeftButton) {
+ appManager.launchApp(id);
+ return;
+ }
+ }
+ }
}
Component {
id: labelItem
- AppControls2.LabelItem {}
+ AppControls2.LabelItem {
+ onClicked: labelItemClicked();
+ }
}
Component {
id: folderItem
- AppControls2.FolderItem {}
+ AppControls2.FolderItem {
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ if (mouse.button === Qt.RightButton) {
+ appListView.model.openMenu(index);
+ return;
+ }
+ if (mouse.button === Qt.LeftButton) {
+ openFolderPageSignal(id, name);
+ return;
+ }
+ }
+ }
}
}
diff --git a/qml/AppUI/AppListView.qml b/qml/AppUI/AppListView.qml
new file mode 100644
index 0000000..7d975ea
--- /dev/null
+++ b/qml/AppUI/AppListView.qml
@@ -0,0 +1,69 @@
+/*
+ * 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.Controls 2.12
+import QtQuick.Layouts 1.12
+import AppControls2 1.0 as AppControls2
+import org.ukui.menu.core 1.0
+
+MouseArea {
+ id: root
+
+ readonly property alias view: listView
+ property alias model: listView.model
+ property alias delegate: listView.delegate
+
+ hoverEnabled: true
+ clip: true
+
+ AppControls2.StyleBackground {
+ anchors.top: parent.top
+ width: parent.width
+ height: 1
+ useStyleTransparent: false
+ alpha: 0.15
+ paletteRole: Palette.Text
+ visible: listView.contentY > 0
+ }
+
+ RowLayout {
+ anchors.fill: parent
+ spacing: 0
+ anchors.leftMargin: 4
+
+ ListView {
+ id: listView
+
+ spacing: 4
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ highlightMoveDuration: 0
+ boundsBehavior: Flickable.StopAtBounds
+ ScrollBar.vertical: listViewScrollBar
+ }
+
+ AppControls2.ScrollBar {
+ id: listViewScrollBar
+
+ Layout.fillHeight: true
+ Layout.preferredWidth: 14
+ visual: root.containsMouse
+ }
+ }
+}
diff --git a/qml/AppUI/AppPageContent.qml b/qml/AppUI/AppPageContent.qml
index 5311452..389818e 100644
--- a/qml/AppUI/AppPageContent.qml
+++ b/qml/AppUI/AppPageContent.qml
@@ -28,7 +28,7 @@ Item {
clip: true
anchors.fill: parent
anchors.leftMargin: 4
- function labelItemClicked() {
+ onLabelItemClicked: {
appList.visible = false;
selectionPage.viewShowStart();
}
diff --git a/qml/AppUI/qmldir b/qml/AppUI/qmldir
index d09f024..fc4fa7d 100644
--- a/qml/AppUI/qmldir
+++ b/qml/AppUI/qmldir
@@ -5,6 +5,7 @@ Sidebar 1.0 Sidebar.qml
NormalUI 1.0 NormalUI.qml
FullScreenUI 1.0 FullScreenUI.qml
AppPageHeader 1.0 AppPageHeader.qml
+AppListView 1.0 AppListView.qml
SearchInputBar 1.0 SearchInputBar.qml
PluginSelectMenu 1.0 PluginSelectMenu.qml
FullScreenHeader 1.0 FullScreenHeader.qml
diff --git a/qml/qml.qrc b/qml/qml.qrc
index 91772c6..9504dff 100644
--- a/qml/qml.qrc
+++ b/qml/qml.qrc
@@ -15,6 +15,7 @@
AppUI/FullScreenFooter.qml
AppUI/AppPageHeader.qml
AppUI/SearchInputBar.qml
+ AppUI/AppListView.qml
AppControls2/qmldir
AppControls2/App.qml
AppControls2/ScrollBar.qml