Warning, /network/tokodon/src/content/ui/FullScreenImage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: 2019 Black Hat <bhat@encom.eu.org>
0002 // SPDX-License-Identifier: GPL-3.0-only
0003 
0004 import QtCore
0005 import QtQuick
0006 import QtQuick.Controls 2 as QQC2
0007 import QtQuick.Layouts
0008 import QtQuick.Dialogs
0009 import Qt.labs.qmlmodels 1.0
0010 
0011 import org.kde.kirigami 2 as Kirigami
0012 import org.kde.kirigamiaddons.labs.components 1 as Components
0013 import org.kde.tokodon
0014 
0015 import "./StatusDelegate" as StatusDelegate
0016 
0017 Components.AlbumMaximizeComponent {
0018     id: root
0019 
0020     property alias attachments: root.model
0021     required property var identity
0022 
0023     actions: ShareAction {
0024         inputData: {
0025             'urls': [content.currentItem.source],
0026             'title': "Image",
0027         }
0028     }
0029 
0030     leading: StatusDelegate.InlineIdentityInfo {
0031         identity: root.identity
0032         secondary: false
0033         onClicked: close()
0034     }
0035 
0036     onSaveItem: {
0037         const dialog = saveAsDialog.createObject(applicationWindow().overlay, {
0038             url: content.currentItem.source,
0039         })
0040         dialog.selectedFile = dialog.currentFolder + "/" + FileHelper.fileName(content.currentItem.source);
0041         dialog.open();
0042     }
0043 
0044     onItemRightClicked: imageMenu.popup()
0045 
0046     Component {
0047         id: saveAsDialog
0048         FileDialog {
0049             property var url
0050             fileMode: FileDialog.SaveFile
0051             currentFolder: StandardPaths.writableLocation(StandardPaths.DownloadLocation)
0052             onAccepted: {
0053                 if (!selectedFile) {
0054                     return;
0055                 }
0056                 console.log(url, selectedFile, AccountManager.selectedAccount)
0057                 FileHelper.downloadFile(AccountManager.selectedAccount, url, selectedFile)
0058             }
0059         }
0060     }
0061 
0062     onClosed: {
0063         applicationWindow().isShowingFullScreenImage = false;
0064     }
0065 
0066     onOpened: {
0067         applicationWindow().isShowingFullScreenImage = true;
0068         forceActiveFocus();
0069     }
0070 
0071     ImageMenu {
0072         id: imageMenu
0073         attachment: content.currentItem
0074     }
0075 }