From b7cc728d63610978dbac37238b00f0e08cf58ddc Mon Sep 17 00:00:00 2001 From: nowrep Date: Fri, 25 Jan 2013 19:52:30 +0100 Subject: [PATCH] Improved PopupWindow + added correspoding tests. Added menu to popup windows. It is now also possible to search on page in popup window (Ctrl+F). --- TODO | 15 --- src/lib/app/qupzilla.cpp | 33 ++++-- src/lib/app/qupzilla.h | 2 + src/lib/popupwindow/popupwebpage.cpp | 25 ++--- src/lib/popupwindow/popupwindow.cpp | 157 +++++++++++++++++++++++---- src/lib/popupwindow/popupwindow.h | 33 ++++-- src/lib/preferences/jsoptions.cpp | 5 +- src/lib/preferences/jsoptions.h | 3 +- src/lib/webview/searchtoolbar.cpp | 32 +++--- src/lib/webview/searchtoolbar.h | 10 +- tests/autotests/formcompletertest.h | 1 + tests/{forms => }/form.html | 0 tests/popup.html | 11 ++ tests/popupwindows.html | 40 +++++++ 14 files changed, 274 insertions(+), 93 deletions(-) delete mode 100644 TODO rename tests/{forms => }/form.html (100%) create mode 100644 tests/popup.html create mode 100644 tests/popupwindows.html diff --git a/TODO b/TODO deleted file mode 100644 index d129fecb8..000000000 --- a/TODO +++ /dev/null @@ -1,15 +0,0 @@ -TODO List ----------------------------------------------------------------------------------- - -There are some features, which I plan to implement in future. -The list is not sorted by priority. - -* Export Bookmarks (html, ...) -* FTP Protocol support -* Zoom Widget in statusbar -* Password Manager: save more than one account for site + input completer -* (KDE) Nepomuk integration -* Support for remote Web inspector -* Session manager -* Editable toolbar -* NoScript plugin diff --git a/src/lib/app/qupzilla.cpp b/src/lib/app/qupzilla.cpp index 275b031d4..9934b9d13 100644 --- a/src/lib/app/qupzilla.cpp +++ b/src/lib/app/qupzilla.cpp @@ -985,7 +985,7 @@ void QupZilla::aboutToShowViewMenu() m_actionShowStatusbar->setChecked(statusBar()->isVisible()); m_actionShowBookmarksToolbar->setChecked(m_bookmarksToolbar->isVisible()); -#if QT_VERSION >= 0x050000 +#if QTWEBKIT_FROM_2_3 m_actionCaretBrowsing->setChecked(mApp->webSettings()->testAttribute(QWebSettings::CaretBrowsingEnabled)); #endif } @@ -1421,6 +1421,11 @@ void QupZilla::currentTabChanged() m_ipLabel->setText(view->getIp()); view->setFocus(); + SearchToolBar* search = searchToolBar(); + if (search) { + search->setWebView(view); + } + updateLoadingActions(); // Setting correct tab order (LocationBar -> WebSearchBar -> WebView) @@ -1483,19 +1488,14 @@ void QupZilla::webSearch() void QupZilla::searchOnPage() { - if (m_mainLayout->count() == 4) { - SearchToolBar* search = qobject_cast(m_mainLayout->itemAt(3)->widget()); - if (!search) { - return; - } + SearchToolBar* toolBar = searchToolBar(); - search->focusSearchLine(); - return; + if (!toolBar) { + toolBar = new SearchToolBar(weView(), this); + m_mainLayout->insertWidget(3, toolBar); } - SearchToolBar* search = new SearchToolBar(this); - m_mainLayout->insertWidget(3, search); - search->focusSearchLine(); + toolBar->focusSearchLine(); #ifdef Q_OS_WIN if (QtWin::isCompositionEnabled()) { @@ -1857,6 +1857,17 @@ void QupZilla::closeEvent(QCloseEvent* event) event->accept(); } +SearchToolBar* QupZilla::searchToolBar() +{ + SearchToolBar* toolBar = 0; + + if (m_mainLayout->count() == 4) { + toolBar = qobject_cast(m_mainLayout->itemAt(3)->widget()); + } + + return toolBar; +} + void QupZilla::disconnectObjects() { // Disconnecting all important widgets before deleting this window diff --git a/src/lib/app/qupzilla.h b/src/lib/app/qupzilla.h index 174196564..6c86ce242 100644 --- a/src/lib/app/qupzilla.h +++ b/src/lib/app/qupzilla.h @@ -202,6 +202,8 @@ private: void keyReleaseEvent(QKeyEvent* event); void closeEvent(QCloseEvent* event); + SearchToolBar* searchToolBar(); + void setupUi(); void setupMenu(); diff --git a/src/lib/popupwindow/popupwebpage.cpp b/src/lib/popupwindow/popupwebpage.cpp index cc804e243..b16b9505d 100644 --- a/src/lib/popupwindow/popupwebpage.cpp +++ b/src/lib/popupwindow/popupwebpage.cpp @@ -56,20 +56,11 @@ PopupWebPage::PopupWebPage(QWebPage::WebWindowType type, QupZilla* mainClass) void PopupWebPage::slotGeometryChangeRequested(const QRect &rect) { - /* Very ugly hack for QtWebKit 2.3 - * It now sends QRect(0, y, 100x100) if the popup window - * geometry was not set in window.open call. - */ - - if (rect.isValid() -//#if QTWEBKIT_FROM_2_3 -#if 0 - && rect.size() != QSize(100, 100) -#endif - ) { - m_geometry = rect; + if (rect.isValid()) { m_createNewWindow = true; } + + m_geometry = rect; } void PopupWebPage::slotMenuBarVisibilityChangeRequested(bool visible) @@ -108,11 +99,19 @@ void PopupWebPage::slotLoadFinished(bool state) void PopupWebPage::checkBehaviour() { + // If menubar/statusbar/toolbar visibility is explicitly set in window.open call, + // at least one of those variables will be false. + // If so, we should open new window. + + if (!m_createNewWindow && (!m_menuBarVisible || !m_statusBarVisible || !m_toolBarVisible)) { + m_createNewWindow = true; + } + if (m_createNewWindow) { PopupWebView* view = new PopupWebView; view->setWebPage(this); - PopupWindow* popup = new PopupWindow(view, p_QupZilla); + PopupWindow* popup = new PopupWindow(view); popup->setWindowGeometry(m_geometry); popup->setMenuBarVisibility(m_menuBarVisible); popup->setStatusBarVisibility(m_statusBarVisible); diff --git a/src/lib/popupwindow/popupwindow.cpp b/src/lib/popupwindow/popupwindow.cpp index 69c080d99..21025080b 100644 --- a/src/lib/popupwindow/popupwindow.cpp +++ b/src/lib/popupwindow/popupwindow.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,21 +20,24 @@ #include "popupwebpage.h" #include "popupstatusbarmessage.h" #include "progressbar.h" -#include "qupzilla.h" +#include "pagescreen.h" +#include "searchtoolbar.h" #include "qzsettings.h" #include "popuplocationbar.h" #include "qztools.h" +#include "iconprovider.h" #include #include #include #include +#include -PopupWindow::PopupWindow(PopupWebView* view, QupZilla* mainClass) +PopupWindow::PopupWindow(PopupWebView* view) : QWidget() - , p_QupZilla(mainClass) , m_view(view) , m_page(qobject_cast(view->page())) + , m_search(0) { m_layout = new QVBoxLayout(this); m_layout->setContentsMargins(0, 0, 0, 0); @@ -45,14 +48,61 @@ PopupWindow::PopupWindow(PopupWebView* view, QupZilla* mainClass) m_statusBar = new QStatusBar(this); m_statusBar->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - m_statusBar->setVisible(p_QupZilla->statusBar()->isVisible()); m_progressBar = new ProgressBar(m_statusBar); m_statusBar->addPermanentWidget(m_progressBar); m_progressBar->hide(); + m_view->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_statusBarMessage = new PopupStatusBarMessage(this); + m_menuBar = new QMenuBar(this); + + QMenu* menuFile = new QMenu(tr("File")); + menuFile->addAction(QIcon::fromTheme("document-save"), tr("&Save Page As..."), m_view, SLOT(savePageAs()))->setShortcut(QKeySequence("Ctrl+S")); + menuFile->addAction(tr("Save Page Screen"), this, SLOT(savePageScreen())); + menuFile->addAction(QIcon::fromTheme("mail-message-new"), tr("Send Link..."), m_view, SLOT(sendPageByMail())); + menuFile->addAction(QIcon::fromTheme("document-print"), tr("&Print..."), m_view, SLOT(printPage()))->setShortcut(QKeySequence("Ctrl+P")); + menuFile->addSeparator(); + menuFile->addAction(QIcon::fromTheme("window-close"), tr("Close"), this, SLOT(close()))->setShortcut(QKeySequence("Ctrl+W")); + m_menuBar->addMenu(menuFile); + + m_menuEdit = new QMenu(tr("Edit")); + m_menuEdit->addAction(QIcon::fromTheme("edit-undo"), tr("&Undo"), this, SLOT(editUndo()))->setShortcut(QKeySequence("Ctrl+Z")); + m_menuEdit->addAction(QIcon::fromTheme("edit-redo"), tr("&Redo"), this, SLOT(editRedo()))->setShortcut(QKeySequence("Ctrl+Shift+Z")); + m_menuEdit->addSeparator(); + m_menuEdit->addAction(QIcon::fromTheme("edit-cut"), tr("&Cut"), this, SLOT(editCut()))->setShortcut(QKeySequence("Ctrl+X")); + m_menuEdit->addAction(QIcon::fromTheme("edit-copy"), tr("C&opy"), this, SLOT(editCopy()))->setShortcut(QKeySequence("Ctrl+C")); + m_menuEdit->addAction(QIcon::fromTheme("edit-paste"), tr("&Paste"), this, SLOT(editPaste()))->setShortcut(QKeySequence("Ctrl+V")); + m_menuEdit->addSeparator(); + m_menuEdit->addAction(QIcon::fromTheme("edit-select-all"), tr("Select All"), m_view, SLOT(selectAll()))->setShortcut(QKeySequence("Ctrl+A")); + m_menuEdit->addAction(QIcon::fromTheme("edit-find"), tr("Find"), this, SLOT(searchOnPage()))->setShortcut(QKeySequence("Ctrl+F")); + connect(m_menuEdit, SIGNAL(aboutToShow()), this, SLOT(aboutToShowEditMenu())); + m_menuBar->addMenu(m_menuEdit); + + m_menuView = new QMenu(tr("View")); + m_actionStop = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserStop), tr("&Stop"), m_view, SLOT(stop())); + m_actionStop->setShortcut(QKeySequence("Esc")); + m_actionReload = m_menuView->addAction(qIconProvider->standardIcon(QStyle::SP_BrowserReload), tr("&Reload"), m_view, SLOT(reload())); + m_actionReload->setShortcut(QKeySequence("F5")); + m_menuView->addSeparator(); + m_menuView->addAction(QIcon::fromTheme("zoom-in"), tr("Zoom &In"), m_view, SLOT(zoomIn()))->setShortcut(QKeySequence("Ctrl++")); + m_menuView->addAction(QIcon::fromTheme("zoom-out"), tr("Zoom &Out"), m_view, SLOT(zoomOut()))->setShortcut(QKeySequence("Ctrl+-")); + m_menuView->addAction(QIcon::fromTheme("zoom-original"), tr("Reset"), m_view, SLOT(zoomReset()))->setShortcut(QKeySequence("Ctrl+0")); + m_menuView->addSeparator(); + m_menuView->addAction(QIcon::fromTheme("text-html"), tr("&Page Source"), m_view, SLOT(showSource()))->setShortcut(QKeySequence("Ctrl+U")); + m_menuBar->addMenu(m_menuView); + + // Make shortcuts available even with hidden menubar + QList actions = m_menuBar->actions(); + foreach(QAction * action, actions) { + if (action->menu()) { + actions += action->menu()->actions(); + } + addAction(action); + } + + m_layout->insertWidget(0, m_menuBar); m_layout->addWidget(m_locationBar); m_layout->addWidget(m_view); m_layout->addWidget(m_statusBar); @@ -125,6 +175,11 @@ void PopupWindow::loadStarted() m_progressBar->show(); m_locationBar->startLoading(); + + if (m_actionStop) { + m_actionStop->setEnabled(true); + m_actionReload->setEnabled(false); + } } void PopupWindow::loadProgress(int value) @@ -138,6 +193,11 @@ void PopupWindow::loadFinished() m_progressBar->hide(); m_locationBar->stopLoading(); + + if (m_actionStop) { + m_actionStop->setEnabled(false); + m_actionReload->setEnabled(true); + } } void PopupWindow::closeEvent(QCloseEvent* event) @@ -153,17 +213,80 @@ void PopupWindow::closeEvent(QCloseEvent* event) event->accept(); } +void PopupWindow::editSelectAll() +{ + m_view->selectAll(); +} + +void PopupWindow::aboutToShowEditMenu() +{ + m_menuEdit->actions().at(0)->setEnabled(m_view->pageAction(QWebPage::Undo)->isEnabled()); + m_menuEdit->actions().at(1)->setEnabled(m_view->pageAction(QWebPage::Redo)->isEnabled()); + // Separator + m_menuEdit->actions().at(3)->setEnabled(m_view->pageAction(QWebPage::Cut)->isEnabled()); + m_menuEdit->actions().at(4)->setEnabled(m_view->pageAction(QWebPage::Copy)->isEnabled()); + m_menuEdit->actions().at(5)->setEnabled(m_view->pageAction(QWebPage::Paste)->isEnabled()); + // Separator + m_menuEdit->actions().at(7)->setEnabled(m_view->pageAction(QWebPage::SelectAll)->isEnabled()); +} + +void PopupWindow::savePageScreen() +{ + PageScreen* pageScreen = new PageScreen(m_view, this); + pageScreen->show(); +} + +void PopupWindow::searchOnPage() +{ + if (!m_search) { + m_search = new SearchToolBar(m_view, this); + m_layout->insertWidget(m_layout->count() - 1, m_search); + } + + m_search->focusSearchLine(); +} + +void PopupWindow::editUndo() +{ + m_view->triggerPageAction(QWebPage::Undo); +} + +void PopupWindow::editRedo() +{ + m_view->triggerPageAction(QWebPage::Redo); +} + +void PopupWindow::editCut() +{ + m_view->triggerPageAction(QWebPage::Cut); +} + +void PopupWindow::editCopy() +{ + m_view->triggerPageAction(QWebPage::Copy); +} + +void PopupWindow::editPaste() +{ + m_view->triggerPageAction(QWebPage::Paste); +} + void PopupWindow::titleChanged() { setWindowTitle(tr("%1 - QupZilla").arg(m_view->title())); } -void PopupWindow::setWindowGeometry(const QRect &newRect) +void PopupWindow::setWindowGeometry(QRect newRect) { if (!qzSettings->allowJsGeometryChange) { return; } + // left/top was set while width/height not + if (!newRect.topLeft().isNull() && newRect.size().isNull()) { + newRect.setSize(QSize(550, 585)); + } + if (newRect.isValid()) { QRect oldRect = rect(); move(newRect.topLeft()); @@ -179,33 +302,19 @@ void PopupWindow::setWindowGeometry(const QRect &newRect) } } -// From my testing, these 3 slots are always fired with false -// visible argument (even if true should be passed) -// So for now, we just do nothing here - void PopupWindow::setStatusBarVisibility(bool visible) { - if (!qzSettings->allowJsHideStatusBar) { - return; - } - - Q_UNUSED(visible) + m_statusBar->setVisible(qzSettings->allowJsHideStatusBar ? visible : true); } void PopupWindow::setMenuBarVisibility(bool visible) { - if (!qzSettings->allowJsHideMenuBar) { - return; - } - - Q_UNUSED(visible) + m_menuBar->setVisible(qzSettings->allowJsHideMenuBar ? visible : true); } void PopupWindow::setToolBarVisibility(bool visible) { - if (!qzSettings->allowJsHideToolBar) { - return; - } - + // Does nothing now + // m_toolBar->setVisible(qzSettings->allowJsHideToolBar ? visible : true); Q_UNUSED(visible) } diff --git a/src/lib/popupwindow/popupwindow.h b/src/lib/popupwindow/popupwindow.h index 4bac4dee0..0d702e501 100644 --- a/src/lib/popupwindow/popupwindow.h +++ b/src/lib/popupwindow/popupwindow.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,32 +19,33 @@ #define POPUPWINDOW_H #include +#include #include "qz_namespace.h" class QVBoxLayout; class QStatusBar; +class QMenuBar; +class QMenu; -class QupZilla; class PopupWebView; class PopupWebPage; class PopupStatusBarMessage; class PopupLocationBar; class ProgressBar; +class SearchToolBar; class QT_QUPZILLA_EXPORT PopupWindow : public QWidget { Q_OBJECT public: - explicit PopupWindow(PopupWebView* view, QupZilla* mainClass); + explicit PopupWindow(PopupWebView* view); QStatusBar* statusBar(); PopupWebView* webView(); -signals: - public slots: - void setWindowGeometry(const QRect &newRect); + void setWindowGeometry(QRect newRect); void setStatusBarVisibility(bool visible); void setMenuBarVisibility(bool visible); void setToolBarVisibility(bool visible); @@ -58,10 +59,21 @@ private slots: void loadProgress(int value); void loadFinished(); + void editUndo(); + void editRedo(); + void editCut(); + void editCopy(); + void editPaste(); + void editSelectAll(); + + void aboutToShowEditMenu(); + + void savePageScreen(); + void searchOnPage(); + private: void closeEvent(QCloseEvent* event); - QupZilla* p_QupZilla; PopupWebView* m_view; PopupWebPage* m_page; PopupLocationBar* m_locationBar; @@ -70,7 +82,12 @@ private: QVBoxLayout* m_layout; QStatusBar* m_statusBar; - + QMenuBar* m_menuBar; + QMenu* m_menuEdit; + QMenu* m_menuView; + QAction* m_actionReload; + QAction* m_actionStop; + QPointer m_search; }; #endif // POPUPWINDOW_H diff --git a/src/lib/preferences/jsoptions.cpp b/src/lib/preferences/jsoptions.cpp index 59d2905df..5a47205e1 100644 --- a/src/lib/preferences/jsoptions.cpp +++ b/src/lib/preferences/jsoptions.cpp @@ -1,6 +1,7 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2013 David Rosca + 2013 Mladen Pejaković * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,6 +45,8 @@ JsOptions::JsOptions(QWidget* parent) #if QTWEBKIT_TO_2_2 ui->jscanCloseWindow->setHidden(true); #endif +// Disable for now, as it does not do anything (yet) + ui->jscanHideTool->setHidden(true); } void JsOptions::accept() diff --git a/src/lib/preferences/jsoptions.h b/src/lib/preferences/jsoptions.h index 402affccf..767b2fef0 100644 --- a/src/lib/preferences/jsoptions.h +++ b/src/lib/preferences/jsoptions.h @@ -1,6 +1,7 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2013 David Rosca + 2013 Mladen Pejaković * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/lib/webview/searchtoolbar.cpp b/src/lib/webview/searchtoolbar.cpp index cdeed3921..f3e3e0270 100644 --- a/src/lib/webview/searchtoolbar.cpp +++ b/src/lib/webview/searchtoolbar.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,6 @@ * along with this program. If not, see . * ============================================================ */ #include "searchtoolbar.h" -#include "qupzilla.h" #include "tabbedwebview.h" #include "lineedit.h" #include "ui_searchtoolbar.h" @@ -25,10 +24,10 @@ #include #include -SearchToolBar::SearchToolBar(QupZilla* mainClass, QWidget* parent) +SearchToolBar::SearchToolBar(WebView* view, QWidget* parent) : AnimatedWidget(AnimatedWidget::Up, 300, parent) , ui(new Ui::SearchToolbar) - , p_QupZilla(mainClass) + , m_view(view) , m_findFlags(0) { setAttribute(Qt::WA_DeleteOnClose); @@ -53,7 +52,12 @@ SearchToolBar::SearchToolBar(QupZilla* mainClass, QWidget* parent) QShortcut* findPreviousAction = new QShortcut(QKeySequence("Shift+F3"), this); connect(findPreviousAction, SIGNAL(activated()), this, SLOT(findPrevious())); - mainClass->installEventFilter(this); + parent->installEventFilter(this); +} + +void SearchToolBar::setWebView(WebView* view) +{ + m_view = view; } void SearchToolBar::focusSearchLine() @@ -66,7 +70,7 @@ void SearchToolBar::hide() AnimatedWidget::hide(); searchText(QString()); - p_QupZilla->weView()->setFocus(); + m_view->setFocus(); } void SearchToolBar::findNext() @@ -97,13 +101,11 @@ void SearchToolBar::updateFindFlags() void SearchToolBar::highlightChanged() { - WebView* view = p_QupZilla->weView(); - if (ui->highligh->isChecked()) { - view->findText(ui->lineEdit->text(), m_findFlags | QWebPage::HighlightAllOccurrences); + m_view->findText(ui->lineEdit->text(), m_findFlags | QWebPage::HighlightAllOccurrences); } else { - view->findText(QString(), QWebPage::HighlightAllOccurrences); + m_view->findText(QString(), QWebPage::HighlightAllOccurrences); } } @@ -116,12 +118,10 @@ void SearchToolBar::caseSensitivityChanged() void SearchToolBar::searchText(const QString &text) { - WebView* view = p_QupZilla->weView(); - // Clear highlighting on page - view->findText(QString(), QWebPage::HighlightAllOccurrences); + m_view->findText(QString(), QWebPage::HighlightAllOccurrences); - bool found = view->findText(text, m_findFlags); + bool found = m_view->findText(text, m_findFlags); if (text.isEmpty()) { found = true; @@ -130,10 +130,10 @@ void SearchToolBar::searchText(const QString &text) if (ui->highligh->isChecked()) { m_findFlags = QWebPage::HighlightAllOccurrences; updateFindFlags(); - view->findText(text, m_findFlags); + m_view->findText(text, m_findFlags); } else { - view->findText(QString(), QWebPage::HighlightAllOccurrences); + m_view->findText(QString(), QWebPage::HighlightAllOccurrences); } if (!found) { diff --git a/src/lib/webview/searchtoolbar.h b/src/lib/webview/searchtoolbar.h index 7d209ceb2..a13a25726 100644 --- a/src/lib/webview/searchtoolbar.h +++ b/src/lib/webview/searchtoolbar.h @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 David Rosca * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,16 +30,18 @@ class SearchToolbar; class QLineEdit; -class QupZilla; +class WebView; class LineEdit; class QT_QUPZILLA_EXPORT SearchToolBar : public AnimatedWidget { Q_OBJECT public: - explicit SearchToolBar(QupZilla* mainClass, QWidget* parent = 0); + explicit SearchToolBar(WebView* view, QWidget* parent = 0); ~SearchToolBar(); + void setWebView(WebView* view); + void focusSearchLine(); bool eventFilter(QObject* obj, QEvent* event); @@ -58,7 +60,7 @@ public slots: private: Ui::SearchToolbar* ui; - QupZilla* p_QupZilla; + WebView* m_view; QWebPage::FindFlags m_findFlags; }; diff --git a/tests/autotests/formcompletertest.h b/tests/autotests/formcompletertest.h index 8a2d824e9..cc7060fb0 100644 --- a/tests/autotests/formcompletertest.h +++ b/tests/autotests/formcompletertest.h @@ -45,6 +45,7 @@ private: void completeWithData(const QString &html, const QByteArray &data); PageFormData extractFormData(const QString &html, const QByteArray &data); QVariant getElementByIdValue(const QString &id); + QWebView *view; }; diff --git a/tests/forms/form.html b/tests/form.html similarity index 100% rename from tests/forms/form.html rename to tests/form.html diff --git a/tests/popup.html b/tests/popup.html new file mode 100644 index 000000000..0b1caaf1f --- /dev/null +++ b/tests/popup.html @@ -0,0 +1,11 @@ + + + + Popup window + + +

Popup window

+ + + + diff --git a/tests/popupwindows.html b/tests/popupwindows.html new file mode 100644 index 000000000..593809a2e --- /dev/null +++ b/tests/popupwindows.html @@ -0,0 +1,40 @@ + + + + Popup windows test + + +

Popup windows test

+Will be opened in new tab +

+Popup 1 +- can be opened in new tab +

+

+Popup 1 +- with second argument _blank +

+Will be opened in popup window +

+Popup 1 +- with width and height +

+

+Popup 1 +- with width, height, left and top +

+

+Popup 1 +- with left and righ +

+

+Popup 1 +- with menubar +

+

+Popup 1 +- with statusbar +

+

+ +