Fix file browser in qmlvideo example.

Use QUrl::fromLocalFile() to get Windows drive handling
right. Emulate its behavior in QML code. Fix up() to terminate
correctly.

Task-number: QTBUG-32139

Change-Id: Iec6d9f96fbe2181c939e9dbbe6aa042eac630918
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Friedemann Kleint
2013-07-26 14:18:16 +02:00
committed by The Qt Project
parent 9f26d9e242
commit de9092389f
2 changed files with 12 additions and 8 deletions

View File

@@ -101,7 +101,11 @@ Rectangle {
Rectangle {
id: wrapper
function launch() {
var path = "file://" + filePath;
console.debug("launch " + filePath);
var path = "file://";
if (filePath.length > 2 && filePath[1] === ':') // Windows drive logic, see QUrl::fromLocalFile()
path += '/';
path += filePath;
if (folders.isFolder(index))
down(path);
else
@@ -306,7 +310,7 @@ Rectangle {
MouseArea { id: upRegion; anchors.centerIn: parent
width: 56
height: 56
onClicked: if (folders.parentFolder != "") up()
onClicked: up()
}
states: [
State {
@@ -352,6 +356,8 @@ Rectangle {
function up() {
var path = folders.parentFolder;
if (path.toString().length === 0 || path.toString() === 'file:')
return;
if (folders == folders1) {
view = view2
folders = folders2;