Changeset View
Changeset View
Standalone View
Standalone View
tests/khotnewstuff-dialog-ui/main.qml
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2019 Dan Leinir Turthra Jensen <admin@leinir.dk> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) version 3, or any | ||||
8 | * later version accepted by the membership of KDE e.V. (or its | ||||
9 | * successor approved by the membership of KDE e.V.), which shall | ||||
10 | * act as a proxy defined in Section 6 of version 3 of the license. | ||||
11 | * | ||||
12 | * This library is distributed in the hope that it will be useful, | ||||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
15 | * Lesser General Public License for more details. | ||||
16 | * | ||||
17 | * You should have received a copy of the GNU Lesser General Public | ||||
18 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
19 | * | ||||
20 | */ | ||||
21 | | ||||
22 | import QtQuick 2.7 | ||||
23 | import QtQuick.Dialogs 1.3 as QtDialogs | ||||
24 | import QtQuick.Layouts 1.12 as QtLayouts | ||||
25 | import org.kde.kirigami 2.5 as Kirigami | ||||
26 | import org.kde.newstuff 1.62 as NewStuff | ||||
27 | | ||||
28 | Kirigami.ApplicationWindow { | ||||
29 | id: root; | ||||
30 | title: "KNewStuff Dialog" | ||||
31 | | ||||
32 | globalDrawer: Kirigami.GlobalDrawer { | ||||
33 | title: "KNewStuff Dialog" | ||||
34 | titleIcon: "get-hot-new-stuff" | ||||
35 | drawerOpen: true; | ||||
36 | modal: false; | ||||
37 | topContent: NewStuff.Button { | ||||
38 | id: newStuffButton | ||||
39 | QtLayouts.Layout.fillWidth: true | ||||
40 | configFile: knsrcfile | ||||
41 | } | ||||
42 | | ||||
43 | actions: [ | ||||
44 | Kirigami.Action { | ||||
45 | text: "Find Different Hot New Stuff..." | ||||
46 | icon.name: "document-open" | ||||
47 | onTriggered: { | ||||
48 | fileDialog.open(); | ||||
49 | } | ||||
50 | } | ||||
51 | ] | ||||
52 | } | ||||
53 | contextDrawer: Kirigami.ContextDrawer { | ||||
54 | id: contextDrawer | ||||
55 | } | ||||
56 | | ||||
57 | pageStack.defaultColumnWidth: pageStack.width | ||||
58 | Component { | ||||
59 | id: mainPageComponent | ||||
60 | NewStuff.Page { } | ||||
61 | } | ||||
62 | Component.onCompleted: { | ||||
63 | pageStack.push(mainPageComponent, { configFile: knsrcfile } ); | ||||
64 | } | ||||
65 | | ||||
66 | QtDialogs.FileDialog { | ||||
67 | id: fileDialog | ||||
68 | title: "Open KNewStuff configuration file" | ||||
69 | folder: knsrcFilesLocation | ||||
70 | nameFilters: [ "KNewStuff Configuration Files (*.knsrc)", "All Files (*)" ] | ||||
71 | onAccepted: { | ||||
72 | newStuffButton.configFile = fileDialog.fileUrl.toString().substring(7) | ||||
73 | pageStack.clear(); | ||||
74 | pageStack.push(mainPageComponent, { configFile: newStuffButton.configFile }); | ||||
75 | } | ||||
76 | } | ||||
77 | } |