From 5e1d9243c538e19cac7d466141026b471ff445f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Fri, 3 Feb 2012 13:04:41 +0000 Subject: [PATCH] put webview in own class; refs #115 --- src/browser.hxx | 149 ++++++++++++++++---------------- src/downloadmanager.hxx | 4 + src/pluginfactory.hxx | 4 - src/qmake.pro.in | 7 +- src/swissbrowser_de.ts | 185 +++++++++++++++++++--------------------- src/swissbrowser_en.ts | 130 +++++++++++++--------------- src/swissbrowser_fr.ts | 185 +++++++++++++++++++--------------------- src/swissbrowser_it.ts | 120 +++++++++++++------------- src/webpage.cxx | 20 ----- src/webpage.hxx | 21 +++-- src/webview.hxx | 50 +++++++++++ 11 files changed, 442 insertions(+), 433 deletions(-) delete mode 100644 src/webpage.cxx create mode 100644 src/webview.hxx diff --git a/src/browser.hxx b/src/browser.hxx index 44ae026..adfbd86 100644 --- a/src/browser.hxx +++ b/src/browser.hxx @@ -19,8 +19,6 @@ #include #include #include -#include -#include #include #include #include @@ -35,17 +33,16 @@ #include #include #include -#include +#include #include #include -#include #include #include -#include #include #include #include +#include #include #ifndef LOG @@ -63,7 +60,8 @@ class Browser: public QMainWindow, protected Ui::Browser { Settings::MimeTypes mimeTypes = Settings::MimeTypes(), bool kiosk = false, bool login = true, bool quirks=true): _url(0), _find(new ButtonLineEdit), - _kiosk(kiosk), + _kiosk(kiosk), + _downloadManager(new DownloadManager), _settings(mimeTypes, this, settings, !kiosk), _errorLog(this), _logincertificate(this), _proxy("http://swisssign.com", this), @@ -167,16 +165,16 @@ class Browser: public QMainWindow, protected Ui::Browser { assert(connect(&_networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(finished(QNetworkReply*)))); assert(connect(&_networkManager, SIGNAL(created(QNetworkReply*)), - &_downloadManager, SLOT(add(QNetworkReply*)))); - assert(connect(&_downloadManager, SIGNAL(progress(qint64, qint64)), + _downloadManager.get(), SLOT(add(QNetworkReply*)))); + assert(connect(_downloadManager.get(), SIGNAL(progress(qint64, qint64)), SLOT(progress(qint64, qint64)))); - assert(connect(&_downloadManager, SIGNAL(started()), + assert(connect(_downloadManager.get(), SIGNAL(started()), SLOT(started()))); - assert(connect(&_downloadManager, SIGNAL(finished()), + assert(connect(_downloadManager.get(), SIGNAL(finished()), SLOT(finished()))); - assert(connect(&_downloadManager, SIGNAL(error(QString)), + assert(connect(_downloadManager.get(), SIGNAL(error(QString)), SLOT(downloadError(QString)))); - assert(connect(&_downloadManager, SIGNAL(metaDataChanged(QNetworkReply*)), + assert(connect(_downloadManager.get(), SIGNAL(metaDataChanged(QNetworkReply*)), SLOT(metaDataChanged(QNetworkReply*)))); assert(connect(&_settings, SIGNAL(newSettings()), SLOT(newSettings()))); newSettings(); @@ -223,14 +221,69 @@ class Browser: public QMainWindow, protected Ui::Browser { return true; } - QWebView* newTab() { - QWebView* browser(new QWebView); - browser->setPage(new WebPage(this, browser)); - browser->page()->setPluginFactory(new PluginFactory); - browser->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); + WebView* newTab() { + WebView* browser(new WebView); + newTab(browser); + return browser; + } + + protected: + + void closeEvent(QCloseEvent *event) { + LOG; + if (!_kiosk && !_startUrl && _settings.flag("SaveWindowState") + && _settings()) + saveWin(); + QMainWindow::closeEvent(event); + QApplication::exit(0); + } + + private Q_SLOTS: + + void load() { + LOG; + if (qobject_cast(_url)) + load(qobject_cast(_url)->currentText()); + else + load(qobject_cast(_url)->text()); + } + + void load(QString page) { + _settings.replaceSearchEngine(page); + if (QUrl(page).scheme()=="") page = "http://"+page; + load(QUrl(page)); + } + + void load(QUrl page, QWebView* view=0) { + LOG<showMessage(tr("Checking: %1").arg(page.toString())); + if (!check(page)) { + LOG<<"########## BLACK LISTED IGNORED ##########"; + statusBar()->showMessage(tr("Forbidden: %1").arg(page.toString())); + QMessageBox::warning(this, tr("Access Denied"), + tr("

Access denied due to security" + " considerations.

You are not" + " allowed to connect to %1.") + .arg(page.toString())); + return; + } + statusBar()->showMessage(tr("Reading: %1").arg(page.toString())); + if (!page.isValid()) { + statusBar()->showMessage(tr("Illegal URL: %1").arg(page.errorString())); + return; + } + if (!view) view=qobject_cast(_tabs->currentWidget()); + view->load(page); + } + + void newTab(WebView* browser) { browser->page()->setNetworkAccessManager(&_networkManager); - browser->page()->setForwardUnsupportedContent(true); + assert(connect(&_networkManager, SIGNAL(finished(QNetworkReply*)), + SLOT(finished(QNetworkReply*)))); _url->setFocus(); + // WebView + assert(connect(browser, SIGNAL(newView(WebView*)), + SLOT(newTab(WebView*)))); // QWebView assert(connect(browser, SIGNAL(urlChanged(const QUrl&)), SLOT(urlChanged(const QUrl&)))); @@ -486,56 +539,6 @@ class Browser: public QMainWindow, protected Ui::Browser { SLOT(sslErrors(QNetworkReply*, const QList&)))); _tabs->setCurrentIndex(_tabs->addTab(browser, tr("New Tab"))); _tabs->setTabsClosable(_tabs->count()>1); - return browser; - } - - protected: - - void closeEvent(QCloseEvent *event) { - LOG; - if (!_kiosk && !_startUrl && _settings.flag("SaveWindowState") - && _settings()) - saveWin(); - QMainWindow::closeEvent(event); - QApplication::exit(0); - } - - private Q_SLOTS: - - void load() { - LOG; - if (qobject_cast(_url)) - load(qobject_cast(_url)->currentText()); - else - load(qobject_cast(_url)->text()); - } - - void load(QString page) { - _settings.replaceSearchEngine(page); - if (QUrl(page).scheme()=="") page = "http://"+page; - load(QUrl(page)); - } - - void load(QUrl page, QWebView* view=0) { - LOG<showMessage(tr("Checking: %1").arg(page.toString())); - if (!check(page)) { - LOG<<"########## BLACK LISTED IGNORED ##########"; - statusBar()->showMessage(tr("Forbidden: %1").arg(page.toString())); - QMessageBox::warning(this, tr("Access Denied"), - tr("

Access denied due to security" - " considerations.

You are not" - " allowed to connect to %1.") - .arg(page.toString())); - return; - } - statusBar()->showMessage(tr("Reading: %1").arg(page.toString())); - if (!page.isValid()) { - statusBar()->showMessage(tr("Illegal URL: %1").arg(page.errorString())); - return; - } - if (!view) view=qobject_cast(_tabs->currentWidget()); - view->load(page); } void newSettings() { @@ -685,7 +688,7 @@ class Browser: public QMainWindow, protected Ui::Browser { LOG; for (int i(0); i<_tabs->count(); ++i) qobject_cast(_tabs->widget(i))->stop(); - _downloadManager.abort(); + _downloadManager->abort(); } void on_actionClearLocation_triggered() { @@ -1229,7 +1232,7 @@ class Browser: public QMainWindow, protected Ui::Browser { void unsupportedContent(QNetworkReply* reply) { LOG<header(QNetworkRequest::ContentTypeHeader).toString(); - LOG<<"Status:"<<_downloadManager.networkError(reply->error()); + LOG<<"Status:"<<_downloadManager->networkError(reply->error()); QList rh(reply->rawHeaderPairs()); for(QList::iterator it(rh.begin()); it!=rh.end(); ++it) { @@ -1278,12 +1281,12 @@ class Browser: public QMainWindow, protected Ui::Browser { LOG<<"Content-Type:"<header(QNetworkRequest::ContentTypeHeader) .toString(); LOG<<"Content-Disposition:"<rawHeader("Content-Disposition"); - LOG<<"Status:"<<_downloadManager.networkError(reply->error()); + LOG<<"Status:"<<_downloadManager->networkError(reply->error()); LOG<<"URL:"<url().toString(); LOG<<"File:"<url().toLocalFile(); LOG<<"Path:"<url().path(); if (reply->error()!=QNetworkReply::NoError) { - LOG<<"Error:"<<_downloadManager.networkError(reply->error()); + LOG<<"Error:"<<_downloadManager->networkError(reply->error()); return; } QString filename @@ -1555,7 +1558,7 @@ class Browser: public QMainWindow, protected Ui::Browser { bool _kiosk; QPrinter _printer; SslClientAuthNetworkAccessManager _networkManager; - DownloadManager _downloadManager; + std::shared_ptr _downloadManager; typedef std::map DownloadProcesses; DownloadProcesses _downloadProcesses; Settings _settings; diff --git a/src/downloadmanager.hxx b/src/downloadmanager.hxx index 822ba30..58273d8 100644 --- a/src/downloadmanager.hxx +++ b/src/downloadmanager.hxx @@ -5,6 +5,9 @@ // 1 2 3 4 5 6 7 8 // 45678901234567890123456789012345678901234567890123456789012345678901234567890 +#ifndef __DOWNLOAD_MANAGER_HXX +#define __DOWNLOAD_MANAGER_HXX + #include #include #include @@ -277,3 +280,4 @@ class DownloadManager: public QObject { Downloads _downloads; }; +#endif diff --git a/src/pluginfactory.hxx b/src/pluginfactory.hxx index 7fe6f1a..f569a4f 100644 --- a/src/pluginfactory.hxx +++ b/src/pluginfactory.hxx @@ -16,10 +16,6 @@ #define LOG qDebug()<<__PRETTY_FUNCTION__ #endif -#define foreach(A, B) \ - auto foreach_loopvar_##A(B); \ - for (auto A(foreach_loopvar_##A.begin()); A!=foreach_loopvar_##A.end(); ++A) - class PluginFactory: public QWebPluginFactory { public: PluginFactory(QObject* p=0): QWebPluginFactory(p) { diff --git a/src/qmake.pro.in b/src/qmake.pro.in index a91572d..1a62a82 100644 --- a/src/qmake.pro.in +++ b/src/qmake.pro.in @@ -1,7 +1,6 @@ QT += webkit network gui -CONFIG += no_keywords QMAKE_LIBS += -lproxyface -lpcscxx -lssl -lcrypto -QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter +QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter -std=c++0x unix { !macx { @@ -32,11 +31,11 @@ TRANSLATIONS = @PACKAGENAME@_en.ts \ @PACKAGENAME@_fr.ts \ @PACKAGENAME@_it.ts -SOURCES = main.cxx webpage.cxx +SOURCES = main.cxx HEADERS = browser.hxx smartcardauth.hxx pinentry.hxx \ downloadmanager.hxx settings.hxx sslclientnetworkmanager.hxx \ - authentication.hxx webpage.hxx errorlog.hxx \ + authentication.hxx webview.hxx webpage.hxx errorlog.hxx \ certificate.hxx logincertificate.hxx editbookmarks.hxx \ pluginfactory.hxx pdfdisplay.hpp saveorrun.hxx temporaryfile.hxx diff --git a/src/swissbrowser_de.ts b/src/swissbrowser_de.ts index cee2ddf..884a934 100644 --- a/src/swissbrowser_de.ts +++ b/src/swissbrowser_de.ts @@ -170,7 +170,7 @@ - + New Tab @@ -332,137 +332,118 @@ - + Checking: %1 Opening: %1 - + Reading: %1 Reading: %1% - - Zoom: %1% - - - - + Illegal URL: %1 - - gg - - - - - Print Document - - - - - %1 - %2 - Back to %1 - %2 - statusbar actionBack_hovered %1=url %2=title + + Forbidden: %1 - - Info: %1 + + background-color: white + search engines combobox - - done. + + SSL Not Supported - - %1 - statusbar for hovered link %1=url + + SSL is not supported on your system - - Forbidden: %1 + + Access Denied - - background-color: white - search engines combobox + + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - - SSL Not Supported + + gg - - SSL is not supported on your system + + http://www.google.com/search?hl=%2&q=%1 - - Access Denied + + Zoom: %1% - - <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. + + opening new window - - http://www.google.com/search?hl=%2&q=%1 + + Print Document - - opening new window + + %1 - %2 + statusbar actionBack_hovered %1=url %2=title - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - - + + background-color: white neutral find - - + + background-color: #ADA - background-color: #7F7 text found - - + + background-color: #F77 - background-color: lightred text not found - + About - + %8 Version: %1 Builddate: %2 @@ -471,53 +452,61 @@ Libraries: %4 qt-%5 (%6) openssl-%7 - SwissBrowser -Version: %1 -Builddate: %2 -Libraries: -%3 -%4 -qt-%5 (%6) -openssl-%7 - + %1 - + + Info: %1 + + + + + done. + + + + + %1 + statusbar for hovered link %1=url + + + + launching application ... - + errors show error log - + background-color: #F77 invalid url - + background-color: white valid url - + authentication required - + ssl error @@ -630,129 +619,129 @@ openssl-%7 DownloadManager - + Network connection successful, remote host can be reached. - + The remote server refused the connection (the server is not accepting requests). - + The remote server closed the connection prematurely, before the entire reply was received and processed. - + The remote host name was not found (invalid hostname). - + The connection to the remote server timed out. - + The operation was canceled via calls to abort() or close() before it was finished. - + The SSL/TLS handshake failed and the encrypted channel could not be established. See SSL-Errors above. The SSL/TLS handshake failed and the encrypted channel could not be established. The sslErrors() signal should have been emitted. - + The connection to the proxy server was refused (the proxy server is not accepting requests). - + The proxy server closed the connection prematurely, before the entire reply was received and processed. - + The proxy host name was not found (invalid proxy hostname). - + The connection to the proxy timed out or the proxy did not reply in time to the request sent. - + The proxy requires authentication in order to honour the request but did not accept any credentials offered (if any). - + The access to the remote content was denied (similar to HTTP error 401). - + The operation requested on the remote content is not permitted. - + The remote content was not found at the server (similar to HTTP error 404). - + The remote server requires authentication to serve the content but the credentials provided were not accepted (if any). - + The Network Access API cannot honor the request because the protocol is not known. - + The requested operation is invalid for this protocol. - + An unknown network-related error was detected. - + An unknown proxy-related error was detected. - + An unknonwn error related to the remote content was detected. - + A breakdown in protocol was detected (parsing error, invalid or unexpected responses, etc.). - + <strong>Unknown network error (code: %1).</string> - + <h1>Network Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl> <h1>Network Error</h2><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl> - + <h1>SSL Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl><table><caption>Certificate Issuer</caption><tr><th>Organization:</th><td>%4</td></tr><tr><th>Common Name:</th><td>%5</td></tr><tr><th>Location:</th><td>%6</td></tr><tr><th>Organizational Unit:</th><td>%7</td></tr><tr><th>Country:</th><td>%8</td></tr><tr><th>State or Provive:</th><td>%9</td></tr></table><table><caption>Certificate Subject</caption><tr><th>Organization:</th><td>%10</td></tr><tr><th>Common Name:</th><td>%11</td></tr><tr><th>Location:</th><td>%12</td></tr><tr><th>Organizational Unit:</th><td>%13</td></tr><tr><th>Country:</th><td>%14</td></tr><tr><th>State or Provive:</th><td>%15</td></tr></table> <h1>SSL Error</h2><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl><table><caption>Certificate Issuer</caption><tr><th>Organization:</th><td>%4</td></tr><tr><th>Common Name:</th><td>%5</td></tr><tr><th>Location:</th><td>%6</td></tr><tr><th>Organizational Unit:</th><td>%7</td></tr><tr><th>Country:</th><td>%8</td></tr><tr><th>State or Provive:</th><td>%9</td></tr></table><table><caption>Certificate Subject</caption><tr><th>Organization:</th><td>%10</td></tr><tr><th>Common Name:</th><td>%11</td></tr><tr><th>Location:</th><td>%12</td></tr><tr><th>Organizational Unit:</th><td>%13</td></tr><tr><th>Country:</th><td>%14</td></tr><tr><th>State or Provive:</th><td>%15</td></tr></table> diff --git a/src/swissbrowser_en.ts b/src/swissbrowser_en.ts index e836508..6de999b 100644 --- a/src/swissbrowser_en.ts +++ b/src/swissbrowser_en.ts @@ -190,7 +190,7 @@ - + New Tab @@ -330,118 +330,116 @@ - + Checking: %1 - + SSL Not Supported - + background-color: white search engines combobox - + SSL is not supported on your system - + Forbidden: %1 - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + Reading: %1 - + Illegal URL: %1 - + gg - + http://www.google.com/search?hl=%2&q=%1 - + Zoom: %1% - + opening new window - + Print Document - + %1 - %2 statusbar actionBack_hovered %1=url %2=title - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - - + + background-color: white neutral find - - + + background-color: #ADA - background-color: #7F7 text found - - + + background-color: #F77 - background-color: lightred text not found - + About - + %8 Version: %1 Builddate: %2 @@ -450,69 +448,61 @@ Libraries: %4 qt-%5 (%6) openssl-%7 - SwissBrowser -Version: %1 -Builddate: %2 -Libraries: -%3 -%4 -qt-%5 (%6) -openssl-%7 - + %1 - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + launching application ... - + errors show error log - + background-color: #F77 invalid url - + background-color: white valid url - + authentication required - + ssl error @@ -625,127 +615,127 @@ openssl-%7 DownloadManager - + Network connection successful, remote host can be reached. - + The remote server refused the connection (the server is not accepting requests). - + The remote server closed the connection prematurely, before the entire reply was received and processed. - + The remote host name was not found (invalid hostname). - + The connection to the remote server timed out. - + The operation was canceled via calls to abort() or close() before it was finished. - + The SSL/TLS handshake failed and the encrypted channel could not be established. See SSL-Errors above. - + The connection to the proxy server was refused (the proxy server is not accepting requests). - + The proxy server closed the connection prematurely, before the entire reply was received and processed. - + The proxy host name was not found (invalid proxy hostname). - + The connection to the proxy timed out or the proxy did not reply in time to the request sent. - + The proxy requires authentication in order to honour the request but did not accept any credentials offered (if any). - + The access to the remote content was denied (similar to HTTP error 401). - + The operation requested on the remote content is not permitted. - + The remote content was not found at the server (similar to HTTP error 404). - + The remote server requires authentication to serve the content but the credentials provided were not accepted (if any). - + The Network Access API cannot honor the request because the protocol is not known. - + The requested operation is invalid for this protocol. - + An unknown network-related error was detected. - + An unknown proxy-related error was detected. - + An unknonwn error related to the remote content was detected. - + A breakdown in protocol was detected (parsing error, invalid or unexpected responses, etc.). - + <strong>Unknown network error (code: %1).</string> - + <h1>Network Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl> - + <h1>SSL Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl><table><caption>Certificate Issuer</caption><tr><th>Organization:</th><td>%4</td></tr><tr><th>Common Name:</th><td>%5</td></tr><tr><th>Location:</th><td>%6</td></tr><tr><th>Organizational Unit:</th><td>%7</td></tr><tr><th>Country:</th><td>%8</td></tr><tr><th>State or Provive:</th><td>%9</td></tr></table><table><caption>Certificate Subject</caption><tr><th>Organization:</th><td>%10</td></tr><tr><th>Common Name:</th><td>%11</td></tr><tr><th>Location:</th><td>%12</td></tr><tr><th>Organizational Unit:</th><td>%13</td></tr><tr><th>Country:</th><td>%14</td></tr><tr><th>State or Provive:</th><td>%15</td></tr></table> diff --git a/src/swissbrowser_fr.ts b/src/swissbrowser_fr.ts index cee2ddf..884a934 100644 --- a/src/swissbrowser_fr.ts +++ b/src/swissbrowser_fr.ts @@ -170,7 +170,7 @@ - + New Tab @@ -332,137 +332,118 @@ - + Checking: %1 Opening: %1 - + Reading: %1 Reading: %1% - - Zoom: %1% - - - - + Illegal URL: %1 - - gg - - - - - Print Document - - - - - %1 - %2 - Back to %1 - %2 - statusbar actionBack_hovered %1=url %2=title + + Forbidden: %1 - - Info: %1 + + background-color: white + search engines combobox - - done. + + SSL Not Supported - - %1 - statusbar for hovered link %1=url + + SSL is not supported on your system - - Forbidden: %1 + + Access Denied - - background-color: white - search engines combobox + + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - - SSL Not Supported + + gg - - SSL is not supported on your system + + http://www.google.com/search?hl=%2&q=%1 - - Access Denied + + Zoom: %1% - - <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. + + opening new window - - http://www.google.com/search?hl=%2&q=%1 + + Print Document - - opening new window + + %1 - %2 + statusbar actionBack_hovered %1=url %2=title - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - - + + background-color: white neutral find - - + + background-color: #ADA - background-color: #7F7 text found - - + + background-color: #F77 - background-color: lightred text not found - + About - + %8 Version: %1 Builddate: %2 @@ -471,53 +452,61 @@ Libraries: %4 qt-%5 (%6) openssl-%7 - SwissBrowser -Version: %1 -Builddate: %2 -Libraries: -%3 -%4 -qt-%5 (%6) -openssl-%7 - + %1 - + + Info: %1 + + + + + done. + + + + + %1 + statusbar for hovered link %1=url + + + + launching application ... - + errors show error log - + background-color: #F77 invalid url - + background-color: white valid url - + authentication required - + ssl error @@ -630,129 +619,129 @@ openssl-%7 DownloadManager - + Network connection successful, remote host can be reached. - + The remote server refused the connection (the server is not accepting requests). - + The remote server closed the connection prematurely, before the entire reply was received and processed. - + The remote host name was not found (invalid hostname). - + The connection to the remote server timed out. - + The operation was canceled via calls to abort() or close() before it was finished. - + The SSL/TLS handshake failed and the encrypted channel could not be established. See SSL-Errors above. The SSL/TLS handshake failed and the encrypted channel could not be established. The sslErrors() signal should have been emitted. - + The connection to the proxy server was refused (the proxy server is not accepting requests). - + The proxy server closed the connection prematurely, before the entire reply was received and processed. - + The proxy host name was not found (invalid proxy hostname). - + The connection to the proxy timed out or the proxy did not reply in time to the request sent. - + The proxy requires authentication in order to honour the request but did not accept any credentials offered (if any). - + The access to the remote content was denied (similar to HTTP error 401). - + The operation requested on the remote content is not permitted. - + The remote content was not found at the server (similar to HTTP error 404). - + The remote server requires authentication to serve the content but the credentials provided were not accepted (if any). - + The Network Access API cannot honor the request because the protocol is not known. - + The requested operation is invalid for this protocol. - + An unknown network-related error was detected. - + An unknown proxy-related error was detected. - + An unknonwn error related to the remote content was detected. - + A breakdown in protocol was detected (parsing error, invalid or unexpected responses, etc.). - + <strong>Unknown network error (code: %1).</string> - + <h1>Network Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl> <h1>Network Error</h2><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl> - + <h1>SSL Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl><table><caption>Certificate Issuer</caption><tr><th>Organization:</th><td>%4</td></tr><tr><th>Common Name:</th><td>%5</td></tr><tr><th>Location:</th><td>%6</td></tr><tr><th>Organizational Unit:</th><td>%7</td></tr><tr><th>Country:</th><td>%8</td></tr><tr><th>State or Provive:</th><td>%9</td></tr></table><table><caption>Certificate Subject</caption><tr><th>Organization:</th><td>%10</td></tr><tr><th>Common Name:</th><td>%11</td></tr><tr><th>Location:</th><td>%12</td></tr><tr><th>Organizational Unit:</th><td>%13</td></tr><tr><th>Country:</th><td>%14</td></tr><tr><th>State or Provive:</th><td>%15</td></tr></table> <h1>SSL Error</h2><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl><table><caption>Certificate Issuer</caption><tr><th>Organization:</th><td>%4</td></tr><tr><th>Common Name:</th><td>%5</td></tr><tr><th>Location:</th><td>%6</td></tr><tr><th>Organizational Unit:</th><td>%7</td></tr><tr><th>Country:</th><td>%8</td></tr><tr><th>State or Provive:</th><td>%9</td></tr></table><table><caption>Certificate Subject</caption><tr><th>Organization:</th><td>%10</td></tr><tr><th>Common Name:</th><td>%11</td></tr><tr><th>Location:</th><td>%12</td></tr><tr><th>Organizational Unit:</th><td>%13</td></tr><tr><th>Country:</th><td>%14</td></tr><tr><th>State or Provive:</th><td>%15</td></tr></table> diff --git a/src/swissbrowser_it.ts b/src/swissbrowser_it.ts index d42f20a..eb48237 100644 --- a/src/swissbrowser_it.ts +++ b/src/swissbrowser_it.ts @@ -190,7 +190,7 @@ - + New Tab @@ -330,116 +330,116 @@ - + background-color: white search engines combobox - + SSL Not Supported - + SSL is not supported on your system - + Checking: %1 - + Forbidden: %1 - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + Reading: %1 - + Illegal URL: %1 - + gg - + http://www.google.com/search?hl=%2&q=%1 - + Zoom: %1% - + opening new window - + Print Document - + %1 - %2 statusbar actionBack_hovered %1=url %2=title - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - - + + background-color: white neutral find - - + + background-color: #ADA text found - - + + background-color: #F77 text not found - + About - + %8 Version: %1 Builddate: %2 @@ -451,58 +451,58 @@ openssl-%7 - + %1 - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + launching application ... - + errors show error log - + background-color: #F77 invalid url - + background-color: white valid url - + authentication required - + ssl error @@ -615,127 +615,127 @@ openssl-%7 DownloadManager - + Network connection successful, remote host can be reached. - + The remote server refused the connection (the server is not accepting requests). - + The remote server closed the connection prematurely, before the entire reply was received and processed. - + The remote host name was not found (invalid hostname). - + The connection to the remote server timed out. - + The operation was canceled via calls to abort() or close() before it was finished. - + The SSL/TLS handshake failed and the encrypted channel could not be established. See SSL-Errors above. - + The connection to the proxy server was refused (the proxy server is not accepting requests). - + The proxy server closed the connection prematurely, before the entire reply was received and processed. - + The proxy host name was not found (invalid proxy hostname). - + The connection to the proxy timed out or the proxy did not reply in time to the request sent. - + The proxy requires authentication in order to honour the request but did not accept any credentials offered (if any). - + The access to the remote content was denied (similar to HTTP error 401). - + The operation requested on the remote content is not permitted. - + The remote content was not found at the server (similar to HTTP error 404). - + The remote server requires authentication to serve the content but the credentials provided were not accepted (if any). - + The Network Access API cannot honor the request because the protocol is not known. - + The requested operation is invalid for this protocol. - + An unknown network-related error was detected. - + An unknown proxy-related error was detected. - + An unknonwn error related to the remote content was detected. - + A breakdown in protocol was detected (parsing error, invalid or unexpected responses, etc.). - + <strong>Unknown network error (code: %1).</string> - + <h1>Network Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl> - + <h1>SSL Error</h1><dl><dt>URL:</dt><dd>%1</dd><dt>Error Code:</dt><dd>%3</dd><dt>Error Details:</dt><dd>%2</dd></dl><table><caption>Certificate Issuer</caption><tr><th>Organization:</th><td>%4</td></tr><tr><th>Common Name:</th><td>%5</td></tr><tr><th>Location:</th><td>%6</td></tr><tr><th>Organizational Unit:</th><td>%7</td></tr><tr><th>Country:</th><td>%8</td></tr><tr><th>State or Provive:</th><td>%9</td></tr></table><table><caption>Certificate Subject</caption><tr><th>Organization:</th><td>%10</td></tr><tr><th>Common Name:</th><td>%11</td></tr><tr><th>Location:</th><td>%12</td></tr><tr><th>Organizational Unit:</th><td>%13</td></tr><tr><th>Country:</th><td>%14</td></tr><tr><th>State or Provive:</th><td>%15</td></tr></table> diff --git a/src/webpage.cxx b/src/webpage.cxx deleted file mode 100644 index bea9427..0000000 --- a/src/webpage.cxx +++ /dev/null @@ -1,20 +0,0 @@ -/*! @file - - @id $Id$ -*/ -// 1 2 3 4 5 6 7 8 -// 45678901234567890123456789012345678901234567890123456789012345678901234567890 - -#include -#include - -QWebPage* WebPage::createWindow(WebWindowType type) { - switch (type) { - case QWebPage::WebBrowserWindow: - case QWebPage::WebModalDialog: { - return _browser->newTab()->page(); - } break; - } - return 0; -} - diff --git a/src/webpage.hxx b/src/webpage.hxx index d503ef8..59f4e93 100644 --- a/src/webpage.hxx +++ b/src/webpage.hxx @@ -16,13 +16,24 @@ #define LOG qDebug()<<__PRETTY_FUNCTION__ #endif -class Browser; - class WebPage: public QWebPage { + Q_OBJECT; + signals: + void newPage(WebPage*); public: - WebPage(Browser* b, QObject *parent = 0): QWebPage(parent), _browser(b) {} + WebPage(QObject *parent = 0): QWebPage(parent) {} protected: - virtual QWebPage* createWindow(WebWindowType type); + virtual QWebPage* createWindow(WebWindowType type) { + switch (type) { + case QWebPage::WebBrowserWindow: + case QWebPage::WebModalDialog: { + WebPage *page(new WebPage); + newPage(page); + return page; + } break; + } + return 0; + } virtual QString userAgentForUrl(const QUrl& url) const { QString add(QProcessEnvironment::systemEnvironment() .value("SWISSSURFER_USERAGENT")); @@ -37,8 +48,6 @@ class WebPage: public QWebPage { <<"paramValues:"< +#include +#include +#include + +#include + +#include + +class WebView: public QWebView { + Q_OBJECT; + signals: + void newView(WebView*); + public: + WebView(WebPage* webpage) { + x(webpage); //! @bugfix, gcc does not yet support constructor calling + } + WebView(QWidget *parent=0): QWebView(parent) { + x(new WebPage); //! @bugfix, gcc does not yet support constructor calling + } + private: + //! @bugfix, gcc does not yet support constructor calling + /*! @see http://en.wikipedia.org/wiki/C++11#Object_construction_improvement + */ + void x(WebPage* webpage) { + webpage->setParent(this); + setPage(webpage); + page()->setPluginFactory(new PluginFactory); + page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); + page()->setForwardUnsupportedContent(true); + assert(connect(page(), SIGNAL(newPage(WebPage*)), + SLOT(newPage(WebPage*)))); + } + private slots: + void newPage(WebPage* p) { + newView(new WebView(p)); + } +}; + +#endif