User is not able to select file from FileBrowser and play it.

When string is converted to Url qrc:// scheme is used.
Fix Filebrowser to use file:// scheme instead.

Change-Id: I9617d9503ed403de7d017b8586ae37b05dc096cb
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
sanevala
2013-02-12 12:02:46 +02:00
committed by The Qt Project
parent c64db5dfde
commit 73859f6ec3
2 changed files with 9 additions and 5 deletions

View File

@@ -127,10 +127,13 @@ int main(int argc, char *argv[])
rootObject, SLOT(qmlFramePainted())); rootObject, SLOT(qmlFramePainted()));
#endif #endif
QString videoPath; QUrl videoPath;
const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation); const QStringList moviesLocation = QStandardPaths::standardLocations(QStandardPaths::MoviesLocation);
if (!moviesLocation.isEmpty()) if (moviesLocation.isEmpty()) {
videoPath = moviesLocation.first(); QUrl appPath(QString("file:///%1").arg(app.applicationDirPath()));
videoPath = appPath.resolved(QUrl("./"));
} else
videoPath = QString("file:///%1").arg(moviesLocation.first());
viewer.rootContext()->setContextProperty("videoPath", videoPath); viewer.rootContext()->setContextProperty("videoPath", videoPath);
QMetaObject::invokeMethod(rootObject, "init"); QMetaObject::invokeMethod(rootObject, "init");

View File

@@ -100,10 +100,11 @@ Rectangle {
Rectangle { Rectangle {
id: wrapper id: wrapper
function launch() { function launch() {
var path = "file:///" + filePath;
if (folders.isFolder(index)) if (folders.isFolder(index))
down(filePath); down(path);
else else
fileBrowser.selectFile(filePath) fileBrowser.selectFile(path)
} }
width: root.width width: root.width
height: 52 height: 52