Warning, /plasma/plasma-mobile/containments/taskpanel/package/contents/ui/NavigationPanelComponent.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org>
0002 // SPDX-License-Identifier: GPL-2.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Layouts
0006 import QtQuick.Window
0007 
0008 import org.kde.plasma.plasmoid
0009 import org.kde.plasma.core as PlasmaCore
0010 import org.kde.plasma.workspace.keyboardlayout as Keyboards
0011 
0012 import org.kde.plasma.private.mobileshell as MobileShell
0013 import org.kde.plasma.private.mobileshell.state as MobileShellState
0014 import org.kde.taskmanager as TaskManager
0015 import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
0016 import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
0017 
0018 import org.kde.kirigami as Kirigami
0019 
0020 MobileShell.NavigationPanel {
0021     id: root
0022     required property bool opaqueBar
0023     
0024     // background is:
0025     // - opaque if an app is shown or vkbd is shown
0026     // - translucent if the task switcher is open
0027     // - transparent if on the homescreen
0028     backgroundColor: (Keyboards.KWinVirtualKeyboard.visible || opaqueBar) ? Kirigami.Theme.backgroundColor : "transparent";
0029     foregroundColorGroup: opaqueBar ? Kirigami.Theme.Window : Kirigami.Theme.Complementary
0030     shadow: !opaqueBar
0031         
0032     TaskManager.VirtualDesktopInfo {
0033         id: virtualDesktopInfo
0034     }
0035 
0036     TaskManager.ActivityInfo {
0037         id: activityInfo
0038     }
0039 
0040     TaskManager.TasksModel {
0041         id: tasksModel
0042         filterByVirtualDesktop: true
0043         filterByActivity: true
0044         filterNotMaximized: false
0045         filterByScreen: true
0046         filterHidden: true
0047 
0048         virtualDesktop: virtualDesktopInfo.currentDesktop
0049         activity: activityInfo.currentActivity
0050 
0051         groupMode: TaskManager.TasksModel.GroupDisabled
0052     }
0053 
0054     // ~~~~
0055     // navigation panel actions
0056     
0057     // toggle task switcher button
0058     leftAction: MobileShell.NavigationPanelAction {
0059         id: taskSwitcherAction
0060         
0061         enabled: true
0062         iconSource: "mobile-task-switcher"
0063         iconSizeFactor: 0.75
0064         
0065         onTriggered: {
0066             Plasmoid.triggerTaskSwitcher();
0067         }
0068     }
0069     
0070     // home button
0071     middleAction: MobileShell.NavigationPanelAction {
0072         id: homeAction
0073         
0074         enabled: true
0075         iconSource: "start-here-kde"
0076         iconSizeFactor: 1
0077         
0078         onTriggered: {
0079             MobileShellState.ShellDBusClient.openHomeScreen();
0080         }
0081     }
0082     
0083     // close app/keyboard button
0084     rightAction: MobileShell.NavigationPanelAction {
0085         id: closeAppAction
0086         
0087         enabled: Keyboards.KWinVirtualKeyboard.visible || WindowPlugin.WindowUtil.hasCloseableActiveWindow
0088         iconSource: Keyboards.KWinVirtualKeyboard.visible ? "go-down-symbolic" : "mobile-close-app"
0089         // mobile-close-app (from plasma-frameworks) seems to have less margins than icons from breeze-icons
0090         iconSizeFactor: Keyboards.KWinVirtualKeyboard.visible ? 1 : 0.75
0091         
0092         onTriggered: {
0093             if (Keyboards.KWinVirtualKeyboard.active) {
0094                 // close keyboard if it is open
0095                 Keyboards.KWinVirtualKeyboard.active = false;
0096             } else if (WindowPlugin.WindowUtil.hasCloseableActiveWindow) {
0097                 // if task switcher is closed, but there is an active window
0098                 if (tasksModel.activeTask !== 0) {
0099                     tasksModel.requestClose(tasksModel.activeTask);
0100                 }
0101                 MobileShellState.ShellDBusClient.closeAppLaunchAnimation();
0102             }
0103         }
0104     }
0105     
0106     rightCornerAction: MobileShell.NavigationPanelAction {
0107         id: keyboardToggleAction
0108         visible: ShellSettings.Settings.alwaysShowKeyboardToggleOnNavigationPanel || 
0109                  (Keyboards.KWinVirtualKeyboard.available && !Keyboards.KWinVirtualKeyboard.activeClientSupportsTextInput)
0110         enabled: true
0111         iconSource: "input-keyboard-virtual-symbolic"
0112         iconSizeFactor: 0.75
0113         
0114         onTriggered: {
0115             if (Keyboards.KWinVirtualKeyboard.visible) {
0116                 Keyboards.KWinVirtualKeyboard.active = false;
0117             } else {
0118                 Keyboards.KWinVirtualKeyboard.forceActivate();
0119             }
0120         }
0121     }
0122 }