done point 1) in refs #108; separated ButtonLineEdit for refs #115

master
Marc Wäckerlin 13 years ago
parent 088163a14d
commit 9ae8812ef5
  1. 150
      src/browser.hxx
  2. BIN
      src/designer/buttonlineedit.png
  3. 15
      src/designer/buttonlineeditwidgetifc.cxx
  4. 77
      src/designer/buttonlineeditwidgetifc.hxx
  5. 16
      src/designer/makefile.am
  6. 15
      src/designer/qmake.pro.in
  7. 3
      src/designer/resources.qrc.in
  8. 0
      src/designer/swisswebview.png
  9. 17
      src/designer/webviewwidgetifc.hxx
  10. 27
      src/main.cxx
  11. 80
      src/qbrowserlib/buttonlineedit.hxx
  12. 2
      src/qbrowserlib/makefile.am
  13. 2
      src/qbrowserlib/pluginfactory.hxx
  14. 5
      src/qbrowserlib/qmake.pro.in
  15. 1
      src/qbrowserlib/saveorrun.hxx
  16. 50
      src/swissbrowser_de.ts
  17. 50
      src/swissbrowser_en.ts
  18. 50
      src/swissbrowser_fr.ts
  19. 50
      src/swissbrowser_it.ts

@ -13,7 +13,6 @@
#include <errorlog.hxx> #include <errorlog.hxx>
#include <downloadmanager.hxx> #include <downloadmanager.hxx>
#include <authentication.hxx> #include <authentication.hxx>
#include <qbrowserlib/swisswebview.hxx>
#include <settings.hxx> #include <settings.hxx>
#include <editbookmarks.hxx> #include <editbookmarks.hxx>
#include <temporaryfile.hxx> #include <temporaryfile.hxx>
@ -22,11 +21,12 @@
#include <ui_browser.h> #include <ui_browser.h>
#include <qbrowserlib/buttonlineedit.hxx>
#include <qbrowserlib/swisswebview.hxx>
#include <QtGui/QMainWindow> #include <QtGui/QMainWindow>
#include <QtGui/QLineEdit>
#include <QtGui/QProgressBar> #include <QtGui/QProgressBar>
#include <QtGui/QComboBox> #include <QtGui/QComboBox>
#include <QtGui/QToolButton>
#include <QtGui/QSlider> #include <QtGui/QSlider>
#include <QtGui/QMessageBox> #include <QtGui/QMessageBox>
#include <QtGui/QPrinter> #include <QtGui/QPrinter>
@ -41,6 +41,8 @@
#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtGui/QFileDialog> #include <QtGui/QFileDialog>
#include <QtGui/QDesktopServices>
#include <stdexcept> #include <stdexcept>
#include <cassert> #include <cassert>
#include <memory> #include <memory>
@ -50,6 +52,8 @@
#define LOG qDebug()<<__PRETTY_FUNCTION__ #define LOG qDebug()<<__PRETTY_FUNCTION__
#endif #endif
extern QString TMP;
//! @addtogroup browser //! @addtogroup browser
//! @{ //! @{
@ -104,18 +108,25 @@ class Browser: public QMainWindow, protected Ui::Browser {
_zoom->setPageStep(10); _zoom->setPageStep(10);
_zoom->setTickPosition(QSlider::TicksAbove); _zoom->setTickPosition(QSlider::TicksAbove);
assert(connect(_zoom, SIGNAL(valueChanged(int)), SLOT(zoom(int)))); assert(connect(_zoom, SIGNAL(valueChanged(int)), SLOT(zoom(int))));
if (!_quirks) { if (_kiosk||!_quirks) {
_toolbar->addAction(actionReload); _toolbar->addAction(actionReload);
_toolbar->addAction(actionStop); _toolbar->addAction(actionStop);
} }
if (!_kiosk) { if (!_kiosk) {
QComboBox* combo(new QComboBox(_toolbar)); QComboBox* combo(new QComboBox(_toolbar));
_url = combo; _url = combo;
QFrame* urlFrame(new QFrame);
QHBoxLayout* layout(new QHBoxLayout);
urlFrame->setLayout(layout);
_toolbar->addWidget(urlFrame);
urlFrame->setSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Preferred);
layout->addWidget(_url);
combo->setInsertPolicy(QComboBox::NoInsert); combo->setInsertPolicy(QComboBox::NoInsert);
combo->setLineEdit(new ButtonLineEdit(combo)); combo->setLineEdit(new ButtonLineEdit(combo));
combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, combo->setSizePolicy(QSizePolicy::MinimumExpanding,
QSizePolicy::Preferred)); QSizePolicy::Preferred);
combo->setEditable(!_kiosk); combo->setEditable(!_kiosk);
assert(connect(combo, SIGNAL(currentIndexChanged(const QString&)), assert(connect(combo, SIGNAL(currentIndexChanged(const QString&)),
SLOT(load(QString)))); SLOT(load(QString))));
@ -126,8 +137,8 @@ class Browser: public QMainWindow, protected Ui::Browser {
if (_quirks) { if (_quirks) {
dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add
(actionStop); (actionStop);
dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add
(actionReload); (actionReload);
} }
if (!_quirks) { if (!_quirks) {
dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add
@ -141,21 +152,25 @@ class Browser: public QMainWindow, protected Ui::Browser {
QLineEdit* label(new QLineEdit(_toolbar)); QLineEdit* label(new QLineEdit(_toolbar));
_url = label; _url = label;
label->setReadOnly(true); label->setReadOnly(true);
_url->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, // _url->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Minimum)); // QSizePolicy::Minimum));
_toolbar->addWidget(_url);
}
if (!_kiosk) {
QFrame* searchFrame(new QFrame);
QHBoxLayout* layout(new QHBoxLayout);
layout->addWidget(_searchEngines);
layout->addWidget(_search);
searchFrame->setLayout(layout);
_toolbar->addWidget(searchFrame);
_search->add(actionSearch);
_searchEngines->setSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Preferred);
_search->setSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Preferred);
searchFrame->setSizePolicy(QSizePolicy::Preferred,
QSizePolicy::Preferred);
} }
_toolbar->addWidget(_url);
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); if (!_quirks) _search->add(actionClearSearch);
_search->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, _search->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
QSizePolicy::Minimum)); QSizePolicy::Minimum));
@ -203,10 +218,13 @@ class Browser: public QMainWindow, protected Ui::Browser {
if (!QSslSocket::supportsSsl()) if (!QSslSocket::supportsSsl())
QMessageBox::critical(this, tr("SSL Not Supported"), QMessageBox::critical(this, tr("SSL Not Supported"),
tr("SSL is not supported on your system")); tr("SSL is not supported on your system"));
// temporary caching of favicons
QWebSettings::setIconDatabasePath(TMP);
} }
~Browser() { ~Browser() {
LOG; LOG;
QWebSettings::clearIconDatabase();
for (DownloadProcesses::iterator it(_downloadProcesses.begin()); for (DownloadProcesses::iterator it(_downloadProcesses.begin());
it!=_downloadProcesses.end(); ++it) { it!=_downloadProcesses.end(); ++it) {
LOG<<"cleanup:"<<it->second->fileName(); LOG<<"cleanup:"<<it->second->fileName();
@ -225,6 +243,7 @@ class Browser: public QMainWindow, protected Ui::Browser {
return true; return true;
} }
//! Create new empty tab.
SwissWebView* newTab() { SwissWebView* newTab() {
SwissWebView* browser(new SwissWebView); SwissWebView* browser(new SwissWebView);
newTab(browser); newTab(browser);
@ -279,11 +298,10 @@ class Browser: public QMainWindow, protected Ui::Browser {
if (!view) view=qobject_cast<QWebView*>(_tabs->currentWidget()); if (!view) view=qobject_cast<QWebView*>(_tabs->currentWidget());
view->load(page); view->load(page);
} }
//! Slot that receives and initializes a new SwissWebView
void newTab(SwissWebView* browser) { void newTab(SwissWebView* browser) {
browser->page()->setNetworkAccessManager(&_networkManager); browser->page()->setNetworkAccessManager(&_networkManager);
assert(connect(&_networkManager, SIGNAL(finished(QNetworkReply*)),
SLOT(finished(QNetworkReply*))));
_url->setFocus(); _url->setFocus();
// SwissWebView // SwissWebView
assert(connect(browser, SIGNAL(newView(SwissWebView*)), assert(connect(browser, SIGNAL(newView(SwissWebView*)),
@ -557,6 +575,7 @@ class Browser: public QMainWindow, protected Ui::Browser {
if (_searchEngines->count()==0) if (_searchEngines->count()==0)
_searchEngines->addItem(QIcon(":/icons/gg"), tr("gg"), _searchEngines->addItem(QIcon(":/icons/gg"), tr("gg"),
tr("http://www.google.com/search?hl=%2&q=%1")); tr("http://www.google.com/search?hl=%2&q=%1"));
_searchEngines->setVisible(_searchEngines->count()>1);
} }
void on_actionAddBookmark_triggered() { void on_actionAddBookmark_triggered() {
@ -880,15 +899,12 @@ class Browser: public QMainWindow, protected Ui::Browser {
QWebView* view(qobject_cast<QWebView*>(sender())); QWebView* view(qobject_cast<QWebView*>(sender()));
int index = _tabs->indexOf(view); int index = _tabs->indexOf(view);
if (index<0) return; if (index<0) return;
LOG<<"get icon for "<<view->url();
QIcon icon(QWebSettings::iconForUrl(view->url())); QIcon icon(QWebSettings::iconForUrl(view->url()));
if (icon.isNull()) { if (!icon.isNull()) return _tabs->setTabIcon(index, icon);
LOG<<"Icon for URL is Null"<<view->url(); LOG<<"icon for url is null"<<view->url();
QPixmap pixmap(QWebSettings::webGraphic _tabs->setTabIcon(index, QWebSettings::webGraphic
(QWebSettings::DefaultFrameIconGraphic)); (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) { void titleChanged(const QString& text) {
@ -1388,27 +1404,19 @@ class Browser: public QMainWindow, protected Ui::Browser {
void started() { void started() {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
if (_quirks) { actionStop->setVisible(true);
actionStop->setEnabled(true); actionReload->setVisible(false);
} else {
actionStop->setVisible(true);
actionReload->setVisible(false);
}
_progress->setRange(0, 0); _progress->setRange(0, 0);
_progress->setValue(0); _progress->setValue(0);
_progress->setEnabled(true); _progress->setEnabled(true);
_progress->show(); _progress->show();
} }
void finished() { void finished() {
LOG; LOG;
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
if (_quirks) { actionStop->setVisible(false);
actionStop->setEnabled(false); actionReload->setVisible(true);
} else {
actionStop->setVisible(false);
actionReload->setVisible(true);
}
_progress->setRange(0, 1); _progress->setRange(0, 1);
_progress->setValue(1); _progress->setValue(1);
_progress->setEnabled(false); _progress->setEnabled(false);
@ -1502,56 +1510,6 @@ class Browser: public QMainWindow, protected Ui::Browser {
} }
} }
private:
class ButtonLineEdit: public QLineEdit {
public:
ButtonLineEdit(QWidget* p=0): QLineEdit(p) {
LOG;
}
QToolButton* add(QAction* a) {
LOG;
QToolButton* b(new QToolButton(this));
b->setDefaultAction(a);
add(b);
return b;
}
ButtonLineEdit& add(QToolButton* b) {
LOG;
b->setParent(this);
b->setStyleSheet("QToolButton { border: none; padding: 0; }");
b->setCursor(Qt::ArrowCursor);
_buttons.push_back(b);
resizeEvent(0);
return *this;
}
ButtonLineEdit& changeStyleSheet(QString s) {
LOG;
_style = s;
resizeEvent(0);
return *this;
}
protected:
void resizeEvent(QResizeEvent*) {
QSize sz;
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
for (Buttons::iterator it(_buttons.begin());
it!=_buttons.end(); ++it) {
if (sz.isEmpty()) sz = (*it)->sizeHint();
else sz.setWidth(sz.width()+(*it)->sizeHint().width());
(*it)->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 1 - (*it)->sizeHint().height())/2);
}
setStyleSheet(QString("QLineEdit { padding-right: %1px; %2 }")
.arg(sz.width() + frameWidth + 1)
.arg(_style));
}
private:
typedef QList<QToolButton*> Buttons;
Buttons _buttons;
QString _style;
};
private: private:
QWidget* _url; QWidget* _url;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -0,0 +1,15 @@
/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#include <buttonlineeditwidgetifc.hxx>
//! @defgroup designer
//! @{
Q_EXPORT_PLUGIN2(buttonlineedit, ButtonLineEditWidgetIfc);
//! @}

@ -0,0 +1,77 @@
/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#ifndef __BUTTONLINEEDITWIDGETIFC_HXX
#define __BUTTONLINEEDITWIDGETIFC_HXX
#include <qbrowserlib/buttonlineedit.hxx>
#include <QtDesigner>
#ifndef LOG
#define LOG qDebug()<<__PRETTY_FUNCTION__
#endif
//! @defgroup designer
//! @{
//! Buttonlineedit widget for Qt Designer
class ButtonLineEditWidgetIfc: public QObject,
public QDesignerCustomWidgetInterface {
Q_OBJECT;
Q_INTERFACES(QDesignerCustomWidgetInterface);
public:
bool isContainer() const {
LOG;
return false;
}
QIcon icon() const {
LOG;
return QIcon(":/icons/buttonlineedit.png");
}
QString domXml() const {
LOG;
return
QString
("<ui language=\"c++\" displayname=\"%1\">"
" <widget class=\"%1\" name=\"%2\"/>"
" <customwidgets>"
" <customwidget>"
" <class>%1</class>"
" </customwidget>"
" </customwidgets>"
"</ui>")
.arg(name())
.arg(name().toLower());
}
QString group() const {
LOG;
return "Input Widgets";
}
QString includeFile() const {
LOG;
return "qbrowserlib/buttonlineedit.hxx";
}
QString name() const {
LOG;
return "ButtonLineEdit";
}
QString toolTip() const {
LOG;
return "";
}
QString whatsThis() const {
LOG;
return "";
}
QWidget *createWidget(QWidget *parent) {
LOG;
return new ButtonLineEdit(parent);
}
};
//! @}
#endif

@ -27,10 +27,10 @@ ALL_SRC = @srcdir@/*.[ch]xx \
# @srcdir@/*.ui # @srcdir@/*.ui
QMAKE_PROJECT = qmake.pro QMAKE_PROJECT = qmake.pro
QMAKE_MAKEFILE = makefile.qmake
QMAKE_TARGET = libqbrowserlib-plugin.so QMAKE_TARGET = qbrowserlib-swisswebview qbrowserlib-buttonlineedit
TARGETS = ${QMAKE_TARGET} TARGETS = ${QMAKE_TARGET}
QMAKE_MAKEFILE = ${QMAKE_TARGET:%=makefile.qmake.%}
all: ${TARGETS} $ all: ${TARGETS} $
#$(LANGS:%=@PACKAGENAME@_%.ts) #$(LANGS:%=@PACKAGENAME@_%.ts)
@ -71,24 +71,24 @@ print:
# ${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT} # ${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
${QMAKE_MAKEFILE}: ${QMAKE_PROJECT} ${ALL_SRC} ${QMAKE_MAKEFILE}: ${QMAKE_PROJECT} ${ALL_SRC}
${QMAKE} -o $@ $< ${QMAKE} -o $@ $< CONFIG+=${@:makefile.qmake.%=%}
# $(LANGS:%=@PACKAGENAME@_%.qm) # $(LANGS:%=@PACKAGENAME@_%.qm)
${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC} ${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC}
make -f ${QMAKE_MAKEFILE} make -f makefile.qmake.$@
install-data-local: ${QMAKE_MAKEFILE} install-data-local: ${QMAKE_MAKEFILE}
${mkinstalldirs} ${DESTDIR}${QT_INSTALL_PLUGINS} ${mkinstalldirs} ${DESTDIR}${QT_INSTALL_PLUGINS}
${INSTALL} ${QMAKE_TARGET}* ${DESTDIR}${QT_INSTALL_PLUGINS} ${INSTALL} ${QMAKE_TARGET:%=lib%*} ${DESTDIR}${QT_INSTALL_PLUGINS}
uninstall-local: uninstall-local:
rm -r ${DESTDIR}${QT_INSTALL_PLUGINS}/${QMAKE_TARGET}* -rm -r ${QMAKE_TARGET:%=${DESTDIR}${QT_INSTALL_PLUGINS}/lib%*}
clean-local: clean-local:
-rm -r ${QMAKE_TARGET}* -rm -r ${QMAKE_TARGET:%=lib%*}
# $(LANGS:%=@PACKAGENAME@_%.qm) # $(LANGS:%=@PACKAGENAME@_%.qm)
CLEANFILES = ${TARGETS} ${TARGETS:%=%.exe} \ CLEANFILES = ${TARGETS} ${TARGETS:%=%.exe} \
*.o *.obj qrc_*.cpp ui_*.h moc_*.cpp \ *.o *.obj qrc_*.cpp ui_*.h moc_*.cpp \
${QMAKE_TARGET} ${QMAKE_TARGET:%=lib%*}
MAINTAINERCLEANFILES = makefile.in ${QMAKE_MAKEFILE} MAINTAINERCLEANFILES = makefile.in ${QMAKE_MAKEFILE}

@ -29,15 +29,22 @@ win32 {
CONFIG += release CONFIG += release
} }
SOURCES = webviewwidgetifc.cxx
HEADERS = webviewwidgetifc.hxx
FORMS = FORMS =
RESOURCES = resources.qrc RESOURCES = resources.qrc
TEMPLATE = lib TEMPLATE = lib
TARGET = qbrowserlib-plugin
qbrowserlib-swisswebview {
SOURCES = webviewwidgetifc.cxx
HEADERS = webviewwidgetifc.hxx
TARGET = qbrowserlib-swisswebview
}
qbrowserlib-buttonlineedit {
SOURCES = buttonlineeditwidgetifc.cxx
HEADERS = buttonlineeditwidgetifc.hxx
TARGET = qbrowserlib-buttonlineedit
}
CODECFORSRC = UTF-8 CODECFORSRC = UTF-8
CODECFORTR = UTF-8 CODECFORTR = UTF-8

@ -1,5 +1,6 @@
<RCC> <RCC>
<qresource prefix="/icons"> <qresource prefix="/icons">
<file>webview.png</file> <file>swisswebview.png</file>
<file>buttonlineedit.png</file>
</qresource> </qresource>
</RCC> </RCC>

Before

Width:  |  Height:  |  Size: 397 B

After

Width:  |  Height:  |  Size: 397 B

@ -24,13 +24,14 @@ class SwissWebViewWidgetIfc: public QObject,
Q_OBJECT; Q_OBJECT;
Q_INTERFACES(QDesignerCustomWidgetInterface); Q_INTERFACES(QDesignerCustomWidgetInterface);
public: public:
SwissWebViewWidgetIfc(): _initialized(false) {}
bool isContainer() const { bool isContainer() const {
LOG; LOG;
return false; return true;
} }
QIcon icon() const { QIcon icon() const {
LOG; LOG;
return QIcon(":/icons/webview.png"); return QIcon(":/icons/swisswebview.png");
} }
QString domXml() const { QString domXml() const {
LOG; LOG;
@ -53,7 +54,7 @@ class SwissWebViewWidgetIfc: public QObject,
} }
QString includeFile() const { QString includeFile() const {
LOG; LOG;
return "qbrowserlib/webview.hxx"; return "qbrowserlib/swisswebview.hxx";
} }
QString name() const { QString name() const {
LOG; LOG;
@ -71,6 +72,16 @@ class SwissWebViewWidgetIfc: public QObject,
LOG; LOG;
return new SwissWebView(parent); return new SwissWebView(parent);
} }
bool isInitialized() {
LOG;
return _initialized;
}
void initialized() {
LOG;
_initialized = true;
}
private:
bool _initialized;
}; };
//! @} //! @}

@ -26,23 +26,26 @@
#include <memory> #include <memory>
/*! @mainpage The Secure Swiss PKCS#11 WebBrowser
The browser is divided into a library, qbrowserlib that implements
generic browsing utilities, the main browser page that collects
those features into a main window, a PKCS#11 Post-SuisseID
hardware token client authentication and a designer plugin for
flexible GUI creation.
*/
//! @defgroup browser The SwissBrowser Executable and Main Window //! @defgroup browser The SwissBrowser Executable and Main Window
//! @defgroup pkcs11 The PKCS#11 Client Authentication //! @defgroup pkcs11 The PKCS#11 Client Authentication
//! @defgroup qbrowserlib The Swiss Browser Library //! @defgroup qbrowserlib The Swiss Browser Library
//! @defgroup designer Qt Designer Plugin for Browser Related Widgets //! @defgroup designer Qt Designer Plugin for Browser Related Widgets
/*! @mainpage The Secure Swiss PKCS#11 WebBrowser
The browser is divided into a library, @ref qbrowserlib that implements
generic browsing utilities, the main @ref browser page that collects
those features into a main window, a @ref pkcs11 Post-SuisseID
hardware token client authentication and a @ref designer plugin for
flexible GUI creation.
*/
//! @addtogroup browser //! @addtogroup browser
//! @{ //! @{
QString TMP;
const QByteArray SWISSSIGN_EV_GOLD_CA_2009_G2 const QByteArray SWISSSIGN_EV_GOLD_CA_2009_G2
("-----BEGIN CERTIFICATE-----\n" ("-----BEGIN CERTIFICATE-----\n"
"MIIGvzCCBaegAwIBAgIQAPI39KUS4aGJo+mkR4+YuTANBgkqhkiG9w0BAQUFADBN\n" "MIIGvzCCBaegAwIBAgIQAPI39KUS4aGJo+mkR4+YuTANBgkqhkiG9w0BAQUFADBN\n"
@ -309,6 +312,7 @@ int main(int argv, char** argc) try {
<<"Port"<<QNetworkProxy::applicationProxy().port(); <<"Port"<<QNetworkProxy::applicationProxy().port();
qDebug()<<"***************************************************************"; qDebug()<<"***************************************************************";
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
TMP=QDir::toNativeSeparators(QDir::tempPath());
QStringList urls; QStringList urls;
QString actlib QString actlib
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
@ -338,6 +342,7 @@ int main(int argv, char** argc) try {
("Usage: %1 [OPTIONS...] [<url> ...]\n" ("Usage: %1 [OPTIONS...] [<url> ...]\n"
"Options:\n" "Options:\n"
" -h, --help show this help text\n" " -h, --help show this help text\n"
" -t --tmp path temporary folder for data caching\n"
" -k, --kiosk no url bar\n" " -k, --kiosk no url bar\n"
" if you sepcify -k and -s, -k must be first\n" " if you sepcify -k and -s, -k must be first\n"
" -q, --quirks alternate user interface\n" " -q, --quirks alternate user interface\n"
@ -357,13 +362,15 @@ int main(int argv, char** argc) try {
" PROXY_TYPE \"http\" or \"socks\" or \"\" (actual: %2)\n" " PROXY_TYPE \"http\" or \"socks\" or \"\" (actual: %2)\n"
" PROXY_PORT proxy port number (actual: %3)\n" " PROXY_PORT proxy port number (actual: %3)\n"
" PROXY_HOST proxy host name (actual: %4)\n" " PROXY_HOST proxy host name (actual: %4)\n"
" SWISSSURFER_USERAGENT fake user agent (actual: %6)\n") " SWISS_USERAGENT fake user agent (actual: %6)\n")
.arg(QFileInfo(argc[0]).fileName()) .arg(QFileInfo(argc[0]).fileName())
.arg(env["PROXY_TYPE"]).arg(env["PROXY_PORT"]).arg(env["PROXY_HOST"]) .arg(env["PROXY_TYPE"]).arg(env["PROXY_PORT"]).arg(env["PROXY_HOST"])
.arg(env["LANGUAGE"]).arg(env["SWISSSURFER_USERAGENT"]) .arg(env["LANGUAGE"]).arg(env["SWISS_USERAGENT"])
.toStdString() .toStdString()
<<std::endl; <<std::endl;
return 0; return 0;
} else if ((*it=="-t" || *it=="--tmp") && ++it!=args.end()) {
TMP=*it;
} else if ((*it=="-k" || *it=="--kiosk")) { } else if ((*it=="-k" || *it=="--kiosk")) {
silent=true; silent=true;
settings.reset(); settings.reset();

@ -0,0 +1,80 @@
/*! @file
@id $Id$
*/
// 1 2 3 4 5 6 7 8
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
#ifndef __BUTTONLINEEDIT_HXX__
#define __BUTTONLINEEDIT_HXX__
#include <QtGui/QLineEdit>
#include <QtGui/QToolButton>
#include <QtGui/QAction>
#include <QtGui/QStyle>
#include <QtCore/QDebug>
#ifndef LOG
#define LOG qDebug()<<__PRETTY_FUNCTION__
#endif
//! @addtogroup qbrowserlib
//! @{
//! A QLineEdit that may have buttons to the right within the lineedit.
class ButtonLineEdit: public QLineEdit {
Q_OBJECT;
public:
ButtonLineEdit(QWidget* p=0): QLineEdit(p) {
LOG;
}
QToolButton* add(QAction* a) {
LOG;
QToolButton* b(new QToolButton(this));
b->setDefaultAction(a);
add(b);
return b;
}
ButtonLineEdit& add(QToolButton* b) {
LOG;
b->setParent(this);
b->setStyleSheet("QToolButton { border: none; padding: 0; }");
b->setCursor(Qt::ArrowCursor);
_buttons.push_back(b);
resizeEvent(0);
return *this;
}
ButtonLineEdit& changeStyleSheet(QString s) {
LOG;
_style = s;
resizeEvent(0);
return *this;
}
static void foreachActionWidget(QAction& a, void(QWidget::*f)()) {
QList<QWidget*> widgets(a.associatedWidgets());
for (QList<QWidget*>::iterator w(widgets.begin()); w!=widgets.end(); ++w)
((*w)->*f)();
}
protected:
void resizeEvent(QResizeEvent*) {
QSize sz;
int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
for (Buttons::iterator it(_buttons.begin());
it!=_buttons.end(); ++it) {
if (sz.isEmpty()) sz = (*it)->sizeHint();
else sz.setWidth(sz.width()+(*it)->sizeHint().width());
(*it)->move(rect().right() - frameWidth - sz.width(),
(rect().bottom() + 1 - (*it)->sizeHint().height())/2);
}
setStyleSheet(QString("QLineEdit { padding-right: %1px; %2 }")
.arg(sz.width() + frameWidth + 1)
.arg(_style));
}
private:
typedef QList<QToolButton*> Buttons;
Buttons _buttons;
QString _style;
};
//! @}
#endif

@ -80,7 +80,7 @@ install-data-local:
${INSTALL} ${QMAKE_TARGET}* ${DESTDIR}${libdir} ${INSTALL} ${QMAKE_TARGET}* ${DESTDIR}${libdir}
uninstall-local: uninstall-local:
rm -r ${DESTDIR}${libdir}/${QMAKE_TARGET}* -rm -r ${DESTDIR}${libdir}/${QMAKE_TARGET}*
clean-local: clean-local:
-rm -r ${QMAKE_TARGET}* -rm -r ${QMAKE_TARGET}*

@ -19,6 +19,8 @@
//! @addtogroup qbrowserlib //! @addtogroup qbrowserlib
//! @{ //! @{
//! Handle PDF Documents
/*! */
class PluginFactory: public QWebPluginFactory { class PluginFactory: public QWebPluginFactory {
public: public:
PluginFactory(QObject* p=0): QWebPluginFactory(p) { PluginFactory(QObject* p=0): QWebPluginFactory(p) {

@ -36,8 +36,9 @@ TRANSLATIONS = @srcdir@/qbrowserlib_en.ts \
SOURCES = SOURCES =
HEADERS = @srcdir@/swisswebview.hxx @srcdir@/swisswebpage.hxx \ HEADERS = @srcdir@/swisswebview.hxx @srcdir@/swisswebpage.hxx \
@srcdir@/pluginfactory.hxx @srcdir@/saveorrun.hxx @srcdir@/pluginfactory.hxx @srcdir@/saveorrun.hxx \
@srcdir@/buttonlineedit.hxx
FORMS = @srcdir@/saveorrun.ui FORMS = @srcdir@/saveorrun.ui

@ -26,6 +26,7 @@
//! @addtogroup qbrowserlib //! @addtogroup qbrowserlib
//! @{ //! @{
//! Ask User for Saving or Opening a Download
class SaveOrRun: public QWidget, public Ui::SaveOrRun { class SaveOrRun: public QWidget, public Ui::SaveOrRun {
Q_OBJECT; Q_OBJECT;

@ -263,11 +263,6 @@
<source>Clear Search</source> <source>Clear Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>background-color: white</source>
<comment>search engines combobox</comment>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>SSL Not Supported</source> <source>SSL Not Supported</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -696,10 +691,32 @@ openssl-%7</source>
<comment>application name</comment> <comment>application name</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...] <source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...]
Options: Options:
-h, --help show this help text -h, --help show this help text
-t --tmp path temporary folder for data caching
-k, --kiosk no url bar -k, --kiosk no url bar
if you sepcify -k and -s, -k must be first if you sepcify -k and -s, -k must be first
-q, --quirks alternate user interface -q, --quirks alternate user interface
@ -719,31 +736,10 @@ Environment:
PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2) PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2)
PROXY_PORT proxy port number (actual: %3) PROXY_PORT proxy port number (actual: %3)
PROXY_HOST proxy host name (actual: %4) PROXY_HOST proxy host name (actual: %4)
SWISSSURFER_USERAGENT fake user agent (actual: %6) SWISS_USERAGENT fake user agent (actual: %6)
</source> </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>Settings</name> <name>Settings</name>

@ -263,11 +263,6 @@
<source>Clear Search</source> <source>Clear Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>background-color: white</source>
<comment>search engines combobox</comment>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>SSL Not Supported</source> <source>SSL Not Supported</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -696,10 +691,32 @@ openssl-%7</source>
<comment>application name</comment> <comment>application name</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...] <source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...]
Options: Options:
-h, --help show this help text -h, --help show this help text
-t --tmp path temporary folder for data caching
-k, --kiosk no url bar -k, --kiosk no url bar
if you sepcify -k and -s, -k must be first if you sepcify -k and -s, -k must be first
-q, --quirks alternate user interface -q, --quirks alternate user interface
@ -719,31 +736,10 @@ Environment:
PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2) PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2)
PROXY_PORT proxy port number (actual: %3) PROXY_PORT proxy port number (actual: %3)
PROXY_HOST proxy host name (actual: %4) PROXY_HOST proxy host name (actual: %4)
SWISSSURFER_USERAGENT fake user agent (actual: %6) SWISS_USERAGENT fake user agent (actual: %6)
</source> </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>Settings</name> <name>Settings</name>

@ -263,11 +263,6 @@
<source>Clear Search</source> <source>Clear Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>background-color: white</source>
<comment>search engines combobox</comment>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>SSL Not Supported</source> <source>SSL Not Supported</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -696,10 +691,32 @@ openssl-%7</source>
<comment>application name</comment> <comment>application name</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...] <source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...]
Options: Options:
-h, --help show this help text -h, --help show this help text
-t --tmp path temporary folder for data caching
-k, --kiosk no url bar -k, --kiosk no url bar
if you sepcify -k and -s, -k must be first if you sepcify -k and -s, -k must be first
-q, --quirks alternate user interface -q, --quirks alternate user interface
@ -719,31 +736,10 @@ Environment:
PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2) PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2)
PROXY_PORT proxy port number (actual: %3) PROXY_PORT proxy port number (actual: %3)
PROXY_HOST proxy host name (actual: %4) PROXY_HOST proxy host name (actual: %4)
SWISSSURFER_USERAGENT fake user agent (actual: %6) SWISS_USERAGENT fake user agent (actual: %6)
</source> </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>Settings</name> <name>Settings</name>

@ -263,11 +263,6 @@
<source>Clear Search</source> <source>Clear Search</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>background-color: white</source>
<comment>search engines combobox</comment>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>SSL Not Supported</source> <source>SSL Not Supported</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
@ -696,10 +691,32 @@ openssl-%7</source>
<comment>application name</comment> <comment>application name</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
<message> <message>
<source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...] <source>Usage: %1 [OPTIONS...] [&lt;url&gt; ...]
Options: Options:
-h, --help show this help text -h, --help show this help text
-t --tmp path temporary folder for data caching
-k, --kiosk no url bar -k, --kiosk no url bar
if you sepcify -k and -s, -k must be first if you sepcify -k and -s, -k must be first
-q, --quirks alternate user interface -q, --quirks alternate user interface
@ -719,31 +736,10 @@ Environment:
PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2) PROXY_TYPE &quot;http&quot; or &quot;socks&quot; or &quot;&quot; (actual: %2)
PROXY_PORT proxy port number (actual: %3) PROXY_PORT proxy port number (actual: %3)
PROXY_HOST proxy host name (actual: %4) PROXY_HOST proxy host name (actual: %4)
SWISSSURFER_USERAGENT fake user agent (actual: %6) SWISS_USERAGENT fake user agent (actual: %6)
</source> </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Cannot read PEM certificate from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read PEM certificates from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cannot read PEM RSA key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Read private key from file: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Too few arguments.
Try: %1 --help</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>Settings</name> <name>Settings</name>

Loading…
Cancel
Save