Warning, /plasma/aura-browser/app/qml/mainSandbox.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2022 Aditya Mehra <aix.m@outlook.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 import QtQuick 2.12
0008 import QtQuick.Window 2.12
0009 import QtQuick.Layouts 1.12
0010 import QtQuick.Controls 2.12 as Controls
0011 import QtQuick.LocalStorage 2.12
0012 import "views" as Views
0013 import "delegates" as Delegates
0014 import "code/RecentStorage.js" as RecentStorage
0015 import "code/BookmarkStorage.js" as BookmarkStorage
0016 import "code/Utils.js" as Utils
0017 import Aura 1.0 as Aura
0018 import QtWebEngine 1.7
0019 import QtQuick.VirtualKeyboard
0020 import QtQuick.VirtualKeyboard.Settings
0021 import org.kde.kirigami as Kirigami
0022 
0023 Kirigami.AbstractApplicationWindow {
0024     id: root
0025     visible: true
0026     width:  Screen.desktopAvailableWidth
0027     height: Screen.desktopAvailableHeight
0028     title: i18n("Aura-Browser")
0029     property int virtualMouseMoveSpeed: 10
0030     signal settingsTabRequested
0031     signal blurFieldRequested
0032     signal mouseActivationRequested
0033     signal mouseDeActivationRequested
0034     signal ignoreInputRequested
0035     visibility: "FullScreen"
0036 
0037     globalDrawer: Kirigami.GlobalDrawer {
0038         id: gDrawer
0039         handleVisible: false
0040 
0041         onOpened: {
0042             quitButton.forceActiveFocus();
0043         }
0044 
0045         Controls.Label {
0046             id: bblabl
0047             text: i18n("Press 'esc' or the [←] Back button to close")
0048             Layout.alignment: Qt.AlignRight
0049         }
0050 
0051         Kirigami.Separator {
0052             Layout.fillWidth: true
0053             Layout.preferredHeight: 1
0054         }
0055 
0056         Controls.Button {
0057             id: quitButton
0058             Layout.fillWidth: true
0059             Layout.preferredHeight: Kirigami.Units.gridUnit * 4
0060 
0061             background: Rectangle {
0062                 color: quitButton.activeFocus ? Kirigami.Theme.highlightColor : Kirigami.Theme.backgroundColor
0063                 border.color: Kirigami.Theme.disabledTextColor
0064             }
0065 
0066             contentItem: RowLayout {
0067                 Kirigami.Icon {
0068                     source: "window-close"
0069                     Layout.preferredWidth: Kirigami.Units.iconSizes.medium
0070                     Layout.preferredHeight: Kirigami.Units.iconSizes.medium
0071                 }
0072 
0073                 Controls.Label {
0074                     Layout.fillWidth: true
0075                     text: i18n("Quit")
0076                 }
0077             }
0078 
0079             onClicked: (mouse)=> {
0080                 root.close();
0081             }
0082 
0083             Keys.onReturnPressed: (event)=> {
0084                 root.close();
0085             }
0086         }
0087     }
0088 
0089     Component.onCompleted: {
0090         Cursor.setStep(Aura.GlobalSettings.virtualMouseSpeed);
0091         if(Aura.GlobalSettings.firstRun){
0092             RecentStorage.dbInit();
0093             BookmarkStorage.dbInit();
0094             BookmarkStorage.prePopulateBookmarks();
0095             Aura.GlobalSettings.setFirstRun(false);
0096         }
0097         keyFilter.startFilter();
0098     }
0099 
0100     Connections {
0101         target: Aura.GlobalSettings
0102         
0103         function onFocusOnVKeyboard() {
0104            mouseDeActivationRequested();
0105          }
0106         function onFocusOffVKeyboard() {
0107            ignoreInputRequested();
0108         }
0109     }
0110 
0111     SandboxLoader {
0112         anchors.fill: parent
0113     }
0114 
0115     InputPanel {
0116         id: inputPanel
0117         z: 99
0118         x: 0
0119         y: root.height
0120         width: root.width
0121 
0122         onActiveChanged: {
0123             if(!active){
0124                 keyFilter.startFilter();
0125                 blurFieldRequested();
0126             } else {
0127                 keyFilter.stopFilter();
0128             }
0129         }
0130 
0131         states: State {
0132             name: "visible"
0133             when: inputPanel.active
0134             PropertyChanges {
0135                 target: inputPanel
0136                 y: parent.height - inputPanel.height
0137             }
0138         }
0139 
0140         transitions: Transition {
0141             from: ""
0142             to: "visible"
0143             reversible: true
0144             ParallelAnimation {
0145                 NumberAnimation {
0146                     properties: "y"
0147                     duration: 250
0148                     easing.type: Easing.InOutQuad
0149                 }
0150             }
0151         }
0152     }
0153 }