Warning, /multimedia/audiotube/src/contents/ui/ShareMenu.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
0002 // SPDX-FileCopyrightText: 2023 Mathis BrĂ¼chert <mbb@kaidan.im>
0003 // SPDX-License-Identifier: GPL-2.0-or-later
0004 
0005 import QtQuick.Controls as Controls
0006 import QtQuick.Layouts 1.7
0007 import QtQuick 2.7
0008 import QtQuick.Window 2.15
0009 
0010 import org.kde.kirigami 2.20 as Kirigami
0011 import org.kde.kirigami.delegates as KirigamiDelegates
0012 import org.kde.kirigamiaddons.components 1.0 as Components
0013 import org.kde.purpose 1.0 as Purpose
0014 
0015 import org.kde.ytmusic 1.0
0016 
0017 Item{
0018     id:root
0019     property url url
0020     property string inputTitle
0021     function open(){
0022         if (Kirigami.Settings.isMobile){
0023             inputDrawer.open()
0024             inputDrawer.interactive = true
0025             drawerView.inputData = {
0026                 "urls": [root.url.toString()],
0027                 "title": "Title"
0028 
0029             }
0030         } else {
0031             inputSheet.open()
0032             view.inputData = {
0033                 "urls": [root.url.toString()],
0034                 "title": "Title"
0035             }
0036         }
0037     }
0038 
0039     Kirigami.Dialog {
0040         id: inputSheet
0041         title: i18n("Share to")
0042         preferredWidth: Kirigami.Units.gridUnit * 16
0043         standardButtons: Kirigami.Dialog.NoButton
0044         ColumnLayout {
0045             spacing:0
0046             KirigamiDelegates.SubtitleDelegate {
0047                 Layout.fillWidth: true
0048                 icon.name: "edit-copy"
0049                 text: i18n("Copy Link")
0050                 visible: view.depth === 1
0051                 onClicked: {
0052                     Clipboard.text = root.url
0053                     inputSheet.close()
0054                     applicationWindow().showPassiveNotification(i18n("Link copied to clipboard"))
0055                 }
0056             }
0057             Purpose.AlternativesView {
0058                 Layout.fillHeight: true
0059                 Layout.fillWidth: true
0060                 id: view
0061                 pluginType: "ShareUrl"
0062                 clip: true
0063 
0064                 delegate: Controls.ItemDelegate {
0065                     onClicked: view.createJob (shareDelegate.index)
0066 
0067                     contentItem: KirigamiDelegates.IconTitleSubtitle {
0068                         id: shareDelegate
0069 
0070                         required property string iconName
0071                         required property int index
0072                         required property string actionDisplay
0073 
0074                         title: shareDelegate.actionDisplay
0075                         Keys.onReturnPressed: view.createJob (shareDelegate.index)
0076                         Keys.onEnterPressed: view.createJob (shareDelegate.index)
0077                         icon.name: shareDelegate.iconName
0078 
0079                         Kirigami.Icon {
0080                             implicitWidth: Kirigami.Units.iconSizes.small
0081                             implicitHeight: Kirigami.Units.iconSizes.small
0082                             source: "arrow-right"
0083                         }
0084                     }
0085                 }
0086 
0087                 onFinished: inputSheet.close()
0088             }
0089         }
0090     }
0091 
0092     Components.BottomDrawer {
0093         id: inputDrawer
0094 
0095         parent: applicationWindow().overlay
0096 
0097         drawerContentItem: ColumnLayout {
0098             spacing:0
0099             KirigamiDelegates.SubtitleDelegate {
0100                 Layout.fillWidth: true
0101                 icon.name: "edit-copy"
0102                 text: i18n("Copy Link")
0103                 visible: drawerView.depth === 1
0104                 onClicked: {
0105                     Clipboard.text = root.url
0106                     inputDrawer.close()
0107                     applicationWindow().showPassiveNotification(i18n("Link copied to clipboard"))
0108                 }
0109             }
0110             Purpose.AlternativesView {
0111                 id: drawerView
0112                 pluginType: "ShareUrl"
0113                 clip: true
0114                 Layout.fillHeight: true
0115                 Layout.fillWidth: true
0116                 delegate: KirigamiDelegates.SubtitleDelegate {
0117                     id: shareDrawerDelegate
0118 
0119                     required property string iconName
0120                     required property int index
0121 
0122                     text: shareDrawerDelegate.display
0123                     onClicked: drawerView.createJob (shareDrawerDelegate.index)
0124                     Keys.onReturnPressed: view.createJob (shareDrawerDelegate.index)
0125                     Keys.onEnterPressed: view.createJob (shareDrawerDelegate.index)
0126                     icon.name: shareDrawerDelegate.iconName
0127 
0128                     Kirigami.Icon {
0129                         implicitWidth: Kirigami.Units.iconSizes.small
0130                         implicitHeight: Kirigami.Units.iconSizes.small
0131                         source: "arrow-right"
0132                     }
0133                 }
0134 
0135                 onFinished: inputDrawer.close()
0136             }
0137 
0138             Item{
0139                 Layout.fillHeight: true
0140             }
0141 
0142         }
0143     }
0144 }