MauiKit Controls

ShareDialogLinux.qml
1/*
2 * Copyright 2018 Camilo Higuita <milo.h@aol.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Library General Public License as
6 * published by the Free Software Foundation; either version 2, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20import QtQuick 2.10
21import QtQuick.Controls 2.10
22import QtQuick.Layouts 1.3
23
24import org.mauikit.controls 1.2 as Maui
25import org.kde.purpose 1.0 as Purpose
26
27/**
28 * @brief The Linux implementation for the ShareDialog
29 */
30Maui.PopupPage
31{
32 id: control
33
34 /**
35 * @brief The list of local file URLs to be shared to the selected services
36 */
37 property var urls : []
38
39 /**
40 * @brief The mime type of the set of URLs to perform the correct service lookup
41 */
42 property string mimeType
43
44 widthHint: 0.9
45
46 maxHeight: 400
47 maxWidth: 350
48
49 title: i18n("Share")
50
51 headBar.leftContent: ToolButton
52 {
53 visible: _purpose.depth>1;
54 icon.name: "go-previous"
55 onClicked:
56 {
57 _purpose.reset()
58 _purpose.error = false
59 }
60 }
61
62 stack: Purpose.AlternativesView
63 {
64 id: _purpose
65 property bool error : false
66 Layout.fillWidth: true
67 Layout.fillHeight: true
68 Layout.margins: Maui.Style.space.medium
69 pluginType: 'Export'
70 clip: true
71 spacing: Maui.Style.defaultSpacing
72
73 inputData :
74 {
75 'urls': control.urls,
76 'mimeType':control.mimeType
77 }
78
79 delegate: Maui.ListBrowserDelegate
80 {
81 width: ListView.view.width
82
83 label1.text: model.display
84 iconSource: model.iconName
85 iconSizeHint: Maui.Style.iconSizes.big
86 onClicked: _purpose.createJob(index)
87 }
88
89 onFinished: (output, error, message) =>
90 {
91 if(error!=0)
92 {
93 _purpose.error = true
94 _holder.body = message
95 return
96 }
97
98 _purpose.error = false
99 }
100
101 Maui.Holder
102 {
103 id: _holder
104 anchors.fill: parent
105 visible: _purpose.error
106 }
107 }
108}
109
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:56:16 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.