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
36 property alias configFile: newStuffEngine.configFile
38 readonly property alias engine: newStuffEngine
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
77 newStuffEngine.updateEntryContents(entry);
101 id: _restoreSearchState
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
126 Component.onCompleted: {
127 view.currentIndex = -1;
130 title: newStuffEngine.name
132 headerPaddingEnabled:
false
137 position:
Kirigami.InlineMessage.Position.Header
139 ?
xi18nd(
"knewstuff6",
"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")
140 :
i18nd(
"knewstuff6",
"User-created content shown here hasn't been tested by KDE or your distributor for functionality or quality.")
151 Private.ErrorDisplayer {
152 engine: newStuffEngine
162 visible: newStuffEngine.needsLazyLoadSpinner
171 if (root.viewMode ===
Page.ViewMode.Tiles) {
172 return i18nd(
"knewstuff6",
"Tiles");
173 }
else if (root.viewMode ===
Page.ViewMode.Icons) {
174 return i18nd(
"knewstuff6",
"Icons");
176 return i18nd(
"knewstuff6",
"Preview");
181 if (root.viewMode ===
Page.ViewMode.Tiles) {
182 return "view-list-details";
183 }
else if (root.viewMode ===
Page.ViewMode.Icons) {
184 return "view-list-icons";
186 return "view-preview";
191 icon.name:
"view-list-details"
192 text:
i18nd(
"knewstuff6",
"Detailed Tiles View Mode")
193 onTriggered: source => {
194 root.viewMode =
Page.ViewMode.Tiles;
196 checked: root.viewMode ===
Page.ViewMode.Tiles
202 icon.name:
"view-list-icons"
203 text:
i18nd(
"knewstuff6",
"Icons Only View Mode")
204 onTriggered: source => {
205 root.viewMode =
Page.ViewMode.Icons;
207 checked: root.viewMode ===
Page.ViewMode.Icons
213 icon.name:
"view-preview"
214 text:
i18nd(
"knewstuff6",
"Large Preview View Mode")
215 onTriggered: source => {
216 root.viewMode =
Page.ViewMode.Preview;
218 checked: root.viewMode ===
Page.ViewMode.Preview
226 if (newStuffEngine.filter === 0) {
227 return i18nd(
"knewstuff6",
"Everything");
228 }
else if (newStuffEngine.filter === 1) {
229 return i18nd(
"knewstuff6",
"Installed");
230 }
else if (newStuffEngine.filter === 2) {
231 return i18nd(
"knewstuff6",
"Updateable");
238 if (newStuffEngine.filter === 0) {
239 return "package-available"
240 }
else if (newStuffEngine.filter === 1) {
241 return "package-installed-updated"
242 }
else if (newStuffEngine.filter === 2) {
243 return "package-installed-outdated"
250 icon.name:
"package-available"
251 text:
i18ndc(
"knewstuff6",
"List option which will set the filter to show everything",
"Show All Entries")
253 checked: newStuffEngine.filter === 0
254 onTriggered: source => {
255 newStuffEngine.filter = 0;
261 icon.name:
"package-installed-updated"
262 text:
i18ndc(
"knewstuff6",
"List option which will set the filter so only installed items are shown",
"Show Only Installed Entries")
264 checked: newStuffEngine.filter === 1
265 onTriggered: source => {
266 newStuffEngine.filter = 1;
272 icon.name:
"package-installed-outdated"
273 text:
i18ndc(
"knewstuff6",
"List option which will set the filter so only installed items with updates available are shown",
"Show Only Updateable Entries")
275 checked: newStuffEngine.filter === 2
276 onTriggered: source => {
277 newStuffEngine.filter = 2;
285 if (newStuffEngine.sortOrder === 0) {
286 return i18nd(
"knewstuff6",
"Recent");
287 }
else if (newStuffEngine.sortOrder === 1) {
288 return i18nd(
"knewstuff6",
"Alphabetical");
289 }
else if (newStuffEngine.sortOrder === 2) {
290 return i18nd(
"knewstuff6",
"Rating");
291 }
else if (newStuffEngine.sortOrder === 3) {
292 return i18nd(
"knewstuff6",
"Downloads");
298 if (newStuffEngine.sortOrder === 0) {
299 return "change-date-symbolic";
300 }
else if (newStuffEngine.sortOrder === 1) {
302 }
else if (newStuffEngine.sortOrder === 2) {
304 }
else if (newStuffEngine.sortOrder === 3) {
311 icon.name:
"change-date-symbolic"
312 text:
i18ndc(
"knewstuff6",
"List option which will set the sort order to based on when items were most recently updated",
"Show Most Recent First")
314 checked: newStuffEngine.sortOrder === 0
315 onTriggered: source => {
316 newStuffEngine.sortOrder = 0;
322 icon.name:
"sort-name"
323 text:
i18ndc(
"knewstuff6",
"List option which will set the sort order to be alphabetical based on the name",
"Sort Alphabetically By Name")
325 checked: newStuffEngine.sortOrder === 1
326 onTriggered: source => {
327 newStuffEngine.sortOrder = 1;
334 text:
i18ndc(
"knewstuff6",
"List option which will set the sort order to based on user ratings",
"Show Highest Rated First")
336 checked: newStuffEngine.sortOrder === 2
337 onTriggered: source => {
338 newStuffEngine.sortOrder = 2;
344 icon.name:
"download"
345 text:
i18ndc(
"knewstuff6",
"List option which will set the sort order to based on number of downloads",
"Show Most Downloaded First")
347 checked: newStuffEngine.sortOrder === 3
348 onTriggered: source => {
349 newStuffEngine.sortOrder = 3;
358 text:
i18nd(
"knewstuff6",
"Upload…")
360 icon.name: "upload-media"
361 visible: newStuffEngine.uploadEnabled
363 onTriggered: source => {
364 pageStack.push(uploadPage);
369 text:
i18nd(
"knewstuff6",
"Go to…")
372 visible: children.length > 0
376 text:
i18nd(
"knewstuff6",
"Search…")
377 icon.name: "system-search"
383 enabled: engine.isValid
384 focusSequence:
"Ctrl+F"
385 placeholderText:
i18nd(
"knewstuff6",
"Search…")
386 text: newStuffEngine.searchTerm
392 Component.onCompleted: {
393 if (!
Kirigami.InputMethod.willShowOnActive) {
404 model: newStuffEngine.searchPresetModel
409 text: model.displayName
410 icon.name: model.iconName
412 onTriggered: source => {
413 const curIndex = newStuffEngine.searchPresetModel.index(index, 0);
414 newStuffEngine.searchPresetModel.loadSearch(
curIndex);
424 target: newStuffEngine.searchPresetModel
432 spacing:
Kirigami.Units.smallSpacing
435 height: visible ? implicitHeight : 0
439 text:
i18nd(
"knewstuff6",
"Category:")
448 model: newStuffEngine.categories
449 textRole:
"displayName"
452 newStuffEngine.categoriesFilter = model.
data(model.index(currentIndex, 0),
NewStuff.CategoriesModel.NameRole);
459 text:
i18nd(
"knewstuff6",
"Contribute your own…")
460 icon.name: "upload-media"
461 visible: newStuffEngine.uploadEnabled && !
uploadAction.visible
464 pageStack.push(uploadPage);
472 engine: newStuffEngine
476 id: downloadItemsSheet
478 parent: root.QQC2.Overlay.overlay
485 view.implicitCellWidth:
switch (root.viewMode) {
486 case Page.ViewMode.Tiles:
487 return Kirigami.Units.gridUnit * 30;
489 case Page.ViewMode.Preview:
490 return Kirigami.Units.gridUnit * 25;
492 case Page.ViewMode.Icons:
494 return Kirigami.Units.gridUnit * 10;
497 view.implicitCellHeight:
switch (root.viewMode) {
498 case Page.ViewMode.Tiles:
499 return Math.round(view.implicitCellWidth / 3);
501 case Page.ViewMode.Preview:
502 return Kirigami.Units.gridUnit * 25;
504 case Page.ViewMode.Icons:
506 return Math.round(view.implicitCellWidth / 1.6) +
Kirigami.Units.gridUnit * 2;
509 view.delegate:
switch (root.viewMode) {
510 case Page.ViewMode.Tiles:
513 case Page.ViewMode.Preview:
516 case Page.ViewMode.Icons:
531 useLabel: root.useLabel
532 uninstallLabel: root.uninstallLabel
540 useLabel: root.useLabel
541 uninstallLabel: root.uninstallLabel
555 engine: newStuffEngine
564 opacity: newStuffEngine.isLoading && !newStuffEngine.needsLazyLoadSpinner ? 1 : 0
567 duration:
Kirigami.Units.longDuration
575 color:
Kirigami.Theme.backgroundColor
579 anchors.centerIn: parent
580 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 xi18nd(const char *domain, const char *text, const TYPE &arg...)
QString i18nd(const char *domain, const char *text, const TYPE &arg...)
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)