Changeset View
Changeset View
Standalone View
Standalone View
discover/qml/SourcesPage.qml
1 | import QtQuick 2.4 | 1 | import QtQuick 2.4 | ||
---|---|---|---|---|---|
2 | import QtQuick.Controls 2.1 | 2 | import QtQuick.Controls 2.1 | ||
3 | import QtQuick.Layouts 1.1 | 3 | import QtQuick.Layouts 1.1 | ||
4 | import org.kde.discover 2.0 | 4 | import org.kde.discover 2.0 | ||
5 | import org.kde.discover.app 1.0 | 5 | import org.kde.discover.app 1.0 | ||
6 | import org.kde.kirigami 2.2 as Kirigami | 6 | import org.kde.kirigami 2.2 as Kirigami | ||
7 | import "navigation.js" as Navigation | 7 | import "navigation.js" as Navigation | ||
8 | 8 | | |||
9 | DiscoverPage { | 9 | DiscoverPage { | ||
10 | id: page | 10 | id: page | ||
11 | clip: true | 11 | clip: true | ||
12 | title: i18n("Settings") | 12 | title: i18n("Settings") | ||
13 | property string search: "" | 13 | property string search: "" | ||
14 | 14 | | |||
15 | Kirigami.Theme.inherit: false | | |||
16 | Kirigami.Theme.colorSet: Kirigami.Theme.View | | |||
17 | | ||||
18 | background: Rectangle { | | |||
19 | color: Kirigami.Theme.backgroundColor | | |||
20 | } | | |||
21 | | ||||
22 | contextualActions: [ | 15 | contextualActions: [ | ||
23 | KirigamiActionBridge { action: app.action("help_about_app") }, | 16 | KirigamiActionBridge { action: app.action("help_about_app") }, | ||
24 | KirigamiActionBridge { action: app.action("help_report_bug") } | 17 | KirigamiActionBridge { action: app.action("help_report_bug") } | ||
25 | ] | 18 | ] | ||
26 | 19 | | |||
27 | mainItem: ListView { | 20 | mainItem: ListView { | ||
28 | id: sourcesView | 21 | id: sourcesView | ||
29 | model: QSortFilterProxyModel { | 22 | model: QSortFilterProxyModel { | ||
30 | filterRegExp: new RegExp(page.search, 'i') | 23 | filterRegExp: new RegExp(page.search, 'i') | ||
31 | dynamicSortFilter: false //We don't want to sort, as sorting can have some semantics on some backends | 24 | dynamicSortFilter: false //We don't want to sort, as sorting can have some semantics on some backends | ||
32 | sourceModel: SourcesModel | 25 | sourceModel: SourcesModel | ||
33 | } | 26 | } | ||
34 | currentIndex: -1 | 27 | currentIndex: -1 | ||
35 | 28 | | |||
36 | section.property: "sourceName" | 29 | section.property: "sourceName" | ||
37 | section.delegate: Kirigami.AbstractListItem { | 30 | section.delegate: Kirigami.AbstractListItem { | ||
38 | id: backendItem | 31 | id: backendItem | ||
39 | hoverEnabled: false | 32 | hoverEnabled: false | ||
40 | supportsMouseEvents: false | 33 | supportsMouseEvents: false | ||
41 | readonly property QtObject backend: SourcesModel.sourcesBackendByName(section) | 34 | readonly property QtObject backend: SourcesModel.sourcesBackendByName(section) | ||
42 | readonly property QtObject resourcesBackend: backend.resourcesBackend | 35 | readonly property QtObject resourcesBackend: backend.resourcesBackend | ||
43 | readonly property bool isDefault: ResourcesModel.currentApplicationBackend == resourcesBackend | 36 | readonly property bool isDefault: ResourcesModel.currentApplicationBackend == resourcesBackend | ||
37 | | ||||
44 | RowLayout { | 38 | RowLayout { | ||
39 | Layout.fillHeight: true | ||||
45 | Connections { | 40 | Connections { | ||
46 | target: backendItem.backend | 41 | target: backendItem.backend | ||
47 | onPassiveMessage: window.showPassiveNotification(message) | 42 | onPassiveMessage: window.showPassiveNotification(message) | ||
48 | } | 43 | } | ||
49 | 44 | | |||
50 | anchors { | | |||
51 | right: parent.right | | |||
52 | left: parent.left | | |||
53 | rightMargin: parent.rightPadding | | |||
54 | leftMargin: parent.leftPadding | | |||
55 | } | | |||
56 | Kirigami.Heading { | 45 | Kirigami.Heading { | ||
57 | Layout.fillWidth: true | 46 | Layout.fillWidth: true | ||
58 | Layout.leftMargin: Kirigami.Units.smallSpacing | 47 | Layout.leftMargin: Kirigami.Units.smallSpacing | ||
48 | Layout.alignment: Qt.AlignVCenter | ||||
59 | text: backendItem.isDefault ? i18n("%1 (Default)", resourcesBackend.displayName) : resourcesBackend.displayName | 49 | text: backendItem.isDefault ? i18n("%1 (Default)", resourcesBackend.displayName) : resourcesBackend.displayName | ||
50 | level: 3 | ||||
60 | } | 51 | } | ||
61 | Button { | 52 | Button { | ||
62 | Layout.rightMargin: Kirigami.Units.smallSpacing | 53 | Layout.alignment: Qt.AlignVCenter | ||
63 | icon.name: "preferences-other" | 54 | icon.name: "preferences-other" | ||
64 | 55 | | |||
65 | visible: resourcesBackend && resourcesBackend.hasApplications | 56 | visible: resourcesBackend && resourcesBackend.hasApplications | ||
66 | Component { | 57 | Component { | ||
67 | id: dialogComponent | 58 | id: dialogComponent | ||
68 | AddSourceDialog { | 59 | AddSourceDialog { | ||
69 | source: backendItem.backend | 60 | source: backendItem.backend | ||
70 | onVisibleChanged: if (!visible) { | 61 | onVisibleChanged: if (!visible) { | ||
▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines |