From 94fe11262a32e9312c8f7fbee1a8d347d3f37605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Wed, 27 Apr 2011 11:30:29 +0000 Subject: [PATCH] added server certificate SWISSSIGN_SERVER_GOLD_CA_2008_G2; allow reject of authentication; added meaningful about dialog; added history menu; refs #22 --- swisssurfer/configure.in | 4 +- swisssurfer/src/authentication.hxx | 5 ++ swisssurfer/src/browser.hxx | 35 ++++++--- swisssurfer/src/browser.ui | 6 ++ swisssurfer/src/main.cxx | 39 +++++++++++ swisssurfer/src/qmake.pro.in | 3 + swisssurfer/src/swisssurfer_de.ts | 109 +++++++++++++++++------------ swisssurfer/src/swisssurfer_en.ts | 109 +++++++++++++++++------------ swisssurfer/src/swisssurfer_fr.ts | 109 +++++++++++++++++------------ swisssurfer/src/swisssurfer_it.ts | 109 +++++++++++++++++------------ 10 files changed, 339 insertions(+), 189 deletions(-) diff --git a/swisssurfer/configure.in b/swisssurfer/configure.in index eaa98de..5e869c4 100644 --- a/swisssurfer/configure.in +++ b/swisssurfer/configure.in @@ -6,11 +6,12 @@ DOC_DIR=doc m4_define(x_packagename, swisssurfer) m4_define(x_major, 1) -m4_define(x_minor, 0) +m4_define(x_minor, 1) PACKAGENAME=x_packagename MAJOR=x_major MINOR=x_minor +BUILDDATE=$(date "+%d.%m.%Y") LEAST="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout" for path in . .. ../..; do @@ -30,6 +31,7 @@ AC_CONFIG_FILES(makefile AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(LEAST) +AC_SUBST(BUILDDATE) # libtool versioning LIB_MAJOR=m4_eval(x_major+x_minor) diff --git a/swisssurfer/src/authentication.hxx b/swisssurfer/src/authentication.hxx index 6d1eef4..19be8a0 100644 --- a/swisssurfer/src/authentication.hxx +++ b/swisssurfer/src/authentication.hxx @@ -28,6 +28,11 @@ class Authentication: public QDialog, protected Ui::Authentication { _auth->setPassword(_password->text()); QDialog::accept(); } + virtual void reject() { + _auth->setUser(QString()); + _auth->setPassword(QString()); + QDialog::reject(); + } private: QAuthenticator* _auth; }; diff --git a/swisssurfer/src/browser.hxx b/swisssurfer/src/browser.hxx index bc043f3..57fe480 100644 --- a/swisssurfer/src/browser.hxx +++ b/swisssurfer/src/browser.hxx @@ -449,6 +449,10 @@ class Browser: public QMainWindow, protected Ui::Browser { statusBar()->showMessage(tr("Zoom: %1%").arg(100.0*i/10.0)); qobject_cast(_tabs->currentWidget())->setZoomFactor(i/10.0); } + + void loadFromHistory() { + load(qobject_cast(sender())->data().toString()); + } void on_actionHome_activated() { LOG; @@ -597,7 +601,16 @@ class Browser: public QMainWindow, protected Ui::Browser { } void on_actionAbout_triggered() { - QMessageBox::aboutQt(this); + QMessageBox::about(this, tr("About"), + tr("SwissSurfer %1 (%2)\n\n" + "%3\n" + "Using: qt-%4\n" + "Compiled: qt-%5") + .arg(VERSION) + .arg(BUILDDATE) + .arg(QString::fromStdString(pcsc::version())) + .arg(qVersion()) + .arg(QT_VERSION_STR)); } void on_actionSettings_triggered() { @@ -1073,10 +1086,10 @@ class Browser: public QMainWindow, protected Ui::Browser { void authenticationRequired(QNetworkReply* reply, QAuthenticator* authenticator) { - LOG; + LOG<url().toString()<realm(); statusBar()->showMessage(tr("authentication required")); Authentication auth(authenticator, this); - auth.exec(); + if (auth.exec()==QDialog::Rejected) reply->abort(); } void proxyAuthenticationRequired(const QNetworkProxy& proxy, @@ -1139,10 +1152,17 @@ class Browser: public QMainWindow, protected Ui::Browser { void activateTab() { iconChanged(); - actionForward->setEnabled(dynamic_cast(_tabs->currentWidget()) - ->history()->canGoForward()); - actionBack->setEnabled(dynamic_cast(_tabs->currentWidget()) - ->history()->canGoBack()); + QWebHistory* history(dynamic_cast(_tabs->currentWidget()) + ->history()); + actionForward->setEnabled(history->canGoForward()); + actionBack->setEnabled(history->canGoBack()); + _history->clear(); + QList items(history->items()); + for (int i = 0; i < items.size(); ++i) { + QAction* a(_history->addAction(items[i].title())); + a->setData(items[i].url()); + connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory())); + } } private: @@ -1164,7 +1184,6 @@ class Browser: public QMainWindow, protected Ui::Browser { DownloadProcesses _downloadProcesses; Settings _settings; SmartCardAuth _scAuth; - }; #endif diff --git a/swisssurfer/src/browser.ui b/swisssurfer/src/browser.ui index 871db85..eef098c 100644 --- a/swisssurfer/src/browser.ui +++ b/swisssurfer/src/browser.ui @@ -94,6 +94,11 @@ + + + History + + Info @@ -102,6 +107,7 @@ + diff --git a/swisssurfer/src/main.cxx b/swisssurfer/src/main.cxx index f1101a5..e7838d8 100644 --- a/swisssurfer/src/main.cxx +++ b/swisssurfer/src/main.cxx @@ -26,6 +26,44 @@ #include +const QByteArray SWISSSIGN_SERVER_GOLD_CA_2008_G2 + ("-----BEGIN CERTIFICATE-----\n" + "MIIGXjCCBEagAwIBAgIIXsz6acAzJ+8wDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UE\n" + "BhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEfMB0GA1UEAxMWU3dpc3NTaWdu\n" + "IEdvbGQgQ0EgLSBHMjAeFw0wODA3MDcxNzA2MDNaFw0yMzA3MDcxNzA2MDNaMFEx\n" + "CzAJBgNVBAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxKzApBgNVBAMTIlN3\n" + "aXNzU2lnbiBTZXJ2ZXIgR29sZCBDQSAyMDA4IC0gRzIwggEiMA0GCSqGSIb3DQEB\n" + "AQUAA4IBDwAwggEKAoIBAQDNMradteMVxVvR6t+pOooZejP8r1lY85el0PB7C118\n" + "iKYv1Apfq3mZ0wt7ZdpCyd2DzKE338Ki04Qn9IidLCkKDLOSNtlQlw4Yvg12W2bU\n" + "/WVaVAeUN0Tn3VeCkdWbSRIbvTGU63X9dp5lbgEm8XyjpLAK3SKABn7dWivfWuBo\n" + "oUCy64hJ+fSWljJmqG772Qmc9p3GxfN7/L227JH4S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r4qmBwIKM33x8J\n" + "U3xjHQ/ynptuwkI5sqQsUcfuHe6uipqA3lIJoBM8u6M65jg/tZTsLoExFE+DtOf5\n" + "pHDvUXMFwhsjv9AbkhL6X1LBZAZEMkOpnuRdR2FD0wy1Kh4Hbel9LwmmaYJdfH5a\n" + "tkKVlHsN0b6stJ6zEX0dIgi/7M4FYaAZgoxBS1OijPxFCSl0sFT6UYf0GYXcr6M+\n" + "URLc1NBofDHo/lIrTygFNfk7PIvOrBoREiOqNtE5RnuGyJa+tt2y2P3QyGBE6Ppi\n" + "e/VCCMJagmH8yel0WhuyDUJE35bpNEL34w+pJKr7ApQ1sT0yh607jGEbl53Y+vFC\n" + "Uuwo39MMqzx26notCbj0izccf+nDuW05jFQWmRc6OCI2L9Yw34r+1PQTmQe1TKx6\n" + "FqnW3WP66ZwbXfGXwwfqmjcK+42695kQYSLsDfNaxxkCBTkt+MauYgXWiOfzAnYz\n" + "R2nMQ/LHTDsTpTMkJ+eA/bHcrUJVkBHNWDiolD5C03oSFY0fPRlSnfXHRpgcOkq8\n" + "yI/OYArKo4tvQpAYPnG7ELI/j2grgRx6xutuVMYVmzhr/JnqFto5Eg32hKjA5H5+\n" + "c4Ssw1ZaGGMMb9aMFlnJi4SYoXB8MfL+SU/u1K54dM1mV/oFK6e2dtGgaYDdV86v\n" + "0qo=\n" + "-----END CERTIFICATE-----"); const QByteArray SWISSSIGN_GOLD_CA_G2 ("-----BEGIN CERTIFICATE-----\n" "MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJ\n" @@ -148,6 +186,7 @@ int main(int argv, char** argc) try { QSslConfiguration sslConfig(QSslConfiguration::defaultConfiguration()); QList certs(sslConfig.caCertificates()); certs.push_back(QSslCertificate(SWISSSIGN_GOLD_CA_G2)); + certs.push_back(QSslCertificate(SWISSSIGN_SERVER_GOLD_CA_2008_G2)); certs.push_back(QSslCertificate(SWISSSIGN_SILVER_CA_G2)); certs.push_back(QSslCertificate(SWISSSIGN_PLATINUM_CA_G2)); sslConfig.setCaCertificates(certs); diff --git a/swisssurfer/src/qmake.pro.in b/swisssurfer/src/qmake.pro.in index 62ff407..d82f3ea 100644 --- a/swisssurfer/src/qmake.pro.in +++ b/swisssurfer/src/qmake.pro.in @@ -33,3 +33,6 @@ TARGET = @PACKAGENAME@ CODECFORSRC = UTF-8 CODECFORTR = UTF-8 + +DEFINES += VERSION=\'\"@VERSION@\"\' BUILDDATE=\'\"@BUILDDATE@\"\' +QMAKE_CXXFLAGS += -include iostream -D\"CRYPTOKI_LOG(X)=std::clog<<\\\"CRYPTOKI_\\\"< - + Info - + + History + + + + neu laden - + F5 - + stoppen - + zurückkehren - + weitergehen - + Startseite - + Ctrl+Home - + &New Browser - + New Browser Window - + Ctrl+N - + &Close - + &Proxy... - + Ctrl+P - + Next Tab - + Shift+Right - + Previous Tab - + Shift+Left - + New Tab - + Add New Tab - + Ctrl+T - + Find - + Close Find - + &About - + &Settings ... - + &Reverse Find - + Ctrl+R - - + + Esc - + find in page - + Ctrl+F - + Print ... - + Quick &Print &Print - + Print Pre&view ... @@ -243,34 +248,34 @@ - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + page load error. - + %1 statusbar for hovered link %1=url @@ -291,28 +296,42 @@ - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + + About + + + + + Certificate Assistant %1 (%2) + +%3 +Using: qt-%4 +Compiled: qt-%5 + + + + %1 - + Save File As ... - + authentication required - + ssl error diff --git a/swisssurfer/src/swisssurfer_en.ts b/swisssurfer/src/swisssurfer_en.ts index 155c90c..46706da 100644 --- a/swisssurfer/src/swisssurfer_en.ts +++ b/swisssurfer/src/swisssurfer_en.ts @@ -54,169 +54,174 @@ - + Info - + + History + + + + neu laden - + F5 - + stoppen - + zurückkehren - + weitergehen - + Startseite - + Ctrl+Home - + &New Browser - + New Browser Window - + Ctrl+N - + &Close - + &Proxy... - + Ctrl+P - + Next Tab - + Shift+Right - + Previous Tab - + Shift+Left - + New Tab - + Add New Tab - + Ctrl+T - + Find - + Close Find - + &About - + &Settings ... - + &Reverse Find - + Ctrl+R - - + + Esc - + find in page - + Ctrl+F - + Print ... - + Quick &Print &Print - + Print Pre&view ... @@ -243,34 +248,34 @@ - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + page load error. - + %1 statusbar for hovered link %1=url @@ -291,28 +296,42 @@ - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + + About + + + + + Certificate Assistant %1 (%2) + +%3 +Using: qt-%4 +Compiled: qt-%5 + + + + %1 - + Save File As ... - + authentication required - + ssl error diff --git a/swisssurfer/src/swisssurfer_fr.ts b/swisssurfer/src/swisssurfer_fr.ts index 155c90c..46706da 100644 --- a/swisssurfer/src/swisssurfer_fr.ts +++ b/swisssurfer/src/swisssurfer_fr.ts @@ -54,169 +54,174 @@ - + Info - + + History + + + + neu laden - + F5 - + stoppen - + zurückkehren - + weitergehen - + Startseite - + Ctrl+Home - + &New Browser - + New Browser Window - + Ctrl+N - + &Close - + &Proxy... - + Ctrl+P - + Next Tab - + Shift+Right - + Previous Tab - + Shift+Left - + New Tab - + Add New Tab - + Ctrl+T - + Find - + Close Find - + &About - + &Settings ... - + &Reverse Find - + Ctrl+R - - + + Esc - + find in page - + Ctrl+F - + Print ... - + Quick &Print &Print - + Print Pre&view ... @@ -243,34 +248,34 @@ - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + page load error. - + %1 statusbar for hovered link %1=url @@ -291,28 +296,42 @@ - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + + About + + + + + Certificate Assistant %1 (%2) + +%3 +Using: qt-%4 +Compiled: qt-%5 + + + + %1 - + Save File As ... - + authentication required - + ssl error diff --git a/swisssurfer/src/swisssurfer_it.ts b/swisssurfer/src/swisssurfer_it.ts index 155c90c..46706da 100644 --- a/swisssurfer/src/swisssurfer_it.ts +++ b/swisssurfer/src/swisssurfer_it.ts @@ -54,169 +54,174 @@ - + Info - + + History + + + + neu laden - + F5 - + stoppen - + zurückkehren - + weitergehen - + Startseite - + Ctrl+Home - + &New Browser - + New Browser Window - + Ctrl+N - + &Close - + &Proxy... - + Ctrl+P - + Next Tab - + Shift+Right - + Previous Tab - + Shift+Left - + New Tab - + Add New Tab - + Ctrl+T - + Find - + Close Find - + &About - + &Settings ... - + &Reverse Find - + Ctrl+R - - + + Esc - + find in page - + Ctrl+F - + Print ... - + Quick &Print &Print - + Print Pre&view ... @@ -243,34 +248,34 @@ - + Print Document - + %1 - %2 Back to %1 - %2 statusbar actionBack_hovered %1=url %2=title - + Info: %1 - + done. - + page load error. - + %1 statusbar for hovered link %1=url @@ -291,28 +296,42 @@ - + %1 - %2 statusbar actionForward_hovered %1=url %2=title - + + About + + + + + Certificate Assistant %1 (%2) + +%3 +Using: qt-%4 +Compiled: qt-%5 + + + + %1 - + Save File As ... - + authentication required - + ssl error