mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-30 09:56:14 -05:00
Create custom filechooser depending on OS type
This commit is contained in:
parent
8a59503260
commit
c83ce86252
@ -19,6 +19,7 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import "." //Needed for ClipboardWrapper singleton
|
||||
import "./components"
|
||||
import "URI.js" as UriJs
|
||||
|
||||
Item
|
||||
@ -28,13 +29,18 @@ Item
|
||||
property bool is_contact: cntDt.md.is_contact
|
||||
|
||||
Button
|
||||
{
|
||||
text: "Open f d "
|
||||
onClicked:
|
||||
{
|
||||
androidImagePicker.openPicker()
|
||||
}
|
||||
{
|
||||
text: "Open f d "
|
||||
onClicked:
|
||||
{
|
||||
fileChooser.open()
|
||||
}
|
||||
CustomFileChooser
|
||||
{
|
||||
id: fileChooser
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
ColorHash
|
||||
{
|
||||
|
@ -0,0 +1,45 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
Item
|
||||
{
|
||||
id: compRoot
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: fileDialog
|
||||
title: "Please choose a file"
|
||||
folder: shortcuts.pictures
|
||||
nameFilters: [ "Image files (*.png *.jpg)"]
|
||||
visible: false
|
||||
onAccepted: {
|
||||
console.log("You chose: " + fileDialog.fileUrls)
|
||||
}
|
||||
onRejected: {
|
||||
console.log("Canceled")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function open()
|
||||
{
|
||||
if (Qt.platform.os === "android")
|
||||
{
|
||||
console.log("ImagePicker Android platform detected")
|
||||
mainWindow.addUriHandler("/media", androidResult)
|
||||
androidImagePicker.openPicker()
|
||||
}
|
||||
else
|
||||
{
|
||||
fileDialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
function androidResult (uri)
|
||||
{
|
||||
console.log("Android image uri found" , uri)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -29,5 +29,6 @@
|
||||
<file>icons/rating-unrated.png</file>
|
||||
<file>icons/rating.png</file>
|
||||
<file>TimedPopup.qml</file>
|
||||
<file>components/CustomFileChooser.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Loading…
Reference in New Issue
Block a user