Implemented createWindow() in QtLauncher.
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 14:30:34 +0000 (14:30 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2007 14:30:34 +0000 (14:30 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27546 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/ChangeLog
WebKit/qt/QtLauncher/main.cpp

index 54f8d6599299b2627e36b90efaca0d6395ac7b46..c84f80a77fef5fd2795c25a8ee65a2a5412ad046 100644 (file)
@@ -1,3 +1,14 @@
+2007-11-07  Simon Hausmann  <hausmann@kde.org>
+
+        Reviewed by Lars.
+
+        Implemented createWindow() in QtLauncher.
+
+        * QtLauncher/main.cpp:
+        (WebPage::WebPage):
+        (MainWindow::MainWindow):
+        (WebPage::createWindow):
+
 2007-11-07  Simon Hausmann  <hausmann@kde.org>
 
         Reviewed by Lars.
index f639685edbc48be976e5b8a2321311db2f0adb84..b96cf060f81d57871d9b5f748430672def16c4b4 100644 (file)
@@ -270,13 +270,21 @@ protected:
     QPushButton *clearButton;
 };
 
+class WebPage : public QWebPage
+{
+public:
+    inline WebPage(QWidget *parent) : QWebPage(parent) {}
+
+    virtual QWebPage *createWindow();
+};
+
 class MainWindow : public QMainWindow
 {
     Q_OBJECT
 public:
-    MainWindow(const QUrl &url)
+    MainWindow(const QUrl &url = QUrl())
     {
-        page = new QWebPage(this);
+        page = new WebPage(this);
         InfoWidget *info = new InfoWidget(page);
         info->setGeometry(20, 20, info->sizeHint().width(),
                           info->sizeHint().height());
@@ -320,10 +328,12 @@ public:
         hoverLabel = new HoverLabel(this);
         hoverLabel->hide();
 
-        page->open(url);
+        if (url.isValid())
+            page->open(url);
 
         info->raise();
     }
+    inline QWebPage *webPage() const { return page; }
 protected slots:
     void changeLocation()
     {
@@ -355,6 +365,12 @@ private:
     HoverLabel *hoverLabel;
 };
 
+QWebPage *WebPage::createWindow()
+{
+    MainWindow *mw = new MainWindow;
+    return mw->webPage();
+}
+
 #include "main.moc"
 
 int main(int argc, char **argv)