2 * Copyright (C) 2025 UBports Foundation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18import Lomiri.Components 1.3
19import Lomiri.Components.Extras 0.2 as Extras
20import Lomiri.Content 1.1
26 property var screenshotEditor : null
43 editorComponent.createObject(
44 screenshotEditorRoot);
46 screenshotSharePicker.filePath = path;
48 screenshotEditor.open(path);
52 screenshotSharePicker.visible = false;
53 screenshotSharePicker.filePath = "";
55 screenshotEditor.destroy();
56 screenshotEditor = null;
60 id: screenshotEditorRoot
61 y: screenshotEditorHeader.height
62 anchors.left: parent.left
63 anchors.right: parent.right
64 anchors.top: screenshotEditorHeader.bottom
65 anchors.bottom: parent.bottom
68 // Place the PageHeader below the editor for proper z-level layering,
69 // otherwise pictures would overlay and peek out over the header.
71 id: screenshotEditorHeader
72 anchors.left: parent.left
73 anchors.right: parent.right
74 anchors.top: parent.top
75 height: implicitHeight
79 iconName: "edit-delete"
80 text: i18n.tr("Delete")
82 FileIo.remove(screenshotSharePicker.filePath);
91 iconName: "document-save"
94 screenshotEditor.close(true);
100 text: i18n.tr("Share")
102 screenshotEditor.close(true);
103 screenshotSharePicker.visible = true;
111 id: screenshotSharePicker
117 contentType: ContentType.Pictures
118 handler: ContentHandler.Share
120 property string filePath : ""
128 const activeTransfer = peer.request();
129 activeTransfer.stateChanged.connect(function() {
130 if (activeTransfer.state === ContentTransfer.InProgress) {
131 const url = "file://" + screenshotSharePicker.filePath
132 console.log("File transfer in progress: " + url);
133 activeTransfer.items = [
134 resultComponent.createObject(parent, {"url": url})
136 activeTransfer.state = ContentTransfer.Charged;