Changeset View
Changeset View
Standalone View
Standalone View
kcms/baloo/package/contents/ui/main.qml
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | 59 | ColumnLayout { | |||
---|---|---|---|---|---|
73 | } | 73 | } | ||
74 | } | 74 | } | ||
75 | } | 75 | } | ||
76 | 76 | | |||
77 | Item { | 77 | Item { | ||
78 | Layout.preferredHeight: Kirigami.Units.gridUnit | 78 | Layout.preferredHeight: Kirigami.Units.gridUnit | ||
79 | } | 79 | } | ||
80 | QQC2.Label { | 80 | QQC2.Label { | ||
81 | text: i18n("Do not search in these locations:") | 81 | text: i18n("Folder specific configuration:") | ||
82 | } | 82 | } | ||
83 | 83 | | |||
84 | QQC2.ScrollView { | 84 | QQC2.ScrollView { | ||
85 | id: bgObject | 85 | id: bgObject | ||
86 | Component.onCompleted: bgObject.background.visible = true | 86 | Component.onCompleted: bgObject.background.visible = true | ||
87 | Layout.fillWidth: true | 87 | Layout.fillWidth: true | ||
88 | Layout.fillHeight: true | 88 | Layout.fillHeight: true | ||
89 | 89 | | |||
90 | ListView { | 90 | ListView { | ||
91 | id: fileExcludeList | 91 | id: directoryConfigList | ||
92 | | ||||
93 | clip: true | 92 | clip: true | ||
93 | currentIndex: -1 | ||||
94 | | ||||
94 | model: kcm.filteredModel | 95 | model: kcm.filteredModel | ||
95 | delegate: Kirigami.BasicListItem { | 96 | delegate: directoryConfigDelegate | ||
96 | icon: model.decoration | | |||
97 | label: model.folder | | |||
98 | onClicked: fileExcludeList.currentIndex = index | | |||
99 | } | | |||
100 | } | 97 | } | ||
101 | } | 98 | } | ||
102 | 99 | | |||
103 | RowLayout { | | |||
104 | QQC2.Button { | 100 | QQC2.Button { | ||
ngraham: Since this layout now only has one item in it, there's no longer a need for a layout at all | |||||
101 | Layout.alignment: Qt.AlignRight | ||||
105 | id: addFolder | 102 | id: addFolder | ||
106 | icon.name: "list-add" | 103 | icon.name: "folder-add" | ||
104 | text: i18n("Add folder configuration...") | ||||
107 | onClicked: fileDialogLoader.active = true | 105 | onClicked: fileDialogLoader.active = true | ||
108 | } | 106 | } | ||
107 | } | ||||
109 | 108 | | |||
110 | QQC2.Button{ | 109 | Component { | ||
111 | id: removeFolder | 110 | id: directoryConfigDelegate | ||
112 | icon.name: "list-remove" | 111 | Kirigami.SwipeListItem { | ||
113 | enabled: fileExcludeList.currentIndex !== -1 | 112 | id: listItem | ||
113 | onClicked: { | ||||
114 | directoryConfigList.currentIndex = index | ||||
115 | } | ||||
116 | property int iconSize: Kirigami.Units.iconSizes.smallMedium | ||||
117 | property bool selected: directoryConfigList.currentIndex === index | ||||
118 | | ||||
119 | RowLayout { | ||||
Since this is only used once, it could simply be declared inline delegate: Kirigami.SwipeListItem { id: listItem onClicked: { [blabla] } ngraham: Since this is only used once, it could simply be declared inline
```
delegate: Kirigami. | |||||
IMHO it is to large to be declared inline. The toplevel layout is ~90 lines and can be viewed on a single screen now. bruns: IMHO it is to large to be declared inline. The toplevel layout is ~90 lines and can be viewed… | |||||
120 | spacing: units.smallSpacing | ||||
ngraham: ditto | |||||
121 | | ||||
122 | Kirigami.Icon { | ||||
123 | source: model.enableIndex ? "search" : "list-remove" | ||||
124 | height: listItem.iconSize | ||||
125 | width: listItem.iconSize | ||||
126 | } | ||||
127 | | ||||
128 | ColumnLayout { | ||||
129 | RowLayout { | ||||
set spacing: units.smallSpacing on the layout instead of adding an empty item between objects for spacing ngraham: set spacing: units.smallSpacing on the layout instead of adding an empty item between objects… | |||||
130 | spacing: units.smallSpacing | ||||
131 | | ||||
132 | Kirigami.Icon { | ||||
133 | source: model.decoration | ||||
134 | height: listItem.iconSize | ||||
135 | width: listItem.iconSize | ||||
136 | } | ||||
137 | QQC2.Label { | ||||
138 | text: model.folder | ||||
139 | elide: Text.ElideRight | ||||
140 | Layout.fillWidth: true | ||||
141 | } | ||||
142 | } | ||||
143 | QQC2.Label { | ||||
144 | text: (model.enableIndex ? i18n("%1 is included.", model.url) | ||||
145 | : i18n("%1 is excluded.", model.url)) | ||||
146 | elide: Text.ElideRight | ||||
147 | Layout.fillWidth: true | ||||
148 | opacity: listItem.hovered ? 0.8 : 0.6 | ||||
149 | visible: listItem.selected | ||||
150 | } | ||||
151 | } | ||||
152 | | ||||
153 | QQC2.ToolButton { | ||||
154 | visible: listItem.hovered && listItem.actionsVisible | ||||
155 | height: listItem.iconSize | ||||
156 | icon.name: "search" | ||||
157 | text: model.enableIndex ? i18n("Disable indexing") : i18n("Enable indexing") | ||||
114 | onClicked: { | 158 | onClicked: { | ||
115 | kcm.filteredModel.removeFolder(fileExcludeList.currentIndex) | 159 | model.enableIndex = !model.enableIndex | ||
160 | } | ||||
161 | } | ||||
162 | } | ||||
163 | | ||||
164 | actions: [ | ||||
165 | Kirigami.Action { | ||||
166 | id: removeFolder | ||||
167 | enabled: model.deletable | ||||
168 | icon.name: "user-trash" | ||||
169 | tooltip: i18n("Delete entry") | ||||
170 | onTriggered: { | ||||
171 | kcm.filteredModel.removeFolder(index) | ||||
116 | } | 172 | } | ||
117 | } | 173 | } | ||
174 | ] | ||||
118 | } | 175 | } | ||
119 | } | 176 | } | ||
bruns: Spurious tab | |||||
120 | 177 | | |||
121 | Loader { | 178 | Loader { | ||
122 | id: fileDialogLoader | 179 | id: fileDialogLoader | ||
123 | active: false | 180 | active: false | ||
124 | sourceComponent: QtDialogs.FileDialog { | 181 | sourceComponent: QtDialogs.FileDialog { | ||
125 | title: i18n("Select a folder to filter") | 182 | title: i18n("Select a folder to filter") | ||
126 | folder: shortcuts.home | 183 | folder: shortcuts.home | ||
127 | selectFolder: true | 184 | selectFolder: true | ||
Show All 14 Lines |
Since this layout now only has one item in it, there's no longer a need for a layout at all