diff options
Diffstat (limited to 'WebKitTools/QtTestBrowser')
-rw-r--r-- | WebKitTools/QtTestBrowser/QtTestBrowser.pro | 2 | ||||
-rw-r--r-- | WebKitTools/QtTestBrowser/main.cpp | 8 | ||||
-rw-r--r-- | WebKitTools/QtTestBrowser/mainwindow.cpp | 2 | ||||
-rw-r--r-- | WebKitTools/QtTestBrowser/useragentlist.txt | 4 | ||||
-rw-r--r-- | WebKitTools/QtTestBrowser/webpage.cpp | 44 | ||||
-rw-r--r-- | WebKitTools/QtTestBrowser/webpage.h | 1 |
6 files changed, 53 insertions, 8 deletions
diff --git a/WebKitTools/QtTestBrowser/QtTestBrowser.pro b/WebKitTools/QtTestBrowser/QtTestBrowser.pro index 4c4d83f..fa16c82 100644 --- a/WebKitTools/QtTestBrowser/QtTestBrowser.pro +++ b/WebKitTools/QtTestBrowser/QtTestBrowser.pro @@ -20,13 +20,13 @@ HEADERS += \ webview.h \ fpstimer.h \ -CONFIG -= app_bundle CONFIG += uitools isEmpty(OUTPUT_DIR): OUTPUT_DIR = ../.. include(../../WebKit.pri) DESTDIR = $$OUTPUT_DIR/bin +!CONFIG(standalone_package): CONFIG -= app_bundle QT += network macx:QT+=xml diff --git a/WebKitTools/QtTestBrowser/main.cpp b/WebKitTools/QtTestBrowser/main.cpp index 49c08d9..ca3bf7a 100644 --- a/WebKitTools/QtTestBrowser/main.cpp +++ b/WebKitTools/QtTestBrowser/main.cpp @@ -883,13 +883,13 @@ void LauncherWindow::createChrome() QAction* toggleResizesToContents = graphicsViewMenu->addAction("Toggle Resizes To Contents Mode", this, SLOT(toggleResizesToContents(bool))); toggleResizesToContents->setCheckable(true); toggleResizesToContents->setChecked(false); - toggleResizesToContents->setEnabled(false); + toggleResizesToContents->setEnabled(isGraphicsBased()); toggleResizesToContents->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); QAction* toggleTiledBackingStore = graphicsViewMenu->addAction("Toggle Tiled Backing Store", this, SLOT(toggleTiledBackingStore(bool))); toggleTiledBackingStore->setCheckable(true); toggleTiledBackingStore->setChecked(false); - toggleTiledBackingStore->setEnabled(false); + toggleTiledBackingStore->setEnabled(isGraphicsBased()); toggleTiledBackingStore->connect(toggleGraphicsView, SIGNAL(toggled(bool)), SLOT(setEnabled(bool))); QAction* spatialNavigationAction = toolsMenu->addAction("Toggle Spatial Navigation", this, SLOT(toggleSpatialNavigation(bool))); @@ -1063,7 +1063,7 @@ LauncherApplication::LauncherApplication(int& argc, char** argv) { // To allow QWebInspector's configuration persistence setOrganizationName("Nokia"); - setApplicationName("QtLauncher"); + setApplicationName("QtTestBrowser"); setApplicationVersion("0.1"); applyDefaultSettings(); @@ -1082,7 +1082,7 @@ void LauncherApplication::handleUserOptions() { QStringList args = arguments(); QFileInfo program(args.at(0)); - QString programName("QtLauncher"); + QString programName("QtTestBrowser"); if (program.exists()) programName = program.baseName(); diff --git a/WebKitTools/QtTestBrowser/mainwindow.cpp b/WebKitTools/QtTestBrowser/mainwindow.cpp index aa6aa26..941ef79 100644 --- a/WebKitTools/QtTestBrowser/mainwindow.cpp +++ b/WebKitTools/QtTestBrowser/mainwindow.cpp @@ -39,7 +39,7 @@ MainWindow::MainWindow(const QString& url) : m_page(new WebPage(this)) { setAttribute(Qt::WA_DeleteOnClose); - if (qgetenv("QTLAUNCHER_USE_ARGB_VISUALS").toInt() == 1) + if (qgetenv("QTTESTBROWSER_USE_ARGB_VISUALS").toInt() == 1) setAttribute(Qt::WA_TranslucentBackground); buildUI(); diff --git a/WebKitTools/QtTestBrowser/useragentlist.txt b/WebKitTools/QtTestBrowser/useragentlist.txt index ca53693..b4b00f6 100644 --- a/WebKitTools/QtTestBrowser/useragentlist.txt +++ b/WebKitTools/QtTestBrowser/useragentlist.txt @@ -1,5 +1,5 @@ -Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/533.3 (KHTML, like Gecko) QtLauncher/0.1 Safari/533.3 -Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0; en-GB) AppleWebKit/533.3 (KHTML, like Gecko) QtLauncher/0.1 Mobile Safari/533.3 +Mozilla/5.0 (X11; U; Linux; en-US) AppleWebKit/533.3 (KHTML, like Gecko) QtTestBrowser/0.1 Safari/533.3 +Mozilla/5.0 (SymbianOS/9.4; U; Series60/5.0; en-GB) AppleWebKit/533.3 (KHTML, like Gecko) QtTestBrowser/0.1 Mobile Safari/533.3 Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8 Mozilla/5.0 (Linux; U; Android 1.1; en-gb; dream) AppleWebKit/525.10+ (KHTML, like Gecko) Version/3.0.4 Mobile Safari/523.12.2 Mozilla/5.0 (iPhone; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10 diff --git a/WebKitTools/QtTestBrowser/webpage.cpp b/WebKitTools/QtTestBrowser/webpage.cpp index 624a66f..2a3aae6 100644 --- a/WebKitTools/QtTestBrowser/webpage.cpp +++ b/WebKitTools/QtTestBrowser/webpage.cpp @@ -32,8 +32,10 @@ #include "webpage.h" +#include <QAuthenticator> #include <QDesktopServices> #include <QtGui> +#include <QtNetwork/QNetworkReply> #include <QtNetwork/QNetworkRequest> #include <QtNetwork/QNetworkProxy> @@ -43,6 +45,9 @@ WebPage::WebPage(QObject* parent) , m_interruptingJavaScriptEnabled(false) { applyProxy(); + + connect(networkAccessManager(), SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), + this, SLOT(authenticationRequired(QNetworkReply*, QAuthenticator*))); } void WebPage::applyProxy() @@ -118,3 +123,42 @@ bool WebPage::shouldInterruptJavaScript() return false; return QWebPage::shouldInterruptJavaScript(); } + +void WebPage::authenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) +{ + QDialog* dialog = new QDialog(QApplication::activeWindow()); + dialog->setWindowTitle("HTTP Authentication"); + + QGridLayout* layout = new QGridLayout(dialog); + dialog->setLayout(layout); + + QLabel* messageLabel = new QLabel(dialog); + messageLabel->setWordWrap(true); + QString messageStr = QString("Enter with username and password for: %1"); + messageLabel->setText(messageStr.arg(reply->url().toString())); + layout->addWidget(messageLabel, 0, 1); + + QLabel* userLabel = new QLabel("Username:", dialog); + layout->addWidget(userLabel, 1, 0); + QLineEdit* userInput = new QLineEdit(dialog); + layout->addWidget(userInput, 1, 1); + + QLabel* passLabel = new QLabel("Password:", dialog); + layout->addWidget(passLabel, 2, 0); + QLineEdit* passInput = new QLineEdit(dialog); + passInput->setEchoMode(QLineEdit::Password); + layout->addWidget(passInput, 2, 1); + + QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok + | QDialogButtonBox::Cancel, Qt::Horizontal, dialog); + connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); + connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); + layout->addWidget(buttonBox, 3, 1); + + if (dialog->exec() == QDialog::Accepted) { + authenticator->setUser(userInput->text()); + authenticator->setPassword(passInput->text()); + } + + delete dialog; +} diff --git a/WebKitTools/QtTestBrowser/webpage.h b/WebKitTools/QtTestBrowser/webpage.h index 061deb5..03cde43 100644 --- a/WebKitTools/QtTestBrowser/webpage.h +++ b/WebKitTools/QtTestBrowser/webpage.h @@ -56,6 +56,7 @@ public slots: void openUrlInDefaultBrowser(const QUrl& url = QUrl()); void setUserAgent(const QString& ua) { m_userAgent = ua; } bool shouldInterruptJavaScript(); + void authenticationRequired(QNetworkReply*, QAuthenticator*); private: void applyProxy(); |