mirror of
https://github.com/muesli/telephant
synced 2025-02-16 19:48:24 +00:00
Add file-picker dialog which lets you add images to posts
This commit is contained in:
parent
b90ffb4b3d
commit
d3dfa08d36
1 changed files with 32 additions and 3 deletions
|
@ -2,6 +2,7 @@ import QtQuick 2.4
|
|||
import QtQuick.Controls 2.1
|
||||
import QtQuick.Controls.Material 2.1
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtQuick.Dialogs 1.3
|
||||
|
||||
Popup {
|
||||
id: popup
|
||||
|
@ -15,6 +16,29 @@ Popup {
|
|||
anchors.centerIn: mainWindow.overlay
|
||||
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||
|
||||
FileDialog {
|
||||
id: imageFileDialog
|
||||
title: "Please choose an image"
|
||||
folder: shortcuts.home
|
||||
nameFilters: [ "Image files (*.jpg *.jpeg *.png *.gif)", "All files (*)" ]
|
||||
selectExisting: true
|
||||
selectMultiple: true
|
||||
|
||||
onAccepted: {
|
||||
console.log("chose", imageFileDialog.fileUrls.length)
|
||||
|
||||
for (var i = 0; i < imageFileDialog.fileUrls.length; i++) {
|
||||
console.log(imageFileDialog.fileUrls[i])
|
||||
|
||||
busy.running = true
|
||||
var media = uiBridge.uploadAttachment(imageFileDialog.fileUrls[i])
|
||||
}
|
||||
}
|
||||
onRejected: {
|
||||
console.log("Canceled")
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors.fill: parent
|
||||
|
@ -47,9 +71,11 @@ Popup {
|
|||
|
||||
busy.running = true
|
||||
var media = uiBridge.uploadAttachment(drop.urls[i])
|
||||
/*if (media != '') {
|
||||
/*
|
||||
if (media != '') {
|
||||
attachments.append({"id": media, "url": drop.urls[i]})
|
||||
}*/
|
||||
}
|
||||
*/
|
||||
}
|
||||
drop.acceptProposedAction()
|
||||
}
|
||||
|
@ -112,9 +138,12 @@ Popup {
|
|||
}
|
||||
}
|
||||
|
||||
Label {
|
||||
TextButton {
|
||||
text: "Attach files by dragging & dropping them."
|
||||
font.pointSize: 9
|
||||
onClicked: function() {
|
||||
imageFileDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
|
|
Loading…
Add table
Reference in a new issue