mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
folio: Fix AppDelegate null errors
Sometimes due to model changes the application will be null, which causes a lot of errors in the console. Add null checks to avoid this.
This commit is contained in:
parent
bd895574ff
commit
c5f0d15b14
1 changed files with 11 additions and 7 deletions
|
|
@ -17,8 +17,9 @@ AbstractDelegate {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
shadow: true
|
shadow: true
|
||||||
name: application.name
|
name: application ? application.name : ""
|
||||||
|
|
||||||
|
// This may be null for short periods of time due to model changes
|
||||||
property Folio.FolioApplication application
|
property Folio.FolioApplication application
|
||||||
|
|
||||||
property alias iconItem: icon
|
property alias iconItem: icon
|
||||||
|
|
@ -27,6 +28,10 @@ AbstractDelegate {
|
||||||
property bool turnToFolderAnimEnabled: false
|
property bool turnToFolderAnimEnabled: false
|
||||||
|
|
||||||
function launchApp() {
|
function launchApp() {
|
||||||
|
if (!application) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (application.icon !== "" && !root.application.running) {
|
if (application.icon !== "" && !root.application.running) {
|
||||||
MobileShellState.ShellDBusClient.openAppLaunchAnimationWithPosition(
|
MobileShellState.ShellDBusClient.openAppLaunchAnimationWithPosition(
|
||||||
Plasmoid.screen,
|
Plasmoid.screen,
|
||||||
|
|
@ -50,7 +55,7 @@ AbstractDelegate {
|
||||||
height: folio.FolioSettings.delegateIconSize
|
height: folio.FolioSettings.delegateIconSize
|
||||||
width: folio.FolioSettings.delegateIconSize
|
width: folio.FolioSettings.delegateIconSize
|
||||||
|
|
||||||
// background for folder creation animation
|
// Background for folder creation animation
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: rect
|
id: rect
|
||||||
radius: Kirigami.Units.cornerRadius
|
radius: Kirigami.Units.cornerRadius
|
||||||
|
|
@ -77,12 +82,12 @@ AbstractDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// app icon
|
// Application icon
|
||||||
DelegateAppIcon {
|
DelegateAppIcon {
|
||||||
id: icon
|
id: icon
|
||||||
folio: root.folio
|
folio: root.folio
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
source: root.application.icon
|
source: root.application ? root.application.icon : ""
|
||||||
|
|
||||||
property real scaleAmount: root.turnToFolder ? 0.3 : 1.0
|
property real scaleAmount: root.turnToFolder ? 0.3 : 1.0
|
||||||
Behavior on scaleAmount {
|
Behavior on scaleAmount {
|
||||||
|
|
@ -97,13 +102,14 @@ AbstractDelegate {
|
||||||
yScale: icon.scaleAmount
|
yScale: icon.scaleAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Running indicator
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
bottomMargin: -Kirigami.Units.smallSpacing
|
bottomMargin: -Kirigami.Units.smallSpacing
|
||||||
}
|
}
|
||||||
visible: root.application.running
|
visible: root.application && root.application.running
|
||||||
radius: width
|
radius: width
|
||||||
width: Kirigami.Units.smallSpacing
|
width: Kirigami.Units.smallSpacing
|
||||||
height: width
|
height: width
|
||||||
|
|
@ -112,5 +118,3 @@ AbstractDelegate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue