Title: [111012] trunk
Revision
111012
Author
[email protected]
Date
2012-03-16 09:16:25 -0700 (Fri, 16 Mar 2012)

Log Message

[Qt][Wk2] Assertion Failure and crash on file upload
https://bugs.webkit.org/show_bug.cgi?id=80854

Patch by Dinu Jacob <[email protected]> on 2012-03-16
Reviewed by Simon Hausmann.

Source/WebKit2:

Crash resulted from attempting to create QFileDialog, a QtWidget based dialog from a
QGuiApplication. Replace QFileDialog with a QML implementable component.
Added a new property 'filePicker' to WebView experimental to set the QML component for
file upload triggered by an input file element.

Co-authored with Kasthuri Nallappasoundararajan <[email protected]>

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::QQuickWebViewPrivate):
(QQuickWebViewPrivate::chooseFiles):
(QQuickWebViewExperimental::filePicker):
(QQuickWebViewExperimental::setFilePicker):
* UIProcess/API/qt/qquickwebview_p.h:
* UIProcess/API/qt/qquickwebview_p_p.h:
(QQuickWebViewPrivate):
* UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro:
* UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml: Added.
* UIProcess/API/qt/tests/qmltests/common/singlefileupload.html: Added.
* UIProcess/qt/QtDialogRunner.cpp:
(FilePickerContextObject):
(FilePickerContextObject::FilePickerContextObject):
(FilePickerContextObject::fileList):
(FilePickerContextObject::reject):
(FilePickerContextObject::accept):
(QtDialogRunner::initForFilePicker):
* UIProcess/qt/QtDialogRunner.h:
(QtDialogRunner):
(QtDialogRunner::filePaths):
(QtDialogRunner::onFileSelected):

Tools:

Added filePicker to WebView using experimental API.

* MiniBrowser/qt/MiniBrowser.qrc:
* MiniBrowser/qt/icons/folder.png: Added.
* MiniBrowser/qt/icons/titlebar.png: Added.
* MiniBrowser/qt/icons/up.png: Added.
* MiniBrowser/qt/qml/BrowserWindow.qml:
* MiniBrowser/qt/qml/FilePicker.qml: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (111011 => 111012)


--- trunk/Source/WebKit2/ChangeLog	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-16 16:16:25 UTC (rev 111012)
@@ -1,5 +1,42 @@
 2012-03-16  Dinu Jacob  <[email protected]>
 
+        [Qt][Wk2] Assertion Failure and crash on file upload
+        https://bugs.webkit.org/show_bug.cgi?id=80854
+
+        Reviewed by Simon Hausmann.
+
+        Crash resulted from attempting to create QFileDialog, a QtWidget based dialog from a 
+        QGuiApplication. Replace QFileDialog with a QML implementable component.
+        Added a new property 'filePicker' to WebView experimental to set the QML component for
+        file upload triggered by an input file element.
+
+        Co-authored with Kasthuri Nallappasoundararajan <[email protected]>
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::QQuickWebViewPrivate):
+        (QQuickWebViewPrivate::chooseFiles):
+        (QQuickWebViewExperimental::filePicker):
+        (QQuickWebViewExperimental::setFilePicker):
+        * UIProcess/API/qt/qquickwebview_p.h:
+        * UIProcess/API/qt/qquickwebview_p_p.h:
+        (QQuickWebViewPrivate):
+        * UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro:
+        * UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml: Added.
+        * UIProcess/API/qt/tests/qmltests/common/singlefileupload.html: Added.
+        * UIProcess/qt/QtDialogRunner.cpp:
+        (FilePickerContextObject):
+        (FilePickerContextObject::FilePickerContextObject):
+        (FilePickerContextObject::fileList):
+        (FilePickerContextObject::reject):
+        (FilePickerContextObject::accept):
+        (QtDialogRunner::initForFilePicker):
+        * UIProcess/qt/QtDialogRunner.h:
+        (QtDialogRunner):
+        (QtDialogRunner::filePaths):
+        (QtDialogRunner::onFileSelected):
+
+2012-03-16  Dinu Jacob  <[email protected]>
+
         [Qt][WK2] Build failure when using --no-touch-events
         https://bugs.webkit.org/show_bug.cgi?id=81241
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (111011 => 111012)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-03-16 16:16:25 UTC (rev 111012)
@@ -47,7 +47,6 @@
 #include <private/qquickflickable_p.h>
 #include <_javascript_Core/InitializeThreading.h>
 #include <QDeclarativeEngine>
-#include <QFileDialog>
 #include <QtQuick/QQuickCanvas>
 #include <WebCore/IntPoint.h>
 #include <WebCore/IntRect.h>
@@ -76,6 +75,7 @@
     , certificateVerificationDialog(0)
     , itemSelector(0)
     , proxyAuthenticationDialog(0)
+    , filePicker(0)
     , userDidOverrideContentWidth(false)
     , userDidOverrideContentHeight(false)
     , m_navigatorQtObjectEnabled(false)
@@ -375,52 +375,30 @@
 
 void QQuickWebViewPrivate::chooseFiles(WKOpenPanelResultListenerRef listenerRef, const QStringList& selectedFileNames, QtWebPageUIClient::FileChooserType type)
 {
-#ifndef QT_NO_FILEDIALOG
     Q_Q(QQuickWebView);
-    openPanelResultListener = listenerRef;
 
-    // Qt does not support multiple files suggestion, so we get just the first suggestion.
-    QString selectedFileName;
-    if (!selectedFileNames.isEmpty())
-        selectedFileName = selectedFileNames.at(0);
+    if (!filePicker || type == QtWebPageUIClient::MultipleFilesSelection)
+        return;
 
-    Q_ASSERT(!fileDialog);
-
-    QWindow* window = q->canvas();
-    if (!window)
+    QtDialogRunner dialogRunner;
+    if (!dialogRunner.initForFilePicker(filePicker, q, selectedFileNames))
         return;
 
-    fileDialog = new QFileDialog(0, QString(), selectedFileName);
-    fileDialog->window()->winId(); // Ensure that the dialog has a window
-    Q_ASSERT(fileDialog->window()->windowHandle());
-    fileDialog->window()->windowHandle()->setTransientParent(window);
+    execDialogRunner(dialogRunner);
 
-    fileDialog->open(q, SLOT(_q_onOpenPanelFilesSelected()));
+    if (dialogRunner.wasAccepted()) {
+        QStringList selectedPaths = dialogRunner.filePaths();
 
-    q->connect(fileDialog, SIGNAL(finished(int)), SLOT(_q_onOpenPanelFinished(int)));
-#endif
-}
+        Vector<RefPtr<APIObject> > wkFiles(selectedPaths.size());
+        for (unsigned i = 0; i < selectedPaths.size(); ++i)
+            wkFiles[i] = WebURL::create(QUrl::fromLocalFile(selectedPaths.at(i)).toString());            
 
-void QQuickWebViewPrivate::_q_onOpenPanelFilesSelected()
-{
-    const QStringList fileList = fileDialog->selectedFiles();
-    Vector<RefPtr<APIObject> > wkFiles(fileList.size());
+        WKOpenPanelResultListenerChooseFiles(listenerRef, toAPI(ImmutableArray::adopt(wkFiles).leakRef()));
+    } else
+        WKOpenPanelResultListenerCancel(listenerRef);
 
-    for (unsigned i = 0; i < fileList.size(); ++i)
-        wkFiles[i] = WebURL::create(QUrl::fromLocalFile(fileList.at(i)).toString());
-
-    WKOpenPanelResultListenerChooseFiles(openPanelResultListener, toAPI(ImmutableArray::adopt(wkFiles).leakRef()));
 }
 
-void QQuickWebViewPrivate::_q_onOpenPanelFinished(int result)
-{
-    if (result == QDialog::Rejected)
-        WKOpenPanelResultListenerCancel(openPanelResultListener);
-
-    fileDialog->deleteLater();
-    fileDialog = 0;
-}
-
 void QQuickWebViewPrivate::setViewInAttachedProperties(QObject* object)
 {
     Q_Q(QQuickWebView);
@@ -968,6 +946,21 @@
     emit itemSelectorChanged();
 }
 
+QDeclarativeComponent* QQuickWebViewExperimental::filePicker() const
+{
+    Q_D(const QQuickWebView);
+    return d->filePicker;
+}
+
+void QQuickWebViewExperimental::setFilePicker(QDeclarativeComponent* filePicker)
+{
+    Q_D(QQuickWebView);
+    if (d->filePicker == filePicker)
+        return;
+    d->filePicker = filePicker;
+    emit filePickerChanged();
+}
+
 QQuickUrlSchemeDelegate* QQuickWebViewExperimental::schemeDelegates_At(QDeclarativeListProperty<QQuickUrlSchemeDelegate>* property, int index)
 {
     const QObjectList children = property->object->children();

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (111011 => 111012)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-03-16 16:16:25 UTC (rev 111012)
@@ -191,8 +191,6 @@
     Q_PRIVATE_SLOT(d_func(), void _q_commitPositionChange(const QPointF&));
     Q_PRIVATE_SLOT(d_func(), void _q_commitScaleChange());
 
-    Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFilesSelected());
-    Q_PRIVATE_SLOT(d_func(), void _q_onOpenPanelFinished(int result));
     Q_PRIVATE_SLOT(d_func(), void _q_onVisibleChanged());
     Q_PRIVATE_SLOT(d_func(), void _q_onUrlChanged());
     Q_PRIVATE_SLOT(d_func(), void _q_onReceivedResponseFromDownload(QWebDownloadItem*));
@@ -250,6 +248,7 @@
     Q_PROPERTY(QDeclarativeComponent* proxyAuthenticationDialog READ proxyAuthenticationDialog WRITE setProxyAuthenticationDialog NOTIFY proxyAuthenticationDialogChanged)
     Q_PROPERTY(QDeclarativeComponent* certificateVerificationDialog READ certificateVerificationDialog WRITE setCertificateVerificationDialog NOTIFY certificateVerificationDialogChanged)
     Q_PROPERTY(QDeclarativeComponent* itemSelector READ itemSelector WRITE setItemSelector NOTIFY itemSelectorChanged)
+    Q_PROPERTY(QDeclarativeComponent* filePicker READ filePicker WRITE setFilePicker NOTIFY filePickerChanged)
     Q_PROPERTY(QWebPreferences* preferences READ preferences CONSTANT FINAL)
     Q_PROPERTY(QWebViewportInfo* viewportInfo READ viewportInfo CONSTANT FINAL)
     Q_PROPERTY(QDeclarativeListProperty<QQuickUrlSchemeDelegate> urlSchemeDelegates READ schemeDelegates)
@@ -277,6 +276,8 @@
     void setItemSelector(QDeclarativeComponent*);
     QDeclarativeComponent* proxyAuthenticationDialog() const;
     void setProxyAuthenticationDialog(QDeclarativeComponent*);
+    QDeclarativeComponent* filePicker() const;
+    void setFilePicker(QDeclarativeComponent*);
 
     QWebViewportInfo* viewportInfo();
 
@@ -329,6 +330,7 @@
     void authenticationDialogChanged();
     void certificateVerificationDialogChanged();
     void itemSelectorChanged();
+    void filePickerChanged();
     void downloadRequested(QWebDownloadItem* downloadItem);
     void permissionRequested(QWebPermissionRequest* permission);
     void messageReceived(const QVariantMap& message);

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h (111011 => 111012)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h	2012-03-16 16:16:25 UTC (rev 111012)
@@ -50,7 +50,6 @@
 
 QT_BEGIN_NAMESPACE
 class QDeclarativeComponent;
-class QFileDialog;
 QT_END_NAMESPACE
 
 class QQuickWebViewPrivate {
@@ -93,8 +92,6 @@
     virtual void _q_commitScaleChange() { }
     void _q_commitPositionChange(const QPointF&);
 
-    void _q_onOpenPanelFilesSelected();
-    void _q_onOpenPanelFinished(int result);
     void _q_onVisibleChanged();
     void _q_onUrlChanged();
     void _q_onReceivedResponseFromDownload(QWebDownloadItem*);
@@ -158,10 +155,9 @@
     QDeclarativeComponent* certificateVerificationDialog;
     QDeclarativeComponent* itemSelector;
     QDeclarativeComponent* proxyAuthenticationDialog;
+    QDeclarativeComponent* filePicker;
 
     WebCore::ViewportArguments viewportArguments;
-    QFileDialog* fileDialog;
-    WKOpenPanelResultListenerRef openPanelResultListener;
 
     bool userDidOverrideContentWidth;
     bool userDidOverrideContentHeight;

Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml (0 => 111012)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_singleFileUpload.qml	2012-03-16 16:16:25 UTC (rev 111012)
@@ -0,0 +1,65 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit 3.0
+import QtWebKit.experimental 1.0
+import "../common"
+
+// FIXME: Added to Desktop tests because we want to have mouseClick() to open the <input> tag. We can move it back
+// when TestCase starts supporting touch events, see https://bugreports.qt.nokia.com/browse/QTBUG-23083.
+TestWebView {
+    id: webView
+
+    width: 400
+    height: 400
+
+    property bool selectFile
+
+    experimental.filePicker: Item {
+        Timer {
+            running: true
+            interval: 1
+            onTriggered: {
+                if (selectFile)
+                    model.accept("acceptedfilename");
+                else
+                    model.reject();
+            }
+        }
+    }
+
+    SignalSpy {
+        id: titleSpy
+        target: webView
+        signalName: "titleChanged"
+    }
+
+    TestCase {
+        id: test
+        name: "WebViewSingleFilePicker"
+        when: windowShown
+
+        function init() {
+            webView.url = ""
+            verify(webView.waitForLoadSucceeded())
+            titleSpy.clear()
+        }
+
+        function openItemSelector() {
+            mouseClick(webView, 15, 15, Qt.LeftButton)
+        }
+
+        function test_accept() {
+            webView.selectFile = true;
+            openItemSelector()
+            titleSpy.wait()
+            compare(webView.title, "acceptedfilename")
+        }
+
+        function test_reject() {
+            var oldTitle = webView.title
+            webView.selectFile = false;
+            openItemSelector()
+            compare(webView.title, oldTitle)
+        }
+    }
+}

Modified: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro (111011 => 111012)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro	2012-03-16 16:16:25 UTC (rev 111012)
@@ -19,4 +19,5 @@
     DesktopBehavior/tst_linkHovered.qml \
     DesktopBehavior/tst_loadHtml.qml \
     DesktopBehavior/tst_messaging.qml \
-    DesktopBehavior/tst_navigationRequested.qml
+    DesktopBehavior/tst_navigationRequested.qml \
+    DesktopBehavior/tst_singlefileupload.qml

Added: trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html (0 => 111012)


--- trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html	                        (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html	2012-03-16 16:16:25 UTC (rev 111012)
@@ -0,0 +1,26 @@
+<html>
+<head>
+<meta name="viewport" initial-scale=1">
+<title>No file selected</title>
+<script>
+function updateTitle()
+{
+    var inp = document.getElementById("upfile");
+    var allfiles = new String("");
+    var name = new String("");
+    for (var i = 0; i < inp.files.length; ++i)
+    {
+        name = inp.files.item(i).name;
+        if (allfiles.length == 0)
+            allfiles = name;
+        else
+            allfiles = allfiles + "," + name;
+    }
+    document.title = allfiles;
+}
+</script>
+
+<body>
+<input type="file" name="file" id="upfile" _onchange_="updateTitle()"/>
+</body>
+</html>

Modified: trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp (111011 => 111012)


--- trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.cpp	2012-03-16 16:16:25 UTC (rev 111012)
@@ -157,6 +157,31 @@
     QString m_hostname;
 };
 
+class FilePickerContextObject : public QObject {
+    Q_OBJECT
+    Q_PROPERTY(QStringList fileList READ fileList CONSTANT)
+
+public:
+    FilePickerContextObject(const QStringList& selectedFiles)
+        : QObject()
+        , m_fileList(selectedFiles)
+    {
+    }
+
+    QStringList fileList() const { return m_fileList; }
+
+public slots:
+    void reject() { emit rejected();}
+    void accept(const QVariant& path) { emit fileSelected(path.toStringList()); }
+
+signals:
+    void rejected();
+    void fileSelected(const QStringList&);
+
+private:
+    QStringList m_fileList;
+};
+
 bool QtDialogRunner::initForAlert(QDeclarativeComponent* component, QQuickItem* dialogParent, const QString& message)
 {
     DialogContextObject* contextObject = new DialogContextObject(message);
@@ -230,6 +255,19 @@
     return true;
 }
 
+bool QtDialogRunner::initForFilePicker(QDeclarativeComponent* component, QQuickItem* dialogParent, const QStringList& selectedFiles)
+{
+    FilePickerContextObject* contextObject = new FilePickerContextObject(selectedFiles);
+    if (!createDialog(component, dialogParent, contextObject))
+        return false;
+
+    connect(contextObject, SIGNAL(fileSelected(QStringList)), SLOT(onFileSelected(QStringList)));
+    connect(contextObject, SIGNAL(fileSelected(QStringList)), SLOT(quit()));
+    connect(contextObject, SIGNAL(rejected()), SLOT(quit()));
+
+    return true;
+}
+
 bool QtDialogRunner::createDialog(QDeclarativeComponent* component, QQuickItem* dialogParent, QObject* contextObject)
 {
     QDeclarativeContext* baseContext = component->creationContext();

Modified: trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.h (111011 => 111012)


--- trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.h	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Source/WebKit2/UIProcess/qt/QtDialogRunner.h	2012-03-16 16:16:25 UTC (rev 111012)
@@ -22,6 +22,7 @@
 #define QtDialogRunner_h
 
 #include <QtCore/QEventLoop>
+#include <QtCore/QStringList>
 #include <wtf/OwnPtr.h>
 
 class QDeclarativeComponent;
@@ -41,6 +42,7 @@
     bool initForAuthentication(QDeclarativeComponent*, QQuickItem* dialogParent, const QString& hostname, const QString& realm, const QString& prefilledUsername);
     bool initForCertificateVerification(QDeclarativeComponent*, QQuickItem*, const QString& hostname);
     bool initForProxyAuthentication(QDeclarativeComponent*, QQuickItem*, const QString& hostname, uint16_t port, const QString& prefilledUsername);
+    bool initForFilePicker(QDeclarativeComponent*, QQuickItem*, const QStringList& selectedFiles);
 
     QQuickItem* dialog() const { return m_dialog.get(); }
 
@@ -50,6 +52,8 @@
     QString username() const { return m_username; }
     QString password() const { return m_password; }
 
+    QStringList filePaths() const { return m_filepaths; }
+
 public slots:
     void onAccepted(const QString& result = QString())
     {
@@ -63,6 +67,12 @@
         m_password = password;
     }
 
+    void onFileSelected(const QStringList& filePaths)
+    {
+        m_wasAccepted = true;
+        m_filepaths = filePaths;
+    }
+
 private:
     bool createDialog(QDeclarativeComponent*, QQuickItem* dialogParent, QObject* contextObject);
 
@@ -73,6 +83,7 @@
 
     QString m_username;
     QString m_password;
+    QStringList m_filepaths;
 };
 
 #endif // QtDialogRunner_h

Modified: trunk/Tools/ChangeLog (111011 => 111012)


--- trunk/Tools/ChangeLog	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Tools/ChangeLog	2012-03-16 16:16:25 UTC (rev 111012)
@@ -1,3 +1,19 @@
+2012-03-16  Dinu Jacob  <[email protected]>
+
+        [Qt][Wk2] Assertion Failure and crash on file upload
+        https://bugs.webkit.org/show_bug.cgi?id=80854
+
+        Reviewed by Simon Hausmann.
+
+        Added filePicker to WebView using experimental API.
+
+        * MiniBrowser/qt/MiniBrowser.qrc:
+        * MiniBrowser/qt/icons/folder.png: Added.
+        * MiniBrowser/qt/icons/titlebar.png: Added.
+        * MiniBrowser/qt/icons/up.png: Added.
+        * MiniBrowser/qt/qml/BrowserWindow.qml:
+        * MiniBrowser/qt/qml/FilePicker.qml: Added.
+
 2012-03-16  Mahesh Kulkarni  <[email protected]>
 
         Updating email for committer.py script.

Modified: trunk/Tools/MiniBrowser/qt/MiniBrowser.qrc (111011 => 111012)


--- trunk/Tools/MiniBrowser/qt/MiniBrowser.qrc	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Tools/MiniBrowser/qt/MiniBrowser.qrc	2012-03-16 16:16:25 UTC (rev 111012)
@@ -1,13 +1,17 @@
 <RCC>
     <qresource prefix="/">
+        <file>icons/favicon.png</file>
+        <file>icons/folder.png</file>
         <file>icons/info.png</file>
         <file>icons/next.png</file>
         <file>icons/plus.png</file>
         <file>icons/previous.png</file>
         <file>icons/refresh.png</file>
         <file>icons/stop.png</file>
+        <file>icons/titlebar.png</file>
         <file>icons/touch.png</file>
         <file>icons/touchpoint.png</file>
+        <file>icons/up.png</file>
         <file>qml/AlertDialog.qml</file>
         <file>qml/AuthenticationDialog.qml</file>
         <file>qml/BrowserWindow.qml</file>
@@ -15,6 +19,7 @@
         <file>qml/Dialog.qml</file>
         <file>qml/DialogButton.qml</file>
         <file>qml/DialogLineInput.qml</file>
+        <file>qml/FilePicker.qml</file>
         <file>qml/ItemSelector.qml</file>
         <file>qml/MockTouchPoint.qml</file>
         <file>qml/PromptDialog.qml</file>
@@ -22,6 +27,5 @@
         <file>qml/ScrollIndicator.qml</file>
         <file>qml/ViewportInfoItem.qml</file>
         <file>useragentlist.txt</file>
-        <file>icons/favicon.png</file>
     </qresource>
 </RCC>

Added: trunk/Tools/MiniBrowser/qt/icons/folder.png (0 => 111012)


--- trunk/Tools/MiniBrowser/qt/icons/folder.png	                        (rev 0)
+++ trunk/Tools/MiniBrowser/qt/icons/folder.png	2012-03-16 16:16:25 UTC (rev 111012)
@@ -0,0 +1,15 @@
+\x89PNG
+
+
+IHDR  szz\xF4sBIT|d\x88	pHYs~~E\xFA\xFC\x9FtEXtSoftwarewww.inkscape.org\x9B\xEE<\xAEIDATX\x85\xBD\x96ilT\xD7\xC7\xFF\xE7\xBE7\xFB>^\xC03\xDB\xE3\xEF{\xC0)\xB6q3\x80\xA3\x925\x824RM\xA9[\x92,mS)R\x95\xA8\x94\xD2H\x91H\xDDT\x87$-\xA5$M-R\x94D)1[\xEA\x94\xD4\xC2\x85\x80<6\xB6\x99\xC5\xE3\xF1̛\xCFr\xFB\xC166fL<%\xEDOz\xAE\xEE{\xE7\xFD\xEE9\xE7\xBEw\x89s\x8E\xB9\x8Dڕ\xF9\xCF\xDAZ\xBD^\xAD\x81y<\xFE\xA1\xB3g.n\xEF\xBE\xE3\x81{@\x9C= "Sss\xE5\xC7?y\xEA\xE1eK\xB2\xD3&\xB3r\xB9\xF0\x8DJ\xF9ii\x86\x8F\xCCf\xFDZ\xAF\xD7\xF6nA-\x96\xF4M\xA5ey\xCF(\xDE\xDF\xEF:\xF2\xF9玣\x9C\xF3\x81\xAF\xF0\xFB\x86\xBA\xE2\x82\xC2,қ\xE4P\xAAf\xA6YԐ+\xAB4D\xF8`\xD1"\xF3Ƒ\xEF?\xE6#"劕E\xC7\xDA\xDA\xEC
+\xB9\xB6L9@\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012)


--- trunk/Tools/MiniBrowser/qt/icons/titlebar.png	                        (rev 0)
+++ trunk/Tools/MiniBrowser/qt/icons/titlebar.png	2012-03-16 16:16:25 UTC (rev 111012)
@@ -0,0 +1,4 @@
+\x89PNG
+
+
+IHDR0,\xACt\xAC0sRGB\xAE\xCE\xE9gAMA\xB1\x8F\xFCa	pHYstt\xDEfxZIDATXG\xEDұ0\xC40d\xFFyA-\x85Ӻᔟ}\xF6\xE6\xD9=\xDBA\xFA\x91\x84\x92\x80zJH\xEAm(!	\xA8\xB7\xA1\x84$\xA0ކ\x92\x80zJH\xEAm(!	\xA8\xB7\xA1\x84$\xA0ކ\x92\x80zJH\xEA|\x98YjC\xE8\x9F\xDAIEND\xAEB`\x82
\ No newline at end of file

Added: trunk/Tools/MiniBrowser/qt/icons/up.png (0 => 111012)


--- trunk/Tools/MiniBrowser/qt/icons/up.png	                        (rev 0)
+++ trunk/Tools/MiniBrowser/qt/icons/up.png	2012-03-16 16:16:25 UTC (rev 111012)
@@ -0,0 +1,8 @@
+\x89PNG
+
+
+IHDRVΎWsRGB\xAE\xCE\xE9bKGD\xFF\xFF\xFF\xA0\xBD\xA7\x93	pHYs\x9A\x9CtIME\xD97\x91\x81IDAT8˽\x94\xCFkA\xC7?of7٘\xF2\xA3ML\xB5\x8A\xF5d\xB5CU,z\xF0\xE0\xA0Gۋԓ޼+x\xEF\xCD?\xC0\xFF@<HQē\xA0*UI5i~l\x93\x9A\xEC\xECz\xE8n\xD26\xEA\xC5\x8F\x98\x99\xCF\xFB\xBE\x99\xF7\xFE\xA3Y\xA1\x8F4\xFD\x87\xF5R,\xAEok[./\xE8+\x80\xF9W%\xA9\xB4\xBDx\xF1\xEA\xC1\xCE\xF5[\x93\xBD\xC3\xC7\xF4S\xA0\xC4\xFEV\x91h-'a\xDD97\xBB\xFFfy6\xED\xEC\xC9Uu:\xD3;\xE0\xB69\xBA\xD6\xE4\x83o\xF8>\xAClHk)dr\xCEéJqn\xFABR\xFBz\xE3\xBBd\xF2\xA8\xEC\x93n\x93\xED\xEF|\xC37\xC0\xDF
+TL\xA6컧ʅ\xB9\xCA\xE5$bW\xF1\x8C\x8BRZC.ټ\x94\x9A\xAB\xA9\xAF\xF0\xB6`\x83\xA0\xBD\xA9\xB4}\xAF|\xBE4?=\x93\xD4:\xBE\x82\xE7\xB5P\xE2c)С\xE7\xF2\x90\x97\x89f\x9DC\xF5|\xBEft\xE5\xF4Ll\xE1\xE4T'K4\x80J\xFCM@[w\xC17\xA8TJ\xF6u\xBB\xE45\xDE\xB5AP\xE7\xCBG\xEF\xD7\xCBg\xDExuYϜM=\xAC"`+h\xAE\xC2\xE2\xFD\xC0\xBC]\xE2U\xA3\xC6#\xE05\xD0W\xA0\xCF\xC0\xE0\x9A\xAD\x92N[\xC0
+\xDD\x81\x96\x80M`x\xAC\xFE`\xC5\x80tE\xC0\x92K\xA80%\xA5@Be\xE1^X\xFA@0\\xFAAT:\x8CA\x94\xA5\xC1V\x82DAM\xF4j;\xF6\x90 \xBEA|s-\xC1\xAE
+9l~\xAB\xD5\xFE\xF9\xE2y{\xCCu7\x8B
+\x81\xFD>C-Ji+\xF8vs\x80\xC0\xF1\xB0\xAF\xF4\xE9/\x8F\x81vt2\xE2\xEB\x88q\xC0V\xF4\xC2\xD7\xDAT%#\xBA_F\xACC#\xBF\xFD\xBA\xA42\xD6\xE1\xA2IIEND\xAEB`\x82
\ No newline at end of file

Modified: trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml (111011 => 111012)


--- trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml	2012-03-16 16:04:44 UTC (rev 111011)
+++ trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml	2012-03-16 16:16:25 UTC (rev 111012)
@@ -313,6 +313,7 @@
         experimental.promptDialog: PromptDialog { }
         experimental.authenticationDialog: AuthenticationDialog { }
         experimental.proxyAuthenticationDialog: ProxyAuthenticationDialog { }
+        experimental.filePicker: FilePicker { }
 
         ScrollIndicator {
             flickableItem: webView.experimental.flickable

Added: trunk/Tools/MiniBrowser/qt/qml/FilePicker.qml (0 => 111012)


--- trunk/Tools/MiniBrowser/qt/qml/FilePicker.qml	                        (rev 0)
+++ trunk/Tools/MiniBrowser/qt/qml/FilePicker.qml	2012-03-16 16:16:25 UTC (rev 111012)
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this program; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+import QtQuick 2.0
+import Qt.labs.folderlistmodel 1.0
+
+Rectangle {
+    id: filePicker
+
+    property QtObject fileModel: model
+    property alias folder: folders.folder
+
+    color: "white"
+    width: 400
+    height: 500
+
+    smooth: true
+    radius: 5
+    anchors.centerIn: parent
+
+    border {
+        width: 1
+        color: "#bfbfbf"
+    }
+
+    BorderImage {
+        source: "../icons/titlebar.png";
+        width: parent.width;
+        height: 50
+        y: -7
+        id: titleBar
+
+        anchors {
+            top: parent.top
+            bottom: folderListView.top
+        }
+        Rectangle {
+            id: upButton
+            width: 48
+            height: titleBar.height - 7
+            color: "transparent"
+            Image { anchors.centerIn: parent; source: "../icons/up.png" }
+            MouseArea { id: upRegion; anchors.centerIn: parent
+                width: 48
+                height: 48
+                onClicked: if (folders.parentFolder != "") up()
+            }
+        }
+
+        Rectangle {
+            color: "gray"
+            x: 48
+            width: 1
+            height: 44
+        }
+
+        Text {
+            anchors {
+                left: upButton.right
+                right: parent.right
+                leftMargin: 4
+                rightMargin: 4
+            }
+
+            height: parent.height
+            text: folders.folder
+            color: "white"
+            elide: Text.ElideLeft;
+            horizontalAlignment: Text.AlignLeft;
+            verticalAlignment: Text.AlignVCenter
+            font.pixelSize: 24
+        }
+    }
+
+    ListView {
+        id: folderListView
+
+        width: parent.width
+        height: 400
+        anchors.centerIn: parent
+        spacing: 2
+        clip: true
+
+        FolderListModel {
+            id: folders
+        }
+
+        Component {
+            id: fileDelegate
+
+            Rectangle {
+                function selected() {
+                    if (folders.isFolder(index))
+                        openFolder(filePath);
+                    else
+                        fileModel.accept(filePath);
+                }
+
+                height: 50
+                width: parent.width
+                color: folders.isFolder(index) ? "lightgray": "darkgray"
+
+                Item {
+                    width: 48;
+                    height: 48
+                    Image {
+                        source: "../icons/folder.png"
+                        anchors.centerIn: parent
+                        visible: folders.isFolder(index)
+                    }
+                }
+
+                Text {
+                    anchors.centerIn: parent
+                    anchors.leftMargin: 50
+                    text: fileName
+                }
+
+                MouseArea {
+                    anchors.fill: parent
+                    onClicked: selected();
+                }
+            }
+        }
+        model: folders
+        delegate: fileDelegate
+    }
+
+    Rectangle {
+        id: button
+
+        height: 50
+
+        border {
+            width: 1
+            color: "#bfbfbf"
+        }
+
+        anchors {
+            bottom: parent.bottom
+            top: folderListView.bottom
+            left: parent.left
+            right: parent.right
+        }
+
+        DialogButton {
+            id: cancel
+            text: "Cancel"
+            anchors {
+                horizontalCenter: parent.horizontalCenter;
+                verticalCenter:  parent.verticalCenter
+            }
+
+            onClicked: fileModel.reject()
+        }
+    }
+
+    function openFolder(path) {
+        folders.folder = path;
+    }
+
+    function up() {
+        folders.folder = folders.parentFolder;
+    }
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to