17import QtQuick.Controls as QQC2
20import org.kde.kcmutils as KCMUtils
21import org.kde.kirigami as Kirigami
22import org.kde.newstuff as NewStuff
24import "private" as Private
25import "private/entrygriddelegates" as EntryGridDelegates
36 property alias configFile: newStuffEngine.configFile
38 readonly
property alias engine: newStuffEngine
47 property alias showUploadAction: uploadAction.visible
57 function showEntryDetails(providerId, entryId) {
58 _showEntryDetailsThrottle.enabled =
true;
59 _showEntryDetailsThrottle.entry = newStuffEngine. __createEntry(providerId, entryId);
60 if (newStuffEngine.busyState === NewStuff.Engine.Initializing) {
61 _showEntryDetailsThrottle.queryWhenInitialized =
true;
63 _showEntryDetailsThrottle.requestDetails();
69 id: _showEntryDetailsThrottle
70 target: newStuffModel.engine
74 property bool queryWhenInitialized:
false
76 function requestDetails() {
77 newStuffEngine.updateEntryContents(entry);
78 queryWhenInitialized =
false;
81 function onBusyStateChanged() {
82 if (queryWhenInitialized && newStuffEngine.busyState !== NewStuff.Engine.Initializing) {
84 queryWhenInitialized =
false;
88 function onSignalEntryEvent(changedEntry, event) {
89 if (event === NewStuff.Engine.DetailsLoadedEvent && changedEntry === entry) {
91 pageStack.push(detailsPage, {
93 providerId: changedEntry.providerId,
101 id: _restoreSearchState
106 function onCurrentIndexChanged() {
107 if (pageStack.currentIndex === 0) {
108 newStuffEngine.restoreSearch();
109 _restoreSearchState.enabled =
false;
114 property string uninstallLabel:
i18ndc(
"knewstuff6",
"Request uninstallation of this item",
"Uninstall")
115 property
string useLabel: engine.useLabel
117 property
int viewMode:
Page.ViewMode.Tiles
127 Component.onCompleted: {
128 view.currentIndex = -1;
131 title: newStuffEngine.name
133 headerPaddingEnabled:
false
135 readonly
property bool riskyContent: newStuffEngine.contentWarningType === NewStuff.Engine.Executables
136 visible: !loadingOverlay.visible
138 position:
Kirigami.InlineMessage.Position.Header
140 ?
xi18ndc(
"knewstuff6",
"@info displayed as InlineMessage",
"Use caution when accessing user-created content shown here, as it may contain executable code that hasn't been tested by KDE or your distributor for safety, stability, or quality.")
141 :
i18ndc(
"knewstuff6",
"@info displayed as InlineMessage",
"User-created content shown here hasn't been tested by KDE or your distributor for functionality or quality.")
149 parent: root.QQC2.Overlay.overlay
152 Private.ErrorDisplayer {
153 engine: newStuffEngine
154 active: root.isCurrentPage
157 QQC2.ActionGroup { id: viewFilterActionGroup }
158 QQC2.ActionGroup { id: viewSortingActionGroup }
162 visible: newStuffEngine.needsLazyLoadSpinner
163 displayComponent: QQC2.BusyIndicator {
171 if (newStuffEngine.filter === 0) {
172 return i18ndc(
"knewstuff6",
"@action:button opening menu similar to combobox, filter list",
"All");
173 }
else if (newStuffEngine.filter === 1) {
174 return i18ndc(
"knewstuff6",
"@action:button opening menu similar to combobox, filter list",
"Installed");
175 }
else if (newStuffEngine.filter === 2) {
176 return i18ndc(
"knewstuff6",
"@action:button opening menu similar to combobox, filter list",
"Updateable");
182 icon.name:
"view-filter"
185 icon.name:
"package-available"
186 text:
i18ndc(
"knewstuff6",
"@option:radio similar to combobox item, List option which will set the filter to show everything",
"All")
188 checked: newStuffEngine.filter === 0
189 onTriggered: source => {
190 newStuffEngine.filter = 0;
192 QQC2.ActionGroup.group: viewFilterActionGroup
196 icon.name:
"package-installed-updated"
197 text:
i18ndc(
"knewstuff6",
"@option:radio similar to combobox item, List option which will set the filter so only installed items are shown",
"Installed")
199 checked: newStuffEngine.filter === 1
200 onTriggered: source => {
201 newStuffEngine.filter = 1;
203 QQC2.ActionGroup.group: viewFilterActionGroup
207 icon.name:
"package-installed-outdated"
208 text:
i18ndc(
"knewstuff6",
"@option:radio similar to combobox item, List option which will set the filter so only installed items with updates available are shown",
"Updateable")
210 checked: newStuffEngine.filter === 2
211 onTriggered: source => {
212 newStuffEngine.filter = 2;
214 QQC2.ActionGroup.group: viewFilterActionGroup
220 if (newStuffEngine.sortOrder === 0) {
221 return i18ndc(
"knewstuff6",
"@action:button opening menu similar to combobox, filter list",
"Sort: Release date");
222 }
else if (newStuffEngine.sortOrder === 1) {
223 return i18ndc(
"knewstuff6",
"@action:button opening menu similar to combobox, filter list",
"Sort: Name");
224 }
else if (newStuffEngine.sortOrder === 2) {
225 return i18ndc(
"knewstuff6",
"@action:button opening menu similar to combobox, filter list",
"Sort: Rating");
226 }
else if (newStuffEngine.sortOrder === 3) {
227 return i18ndc(
"knewstuff6",
"@action:button opening menu similar to combobox, filter list",
"Sort: Downloads");
232 icon.name:
"view-sort"
235 icon.name:
"sort-name"
236 text:
i18ndc(
"knewstuff6",
"@option:radio in menu, List option which will set the sort order to be alphabetical based on the name",
"Name")
238 checked: newStuffEngine.sortOrder === 1
239 onTriggered: source => {
240 newStuffEngine.sortOrder = 1;
242 QQC2.ActionGroup.group: viewSortingActionGroup
247 text:
i18ndc(
"knewstuff6",
"@option:radio in menu, List option which will set the sort order to based on user ratings",
"Rating")
249 checked: newStuffEngine.sortOrder === 2
250 onTriggered: source => {
251 newStuffEngine.sortOrder = 2;
253 QQC2.ActionGroup.group: viewSortingActionGroup
257 icon.name:
"download"
258 text:
i18ndc(
"knewstuff6",
"@option:radio similar to combobox item, List option which will set the sort order to based on number of downloads",
"Downloads")
260 checked: newStuffEngine.sortOrder === 3
261 onTriggered: source => {
262 newStuffEngine.sortOrder = 3;
264 QQC2.ActionGroup.group: viewSortingActionGroup
268 icon.name:
"change-date-symbolic"
269 text:
i18ndc(
"knewstuff6",
"@option:radio similar to combobox item, List option which will set the sort order to based on when items were most recently updated",
"Release date")
271 checked: newStuffEngine.sortOrder === 0
272 onTriggered: source => {
273 newStuffEngine.sortOrder = 0;
275 QQC2.ActionGroup.group: viewSortingActionGroup
282 text:
i18nd(
"knewstuff6",
"Upload…")
283 tooltip: i18nd("knewstuff6", "Learn how to add your own hot new stuff to this list")
284 icon.name: "upload-media"
285 visible: newStuffEngine.uploadEnabled
287 onTriggered: source => {
288 pageStack.push(uploadPage);
293 text:
i18nd(
"knewstuff6",
"Go to…")
295 id: searchModelActions
296 visible: children.length > 0
300 text:
i18nd(
"knewstuff6",
"Search…")
301 icon.name: "system-search"
302 displayHint:
Kirigami.DisplayHint.KeepVisible
307 enabled: engine.isValid
308 focusSequence:
"Ctrl+F"
309 placeholderText:
i18nd(
"knewstuff6",
"Search…")
310 text: newStuffEngine.searchTerm
313 newStuffEngine.searchTerm = searchField.text;
316 Component.onCompleted: {
317 if (!
Kirigami.InputMethod.willShowOnActive) {
326 id: searchPresetInstatiator
328 model: newStuffEngine.searchPresetModel
331 required
property int index
333 text: model.displayName
334 icon.name: model.iconName
336 onTriggered: source => {
337 const curIndex = newStuffEngine.searchPresetModel.index(index, 0);
338 newStuffEngine.searchPresetModel.loadSearch(curIndex);
342 onObjectAdded: (index, object) => {
343 searchModelActions.children.push(
object);
348 target: newStuffEngine.searchPresetModel
350 function onModelReset() {
351 searchModelActions.children = [];
356 spacing:
Kirigami.Units.smallSpacing
358 visible: visibleChildren.length > 0
359 height: visible ? implicitHeight : 0
362 visible: categoriesCombo.count > 2
363 text:
i18nd(
"knewstuff6",
"Category:")
369 Layout.fillWidth:
true
372 model: newStuffEngine.categories
373 textRole:
"displayName"
375 onCurrentIndexChanged: {
376 newStuffEngine.categoriesFilter = model.data(model.index(currentIndex, 0), NewStuff.CategoriesModel.NameRole);
381 Layout.alignment:
Qt.AlignRight
383 text:
i18nd(
"knewstuff6",
"Contribute Your Own…")
384 icon.name: "upload-media"
385 visible: newStuffEngine.uploadEnabled && !uploadAction.visible
388 pageStack.push(uploadPage);
393 view.model: NewStuff.ItemsModel {
396 engine: newStuffEngine
399 NewStuff.DownloadItemsSheet {
400 id: downloadItemsSheet
402 parent: root.QQC2.Overlay.overlay
404 onItemPicked: (entry, downloadItemId) => {
405 newStuffModel.engine.install(entry, downloadItemId);
409 view.implicitCellWidth:
switch (root.viewMode) {
410 case Page.ViewMode.Preview:
411 return Kirigami.Units.gridUnit * 25;
413 case Page.ViewMode.Tiles:
414 case Page.ViewMode.Icons:
416 return Kirigami.Units.gridUnit * 30;
419 view.implicitCellHeight:
switch (root.viewMode) {
420 case Page.ViewMode.Preview:
421 return Kirigami.Units.gridUnit * 25;
423 case Page.ViewMode.Tiles:
424 case Page.ViewMode.Icons:
426 return Math.round(view.implicitCellWidth / 3);
429 view.delegate:
switch (root.viewMode) {
430 case Page.ViewMode.Preview:
431 return bigPreviewDelegate;
433 case Page.ViewMode.Tiles:
434 case Page.ViewMode.Icons:
440 id: bigPreviewDelegate
442 EntryGridDelegates.BigPreviewDelegate { }
448 EntryGridDelegates.TileDelegate {
449 useLabel: root.useLabel
450 uninstallLabel: root.uninstallLabel
457 NewStuff.EntryDetails { }
463 NewStuff.UploadPage {
464 engine: newStuffEngine
473 opacity: newStuffEngine.isLoading && !newStuffEngine.needsLazyLoadSpinner ? 1 : 0
474 Behavior on opacity {
476 duration:
Kirigami.Units.longDuration
484 color:
Kirigami.Theme.backgroundColor
488 anchors.centerIn: parent
489 text: newStuffEngine.busyMessage
An action which when triggered will open a NewStuff.Dialog or a NewStuff.Page, depending on settings.
KNSCore::EngineBase for interfacing with QML.
A Kirigami.Page component used for managing KNS entries.
A component used to forward questions from KNewStuff's engine to the UI.
QString i18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
QString xi18ndc(const char *domain, const char *context, const char *text, const TYPE &arg...)
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)