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 QtQuick 2.15
0005 import QtQuick.Controls 2.15 as QQC2
0006 import QtQuick.Layouts 1.15
0007 import Qt.labs.platform 1.1
0008 import Qt.labs.qmlmodels 1.0
0009 
0010 import org.kde.kirigami 2.15 as Kirigami
0011 import org.kde.kirigamiaddons.labs.components 1.0 as Components
0012 import org.kde.kmasto 1.0
0013 
0014 import "./StatusDelegate" as StatusDelegate
0015 
0016 Components.AlbumMaximizeComponent {
0017     id: root
0018 
0019     property alias attachments: root.model
0020     required property var identity
0021 
0022     actions: ShareAction {
0023         inputData: {
0024             'urls': [content.currentItem.source],
0025             'title': "Image",
0026         }
0027     }
0028 
0029     leading: StatusDelegate.InlineIdentityInfo {
0030         identity: root.identity
0031         secondary: false
0032         onClicked: close()
0033     }
0034 
0035     onSaveItem: {
0036         const dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay, {
0037             url: content.currentItem.source,
0038         })
0039         dialog.open();
0040         dialog.currentFile = dialog.folder + "/" + FileHelper.fileName(content.currentItem.source);
0041     }
0042 
0043     Component {
0044         id: saveAsDialog
0045         FileDialog {
0046             property var url
0047             fileMode: FileDialog.SaveFile
0048             folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation)
0049             onAccepted: {
0050                 if (!currentFile) {
0051                     return;
0052                 }
0053                 console.log(url, currentFile, AccountManager.selectedAccount)
0054                 FileHelper.downloadFile(AccountManager.selectedAccount, url, currentFile)
0055             }
0056         }
0057     }
0058 
0059     onClosed: {
0060         applicationWindow().isShowingFullScreenImage = false;
0061     }
0062 
0063     onOpened: {
0064         applicationWindow().isShowingFullScreenImage = true;
0065         forceActiveFocus();
0066     }
0067 }