mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 06:14:45 +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.kirigami as Kirigami
|
||||||
import org.kde.plasma.plasmoid
|
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.plasma.private.shell 2.0
|
||||||
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
import org.kde.private.mobile.homescreen.folio 1.0 as Folio
|
||||||
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
import org.kde.kirigamiaddons.formcard 1.0 as FormCard
|
||||||
|
|
@ -39,6 +40,15 @@ MouseArea {
|
||||||
color: Qt.rgba(0, 0, 0, 0.7)
|
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 {
|
RowLayout {
|
||||||
id: header
|
id: header
|
||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
|
|
@ -46,6 +56,8 @@ MouseArea {
|
||||||
anchors.leftMargin: Kirigami.Units.gridUnit
|
anchors.leftMargin: Kirigami.Units.gridUnit
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: Kirigami.Units.gridUnit * 3 + root.homeScreen.topMargin
|
anchors.topMargin: Kirigami.Units.gridUnit * 3 + root.homeScreen.topMargin
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Kirigami.Units.gridUnit
|
||||||
|
|
||||||
PC3.ToolButton {
|
PC3.ToolButton {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|
@ -58,10 +70,24 @@ MouseArea {
|
||||||
|
|
||||||
PC3.Label {
|
PC3.Label {
|
||||||
id: heading
|
id: heading
|
||||||
color: 'white'
|
Kirigami.Theme.inherit: false
|
||||||
|
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
|
||||||
text: i18n("Widgets")
|
text: i18n("Widgets")
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
font.pointSize: Kirigami.Theme.defaultFont.pointSize * 1.5
|
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 {
|
WidgetExplorer {
|
||||||
id: widgetExplorer
|
id: widgetExplorer
|
||||||
containment: Plasmoid
|
containment: Plasmoid
|
||||||
|
|
||||||
|
onShouldClose: root.requestClose()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ Item {
|
||||||
property var homeScreen
|
property var homeScreen
|
||||||
property real settingsModeHomeScreenScale
|
property real settingsModeHomeScreenScale
|
||||||
|
|
||||||
readonly property bool homeScreenInteractive: !appletListViewer.open
|
readonly property bool homeScreenInteractive: !appletListViewerLoader.active
|
||||||
|
|
||||||
property real bottomMargin: 0
|
property real bottomMargin: 0
|
||||||
property real leftMargin: 0
|
property real leftMargin: 0
|
||||||
|
|
@ -33,7 +33,7 @@ Item {
|
||||||
// Close applet viewer when settings view closes
|
// Close applet viewer when settings view closes
|
||||||
function onViewStateChanged() {
|
function onViewStateChanged() {
|
||||||
if (folio.HomeScreenState.viewState !== Folio.HomeScreenState.SettingsView) {
|
if (folio.HomeScreenState.viewState !== Folio.HomeScreenState.SettingsView) {
|
||||||
appletListViewer.requestClose();
|
appletListViewerLoader.requestClose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +142,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
appletListViewer.open = true;
|
appletListViewerLoader.active = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -215,27 +215,50 @@ Item {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
AppletListViewer {
|
Loader {
|
||||||
id: appletListViewer
|
id: appletListViewerLoader
|
||||||
folio: root.folio
|
asynchronous: true
|
||||||
|
active: false
|
||||||
|
|
||||||
|
signal requestClose()
|
||||||
|
onRequestClose: item?.requestClose()
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
property bool open: false
|
opacity: status == Loader.Ready ? 1 : 0
|
||||||
onRequestClose: open = false
|
|
||||||
|
|
||||||
opacity: open ? 1 : 0
|
|
||||||
|
|
||||||
// move the settings out of the way if it is not visible
|
// move the settings out of the way if it is not visible
|
||||||
// NOTE: we do this instead of setting visible to false, because
|
// NOTE: we do this instead of setting visible to false, because
|
||||||
// it doesn't mess with widget drag and drop
|
// it doesn't mess with widget drag and drop
|
||||||
y: (opacity === 0) ? appletListViewer.height : 0
|
y: (opacity > 0) ? 0 : parent.height
|
||||||
|
|
||||||
homeScreen: root.homeScreen
|
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation { duration: Kirigami.Units.shortDuration }
|
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 {
|
SettingsWindow {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue