diff --git a/src/controls/ShareDialog.qml b/src/controls/ShareDialog.qml index de83a30..ed309f7 100644 --- a/src/controls/ShareDialog.qml +++ b/src/controls/ShareDialog.qml @@ -1,152 +1,152 @@ /* * Copyright 2018 Camilo Higuita * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import QtQuick 2.9 import QtQuick.Layouts 1.3 import QtQuick.Controls 2.2 import org.kde.mauikit 1.0 as Maui import org.kde.kirigami 2.7 as Kirigami -import org.kde.purpose 1.0 as Purpose +//import org.kde.purpose 1.0 as Purpose Maui.Dialog { - id: control + id: control property var itemUrls : [] widthHint: 0.9 - + maxHeight: Math.max(_layout.contentHeight, maxWidth) + (page.padding * 2.5) + headBar.height - maxWidth: Maui.Style.unit * 500 - - verticalAlignment: Qt.AlignBottom - + maxWidth: Maui.Style.unit * 500 + + verticalAlignment: Qt.AlignBottom + defaultButtons: false - - page.title: qsTr("Open with") - headBar.visible: true - + + page.title: qsTr("Open with") + headBar.visible: true + Kirigami.ScrollablePage { - id: _layout - anchors.fill: parent - leftPadding: 0 - rightPadding: 0 - - ColumnLayout - { - width: parent.width - - Maui.GridBrowser - { - id: grid - Layout.fillWidth: true - Layout.preferredHeight: implicitHeight - showEmblem: false - model: ListModel {} - onItemClicked: - { - grid.currentIndex = index - triggerService(index) - } - } - - Purpose.AlternativesView - { - id: _purpose - Layout.fillWidth: true - Layout.preferredHeight: 400 - pluginType: 'Export' - clip: true - - delegate: Maui.ItemDelegate - { - width: parent.width - height: Maui.Style.rowHeight * 1.5 - - Maui.ListItemTemplate - { - anchors.fill: parent - - label1.text: model.display - iconSource: model.iconName - - iconSizeHint: Maui.Style.iconSizes.big - - } - - onClicked: _purpose.createJob(index) - } - } - } - } - - + id: _layout + anchors.fill: parent + leftPadding: 0 + rightPadding: 0 + + ColumnLayout + { + width: parent.width + + Maui.GridBrowser + { + id: grid + Layout.fillWidth: true + Layout.preferredHeight: implicitHeight + showEmblem: false + model: ListModel {} + onItemClicked: + { + grid.currentIndex = index + triggerService(index) + } + } + +// Purpose.AlternativesView +// { +// id: _purpose +// Layout.fillWidth: true +// Layout.preferredHeight: 400 +// pluginType: 'Export' +// clip: true + +// delegate: Maui.ItemDelegate +// { +// width: parent.width +// height: Maui.Style.rowHeight * 1.5 + +// Maui.ListItemTemplate +// { +// anchors.fill: parent + +// label1.text: model.display +// iconSource: model.iconName + +// iconSizeHint: Maui.Style.iconSizes.big + +// } + +// onClicked: _purpose.createJob(index) +// } +// } + } + } + + onOpened: populate() function show(urls) { if(urls.length > 0) { itemUrls = urls open() } } function populate() { grid.model.clear() var services = Maui.KDE.services(itemUrls[0]) var devices = Maui.KDE.devices() grid.model.append({icon: "internet-mail", label: "Email", email: true}) if(devices.length > 0) for(var i in devices) { devices[i].icon = "smartphone" grid.model.append(devices[i]) } if(services.length > 0) for(i in services) grid.model.append(services[i]) - - _purpose.inputData = { - 'urls': control.itemUrls, - 'mimeType': Maui.FM.getFileInfo(control.itemUrls[0]).mime - } + +// _purpose.inputData = { +// 'urls': control.itemUrls, +// 'mimeType': Maui.FM.getFileInfo(control.itemUrls[0]).mime +// } } function triggerService(index) { var obj = grid.model.get(index) if(obj.serviceKey) Maui.KDE.sendToDevice(obj.label, obj.serviceKey, itemUrls) else if(obj.email) Maui.KDE.attachEmail(itemUrls) else Maui.KDE.openWithApp(obj.actionArgument, itemUrls) close() } }