MauiKit File Browsing

OpenWithDialog.qml
1/*
2 * <one line to give the program's name and a brief idea of what it does.>
3 * Copyright (C) 2020 camilo <chiguitar@unal.edu.co>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19import QtQuick
20import QtQuick.Layouts
21
22import org.mauikit.controls as Maui
23import org.mauikit.filebrowsing as FB
24
25
26/**
27 * @inherit org::mauikit::control::PopupPage
28 * A dialog with a list of services -that can handled the associated list of URLs.
29 * @see urls
30 *
31 * This control inherits from MauiKit PopupPage, to checkout its inherited properties refer to docs.
32 *
33 * The services listed can open the file type of the file URLs.
34 *
35 * @image html openwithdialog.png "Example"
36 *
37 * @code
38 * Maui.Page
39 * {
40 * Maui.Controls.showCSD: true
41 * anchors.fill: parent
42 *
43 * Button
44 * {
45 * anchors.centerIn: parent
46 * text: "Open"
47 * onClicked: _dialog.open()
48 * }
49 *
50 * FB.OpenWithDialog
51 * {
52 * id: _dialog
53 * urls: ["/home/camiloh/Pictures/blend_by_rashadisrazzi_d8ttd59/2K.png"]
54 * }
55 * }
56 * @endcode
57 *
58 * <a href="https://invent.kde.org/maui/mauikit-filebrowser/examples/OpenWithDialog.qml">You can find a more complete example at this link.</a>
59 */
60Maui.PopupPage
61{
62 id: control
63
64 /**
65 * @brief List of file URLs to look for associated services.
66 * @property var OpenWithDialog::urls
67 */
68 property alias urls : _openWithList.urls
69
70 widthHint: 0.9
71 maxWidth: 350
72 persistent: false
73
74 page.title: i18nd("mauikitfilebrowsing", "Open with")
75 headBar.visible: true
76
77 stack: Maui.ListBrowser
78 {
79 id: _list
80 Layout.fillWidth: true
81 Layout.fillHeight: true
82
83 model: Maui.BaseModel
84 {
85 list: FB.OpenWithModel
86 {
87 id: _openWithList
88 }
89 }
90
91 delegate: Maui.ListBrowserDelegate
92 {
93 width: ListView.view.width
94 hoverEnabled: true
95
96 label1.text: model.label
97 label2.text: model.comment
98
99 iconSource: model.icon
100 iconSizeHint: Maui.Style.iconSizes.big
101
102 onClicked:
103 {
104 _list.currentIndex = index
105 _openWithList.openWith(index)
106 close()
107 }
108 }
109 }
110}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:32:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.