Warning, /plasma/discover/discover/qml/Navigation.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Aleix Pol Gonzalez <aleixpol@blue-systems.com> 0003 * SPDX-FileCopyrightText: 2023 ivan tkachenko <me@ratijas.tk> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 pragma Singleton 0009 0010 import QtQml 0011 import org.kde.discover as Discover 0012 0013 QtObject { 0014 // Initialized from C++ 0015 property DiscoverWindow window 0016 0017 function clearStack() { 0018 window.currentTopLevel = ""; 0019 window.pageStack.clear(); 0020 } 0021 0022 function openApplicationListSource(origin: string) { 0023 openApplicationList({ 0024 originFilter: origin, 0025 title: origin, 0026 allBackends: true, 0027 }); 0028 } 0029 0030 function openApplicationMime(mime: string) { 0031 clearStack(); 0032 openApplicationList({ 0033 mimeTypeFilter: mime, 0034 title: i18n("Resources for '%1'", mime), 0035 }); 0036 } 0037 0038 function openCategory(category: string, search = "") { 0039 clearStack() 0040 openApplicationList({ category, search }) 0041 } 0042 0043 function openApplicationList(props) { 0044 const page = window.pageStack.push(Qt.resolvedUrl("ApplicationsListPage.qml"), props); 0045 if (props.search === "") { 0046 page.clearSearch(); 0047 } 0048 } 0049 0050 function openApplication(application: Discover.AbstractResource) { 0051 console.assert(application) 0052 window.pageStack.push(Qt.resolvedUrl("ApplicationPage.qml"), { application }) 0053 } 0054 0055 function openExtends(extending: string, appname: string) { 0056 window.pageStack.push(Qt.resolvedUrl("ApplicationsListPage.qml"), { 0057 extending, 0058 title: i18n("Addons for %1", appname), 0059 }); 0060 } 0061 0062 function openHome() { 0063 if (window.globalDrawer.currentSubMenu) { 0064 window.globalDrawer.resetMenu(); 0065 } 0066 clearStack(); 0067 const pageUrl = Qt.resolvedUrl(window.topBrowsingComp); 0068 const page = window.pageStack.push(pageUrl); 0069 page.clearSearch() 0070 } 0071 }