mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
Closes: #441 Notes: - Camera cannot be selected as an action due to #377 {width=461 height=288}
47 lines
No EOL
1.5 KiB
QML
47 lines
No EOL
1.5 KiB
QML
// SPDX-FileCopyrightText: 2025 User8395 <therealuser8395@proton.me>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
import org.kde.plasma.quicksetting.flashlight 1.0
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
Button {
|
|
id: root
|
|
property int buttonAction
|
|
|
|
visible: buttonAction !== ShellSettings.Settings.None
|
|
highlighted: buttonAction === ShellSettings.Settings.Flashlight ? FlashlightUtil.torchEnabled() : false
|
|
display: Button.IconOnly
|
|
icon.name: {
|
|
switch (buttonAction) {
|
|
case ShellSettings.Settings.Flashlight:
|
|
return "flashlight-on-symbolic"
|
|
case ShellSettings.Settings.Camera:
|
|
return "camera-photo-symbolic"
|
|
}
|
|
}
|
|
text: {
|
|
switch (buttonAction) {
|
|
case ShellSettings.Settings.Flashlight:
|
|
return i18nc("@action:button", "Turn flashlight on");
|
|
case ShellSettings.Settings.Camera:
|
|
return i18nc("@action:button", "Open camera");
|
|
}
|
|
}
|
|
onClicked: {
|
|
switch (buttonAction) {
|
|
case ShellSettings.Settings.Flashlight:
|
|
FlashlightUtil.toggleTorch();
|
|
return;
|
|
case ShellSettings.Settings.Camera:
|
|
MobileShell.ShellUtil.launchApp("org.kde.plasma.camera");
|
|
flickable.goToOpenPosition();
|
|
return;
|
|
}
|
|
}
|
|
} |