diff --git a/swisssurfer/src/authentication.hxx b/swisssurfer/src/authentication.hxx new file mode 100644 index 0000000..6d1eef4 --- /dev/null +++ b/swisssurfer/src/authentication.hxx @@ -0,0 +1,35 @@ +/*! @file + + @id $Id$ +*/ +// 1 2 3 4 5 6 7 8 +// 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +#ifndef __AUTHENTICATION_HXX__ +#define __AUTHENTICATION_HXX__ + +#include +#include +#include + +class Authentication: public QDialog, protected Ui::Authentication { + Q_OBJECT; + public: + Authentication(QAuthenticator* auth, QWidget* p=0): + QDialog(p), _auth(auth) { + setupUi(this); + _realm->setText(_auth->realm()); + _user->setText(_auth->user()); + _password->setText(_auth->password()); + } + public Q_SLOTS: + virtual void accept() { + _auth->setUser(_user->text()); + _auth->setPassword(_password->text()); + QDialog::accept(); + } + private: + QAuthenticator* _auth; +}; + +#endif diff --git a/swisssurfer/src/authentication.ui b/swisssurfer/src/authentication.ui new file mode 100644 index 0000000..d08ddfa --- /dev/null +++ b/swisssurfer/src/authentication.ui @@ -0,0 +1,132 @@ + + + Authentication + + + + 0 + 0 + 277 + 172 + + + + Authorization + + + + + + + + Authentication required for: + + + false + + + + + + + realm + + + false + + + + + + + + + + + Username: + + + + + + + + + + Password: + + + + + + + QLineEdit::Password + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + true + + + + + + + + + buttonBox + accepted() + Authentication + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Authentication + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/swisssurfer/src/browser.hxx b/swisssurfer/src/browser.hxx index 70d37b3..a734a40 100644 --- a/swisssurfer/src/browser.hxx +++ b/swisssurfer/src/browser.hxx @@ -32,6 +32,8 @@ #include #include +#include +#include #include #include @@ -201,751 +203,9 @@ class Browser: public QMainWindow, protected Ui::Browser { return true; } - protected: - - void closeEvent(QCloseEvent *event) { - LOG; - if (!_kiosk && _settings.flag("SaveWindowState") && _settings()) - saveWin(); - QMainWindow::closeEvent(event); - } - - private Q_SLOTS: - - void load() { - LOG; - load(_url->currentText()); - } - - 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 addBookmark() { - _url->addItem(_url->currentText()); - } - - void zoom(int i) { - LOG<<100.0*i/10.0; - statusBar()->showMessage(tr("Zoom: %1%").arg(100.0*i/10.0)); - qobject_cast(_tabs->currentWidget())->setZoomFactor(i/10.0); - } - - void on_actionHome_activated() { - LOG; - load(_home); - } - - void on_actionNew_triggered() { - LOG; - QStringList args(QCoreApplication::arguments()); - QString prg(args.takeFirst()); - QProcess::startDetached(prg, args); - } - - void on_actionNewTab_triggered() { - newTab(); - } - - void on__tabs_currentChanged(int index) { - _url->setEditText(qobject_cast(_tabs->currentWidget()) - ->url().toString()); - activateTab(); - } - - void on__tabs_tabCloseRequested(int index) { - _error.erase(_tabs->widget(index)); - _errorUrl.erase(_tabs->widget(index)); - _tabs->removeTab(index); - _tabs->setTabsClosable(_tabs->count()>1); - } - - void on_actionPrintPreview_triggered() { - QPrintPreviewDialog preview(&_printer, this); - connect(&preview, SIGNAL(paintRequested(QPrinter*)), - qobject_cast(_tabs->currentWidget()), - SLOT(print(QPrinter*))); - preview.exec(); - } - - void on_actionInstantPrint_triggered() { - qobject_cast(_tabs->currentWidget())->print(&_printer); - } - - void on_actionPrint_triggered() { - QPrintDialog dialog(&_printer, this); - dialog.setWindowTitle(tr("Print Document")); - if (dialog.exec()!=QDialog::Accepted) return; - on_actionInstantPrint_triggered(); - } - - void on_actionClose_triggered() { - LOG; - close(); - } - - void on_actionBack_triggered() { - LOG; - qobject_cast(_tabs->currentWidget())->history()->back(); - } - - void on_actionBack_hovered() { - LOG; - if (!qobject_cast(_tabs->currentWidget())->history() - ->backItem().isValid()) - return; - actionBack->setStatusTip - (tr("%1 - %2", "statusbar actionBack_hovered %1=url %2=title") - .arg(qobject_cast(_tabs->currentWidget())->history() - ->backItem().url().toString()) - .arg(qobject_cast(_tabs->currentWidget())->history() - ->backItem().title())); - actionBack->showStatusText(this); - } - - void on_actionForward_triggered() { - LOG; - qobject_cast(_tabs->currentWidget())->history()->forward(); - } - - void on_actionForward_hovered() { - LOG; - if (!qobject_cast(_tabs->currentWidget())->history() - ->forwardItem().isValid()) - return; - actionForward->setStatusTip - (tr("%1 - %2", "statusbar actionForward_hovered %1=url %2=title") - .arg(qobject_cast(_tabs->currentWidget())->history() - ->forwardItem().url().toString()) - .arg(qobject_cast(_tabs->currentWidget())->history() - ->forwardItem().title())); - actionForward->showStatusText(this); - } - - void on_actionReload_triggered() { - LOG; - qobject_cast(_tabs->currentWidget())->reload(); - } - - void on_actionStop_triggered() { - LOG; - for (int i(0); i<_tabs->count(); ++i) - qobject_cast(_tabs->widget(i))->stop(); - _downloadManager.abort(); - } - - void on_actionFind_triggered() { - if (!_find) { - statusBar()->addPermanentWidget(_find = new QLineEdit); - _find->setText(qobject_cast(_tabs->currentWidget()) - ->selectedText()); - } - disconnect(_find, SIGNAL(returnPressed()), this, SLOT(rfind())); - disconnect(_find, SIGNAL(textEdited(QString)), this, SLOT(rfind())); - assert(connect(_find, SIGNAL(returnPressed()), SLOT(find()))); - assert(connect(_find, SIGNAL(textEdited(QString)), SLOT(find()))); - _find->setFocus(); - } - - void on_actionReverseFind_triggered() { - if (!_find) { - statusBar()->addPermanentWidget(_find = new QLineEdit); - _find->setText(qobject_cast(_tabs->currentWidget()) - ->selectedText()); - } - disconnect(_find, SIGNAL(returnPressed()), this, SLOT(find())); - disconnect(_find, SIGNAL(textEdited(QString)), this, SLOT(find())); - assert(connect(_find, SIGNAL(returnPressed()), SLOT(rfind()))); - assert(connect(_find, SIGNAL(textEdited(QString)), SLOT(rfind()))); - _find->setFocus(); - } - - void find(const QString& txt=QString()) { - qobject_cast(_tabs->currentWidget())->findText - (_find->text(), - QWebPage::FindWrapsAroundDocument); - } - - void rfind(const QString& txt=QString()) { - qobject_cast(_tabs->currentWidget())->findText - (_find->text(), - QWebPage::FindWrapsAroundDocument - |QWebPage::FindBackward); - } - - void on_actionUnFind_triggered() { - delete _find; _find=0; - } - - void on_actionAbout_triggered() { - QMessageBox::aboutQt(this); - } - - void on_actionSettings_triggered() { - _settings.show(); - } - - //@name QWebView slots - //@{ - - void urlChanged(const QUrl& url) { - LOG<currentWidget()) return; - LOG<<"signal on current tab"; - if (_url) _url->setEditText(url.toString()); - } - - void linkClicked(const QUrl& url) { - LOG<(sender())); - } - - void iconChanged() { - LOG; - QWebView* view(qobject_cast(sender())); - int index = _tabs->indexOf(view); - if (index<0) return; - QIcon icon(QWebSettings::iconForUrl(view->url())); - if (icon.isNull()) { - LOG<<"Icon for URL is Null"<url(); - QPixmap pixmap(QWebSettings::webGraphic - (QWebSettings::DefaultFrameIconGraphic)); - if (!pixmap.isNull()) icon = pixmap; - } else icon = icon.pixmap(16, 16); - if (icon.isNull()) LOG<<"Icon is still null"; - _tabs->setTabIcon(index, icon); - } - - void titleChanged(const QString& text) { - LOG<setTabText(_tabs->indexOf(qobject_cast(sender())), - trUtf8("%1").arg(text)); - } - - void statusBarMessage(const QString& text) { - LOG<showMessage(tr("Info: %1").arg(text)); - } - - void loadProgress(int i) { - LOG<showMessage(tr("done.")); - activateTab(); - } - - //@} - - //@name QWebPage WebAction slots - //@{ - - void triggeredOpenLink(bool) { - LOG; - } - - void triggeredOpenLinkInNewWindow(bool) { - LOG; - } - - void triggeredOpenFrameInNewWindow(bool) { - LOG; - } - - void triggeredDownloadLinkToDisk(bool) { - LOG; - } - - void triggeredCopyLinkToClipboard(bool) { - LOG; - } - - void triggeredOpenImageInNewWindow(bool) { - LOG; - } - - void triggeredDownloadImageToDisk(bool) { - LOG; - } - - void triggeredCopyImageToClipboard(bool) { - LOG; - } - - void triggeredBack(bool) { - LOG; - } - - void triggeredForward(bool) { - LOG; - } - - void triggeredStop(bool) { - LOG; - } - - void triggeredReload(bool) { - LOG; - } - - void triggeredCut(bool) { - LOG; - } - - void triggeredCopy(bool) { - LOG; - } - - void triggeredPaste(bool) { - LOG; - } - - void triggeredUndo(bool) { - LOG; - } - - void triggeredRedo(bool) { - LOG; - } - - void triggeredMoveToNextChar(bool) { - LOG; - } - - void triggeredMoveToPreviousChar(bool) { - LOG; - } - - void triggeredMoveToNextWord(bool) { - LOG; - } - - void triggeredMoveToPreviousWord(bool) { - LOG; - } - - void triggeredMoveToNextLine(bool) { - LOG; - } - - void triggeredMoveToPreviousLine(bool) { - LOG; - } - - void triggeredMoveToStartOfLine(bool) { - LOG; - } - - void triggeredMoveToEndOfLine(bool) { - LOG; - } - - void triggeredMoveToStartOfBlock(bool) { - LOG; - } - - void triggeredMoveToEndOfBlock(bool) { - LOG; - } - - void triggeredMoveToStartOfDocument(bool) { - LOG; - } - - void triggeredMoveToEndOfDocument(bool) { - LOG; - } - - void triggeredSelectNextChar(bool) { - LOG; - } - - void triggeredSelectPreviousChar(bool) { - LOG; - } - - void triggeredSelectNextWord(bool) { - LOG; - } - - void triggeredSelectPreviousWord(bool) { - LOG; - } - - void triggeredSelectNextLine(bool) { - LOG; - } - - void triggeredSelectPreviousLine(bool) { - LOG; - } - - void triggeredSelectStartOfLine(bool) { - LOG; - } - - void triggeredSelectEndOfLine(bool) { - LOG; - } - - void triggeredSelectStartOfBlock(bool) { - LOG; - } - - void triggeredSelectEndOfBlock(bool) { - LOG; - } - - void triggeredSelectStartOfDocument(bool) { - LOG; - } - - void triggeredSelectEndOfDocument(bool) { - LOG; - } - - void triggeredDeleteStartOfWord(bool) { - LOG; - } - - void triggeredDeleteEndOfWord(bool) { - LOG; - } - - void triggeredSetTextDirectionDefault(bool) { - LOG; - } - - void triggeredSetTextDirectionLeftToRight(bool) { - LOG; - } - - void triggeredSetTextDirectionRightToLeft(bool) { - LOG; - } - - void triggeredToggleBold(bool) { - LOG; - } - - void triggeredToggleItalic(bool) { - LOG; - } - - void triggeredToggleUnderline(bool) { - LOG; - } - - void triggeredInspectElement(bool) { - LOG; - } - - void triggeredInsertParagraphSeparator(bool) { - LOG; - } - - void triggeredInsertLineSeparator(bool) { - LOG; - } - - void triggeredSelectAll(bool) { - LOG; - } - - //@} - - //@name QWebPage slots - //@{ - - void contentsChanged() { - LOG; - } - - void databaseQuotaExceeded(QWebFrame* frame, QString databaseName) { - LOG<showMessage(tr("%1", "statusbar for hovered link %1=url") - .arg(link)); - } - -// void loadFinished(bool ok) { -// LOG<<(ok?"succeess":"error"); -// } - -// void loadProgress(int progress) { -// LOG<header(QNetworkRequest::ContentTypeHeader).toString(); - LOG<<"Status:"<error()); - assert(connect(reply, SIGNAL(finished()), SLOT(downloadFinished()))); - } - - void downloadFinished() { - QNetworkReply *reply(qobject_cast(sender())); - LOG<<"Location:"<header(QNetworkRequest::LocationHeader) - .toString(); - LOG<<"Content-Type:"<header(QNetworkRequest::ContentTypeHeader) - .toString(); - LOG<<"Status:"<error()); - LOG<<"URL:"<url().toString(); - LOG<<"File:"<url().toLocalFile(); - LOG<<"Path:"<url().path(); - Settings::MimeTypes::const_iterator it - (_settings.mimetypes().find - (reply->header(QNetworkRequest::ContentTypeHeader).toString())); - if (it!=_settings.mimetypes().end()) { - QTemporaryFile *file = - new QTemporaryFile(QDir::tempPath()+QDir::separator() - +"swisssurferXXXXXX." - +it.value().toStringList().at(0), this); - file->open(); - file->write(reply->readAll()); - file->close(); - QProcess* process(new QProcess); - _downloadProcesses[process] = file; - assert(connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), - SLOT(processFinished()))); - QStringList args(it.value().toStringList().at(1).split(" ") - .replaceInStrings("%1", file->fileName())); - QString prg(args.takeFirst()); - LOG<<"Running:"<start(prg, args); - } else { - QString saveFile - (QFileDialog::getSaveFileName(this, tr("Save File As ..."), - !reply->url().toLocalFile().isEmpty() - ?reply->url().toLocalFile() - :reply->url().path())); - if (!saveFile.isEmpty()) { - QFile file(saveFile); - file.open(QIODevice::WriteOnly); - file.write(reply->readAll()); - file.close(); - } - } - } - - void processFinished() { - delete _downloadProcesses[qobject_cast(sender())]; - _downloadProcesses.erase(qobject_cast(sender())); - } - - //@} - - void windowCloseRequested() { - LOG; - } - - //@} - - //@name DownloadManager signals - //@{ - - void progress(qint64 done, qint64 total) { - _progress->setMaximum(total); - _progress->setValue(done); - } - - void started() { - actionStop->setEnabled(true); - _progress->setRange(0, 0); - _progress->setValue(0); - _progress->show(); - } - - void finished() { - LOG; - actionStop->setEnabled(false); - _progress->hide(); - } - - //@} - - //@name QNetworkAccessManager signals - //@{ - - void authenticationRequired(QNetworkReply* reply, - QAuthenticator* authenticator) { - LOG; - statusBar()->showMessage(tr("authentication required")); -// _error[sender()] += tr("

%1

URL: %3

%2

") -// .arg(tr("Authentication Required")) -// .arg(networkError(reply->error())) -// .arg(reply->url().toString()); -// _errorUrl[sender()] = reply->url(); - } - - void proxyAuthenticationRequired(const QNetworkProxy& proxy, - QAuthenticator* authenticator) { - LOG; - } - - void sslErrors(QNetworkReply* reply, const QList& errors) { - LOG; - statusBar()->showMessage(tr("ssl error")); -// QString e; -// for (QList::const_iterator err(errors.begin()); -// err!=errors.end(); ++err) -// e+=tr("
  • %1
  • ", "single ssl error").arg(err->errorString()); -// _error[sender()] += tr("

    %1

    URL: %4

    %2

    " -// "

    SSL Errors

    " -// "

      %3

    ") -// .arg(tr("SSL Error")) -// .arg(networkError(reply->error())) -// .arg(e) -// .arg(reply->url().toString()); -// _errorUrl[sender()] = reply->url(); - } - - //@} - - private: - - void saveWin() { - LOG<<"Save Window State"; - QStringList urls; - for (int i(0); i<_url->count(); ++i) - urls<<_url->itemText(i); - _settings()->setValue("Window/Urls", urls); - QStringList tabs; - for (int i(0); i<_tabs->count(); ++i) - tabs<(_tabs->widget(i))->url().toString(); - _settings()->setValue("Window/Tabs", tabs); - _settings()->setValue("Window/CurrentTab", _tabs->currentIndex()); - _settings()->setValue("Window/Geometry", saveGeometry()); - _settings()->setValue("Window/WindowState", saveState()); - } - - void loadWin(bool noRrestoreTabs=true) { - QStringList urls(_settings()->value("Window/Urls").toStringList()); - urls.sort(); - urls.removeDuplicates(); - _url->addItems(urls); - QStringList tabs(_settings()->value("Window/Tabs").toStringList()); - if (!noRrestoreTabs) - for (QStringList::iterator it(tabs.begin()); it!=tabs.end(); ++it) - load(*it, newTab()); - if (_tabs->count()>1) _tabs->removeTab(0); - _tabs->setTabsClosable(_tabs->count()>1); - _tabs->setCurrentIndex(_settings()->value("Window/CurrentTab").toInt()); - restoreGeometry(_settings()->value("Window/Geometry").toByteArray()); - restoreState(_settings()->value("Window/WindowState").toByteArray()); - } - - void activateTab() { - iconChanged(); - actionForward->setEnabled(dynamic_cast(_tabs->currentWidget()) - ->history()->canGoForward()); - actionBack->setEnabled(dynamic_cast(_tabs->currentWidget()) - ->history()->canGoBack()); - } - QWebView* newTab() { QWebView* browser(new QWebView); + browser->setPage(new WebPage(this, browser)); browser->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); browser->page()->setNetworkAccessManager(&_networkManager); browser->page()->setForwardUnsupportedContent(true); @@ -1205,7 +465,747 @@ class Browser: public QMainWindow, protected Ui::Browser { SLOT(sslErrors(QNetworkReply*, const QList&)))); _tabs->setCurrentIndex(_tabs->addTab(browser, "*empty*")); _tabs->setTabsClosable(_tabs->count()>1); - return browser; + return browser; + } + + protected: + + void closeEvent(QCloseEvent *event) { + LOG; + if (!_kiosk && _settings.flag("SaveWindowState") && _settings()) + saveWin(); + QMainWindow::closeEvent(event); + } + + private Q_SLOTS: + + void load() { + LOG; + load(_url->currentText()); + } + + 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 addBookmark() { + _url->addItem(_url->currentText()); + } + + void zoom(int i) { + LOG<<100.0*i/10.0; + statusBar()->showMessage(tr("Zoom: %1%").arg(100.0*i/10.0)); + qobject_cast(_tabs->currentWidget())->setZoomFactor(i/10.0); + } + + void on_actionHome_activated() { + LOG; + load(_home); + } + + void on_actionNew_triggered() { + LOG; + QStringList args(QCoreApplication::arguments()); + QString prg(args.takeFirst()); + QProcess::startDetached(prg, args); + } + + void on_actionNewTab_triggered() { + newTab(); + } + + void on__tabs_currentChanged(int index) { + _url->setEditText(qobject_cast(_tabs->currentWidget()) + ->url().toString()); + activateTab(); + } + + void on__tabs_tabCloseRequested(int index) { + _error.erase(_tabs->widget(index)); + _errorUrl.erase(_tabs->widget(index)); + _tabs->removeTab(index); + _tabs->setTabsClosable(_tabs->count()>1); + } + + void on_actionPrintPreview_triggered() { + QPrintPreviewDialog preview(&_printer, this); + connect(&preview, SIGNAL(paintRequested(QPrinter*)), + qobject_cast(_tabs->currentWidget()), + SLOT(print(QPrinter*))); + preview.exec(); + } + + void on_actionInstantPrint_triggered() { + qobject_cast(_tabs->currentWidget())->print(&_printer); + } + + void on_actionPrint_triggered() { + QPrintDialog dialog(&_printer, this); + dialog.setWindowTitle(tr("Print Document")); + if (dialog.exec()!=QDialog::Accepted) return; + on_actionInstantPrint_triggered(); + } + + void on_actionClose_triggered() { + LOG; + close(); + } + + void on_actionBack_triggered() { + LOG; + qobject_cast(_tabs->currentWidget())->history()->back(); + } + + void on_actionBack_hovered() { + LOG; + if (!qobject_cast(_tabs->currentWidget())->history() + ->backItem().isValid()) + return; + actionBack->setStatusTip + (tr("%1 - %2", "statusbar actionBack_hovered %1=url %2=title") + .arg(qobject_cast(_tabs->currentWidget())->history() + ->backItem().url().toString()) + .arg(qobject_cast(_tabs->currentWidget())->history() + ->backItem().title())); + actionBack->showStatusText(this); + } + + void on_actionForward_triggered() { + LOG; + qobject_cast(_tabs->currentWidget())->history()->forward(); + } + + void on_actionForward_hovered() { + LOG; + if (!qobject_cast(_tabs->currentWidget())->history() + ->forwardItem().isValid()) + return; + actionForward->setStatusTip + (tr("%1 - %2", "statusbar actionForward_hovered %1=url %2=title") + .arg(qobject_cast(_tabs->currentWidget())->history() + ->forwardItem().url().toString()) + .arg(qobject_cast(_tabs->currentWidget())->history() + ->forwardItem().title())); + actionForward->showStatusText(this); + } + + void on_actionReload_triggered() { + LOG; + qobject_cast(_tabs->currentWidget())->reload(); + } + + void on_actionStop_triggered() { + LOG; + for (int i(0); i<_tabs->count(); ++i) + qobject_cast(_tabs->widget(i))->stop(); + _downloadManager.abort(); + } + + void on_actionFind_triggered() { + if (!_find) { + statusBar()->addPermanentWidget(_find = new QLineEdit); + _find->setText(qobject_cast(_tabs->currentWidget()) + ->selectedText()); + } + disconnect(_find, SIGNAL(returnPressed()), this, SLOT(rfind())); + disconnect(_find, SIGNAL(textEdited(QString)), this, SLOT(rfind())); + assert(connect(_find, SIGNAL(returnPressed()), SLOT(find()))); + assert(connect(_find, SIGNAL(textEdited(QString)), SLOT(find()))); + _find->setFocus(); + } + + void on_actionReverseFind_triggered() { + if (!_find) { + statusBar()->addPermanentWidget(_find = new QLineEdit); + _find->setText(qobject_cast(_tabs->currentWidget()) + ->selectedText()); + } + disconnect(_find, SIGNAL(returnPressed()), this, SLOT(find())); + disconnect(_find, SIGNAL(textEdited(QString)), this, SLOT(find())); + assert(connect(_find, SIGNAL(returnPressed()), SLOT(rfind()))); + assert(connect(_find, SIGNAL(textEdited(QString)), SLOT(rfind()))); + _find->setFocus(); + } + + void find(const QString& txt=QString()) { + qobject_cast(_tabs->currentWidget())->findText + (_find->text(), + QWebPage::FindWrapsAroundDocument); + } + + void rfind(const QString& txt=QString()) { + qobject_cast(_tabs->currentWidget())->findText + (_find->text(), + QWebPage::FindWrapsAroundDocument + |QWebPage::FindBackward); + } + + void on_actionUnFind_triggered() { + delete _find; _find=0; + } + + void on_actionAbout_triggered() { + QMessageBox::aboutQt(this); + } + + void on_actionSettings_triggered() { + _settings.show(); + } + + //@name QWebView slots + //@{ + + void urlChanged(const QUrl& url) { + LOG<currentWidget()) return; + LOG<<"signal on current tab"; + if (_url) _url->setEditText(url.toString()); + } + + void linkClicked(const QUrl& url) { + LOG<(sender())); + } + + void iconChanged() { + LOG; + QWebView* view(qobject_cast(sender())); + int index = _tabs->indexOf(view); + if (index<0) return; + QIcon icon(QWebSettings::iconForUrl(view->url())); + if (icon.isNull()) { + LOG<<"Icon for URL is Null"<url(); + QPixmap pixmap(QWebSettings::webGraphic + (QWebSettings::DefaultFrameIconGraphic)); + if (!pixmap.isNull()) icon = pixmap; + } else icon = icon.pixmap(16, 16); + if (icon.isNull()) LOG<<"Icon is still null"; + _tabs->setTabIcon(index, icon); + } + + void titleChanged(const QString& text) { + LOG<setTabText(_tabs->indexOf(qobject_cast(sender())), + trUtf8("%1").arg(text)); + } + + void statusBarMessage(const QString& text) { + LOG<showMessage(tr("Info: %1").arg(text)); + } + + void loadProgress(int i) { + LOG<showMessage(tr("done.")); + activateTab(); + } + + //@} + + //@name QWebPage WebAction slots + //@{ + + void triggeredOpenLink(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredOpenLinkInNewWindow(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredOpenFrameInNewWindow(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredDownloadLinkToDisk(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredCopyLinkToClipboard(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredOpenImageInNewWindow(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredDownloadImageToDisk(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredCopyImageToClipboard(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredBack(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredForward(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredStop(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredReload(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredCut(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredCopy(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredPaste(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredUndo(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredRedo(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToNextChar(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToPreviousChar(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToNextWord(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToPreviousWord(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToNextLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToPreviousLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToStartOfLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToEndOfLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToStartOfBlock(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToEndOfBlock(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToStartOfDocument(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredMoveToEndOfDocument(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectNextChar(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectPreviousChar(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectNextWord(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectPreviousWord(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectNextLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectPreviousLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectStartOfLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectEndOfLine(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectStartOfBlock(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectEndOfBlock(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectStartOfDocument(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectEndOfDocument(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredDeleteStartOfWord(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredDeleteEndOfWord(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSetTextDirectionDefault(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSetTextDirectionLeftToRight(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSetTextDirectionRightToLeft(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredToggleBold(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredToggleItalic(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredToggleUnderline(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredInspectElement(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredInsertParagraphSeparator(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredInsertLineSeparator(bool) { + LOG<(sender())->data().toString(); + } + + void triggeredSelectAll(bool) { + LOG<(sender())->data().toString(); + } + + //@} + + //@name QWebPage slots + //@{ + + void contentsChanged() { + LOG; + } + + void databaseQuotaExceeded(QWebFrame* frame, QString databaseName) { + LOG<showMessage(tr("%1", "statusbar for hovered link %1=url") + .arg(link)); + } + +// void loadFinished(bool ok) { +// LOG<<(ok?"succeess":"error"); +// } + +// void loadProgress(int progress) { +// LOG<header(QNetworkRequest::ContentTypeHeader).toString(); + LOG<<"Status:"<error()); + assert(connect(reply, SIGNAL(finished()), SLOT(downloadFinished()))); + } + + void downloadFinished() { + QNetworkReply *reply(qobject_cast(sender())); + LOG<<"Location:"<header(QNetworkRequest::LocationHeader) + .toString(); + LOG<<"Content-Type:"<header(QNetworkRequest::ContentTypeHeader) + .toString(); + LOG<<"Status:"<error()); + LOG<<"URL:"<url().toString(); + LOG<<"File:"<url().toLocalFile(); + LOG<<"Path:"<url().path(); + Settings::MimeTypes::const_iterator it + (_settings.mimetypes().find + (reply->header(QNetworkRequest::ContentTypeHeader).toString())); + if (it!=_settings.mimetypes().end()) { + QTemporaryFile *file = + new QTemporaryFile(QDir::tempPath()+QDir::separator() + +"swisssurferXXXXXX." + +it.value().toStringList().at(0), this); + file->open(); + file->write(reply->readAll()); + file->close(); + QProcess* process(new QProcess); + _downloadProcesses[process] = file; + assert(connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), + SLOT(processFinished()))); + QStringList args(it.value().toStringList().at(1).split(" ") + .replaceInStrings("%1", file->fileName())); + QString prg(args.takeFirst()); + LOG<<"Running:"<start(prg, args); + } else { + QString saveFile + (QFileDialog::getSaveFileName(this, tr("Save File As ..."), + !reply->url().toLocalFile().isEmpty() + ?reply->url().toLocalFile() + :reply->url().path())); + if (!saveFile.isEmpty()) { + QFile file(saveFile); + file.open(QIODevice::WriteOnly); + file.write(reply->readAll()); + file.close(); + } + } + } + + void processFinished() { + delete _downloadProcesses[qobject_cast(sender())]; + _downloadProcesses.erase(qobject_cast(sender())); + } + + //@} + + void windowCloseRequested() { + LOG; + } + + //@} + + //@name DownloadManager signals + //@{ + + void progress(qint64 done, qint64 total) { + _progress->setMaximum(total); + _progress->setValue(done); + } + + void started() { + actionStop->setEnabled(true); + _progress->setRange(0, 0); + _progress->setValue(0); + _progress->show(); + } + + void finished() { + LOG; + actionStop->setEnabled(false); + _progress->hide(); + } + + //@} + + //@name QNetworkAccessManager signals + //@{ + + void authenticationRequired(QNetworkReply* reply, + QAuthenticator* authenticator) { + LOG; + statusBar()->showMessage(tr("authentication required")); + Authentication auth(authenticator, this); + auth.exec(); + } + + void proxyAuthenticationRequired(const QNetworkProxy& proxy, + QAuthenticator* authenticator) { + LOG; + } + + void sslErrors(QNetworkReply* reply, const QList& errors) { + LOG; + statusBar()->showMessage(tr("ssl error")); +// QString e; +// for (QList::const_iterator err(errors.begin()); +// err!=errors.end(); ++err) +// e+=tr("

  • %1
  • ", "single ssl error").arg(err->errorString()); +// _error[sender()] += tr("

    %1

    URL: %4

    %2

    " +// "

    SSL Errors

    " +// "

      %3

    ") +// .arg(tr("SSL Error")) +// .arg(networkError(reply->error())) +// .arg(e) +// .arg(reply->url().toString()); +// _errorUrl[sender()] = reply->url(); + } + + //@} + + private: + + void saveWin() { + LOG<<"Save Window State"; + QStringList urls; + for (int i(0); i<_url->count(); ++i) + urls<<_url->itemText(i); + _settings()->setValue("Window/Urls", urls); + QStringList tabs; + for (int i(0); i<_tabs->count(); ++i) + tabs<(_tabs->widget(i))->url().toString(); + _settings()->setValue("Window/Tabs", tabs); + _settings()->setValue("Window/CurrentTab", _tabs->currentIndex()); + _settings()->setValue("Window/Geometry", saveGeometry()); + _settings()->setValue("Window/WindowState", saveState()); + } + + void loadWin(bool noRrestoreTabs=true) { + QStringList urls(_settings()->value("Window/Urls").toStringList()); + urls.sort(); + urls.removeDuplicates(); + _url->addItems(urls); + QStringList tabs(_settings()->value("Window/Tabs").toStringList()); + if (!noRrestoreTabs) + for (QStringList::iterator it(tabs.begin()); it!=tabs.end(); ++it) + load(*it, newTab()); + if (_tabs->count()>1) _tabs->removeTab(0); + _tabs->setTabsClosable(_tabs->count()>1); + _tabs->setCurrentIndex(_settings()->value("Window/CurrentTab").toInt()); + restoreGeometry(_settings()->value("Window/Geometry").toByteArray()); + restoreState(_settings()->value("Window/WindowState").toByteArray()); + } + + void activateTab() { + iconChanged(); + actionForward->setEnabled(dynamic_cast(_tabs->currentWidget()) + ->history()->canGoForward()); + actionBack->setEnabled(dynamic_cast(_tabs->currentWidget()) + ->history()->canGoBack()); } private: diff --git a/swisssurfer/src/qmake.pro.in b/swisssurfer/src/qmake.pro.in index 419839f..0b3c397 100644 --- a/swisssurfer/src/qmake.pro.in +++ b/swisssurfer/src/qmake.pro.in @@ -20,12 +20,13 @@ TRANSLATIONS = @PACKAGENAME@_en.ts \ @PACKAGENAME@_fr.ts \ @PACKAGENAME@_it.ts -SOURCES = main.cxx smartcardauth.cxx pindialog.cxx +SOURCES = main.cxx smartcardauth.cxx pindialog.cxx webpage.cxx HEADERS = browser.hxx smartcardauth.hxx pindialog.hxx \ - downloadmanager.hxx settings.hxx sslclientnetworkmanager.hxx + downloadmanager.hxx settings.hxx sslclientnetworkmanager.hxx \ + authentication.hxx webpage.hxx -FORMS = browser.ui settings.ui pinentry.ui +FORMS = browser.ui settings.ui pinentry.ui authentication.ui RESOURCES = languages.qrc resources.qrc diff --git a/swisssurfer/src/smartcardauth.cxx b/swisssurfer/src/smartcardauth.cxx index f395801..27d83b1 100644 --- a/swisssurfer/src/smartcardauth.cxx +++ b/swisssurfer/src/smartcardauth.cxx @@ -59,6 +59,7 @@ std::map sockets; int client_cert_cb(SSL* ssl, X509 **x509, EVP_PKEY **pkey) { if (!e) return 0; + while (!_mutex.tryLock()) QCoreApplication::processEvents(); static std::set allowedUrls; std::map::iterator it(sockets.find(ssl->ctx)); if (it!=sockets.end()) { @@ -76,7 +77,6 @@ int client_cert_cb(SSL* ssl, X509 **x509, EVP_PKEY **pkey) { sockets.erase(it); } - while (!_mutex.tryLock()) QCoreApplication::processEvents(); // NB: Keep in mind that this function is called for EVERY SSL connection to be opened. for(size_t i=certs_found->num_certs;i--;) diff --git a/swisssurfer/src/swisssurfer_de.ts b/swisssurfer/src/swisssurfer_de.ts index 12cba98..860797e 100644 --- a/swisssurfer/src/swisssurfer_de.ts +++ b/swisssurfer/src/swisssurfer_de.ts @@ -2,6 +2,34 @@ UTF-8 + + Authentication + + + Authorization + + + + + Authentication required for: + + + + + realm + + + + + Username: + + + + + Password: + + + Browser @@ -193,210 +221,210 @@ - + The connection to the proxy server was refused (the proxy server is not accepting requests). 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 Network Access API cannot honor the request because the protocol is not known - + Checking: %1 Opening: %1 - + Reading: %1 Reading: %1% - + Zoom: %1% - + 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. The sslErrors() signal should have been emitted. - + 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 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> - + Illegal URL: %1 - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + Forbidden: %1 - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + %1 - + Save File As ... - + authentication required - + ssl error @@ -505,12 +533,12 @@ Try: %1 --help - + Send Authentication? - + Do you want to authenticate yourself to %1? diff --git a/swisssurfer/src/swisssurfer_en.ts b/swisssurfer/src/swisssurfer_en.ts index 12cba98..860797e 100644 --- a/swisssurfer/src/swisssurfer_en.ts +++ b/swisssurfer/src/swisssurfer_en.ts @@ -2,6 +2,34 @@ UTF-8 + + Authentication + + + Authorization + + + + + Authentication required for: + + + + + realm + + + + + Username: + + + + + Password: + + + Browser @@ -193,210 +221,210 @@ - + The connection to the proxy server was refused (the proxy server is not accepting requests). 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 Network Access API cannot honor the request because the protocol is not known - + Checking: %1 Opening: %1 - + Reading: %1 Reading: %1% - + Zoom: %1% - + 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. The sslErrors() signal should have been emitted. - + 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 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> - + Illegal URL: %1 - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + Forbidden: %1 - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + %1 - + Save File As ... - + authentication required - + ssl error @@ -505,12 +533,12 @@ Try: %1 --help - + Send Authentication? - + Do you want to authenticate yourself to %1? diff --git a/swisssurfer/src/swisssurfer_fr.ts b/swisssurfer/src/swisssurfer_fr.ts index 12cba98..860797e 100644 --- a/swisssurfer/src/swisssurfer_fr.ts +++ b/swisssurfer/src/swisssurfer_fr.ts @@ -2,6 +2,34 @@ UTF-8 + + Authentication + + + Authorization + + + + + Authentication required for: + + + + + realm + + + + + Username: + + + + + Password: + + + Browser @@ -193,210 +221,210 @@ - + The connection to the proxy server was refused (the proxy server is not accepting requests). 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 Network Access API cannot honor the request because the protocol is not known - + Checking: %1 Opening: %1 - + Reading: %1 Reading: %1% - + Zoom: %1% - + 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. The sslErrors() signal should have been emitted. - + 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 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> - + Illegal URL: %1 - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + Forbidden: %1 - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + %1 - + Save File As ... - + authentication required - + ssl error @@ -505,12 +533,12 @@ Try: %1 --help - + Send Authentication? - + Do you want to authenticate yourself to %1? diff --git a/swisssurfer/src/swisssurfer_it.ts b/swisssurfer/src/swisssurfer_it.ts index 12cba98..860797e 100644 --- a/swisssurfer/src/swisssurfer_it.ts +++ b/swisssurfer/src/swisssurfer_it.ts @@ -2,6 +2,34 @@ UTF-8 + + Authentication + + + Authorization + + + + + Authentication required for: + + + + + realm + + + + + Username: + + + + + Password: + + + Browser @@ -193,210 +221,210 @@ - + The connection to the proxy server was refused (the proxy server is not accepting requests). 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 Network Access API cannot honor the request because the protocol is not known - + Checking: %1 Opening: %1 - + Reading: %1 Reading: %1% - + Zoom: %1% - + 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. The sslErrors() signal should have been emitted. - + 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 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> - + Illegal URL: %1 - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + Forbidden: %1 - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + %1 - + Save File As ... - + authentication required - + ssl error @@ -505,12 +533,12 @@ Try: %1 --help - + Send Authentication? - + Do you want to authenticate yourself to %1? diff --git a/swisssurfer/src/webpage.cxx b/swisssurfer/src/webpage.cxx new file mode 100644 index 0000000..bea9427 --- /dev/null +++ b/swisssurfer/src/webpage.cxx @@ -0,0 +1,20 @@ +/*! @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/swisssurfer/src/webpage.hxx b/swisssurfer/src/webpage.hxx new file mode 100644 index 0000000..2f7456b --- /dev/null +++ b/swisssurfer/src/webpage.hxx @@ -0,0 +1,24 @@ +/*! @file + + @id $Id$ +*/ +// 1 2 3 4 5 6 7 8 +// 45678901234567890123456789012345678901234567890123456789012345678901234567890 + +#ifndef __WEBPAGE_HXX__ +#define __WEBPAGE_HXX__ + +#include + +class Browser; + +class WebPage: public QWebPage { + public: + WebPage(Browser* b, QObject *parent = 0): QWebPage(parent), _browser(b) {} + protected: + QWebPage* createWindow(WebWindowType type); + private: + Browser* _browser; +}; + +#endif