Warning, /graphics/koko/src/qml/ShareDialog.qml is written in an unsupported language. File is not indexed.

0001 /*
0002  * SPDX-FileCopyrightText: 2017 Atul Sharma <atulsharma406@gmail.com>
0003  * SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006  */
0007 
0008 import QtQuick 2.7
0009 import QtQuick.Layouts 1.3
0010 import QtQuick.Controls 2.15 as Controls
0011 import org.kde.purpose 1.0 as Purpose
0012 import org.kde.kirigami 2.14 as Kirigami
0013 
0014 Kirigami.Page {
0015     id: window
0016 
0017     leftPadding: 0
0018     rightPadding: 0
0019     topPadding: 0
0020     bottomPadding: 0
0021 
0022     property alias index: jobView.index
0023     property alias model: jobView.model
0024 
0025     Controls.Action {
0026         shortcut: 'Escape'
0027         onTriggered: window.closeDialog()
0028     }
0029 
0030     Component.onCompleted: jobView.start()
0031 
0032     contentItem: Purpose.JobView {
0033         id: jobView
0034         onStateChanged: {
0035             if (state === Purpose.PurposeJobController.Finished) {
0036                 if (jobView.job.output.url !== "") {
0037                     // Show share url
0038                     const resultUrl = jobView.job.output.url;
0039                     notificationManager.showNotification(true, resultUrl);
0040                     clipboard.content = resultUrl;
0041                 }
0042             } else if (state === Purpose.PurposeJobController.Error) {
0043                 // Show failure notification
0044                 notificationManager.showNotification(false, jobView.job.errorString);
0045             } else if (state === Purpose.PurposeJobController.Cancelled) {
0046                 // Do nothing
0047             }
0048             window.closeDialog()
0049         }
0050     }
0051 }