Warning, /network/neochat/src/qml/AttachDialog.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.de> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtCore 0005 import QtQuick 0006 import QtQuick.Controls as QQC2 0007 import QtQuick.Layouts 0008 0009 import org.kde.kirigami as Kirigami 0010 0011 import org.kde.neochat 0012 0013 QQC2.Popup { 0014 id: root 0015 0016 padding: 16 0017 0018 signal chosen(string path) 0019 0020 contentItem: RowLayout { 0021 QQC2.ToolButton { 0022 Layout.preferredWidth: 160 0023 Layout.fillHeight: true 0024 0025 icon.name: 'mail-attachment' 0026 0027 text: i18n("Choose local file") 0028 0029 onClicked: { 0030 root.close() 0031 0032 var fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay) 0033 fileDialog.chosen.connect(path => root.chosen(path)) 0034 fileDialog.open() 0035 } 0036 } 0037 0038 Kirigami.Separator {} 0039 0040 QQC2.ToolButton { 0041 Layout.preferredWidth: 160 0042 Layout.fillHeight: true 0043 0044 padding: 16 0045 0046 icon.name: 'insert-image' 0047 text: i18n("Clipboard image") 0048 onClicked: { 0049 const path = StandardPaths.standardLocations(StandardPaths.CacheLocation)[0] + "/screenshots/" + (new Date()).getTime() + ".png" 0050 if (!Clipboard.saveImage(path)) { 0051 return; 0052 } 0053 root.chosen(path) 0054 root.close(); 0055 } 0056 } 0057 } 0058 Component { 0059 id: openFileDialog 0060 0061 OpenFileDialog { 0062 parentWindow: Window.window 0063 currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] 0064 } 0065 } 0066 }