Changeset View
Changeset View
Standalone View
Standalone View
src/controls/GlobalDrawer.qml
Show All 11 Lines | |||||
12 | * GNU Library General Public License for more details | 12 | * GNU Library General Public License for more details | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.6 | ||
21 | import QtQuick.Templates 2.0 as T2 | 21 | import QtQuick.Templates 2.0 as T2 | ||
22 | import QtQuick.Layouts 1.2 | 22 | import QtQuick.Layouts 1.2 | ||
23 | import QtGraphicalEffects 1.0 | 23 | import QtGraphicalEffects 1.0 | ||
24 | import org.kde.kirigami 2.2 | 24 | import org.kde.kirigami 2.3 | ||
25 | 25 | | |||
26 | import "private" | 26 | import "private" | ||
27 | import "templates/private" | 27 | import "templates/private" | ||
28 | 28 | | |||
29 | /** | 29 | /** | ||
30 | * A drawer specialization intended for the global actions of the application | 30 | * A drawer specialization intended for the global actions of the application | ||
31 | * valid regardless of the application state (think about the menubar | 31 | * valid regardless of the application state (think about the menubar | ||
32 | * of a desktop application). | 32 | * of a desktop application). | ||
▲ Show 20 Lines • Show All 352 Lines • ▼ Show 20 Line(s) | 383 | ColumnLayout { | |||
385 | property alias model: actionsRepeater.model | 385 | property alias model: actionsRepeater.model | ||
386 | property Action current | 386 | property Action current | ||
387 | 387 | | |||
388 | property int level: 0 | 388 | property int level: 0 | ||
389 | Layout.maximumHeight: Layout.minimumHeight | 389 | Layout.maximumHeight: Layout.minimumHeight | ||
390 | 390 | | |||
391 | 391 | | |||
392 | BasicListItem { | 392 | BasicListItem { | ||
393 | id: backItem | ||||
393 | visible: level > 0 | 394 | visible: level > 0 | ||
394 | supportsMouseEvents: true | 395 | supportsMouseEvents: true | ||
395 | icon: (LayoutMirroring.enabled ? "go-previous-symbolic-rtl" : "go-previous-symbolic") | 396 | icon: (LayoutMirroring.enabled ? "go-previous-symbolic-rtl" : "go-previous-symbolic") | ||
396 | label: qsTr("Back") | 397 | | ||
398 | label: MnemonicData.richTextLabel | ||||
399 | MnemonicData.enabled: backItem.enabled && backItem.visible | ||||
400 | MnemonicData.controlType: MnemonicData.MenuItem | ||||
401 | MnemonicData.label: qsTr("Back") | ||||
402 | | ||||
397 | separatorVisible: false | 403 | separatorVisible: false | ||
398 | onClicked: stackView.pop() | 404 | onClicked: stackView.pop() | ||
399 | } | 405 | } | ||
406 | Shortcut { | ||||
407 | sequence: backItem.MnemonicData.sequence | ||||
408 | onActivated: backItem.clicked() | ||||
409 | } | ||||
400 | 410 | | |||
401 | Repeater { | 411 | Repeater { | ||
402 | id: actionsRepeater | 412 | id: actionsRepeater | ||
403 | model: actions | 413 | model: actions | ||
404 | delegate: BasicListItem { | 414 | delegate: BasicListItem { | ||
405 | id: listItem | 415 | id: listItem | ||
406 | supportsMouseEvents: true | 416 | supportsMouseEvents: true | ||
407 | checked: modelData.checked | 417 | checked: modelData.checked | ||
408 | icon: modelData.iconName | 418 | icon: modelData.iconName | ||
409 | label: modelData.text | 419 | | ||
420 | label: MnemonicData.richTextLabel | ||||
421 | MnemonicData.enabled: listItem.enabled && listItem.visible | ||||
422 | MnemonicData.controlType: MnemonicData.MenuItem | ||||
423 | MnemonicData.label: modelData.text | ||||
424 | | ||||
410 | separatorVisible: false | 425 | separatorVisible: false | ||
411 | visible: model ? model.visible || model.visible===undefined : modelData.visible | 426 | visible: model ? model.visible || model.visible===undefined : modelData.visible | ||
412 | enabled: model ? model.enabled : modelData.enabled | 427 | enabled: model ? model.enabled : modelData.enabled | ||
413 | opacity: enabled ? 1.0 : 0.3 | 428 | opacity: enabled ? 1.0 : 0.3 | ||
414 | Icon { | 429 | Icon { | ||
430 | Shortcut { | ||||
431 | sequence: listItem.MnemonicData.sequence | ||||
432 | onActivated: listItem.clicked() | ||||
433 | } | ||||
415 | isMask: true | 434 | isMask: true | ||
416 | anchors { | 435 | anchors { | ||
417 | verticalCenter: contentItem.verticalCenter | 436 | verticalCenter: contentItem.verticalCenter | ||
418 | right: contentItem.right | 437 | right: contentItem.right | ||
419 | rightMargin: !Settings.isMobile && mainFlickable.contentHeight > mainFlickable.height ? Units.gridUnit : 0 | 438 | rightMargin: !Settings.isMobile && mainFlickable.contentHeight > mainFlickable.height ? Units.gridUnit : 0 | ||
420 | } | 439 | } | ||
421 | height: Units.iconSizes.smallMedium | 440 | height: Units.iconSizes.smallMedium | ||
422 | selected: listItem.checked || listItem.pressed | 441 | selected: listItem.checked || listItem.pressed | ||
Show All 24 Lines |