diff --git a/swisssurfer/src/browser.hxx b/swisssurfer/src/browser.hxx index 1a461b7..ee5ac56 100644 --- a/swisssurfer/src/browser.hxx +++ b/swisssurfer/src/browser.hxx @@ -69,7 +69,8 @@ class Browser: public QMainWindow, protected Ui::Browser { _proxy("http://swisssign.com", this), _showErrorLog(0), _startUrl(urls.size()), - _quirks(quirks), _search(new ButtonLineEdit) { + _quirks(quirks), _search(new ButtonLineEdit), + _searchEngines(new QComboBox) { LOG<addWidget(_url); - _toolbar->addWidget(_search=new ButtonLineEdit); + QFrame* searchFrame(new QFrame); + searchFrame->setBackgroundRole(QPalette::Base); + searchFrame->setAutoFillBackground(true); + QHBoxLayout* layout(new QHBoxLayout); + layout->addWidget(_searchEngines); + _searchEngines->setStyleSheet(tr("background-color: white", + "search engines combobox")); + layout->addWidget(_search); + searchFrame->setLayout(layout); + _toolbar->addWidget(searchFrame); _search->add(actionSearch); if (!_quirks) _search->add(actionClearSearch); _search->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, @@ -164,6 +174,8 @@ class Browser: public QMainWindow, protected Ui::Browser { SLOT(downloadError(QString)))); assert(connect(&_downloadManager, SIGNAL(metaDataChanged(QNetworkReply*)), SLOT(metaDataChanged(QNetworkReply*)))); + assert(connect(&_settings, SIGNAL(newSettings()), SLOT(newSettings()))); + newSettings(); on_actionNewTab_triggered(); if (!settings || _kiosk) { @@ -522,6 +534,20 @@ class Browser: public QMainWindow, protected Ui::Browser { view->load(page); } + void newSettings() { + _searchEngines->clear(); + for (Settings::SearchEngines::const_iterator + it(_settings.searchEngines().begin()); + it!=_settings.searchEngines().end(); it++) + if (QFile(":/icons/"+it.key()).exists()) + _searchEngines->addItem(QIcon(":/icons/"+it.key()), "", it.value()); + else + _searchEngines->addItem(it.key(), it.value()); + if (_searchEngines->count()==0) + _searchEngines->addItem(QIcon(":/icons/gg"), tr("gg"), + tr("http://www.google.com/search?hl=%2&q=%1")); + } + void on_actionAddBookmark_triggered() { QComboBox* url(qobject_cast(_url)); if (_url) { @@ -721,7 +747,7 @@ class Browser: public QMainWindow, protected Ui::Browser { } void on_actionSearch_triggered() { - load(tr("http://google.com/search?hl=%2&q=%1") + load(_searchEngines->itemData(_searchEngines->currentIndex()).toString() .arg(_search->text()) .arg(QLocale::system().name().left(2))); } @@ -807,12 +833,13 @@ class Browser: public QMainWindow, protected Ui::Browser { connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory())); } QStringList tabs(_settings()->value("Window/Tabs").toStringList()); - while (_tabs->count()>1) _tabs->removeTab(0); + int oldCnt(_tabs->count()); for (QStringList::iterator it(tabs.begin()); it!=tabs.end(); ++it) { LOG<<"-------------------------------------------------------------"; load(*it, newTab()); LOG<<"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"; } + for (int i(0); icount()>1; ++i) _tabs->removeTab(0); _tabs->setTabsClosable(_tabs->count()>1); _tabs->setCurrentIndex(_settings()->value("Window/CurrentTab").toInt()); restoreGeometry(_settings()->value("Window/Geometry").toByteArray()); @@ -1350,7 +1377,12 @@ class Browser: public QMainWindow, protected Ui::Browser { void started() { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); - actionStop->setEnabled(true); + if (_quirks) { + actionStop->setEnabled(true); + } else { + actionStop->setVisible(true); + actionReload->setVisible(false); + } _progress->setRange(0, 0); _progress->setValue(0); _progress->setEnabled(true); @@ -1360,7 +1392,12 @@ class Browser: public QMainWindow, protected Ui::Browser { void finished() { LOG; QApplication::restoreOverrideCursor(); - actionStop->setEnabled(false); + if (_quirks) { + actionStop->setEnabled(false); + } else { + actionStop->setVisible(false); + actionReload->setVisible(true); + } _progress->setRange(0, 1); _progress->setValue(1); _progress->setEnabled(false); @@ -1526,5 +1563,6 @@ class Browser: public QMainWindow, protected Ui::Browser { bool _startUrl; bool _quirks; ButtonLineEdit* _search; + QComboBox* _searchEngines; }; #endif diff --git a/swisssurfer/src/logincertificate.hxx b/swisssurfer/src/logincertificate.hxx index 693b358..96de65e 100644 --- a/swisssurfer/src/logincertificate.hxx +++ b/swisssurfer/src/logincertificate.hxx @@ -17,8 +17,9 @@ class LoginCertificate: public QDialog, protected Ui::LoginCertificate { setup(); } LoginCertificate& setup() { - _cert->certificate(QSslConfiguration::defaultConfiguration() - .localCertificate()); + QSslCertificate c(QSslConfiguration::defaultConfiguration() + .localCertificate()); + _cert->certificate(c); return *this; } protected: diff --git a/swisssurfer/src/pinentry.hxx b/swisssurfer/src/pinentry.hxx index 666a6a7..84fdeda 100644 --- a/swisssurfer/src/pinentry.hxx +++ b/swisssurfer/src/pinentry.hxx @@ -25,6 +25,18 @@ class PinEntry: public QDialog, public Ui::PinEntry { PinEntry(const QSslCertificate& cert, QWidget *parent=0): QDialog(parent) { setupUi(this); _cert->certificate(cert); + _name->setText(utfConv(cert.subjectInfo(QSslCertificate::CommonName)) + .remove(" (Authentication)")); + _mail->setText(utfConv(cert.alternateSubjectNames() + .value(QSsl::EmailEntry))); + if (!cert.subjectInfo(QByteArray("serialNumber")).isEmpty()) { + _certSerialTitle->setText(tr("SuisseID Number:")); + _certSerial->setText(cert.subjectInfo(QByteArray("serialNumber"))); + } else { + _certSerialTitle->setText + (tr("Postzertifikat:", "title for postzertificate serial number")); + _certSerial->setText(cert.serialNumber()); + } } PinEntry& retries(int num) { _pinstatus->setCurrentIndex(num==-1?1:(num==-2?2:0)); @@ -63,6 +75,13 @@ class PinEntry: public QDialog, public Ui::PinEntry { void on__showDetails_toggled(bool s) { _certStack->setCurrentIndex(s?1:0); } + protected: + QString utfConv(const QString& txt) { + QByteArray value(txt.toAscii()); + for (int i(-1); (i=value.indexOf("\\x"))!=-1 && i+3 - + TextLabel @@ -73,21 +73,21 @@ - + TextLabel - + SuisseID Number: - + TextLabel diff --git a/swisssurfer/src/resources.qrc b/swisssurfer/src/resources.qrc index ceb035c..fab67aa 100644 --- a/swisssurfer/src/resources.qrc +++ b/swisssurfer/src/resources.qrc @@ -1,7 +1,8 @@ - resources/icons/sscd_missing.png - resources/icons/sscd_ready.png + resources/icons/gg.png + resources/icons/tel.png + resources/icons/wp.png resources/icons/about.png resources/icons/addbookmark.png resources/icons/back.png @@ -17,7 +18,6 @@ resources/icons/printpreview.png resources/icons/reload.png resources/icons/settings.png - resources/icons/source resources/icons/stop.png resources/icons/up.png resources/icons/usercert.png diff --git a/swisssurfer/src/settings.hxx b/swisssurfer/src/settings.hxx index f9d9724..8c56ee6 100644 --- a/swisssurfer/src/settings.hxx +++ b/swisssurfer/src/settings.hxx @@ -25,6 +25,11 @@ class Settings: public QDialog, protected Ui::Settings { public: typedef QMap MimeTypes; + typedef QMap SearchEngines; + + Q_SIGNALS: + + void newSettings(); public: @@ -147,6 +152,10 @@ class Settings: public QDialog, protected Ui::Settings { return url; } + const SearchEngines& searchEngines() const { + return _searchEngines; + } + bool save() { LOG; if (!_settings || !_settings->isWritable()) return false; @@ -218,6 +227,7 @@ class Settings: public QDialog, protected Ui::Settings { QVariant val(_settings->value("QWebSettings/SearchEngines")); if (val.isValid() && val.canConvert(QVariant::Map)) _searchEngines = val.toMap(); + newSettings(); return true; } @@ -252,6 +262,7 @@ class Settings: public QDialog, protected Ui::Settings { _searchEngineTable->item(row, 1)->text(); // Save if (_autoWrite) save(); + newSettings(); } void on__buttons_rejected() { @@ -350,7 +361,6 @@ class Settings: public QDialog, protected Ui::Settings { QSettings* _settings; bool _autoWrite; MimeTypes _mimetypes; - typedef QMap SearchEngines; SearchEngines _searchEngines; }; diff --git a/swisssurfer/src/swisssurfer_de.ts b/swisssurfer/src/swisssurfer_de.ts index c3a6f23..7acff8e 100644 --- a/swisssurfer/src/swisssurfer_de.ts +++ b/swisssurfer/src/swisssurfer_de.ts @@ -160,7 +160,7 @@ - + New Tab @@ -322,126 +322,137 @@ - + 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 - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + Forbidden: %1 - + + background-color: white + search engines combobox + + + + SSL Not Supported - + SSL is not supported on your system - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + + http://www.google.com/search?hl=%2&q=%1 + + + + opening new window - + %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 - - http://google.com/search?hl=%2&q=%1 - - - - + About - + %8 Version: %1 Builddate: %2 @@ -461,42 +472,42 @@ openssl-%7 - + %1 - + launching application ... - + errors show error log - - + + background-color: #F77 invalid url - - + + background-color: white valid url - + authentication required - + ssl error @@ -813,6 +824,7 @@ openssl-%7 + SuisseID Number: @@ -832,7 +844,13 @@ openssl-%7 - + + Postzertifikat: + title for postzertificate serial number + + + + there are %1 PIN attempts left diff --git a/swisssurfer/src/swisssurfer_en.ts b/swisssurfer/src/swisssurfer_en.ts index d2e82bd..4933657 100644 --- a/swisssurfer/src/swisssurfer_en.ts +++ b/swisssurfer/src/swisssurfer_en.ts @@ -180,7 +180,7 @@ - + New Tab @@ -320,107 +320,118 @@ - + 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 - - http://google.com/search?hl=%2&q=%1 - - - - + About - + %8 Version: %1 Builddate: %2 @@ -440,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 @@ -804,6 +815,7 @@ openssl-%7 + SuisseID Number: @@ -823,7 +835,13 @@ openssl-%7 - + + Postzertifikat: + title for postzertificate serial number + + + + there are %1 PIN attempts left diff --git a/swisssurfer/src/swisssurfer_fr.ts b/swisssurfer/src/swisssurfer_fr.ts index c3a6f23..7acff8e 100644 --- a/swisssurfer/src/swisssurfer_fr.ts +++ b/swisssurfer/src/swisssurfer_fr.ts @@ -160,7 +160,7 @@ - + New Tab @@ -322,126 +322,137 @@ - + 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 - + Info: %1 - + done. - + %1 statusbar for hovered link %1=url - + Forbidden: %1 - + + background-color: white + search engines combobox + + + + SSL Not Supported - + SSL is not supported on your system - + Access Denied - + <p>Access denied due to security considerations.</p><p>You are not allowed to connect to %1. - + + http://www.google.com/search?hl=%2&q=%1 + + + + opening new window - + %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 - - http://google.com/search?hl=%2&q=%1 - - - - + About - + %8 Version: %1 Builddate: %2 @@ -461,42 +472,42 @@ openssl-%7 - + %1 - + launching application ... - + errors show error log - - + + background-color: #F77 invalid url - - + + background-color: white valid url - + authentication required - + ssl error @@ -813,6 +824,7 @@ openssl-%7 + SuisseID Number: @@ -832,7 +844,13 @@ openssl-%7 - + + Postzertifikat: + title for postzertificate serial number + + + + there are %1 PIN attempts left diff --git a/swisssurfer/src/swisssurfer_it.ts b/swisssurfer/src/swisssurfer_it.ts index e237bfe..e7cae25 100644 --- a/swisssurfer/src/swisssurfer_it.ts +++ b/swisssurfer/src/swisssurfer_it.ts @@ -180,7 +180,7 @@ - + New Tab @@ -320,105 +320,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 - - http://google.com/search?hl=%2&q=%1 - - - - + About - + %8 Version: %1 Builddate: %2 @@ -430,58 +441,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 @@ -794,6 +805,7 @@ openssl-%7 + SuisseID Number: @@ -813,7 +825,13 @@ openssl-%7 - + + Postzertifikat: + title for postzertificate serial number + + + + there are %1 PIN attempts left