KNewStuff

DialogContent.qml
1 /*
2  SPDX-FileCopyrightText: 2019 Dan Leinir Turthra Jensen <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 
7 /**
8  * @brief The contents of the NewStuff.Dialog component
9  *
10  * This component is equivalent to the old DownloadWidget, but you should consider
11  * using NewStuff.Page instead for a more modern style of integration into your
12  * application's flow.
13  * @see KNewStuff::DownloadWidget
14  * @since 5.63
15  */
16 
17 import QtQuick 2.11
18 import QtQuick.Layouts 1.11 as QtLayouts
19 
20 import org.kde.kirigami 2.7 as Kirigami
21 
22 import org.kde.newstuff 1.62 as NewStuff
23 
24 Kirigami.ApplicationItem {
25  id: component
26 
27  property alias downloadNewWhat: newStuffPage.title
28  /**
29  * The configuration file to use for this button
30  */
31  property alias configFile: newStuffPage.configFile
32 
33  /**
34  * The engine which handles the content in this dialog
35  */
36  property alias engine: newStuffPage.engine
37 
38  /**
39  * The default view mode of the dialog spawned by this button. This should be
40  * set using the NewStuff.Page.ViewMode enum
41  * @see NewStuff.Page.ViewMode
42  */
43  property alias viewMode: newStuffPage.viewMode
44 
45  /**
46  * Show the details page for a specific entry.
47  * If you call this function before the engine initialisation has been completed,
48  * the action itself will be postponed until that has happened.
49  * @param providerId The provider ID for the entry you wish to show details for
50  * @param entryId The unique ID for the entry you wish to show details for
51  * @since 5.79
52  */
53  function showEntryDetails(providerId, entryId) {
54  newStuffPage.showEntryDetails(providerId, entryId);
55  }
56 
57  QtLayouts.Layout.preferredWidth: Kirigami.Units.gridUnit * 50
58  QtLayouts.Layout.preferredHeight: Kirigami.Units.gridUnit * 40
59  pageStack.defaultColumnWidth: pageStack.width
60  pageStack.globalToolBar.style: Kirigami.ApplicationHeaderStyle.Auto
61  pageStack.globalToolBar.canContainHandles: true
62  pageStack.initialPage: NewStuff.Page {
63  id: newStuffPage
64  showUploadAction: false
65  function showMessage(message) {
66  // As the Page shows something nice and friendly while loading,
67  // there's no reason to do the passive notification thing for those.
68  if (!engine.isLoading) {
69  component.showPassiveNotification(message);
70  }
71  }
72  onMessage: component.showPassiveNotification(message);
73  onIdleMessage: component.showPassiveNotification(message);
74  }
75  contextDrawer: Kirigami.ContextDrawer {
76  id: contextDrawer
77  }
78 }
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Tue Nov 30 2021 22:38:13 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.