[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

dbates at webkit.org dbates at webkit.org
Thu Apr 8 00:51:39 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 9204ba8d5d5b54afdcd87b4f2e06c5a3577b7637
Author: dbates at webkit.org <dbates at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Dec 29 18:27:33 2009 +0000

    2009-12-29  Daniel Bates  <dbates at webkit.org>
    
            Reviewed by Ariya Hidayat.
    
            https://bugs.webkit.org/show_bug.cgi?id=32925
    
            Adds an Open File dialog to make it convenient to open a file
            to view in the browser.
    
            * QGVLauncher/main.cpp:
            (MainWindow::load): Modified to call loadURL.
            (MainWindow::openFile): Added.
            (MainWindow::loadURL): Added.
            (MainWindow::buildUI): Added menu item Open File.
    2009-12-29  Daniel Bates  <dbates at webkit.org>
    
            Reviewed by Ariya Hidayat.
    
            https://bugs.webkit.org/show_bug.cgi?id=32925
    
            Adds an Open File dialog to make it convenient to open a file
            to view in the browser.
    
            Currently a person must either specify the path to a file as a
            command-line argument or type a file URL. Instead, we should
            have a file dialog to allow a person to open a file without
            memorizing its path.
    
            * QtLauncher/main.cpp:
            (MainWindow::MainWindow): Changed urlEdit->setText(qurl.toEncoded())
            to urlEdit->setText(qurl.toString()).
            (MainWindow::openFile): Added.
            (MainWindow::changeLocation): Moved code to load URL into method
            MainWindow::loadURL.
            (MainWindow::loadURL): Added.
            (MainWindow::setupUI): Added menu item Open File.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52626 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 7699218..13ea512 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,18 @@
+2009-12-29  Daniel Bates  <dbates at webkit.org>
+
+        Reviewed by Ariya Hidayat.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32925
+
+        Adds an Open File dialog to make it convenient to open a file
+        to view in the browser.
+
+        * QGVLauncher/main.cpp:
+        (MainWindow::load): Modified to call loadURL.
+        (MainWindow::openFile): Added.
+        (MainWindow::loadURL): Added.
+        (MainWindow::buildUI): Added menu item Open File.
+
 2009-12-29  Robert Hogan  <robert at roberthogan.net>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/qt/QGVLauncher/main.cpp b/WebKit/qt/QGVLauncher/main.cpp
index 2021cb6..af47afc 100644
--- a/WebKit/qt/QGVLauncher/main.cpp
+++ b/WebKit/qt/QGVLauncher/main.cpp
@@ -296,9 +296,7 @@ public:
         if (!deducedUrl.isValid())
             deducedUrl = QUrl("http://" + url + "/");
 
-        urlEdit->setText(deducedUrl.toEncoded());
-        scene->webView()->load(deducedUrl);
-        scene->webView()->setFocus(Qt::OtherFocusReason);
+        loadURL(deducedUrl);
     }
 
     QWebPage* page() const
@@ -307,6 +305,23 @@ public:
     }
 
 protected slots:
+
+    void openFile()
+    {
+        static const QString filter("HTML Files (*.htm *.html);;Text Files (*.txt);;Image Files (*.gif *.jpg *.png);;All Files (*)");
+
+        QFileDialog fileDialog(this, tr("Open"), QString(), filter);
+        fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
+        fileDialog.setFileMode(QFileDialog::ExistingFile);
+        fileDialog.setOptions(QFileDialog::ReadOnly);
+
+        if (fileDialog.exec()) {
+            QString selectedFile = fileDialog.selectedFiles()[0];
+            if (!selectedFile.isEmpty())
+                loadURL(QUrl::fromLocalFile(selectedFile));
+        }
+    }
+
     void changeLocation()
     {
         load(urlEdit->text());
@@ -368,6 +383,17 @@ public slots:
     }
 
 private:
+
+    void loadURL(const QUrl& url)
+    {
+        if (!url.isValid())
+            return;
+    
+        urlEdit->setText(url.toString());
+        scene->webView()->load(url);
+        scene->webView()->setFocus(Qt::OtherFocusReason);
+    }
+
     void buildUI()
     {
         QWebPage* page = scene->webView()->page();
@@ -384,6 +410,7 @@ private:
 
         QMenu* fileMenu = menuBar()->addMenu("&File");
         fileMenu->addAction("New Window", this, SLOT(newWindow()));
+        fileMenu->addAction("Open File...", this, SLOT(openFile()), QKeySequence(Qt::CTRL | Qt::Key_O));
         fileMenu->addAction("Clone view", this, SLOT(clone()));
         fileMenu->addAction("Close", this, SLOT(close()));
 
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index cf54484..61062df 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,26 @@
+2009-12-29  Daniel Bates  <dbates at webkit.org>
+
+        Reviewed by Ariya Hidayat.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32925
+
+        Adds an Open File dialog to make it convenient to open a file
+        to view in the browser.
+
+        Currently a person must either specify the path to a file as a
+        command-line argument or type a file URL. Instead, we should
+        have a file dialog to allow a person to open a file without
+        memorizing its path.
+
+        * QtLauncher/main.cpp:
+        (MainWindow::MainWindow): Changed urlEdit->setText(qurl.toEncoded())
+        to urlEdit->setText(qurl.toString()). 
+        (MainWindow::openFile): Added.
+        (MainWindow::changeLocation): Moved code to load URL into method
+        MainWindow::loadURL.
+        (MainWindow::loadURL): Added.
+        (MainWindow::setupUI): Added menu item Open File.
+
 2009-12-29  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Reviewed by Holger Freyther.
diff --git a/WebKitTools/QtLauncher/main.cpp b/WebKitTools/QtLauncher/main.cpp
index f7ac4b2..4cb59d0 100644
--- a/WebKitTools/QtLauncher/main.cpp
+++ b/WebKitTools/QtLauncher/main.cpp
@@ -218,7 +218,7 @@ public:
         if (qurl.scheme().isEmpty())
             qurl = QUrl("http://" + url + "/");
         if (qurl.isValid()) {
-            urlEdit->setText(qurl.toEncoded());
+            urlEdit->setText(qurl.toString());
             view->load(qurl);
         }
 
@@ -332,17 +332,29 @@ public:
 
 protected slots:
 
+    void openFile()
+    {
+        static const QString filter("HTML Files (*.htm *.html);;Text Files (*.txt);;Image Files (*.gif *.jpg *.png);;All Files (*)");
+
+        QFileDialog fileDialog(this, tr("Open"), QString(), filter);
+        fileDialog.setAcceptMode(QFileDialog::AcceptOpen);
+        fileDialog.setFileMode(QFileDialog::ExistingFile);
+        fileDialog.setOptions(QFileDialog::ReadOnly);
+
+        if (fileDialog.exec()) {
+            QString selectedFile = fileDialog.selectedFiles()[0];
+            if (!selectedFile.isEmpty())
+                loadURL(QUrl::fromLocalFile(selectedFile));
+        }
+    }
+
     void changeLocation()
     {
         QString string = urlEdit->text();
         QUrl url = urlFromUserInput(string);
         if (url.scheme().isEmpty())
             url = QUrl("http://" + string + "/");
-        if (url.isValid()) {
-            urlEdit->setText(url.toEncoded());
-            view->load(url);
-            view->setFocus(Qt::OtherFocusReason);
-        }
+        loadURL(url);
     }
 
     void loadFinished()
@@ -486,6 +498,16 @@ private:
     QVector<int> zoomLevels;
     int currentZoom;
 
+    void loadURL(const QUrl& url)
+    {
+        if (!url.isValid())
+            return;
+    
+        urlEdit->setText(url.toString());
+        view->load(url);
+        view->setFocus(Qt::OtherFocusReason);
+    }
+
     // create the status bar, tool bar & menu
     void setupUI()
     {
@@ -517,6 +539,7 @@ private:
 
         QMenu* fileMenu = menuBar()->addMenu("&File");
         QAction* newWindow = fileMenu->addAction("New Window", this, SLOT(newWindow()));
+        fileMenu->addAction(tr("Open File..."), this, SLOT(openFile()), QKeySequence(Qt::CTRL | Qt::Key_O));
         fileMenu->addAction(tr("Print"), this, SLOT(print()), QKeySequence::Print);
         QAction* screenshot = fileMenu->addAction("Screenshot", this, SLOT(screenshot()));
         fileMenu->addAction("Close", this, SLOT(close()));

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list