diff options
author | Adam Kallai <kadam@inf.u-szeged.hu> | 2014-07-23 07:35:39 -0700 |
---|---|---|
committer | Adam Kallai <kadam@inf.u-szeged.hu> | 2014-09-10 13:57:51 +0200 |
commit | 263e54e5e777a7c45f11560398ae80161327b866 (patch) | |
tree | 55f95166d6f308482433178b7490cb143dca8638 | |
parent | f2224a1d1100c415f0533df1275d212e423f31e4 (diff) |
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 <michael.bruning@digia.com>
Reviewed-by: Andras Becsi <andras.becsi@digia.com>
-rw-r--r-- | src/webengine/ui_delegates_manager.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
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<WebContentsAdapter> &, 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<QList<QUrl> >()) - 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<QQuickItem*>(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)); |