mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-30 02:19:23 +00:00
feat(ui/scripts/Utils/utils): provide a getPathFromUri function
This commit is contained in:
parent
5f203eaac4
commit
0d526abde1
2 changed files with 20 additions and 1 deletions
|
|
@ -82,7 +82,7 @@ TextField {
|
|||
}
|
||||
|
||||
onAccepted: {
|
||||
textField.selectedFile = fileUrl.toString().substring(7)
|
||||
textField.selectedFile = Utils.getPathFromUri(fileUrl)
|
||||
textField.accepted(textField.selectedFile)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,6 +155,25 @@ function openWindow (window, parent, options) {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
function getPathFromUri (uri) {
|
||||
var str = uri.toString()
|
||||
if (startsWith(str, 'file://')) {
|
||||
str = str.substring(7)
|
||||
|
||||
// Absolute path.
|
||||
if (str.charAt(0) === '/') {
|
||||
var os = Qt.platform.os
|
||||
return os === 'windows' || os === 'winrt'
|
||||
? str.substring(1)
|
||||
: str
|
||||
}
|
||||
}
|
||||
|
||||
return str
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Test if a point is in a item.
|
||||
//
|
||||
// `source` is the item that generated the point.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue