mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Add NewStuff Button
This commit is contained in:
parent
0d2e15cea4
commit
11792ae565
2 changed files with 66 additions and 15 deletions
|
|
@ -9,6 +9,7 @@ import QtQuick.Controls as QQC2
|
|||
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.plasma.plasmoid
|
||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||
import org.kde.plasma.private.shell 2.0
|
||||
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
||||
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
||||
|
|
@ -39,6 +40,15 @@ MouseArea {
|
|||
color: Qt.rgba(0, 0, 0, 0.7)
|
||||
}
|
||||
|
||||
|
||||
PlasmaExtras.ModelContextMenu {
|
||||
id: getWidgetsDialog
|
||||
visualParent: getWidgetsButton
|
||||
placement: PlasmaExtras.Menu.TopPosedLeftAlignedPopup
|
||||
// model set on first invocation
|
||||
onClicked: model.trigger()
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: header
|
||||
spacing: Kirigami.Units.largeSpacing
|
||||
|
|
@ -46,6 +56,8 @@ MouseArea {
|
|||
anchors.leftMargin: Kirigami.Units.gridUnit
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: Kirigami.Units.gridUnit * 3 + root.homeScreen.topMargin
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Kirigami.Units.gridUnit
|
||||
|
||||
PC3.ToolButton {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
|
|
@ -58,10 +70,24 @@ MouseArea {
|
|||
|
||||
PC3.Label {
|
||||
id: heading
|
||||
color: 'white'
|
||||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||
text: i18n("Widgets")
|
||||
font.weight: Font.Bold
|
||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
PC3.ToolButton {
|
||||
id: getWidgetsButton
|
||||
icon.name: "get-hot-new-stuff"
|
||||
text: i18ndc("plasma_shell_org.kde.plasma.mobile", "@action:button The word 'new' refers to widgets", "Get New Widgets…")
|
||||
Accessible.name: i18ndc("plasma_shell_org.kde.plasma.mobile", "@action:button", "Get New Widgets…")
|
||||
|
||||
onClicked: {
|
||||
getWidgetsDialog.model = widgetExplorer.widgetsMenuActions
|
||||
getWidgetsDialog.openRelative()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -217,5 +243,7 @@ MouseArea {
|
|||
WidgetExplorer {
|
||||
id: widgetExplorer
|
||||
containment: Plasmoid
|
||||
|
||||
onShouldClose: root.requestClose()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ Item {
|
|||
property var homeScreen
|
||||
property real settingsModeHomeScreenScale
|
||||
|
||||
readonly property bool homeScreenInteractive: !appletListViewer.open
|
||||
readonly property bool homeScreenInteractive: !appletListViewerLoader.active
|
||||
|
||||
property real bottomMargin: 0
|
||||
property real leftMargin: 0
|
||||
|
|
@ -33,7 +33,7 @@ Item {
|
|||
// Close applet viewer when settings view closes
|
||||
function onViewStateChanged() {
|
||||
if (folio.HomeScreenState.viewState !== Folio.HomeScreenState.SettingsView) {
|
||||
appletListViewer.requestClose();
|
||||
appletListViewerLoader.requestClose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ Item {
|
|||
}
|
||||
|
||||
onClicked: {
|
||||
appletListViewer.open = true;
|
||||
appletListViewerLoader.active = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -215,27 +215,50 @@ Item {
|
|||
}
|
||||
]
|
||||
|
||||
AppletListViewer {
|
||||
id: appletListViewer
|
||||
folio: root.folio
|
||||
Loader {
|
||||
id: appletListViewerLoader
|
||||
asynchronous: true
|
||||
active: false
|
||||
|
||||
signal requestClose()
|
||||
onRequestClose: item?.requestClose()
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
property bool open: false
|
||||
onRequestClose: open = false
|
||||
|
||||
opacity: open ? 1 : 0
|
||||
|
||||
opacity: status == Loader.Ready ? 1 : 0
|
||||
// move the settings out of the way if it is not visible
|
||||
// NOTE: we do this instead of setting visible to false, because
|
||||
// it doesn't mess with widget drag and drop
|
||||
y: (opacity === 0) ? appletListViewer.height : 0
|
||||
|
||||
homeScreen: root.homeScreen
|
||||
y: (opacity > 0) ? 0 : parent.height
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: Kirigami.Units.shortDuration }
|
||||
}
|
||||
|
||||
sourceComponent: AppletListViewer {
|
||||
id: appletListViewer
|
||||
folio: root.folio
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
onRequestClose: parent.active = false
|
||||
|
||||
homeScreen: root.homeScreen
|
||||
}
|
||||
}
|
||||
|
||||
PC3.BusyIndicator {
|
||||
id: appletListLoadingIndicator
|
||||
anchors.centerIn: parent
|
||||
visible: appletListViewerLoader.status === Loader.Loading
|
||||
|
||||
implicitHeight: Kirigami.Units.iconSizes.huge
|
||||
implicitWidth: Kirigami.Units.iconSizes.huge
|
||||
|
||||
Kirigami.Theme.inherit: false
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||
}
|
||||
|
||||
SettingsWindow {
|
||||
|
|
|
|||
Loading…
Reference in a new issue