From 263e54e5e777a7c45f11560398ae80161327b866 Mon Sep 17 00:00:00 2001 From: Adam Kallai Date: Wed, 23 Jul 2014 07:35:39 -0700 Subject: Fix the type of argument in FilePickerController::accepted() slot. The filesSelected QML signal is connected to FilePickerController::accepted slot but the type of the parameters were different. Change-Id: I36a33857b557797fc18699144c4d558d0e454cf8 Reviewed-by: Michael Bruning Reviewed-by: Andras Becsi --- src/webengine/ui_delegates_manager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 9b7b0dd18..e559c0fbb 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -347,7 +347,7 @@ public: FilePickerController(WebContentsAdapterClient::FileChooserMode, const QExplicitlySharedDataPointer &, QObject * = 0); public Q_SLOTS: - void accepted(const QVariant &files); + void accepted(const QJSValue &files); void rejected(); private: @@ -364,12 +364,13 @@ FilePickerController::FilePickerController(WebContentsAdapterClient::FileChooser { } -void FilePickerController::accepted(const QVariant &files) +void FilePickerController::accepted(const QJSValue &filesValue) { QStringList stringList; - // Qt Quick's file dialog returns a list of QUrls, this will hence shape our API there. - Q_FOREACH (const QUrl &url, files.value >()) - stringList.append(url.toLocalFile()); + int length = filesValue.property(QStringLiteral("length")).toInt(); + for (int i = 0; i < length; i++) { + stringList.append(QUrl(filesValue.property(i).toString()).toLocalFile()); + } m_adapter->filesSelectedInChooser(stringList, m_mode); } @@ -389,6 +390,7 @@ void UIDelegatesManager::showFilePicker(WebContentsAdapterClient::FileChooserMod if (!ensureComponentLoaded(FilePicker)) return; + QQmlContext *context(creationContextForComponent(filePickerComponent)); QObject *filePicker = filePickerComponent->beginCreate(context); if (QQuickItem* item = qobject_cast(filePicker)) @@ -418,7 +420,7 @@ void UIDelegatesManager::showFilePicker(WebContentsAdapterClient::FileChooserMod CHECK_QML_SIGNAL_PROPERTY(filesPickedSignal, filePickerComponent->url()); QQmlProperty rejectSignal(filePicker, QStringLiteral("onRejected")); CHECK_QML_SIGNAL_PROPERTY(rejectSignal, filePickerComponent->url()); - static int acceptedIndex = controller->metaObject()->indexOfSlot("accepted(QVariant)"); + static int acceptedIndex = controller->metaObject()->indexOfSlot("accepted(QJSValue)"); QObject::connect(filePicker, filesPickedSignal.method(), controller, controller->metaObject()->method(acceptedIndex)); static int rejectedIndex = controller->metaObject()->indexOfSlot("rejected()"); QObject::connect(filePicker, rejectSignal.method(), controller, controller->metaObject()->method(rejectedIndex)); -- cgit v1.2.3