mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
Fix UTF8 file names :
- Overload FileDialog for decoding percent hexa in urls.
This commit is contained in:
parent
1b8b57664c
commit
f87b2f23c8
9 changed files with 33 additions and 9 deletions
|
|
@ -175,6 +175,7 @@
|
|||
<file>ui/modules/Common/Dialog/DialogDescription.qml</file>
|
||||
<file>ui/modules/Common/Dialog/DialogPlus.qml</file>
|
||||
<file>ui/modules/Common/Dialog/DialogTitle.qml</file>
|
||||
<file>ui/modules/Common/Dialog/FileDialog.qml</file>
|
||||
<file>ui/modules/Common/Form/ActionBar.qml</file>
|
||||
<file>ui/modules/Common/Form/ActionButton.qml</file>
|
||||
<file>ui/modules/Common/Form/ActionSwitch.qml</file>
|
||||
|
|
|
|||
|
|
@ -604,4 +604,8 @@ QString Utils::getFileChecksum(const QString& filePath){
|
|||
}
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString Utils::decodePercentFromUtf8(const QString& utf8){
|
||||
return QUrl::fromPercentEncoding(utf8.toUtf8());
|
||||
}
|
||||
|
|
@ -66,6 +66,7 @@ public:
|
|||
Q_INVOKABLE QSize getImageSize(const QString& url);
|
||||
Q_INVOKABLE static QPoint getCursorPosition();
|
||||
Q_INVOKABLE static QString getFileChecksum(const QString& filePath);
|
||||
Q_INVOKABLE static QString decodePercentFromUtf8(const QString& utf8);
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
19
linphone-app/ui/modules/Common/Dialog/FileDialog.qml
Normal file
19
linphone-app/ui/modules/Common/Dialog/FileDialog.qml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
import QtQuick.Dialogs 1.2 as Dialogs
|
||||
|
||||
|
||||
import UtilsCpp 1.0
|
||||
|
||||
Dialogs.FileDialog {
|
||||
id:mainItem
|
||||
|
||||
function getFileUrls(){
|
||||
var decodedFiles = [];
|
||||
for(var i = 0 ; i < fileDialog.fileUrls.length ; ++i)
|
||||
decodedFiles.push(UtilsCpp.decodePercentFromUtf8(fileDialog.fileUrls[i]))
|
||||
return decodedFiles;
|
||||
}
|
||||
|
||||
function getFileUrl(){
|
||||
return UtilsCpp.decodePercentFromUtf8(fileUrl)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
|
|
@ -77,7 +76,7 @@ TextField {
|
|||
}
|
||||
|
||||
onAccepted: {
|
||||
var selectedFile = Utils.getSystemPathFromUri(fileUrl)
|
||||
var selectedFile = Utils.getSystemPathFromUri(getFileUrl())
|
||||
|
||||
textField.selectedFile = selectedFile
|
||||
textField.accepted(selectedFile)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
import Common 1.0
|
||||
|
|
@ -8,6 +7,8 @@ import Linphone 1.0
|
|||
import Common.Styles 1.0
|
||||
import Utils 1.0
|
||||
|
||||
import 'qrc:/ui/scripts/Utils/utils.js' as Utils
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Item {
|
||||
|
|
@ -45,7 +46,6 @@ Item {
|
|||
|
||||
return files
|
||||
}, [])
|
||||
|
||||
if (files.length > 0) {
|
||||
dropped(files)
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ Item {
|
|||
folder: shortcuts.home
|
||||
title: qsTr('fileChooserTitle')
|
||||
|
||||
onAccepted: {_emitFiles(fileDialog.fileUrls);fileDialogLoader.active = false}
|
||||
onAccepted: {_emitFiles(getFileUrls());fileDialogLoader.active = false}
|
||||
onRejected: fileDialogLoader.active = false
|
||||
Component.onCompleted: fileDialog.open()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,10 +12,11 @@ singleton Constants 1.0 Constants/Constants.qml
|
|||
|
||||
BusyIndicator 1.0 Animations/BusyIndicator.qml
|
||||
|
||||
ConfirmDialog 1.0 Dialog/ConfirmDialog.qml
|
||||
DateTimeDialog 1.0 Dialog/DateTimeDialog.qml
|
||||
DialogDescription 1.0 Dialog/DialogDescription.qml
|
||||
ConfirmDialog 1.0 Dialog/ConfirmDialog.qml
|
||||
DialogPlus 1.0 Dialog/DialogPlus.qml
|
||||
FileDialog 1.0 Dialog/FileDialog.qml
|
||||
|
||||
ActionBar 1.0 Form/ActionBar.qml
|
||||
ActionButton 1.0 Form/ActionButton.qml
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.2
|
||||
import QtQuick.Dialogs 1.2
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
import Common 1.0
|
||||
|
|
@ -75,7 +74,7 @@ ColumnLayout {
|
|||
folder: shortcuts.home
|
||||
title: qsTr('avatarChooserTitle')
|
||||
|
||||
onAccepted: Logic.setAvatar(fileUrls[0])
|
||||
onAccepted: Logic.setAvatar(getFileUrls()[0])
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 3e4c31b645e47b5231a9d9a4a8effc11eecb868b
|
||||
Subproject commit 8dc0b5e6033c994f3d63c097f1cf1969bba04864
|
||||
Loading…
Add table
Reference in a new issue