Warning, /multimedia/elisa/src/qml/mobile/MobileSidebar.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2020 (c) Devin Lin <espidev@gmail.com>
0003
0004 SPDX-License-Identifier: LGPL-3.0-or-later
0005 */
0006
0007 import org.kde.kirigami 2.11 as Kirigami
0008 import QtQuick 2.12
0009 import QtQuick.Layouts 1.3
0010 import QtQuick.Controls 2.1
0011
0012 Kirigami.GlobalDrawer {
0013 id: drawer
0014
0015 property alias model: repeater.model
0016 signal switchView(int viewIndex)
0017
0018 property int viewIndex: 0
0019
0020 title: i18nc("@title:window", "Elisa")
0021 titleIcon: "elisa"
0022
0023 modal: true
0024 width: Kirigami.Units.gridUnit * 11
0025
0026 actions: []
0027
0028 Component {
0029 id: action
0030 Kirigami.Action {}
0031 }
0032
0033 Component.onCompleted: {
0034 // disable default handle as it covers content
0035 handle.visible = false;
0036
0037 let settings = action.createObject(drawer, {"icon.name": "settings-configure", text: i18nc("@title:window", "Settings")});
0038 settings.onTriggered.connect(() => {
0039 mainWindow.pageStack.layers.push("MobileSettingsPage.qml");
0040 });
0041 drawer.actions.push(settings);
0042 }
0043
0044 // add sidebar actions
0045 Repeater {
0046 id: repeater
0047 Item {
0048 Component.onCompleted: {
0049 // HACK: the images provided by the model are in the form "image://icon/view-media-genre"
0050 // remove the "image://icon/" in order to use icons
0051 let icon = String(model.image).substring(13);
0052 let object = action.createObject(drawer, {"icon.name": icon, text: model.display});
0053 object.onTriggered.connect(() => {
0054 viewIndex = model.index;
0055 switchView(model.index);
0056 });
0057 drawer.actions.push(object);
0058 }
0059 }
0060 }
0061 }