Warning, /multimedia/plasmatube/src/ui/components/ShareDialog.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
0002 // SPDX-License-Identifier: GPL-3.0-or-later
0003 
0004 import QtQuick
0005 import QtQuick.Layouts
0006 import QtQuick.Controls as QQC2
0007 
0008 import org.kde.purpose as Purpose
0009 import org.kde.notification
0010 import org.kde.kirigami as Kirigami
0011 
0012 Kirigami.Page {
0013     id: window
0014 
0015     leftPadding: 0
0016     rightPadding: 0
0017     topPadding: 0
0018     bottomPadding: 0
0019 
0020     globalToolBarStyle: Kirigami.ApplicationHeaderStyle.None
0021 
0022     property alias index: jobView.index
0023     property alias model: jobView.model
0024 
0025     QQC2.Action {
0026         shortcut: 'Escape'
0027         onTriggered: window.closeDialog()
0028     }
0029 
0030     Notification {
0031         id: sharingFailed
0032         eventId: "sharingFailed"
0033         text: i18n("Sharing failed")
0034         urgency: Notification.NormalUrgency
0035     }
0036 
0037     Notification {
0038         id: sharingSuccess
0039         eventId: "sharingSuccess"
0040         flags: Notification.Persistent
0041     }
0042 
0043     Component.onCompleted: jobView.start()
0044 
0045     contentItem: Purpose.JobView {
0046         id: jobView
0047         onStateChanged: {
0048             if (state === Purpose.PurposeJobController.Finished) {
0049                 window.closeDialog()
0050             } else if (state === Purpose.PurposeJobController.Error) {
0051                 // Show failure notification
0052                 sharingFailed.sendEvent();
0053 
0054                 window.closeDialog()
0055             } else if (state === Purpose.PurposeJobController.Cancelled) {
0056                 // Do nothing
0057                 window.closeDialog()
0058             }
0059         }
0060     }
0061 }