/usr/lib/x86_64-linux-gnu/qt5/qml/org/kde/kirigami.2/AbstractApplicationWindow.qml is in qml-module-org-kde-kirigami2 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | /*
* Copyright 2015 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import QtQuick 2.5
import QtQuick.Controls 2.0 as QQC2
import "templates/private"
import org.kde.kirigami 2.2
import QtGraphicalEffects 1.0
/**
* A window that provides some basic features needed for all apps
* Use this class only if you need a custom content for your application,
* different from the Page Row behavior recomended by the HIG and provided
* by ApplicationWindow.
* It is recomended to use ApplicationWindow instead
* @see ApplicationWindow
*
* It's usually used as a root QML component for the application.
* It provides support for a central page stack, side drawers and
* a top ApplicationHeader, as well as basic support for the
* Android back button
*
* Example usage:
* @code
* import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
* globalDrawer: Kirigami.GlobalDrawer {
* actions: [
* Kirigami.Action {
* text: "View"
* iconName: "view-list-icons"
* Kirigami.Action {
* text: "action 1"
* }
* Kirigami.Action {
* text: "action 2"
* }
* Kirigami.Action {
* text: "action 3"
* }
* },
* Kirigami.Action {
* text: "Sync"
* iconName: "folder-sync"
* }
* ]
* }
*
* contextDrawer: Kirigami.ContextDrawer {
* id: contextDrawer
* }
*
* pageStack: PageStack {
* ...
* }
* [...]
* }
* @endcode
*
* @inherit QtQuick.Controls.ApplicationWindow
*/
QQC2.ApplicationWindow {
id: root
/**
* pageStack: StackView
* Readonly.
* The stack used to allocate the pages and to manage the transitions
* between them.
* Put a container here, such as QQuickControls PageStack
*/
property Item pageStack
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
LayoutMirroring.childrenInherit: true
/**
* Shows a little passive notification at the bottom of the app window
* lasting for few seconds, with an optional action button.
*
* @param message The text message to be shown to the user.
* @param timeout How long to show the message:
* possible values: "short", "long" or the number of milliseconds
* @param actionText Text in the action button, if any.
* @param callBack A JavaScript function that will be executed when the
* user clicks the button.
*/
function showPassiveNotification(message, timeout, actionText, callBack) {
if (!internal.__passiveNotification) {
var component = Qt.createComponent("templates/private/PassiveNotification.qml");
internal.__passiveNotification = component.createObject(overlay.parent);
}
internal.__passiveNotification.showNotification(message, timeout, actionText, callBack);
}
/**
* Hide the passive notification, if any is shown
*/
function hidePassiveNotification() {
if(internal.__passiveNotification) {
internal.__passiveNotification.hideNotification();
}
}
/**
* @returns a pointer to this application window
* can be used anywhere in the application.
*/
function applicationWindow() {
return root;
}
/**
* header: ApplicationHeader
* An item that can be used as a title for the application.
* Scrolling the main page will make it taller or shorter (trough the point of going away)
* It's a behavior similar to the typical mobile web browser adressbar
* the minimum, preferred and maximum heights of the item can be controlled with
* * Layout.minimumHeight: default is 0, i.e. hidden
* * Layout.preferredHeight: default is Units.gridUnit * 1.6
* * Layout.maximumHeight: default is Units.gridUnit * 3
*
* To achieve a titlebar that stays completely fixed just set the 3 sizes as the same
* //FIXME: this should become an actual ApplicationHeader
*/
//header: undefined
/**
* controlsVisible: bool
* This property controls wether the standard chrome of the app, such
* as the Action button, the drawer handles and the application
* header should be visible or not.
*/
property bool controlsVisible: true
/**
* globalDrawer: OverlayDrawer
* The drawer for global actions, that will be opened by sliding from the
* left screen edge or by dragging the ActionButton to the right.
* It is recommended to use the GlobalDrawer class here
*/
property OverlayDrawer globalDrawer
/**
* wideScreen: bool
* If true the application is considered to be in "widescreen" mode, such as on desktops or horizontal tablets.
* Different styles can have an own logic for deciding this
*/
property bool wideScreen: width >= Units.gridUnit * 60
/**
* contextDrawer: OverlayDrawer
* The drawer for context-dependednt actions, that will be opened by sliding from the
* right screen edge or by dragging the ActionButton to the left.
* It is recommended to use the ContextDrawer class here.
* The contents of the context drawer should depend from what page is
* loaded in the main pageStack
*
* Example usage:
* @code
* import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.ApplicationWindow {
* [...]
* contextDrawer: Kirigami.ContextDrawer {
* id: contextDrawer
* }
* [...]
* }
* @endcode
*
* @code
* import org.kde.kirigami 2.2 as Kirigami
*
* Kirigami.Page {
* [...]
* contextualActions: [
* Kirigami.Action {
* iconName: "edit"
* text: "Action text"
* onTriggered: {
* // do stuff
* }
* },
* Kirigami.Action {
* iconName: "edit"
* text: "Action text"
* onTriggered: {
* // do stuff
* }
* }
* ]
* [...]
* }
* @endcode
*
* When this page will be the current one, the context drawer will visualize
* contextualActions defined as property in that page.
*/
property OverlayDrawer contextDrawer
/**
* reachableMode: bool
* When true the application is in reachable mode for single hand use.
* the whole content of the application is moved down the screen to be
* reachable with the thumb. if wideScreen is true, or reachableModeEnabled is false,
* tis property has no effect.
*/
property bool reachableMode: false
/**
* When true the application will go into reachable mode on pull down
*/
property bool reachableModeEnabled: true
MouseArea {
parent: contentItem.parent
z: -1
anchors.fill: parent
onClicked: root.reachableMode = false;
visible: root.reachableMode && root.reachableModeEnabled
Rectangle {
anchors.fill: parent
color: Qt.rgba(0, 0, 0, 0.3)
opacity: 0.15
Icon {
anchors.horizontalCenter: parent.horizontalCenter
y: x
width: Units.iconSizes.large
height: width
source: "go-up"
}
}
}
contentItem.anchors.left: contentItem.parent.left
contentItem.anchors.right: contentItem.parent.right
contentItem.anchors.topMargin: root.wideScreen && header && controlsVisible ? header.height : 0
contentItem.anchors.leftMargin: root.globalDrawer && (root.globalDrawer.modal === false) ? root.globalDrawer.contentItem.width * root.globalDrawer.position : 0
contentItem.anchors.rightMargin: root.contextDrawer && root.contextDrawer.modal === false ? root.contextDrawer.contentItem.width * root.contextDrawer.position : 0
contentItem.transform: Translate {
Behavior on y {
NumberAnimation {
duration: Units.longDuration
easing.type: Easing.InOutQuad
}
}
y: root.reachableMode && root.reachableModeEnabled && !root.wideScreen ? root.height/2 : 0
x: root.globalDrawer && root.globalDrawer.modal === true && root.globalDrawer.toString().indexOf("SplitDrawer") === 0 ? root.globalDrawer.contentItem.width * root.globalDrawer.position : 0
}
//Don't want overscroll in landscape mode
onWidthChanged: {
if (width > height) {
root.reachableMode = false;
}
}
Binding {
when: globalDrawer !== undefined && root.visible
target: globalDrawer
property: "parent"
value: overlay
}
Binding {
when: contextDrawer !== undefined && root.visible
target: contextDrawer
property: "parent"
value: overlay
}
onPageStackChanged: pageStack.parent = contentItem;
width: Units.gridUnit * 30
height: Units.gridUnit * 45
visible: true
QtObject {
id: internal
property Item __passiveNotification
}
Shortcut {
sequence: StandardKey.Quit
onActivated: root.close()
}
}
|