Compare commits
1 Commits
swissbrows
...
swisssurfe
Author | SHA1 | Date | |
---|---|---|---|
|
84d6226317 |
2
README
@@ -8,4 +8,4 @@ Start e.g. with:
|
|||||||
|
|
||||||
SWISSSIGNER='java -Xmx256M -Dorg.jpedal.jai=true -Dswing.aatext=true -Dch.abacus.swisssigner.incamail.certlogin=false -splash:swisssigner-splash.png -Dch.abacus.pkcs11.configuration=swisssigner-pkcs11.cfg -Duser.language=de -cp /home/marc/downloads/swisssigner/swisssigner.jar:/home/marc/downloads/swisssigner/bc.jar:bcmail.jar:/home/marc/downloads/swisssigner/bcpg.jar:/home/marc/downloads/swisssigner/bctsp.jar:/home/marc/downloads/swisssigner/exml.jar:/home/marc/downloads/swisssigner/itext.jar:/home/marc/downloads/swisssigner/jai_codec.jar:/home/marc/downloads/swisssigner/jai_core.jar:/home/marc/downloads/swisssigner/jai_imageio.jar:/home/marc/downloads/swisssigner/jdic.jar:/home/marc/downloads/swisssigner/jdic_native.jar:/home/marc/downloads/swisssigner/jdic_stub_unix.jar:/home/marc/downloads/swisssigner/jpedal.jar: ch.abacus.hotdog.SwissSigner locale=de document=%1 browser_bin=firefox keystores=pkcs11'
|
SWISSSIGNER='java -Xmx256M -Dorg.jpedal.jai=true -Dswing.aatext=true -Dch.abacus.swisssigner.incamail.certlogin=false -splash:swisssigner-splash.png -Dch.abacus.pkcs11.configuration=swisssigner-pkcs11.cfg -Duser.language=de -cp /home/marc/downloads/swisssigner/swisssigner.jar:/home/marc/downloads/swisssigner/bc.jar:bcmail.jar:/home/marc/downloads/swisssigner/bcpg.jar:/home/marc/downloads/swisssigner/bctsp.jar:/home/marc/downloads/swisssigner/exml.jar:/home/marc/downloads/swisssigner/itext.jar:/home/marc/downloads/swisssigner/jai_codec.jar:/home/marc/downloads/swisssigner/jai_core.jar:/home/marc/downloads/swisssigner/jai_imageio.jar:/home/marc/downloads/swisssigner/jdic.jar:/home/marc/downloads/swisssigner/jdic_native.jar:/home/marc/downloads/swisssigner/jdic_stub_unix.jar:/home/marc/downloads/swisssigner/jpedal.jar: ch.abacus.hotdog.SwissSigner locale=de document=%1 browser_bin=firefox keystores=pkcs11'
|
||||||
|
|
||||||
src/swissbrowser --mime application/pdf pdf "$SWISSSIGNER" --mime application/x-java-jnlp-file jnlp "javaws %1" http://swisssign.com/de/swisssign-support/ss-faq/7-server-certificates/34-how-to-apache-konfiguration-mit-ssl-zertifikaten
|
src/swisssurfer --mime application/pdf pdf "$SWISSSIGNER" --mime application/x-java-jnlp-file jnlp "javaws %1" http://swisssign.com/de/swisssign-support/ss-faq/7-server-certificates/34-how-to-apache-konfiguration-mit-ssl-zertifikaten
|
||||||
|
44
configure.in
@@ -17,10 +17,10 @@ dnl refers to ${prefix}. Thus we have to use `eval' twice.
|
|||||||
|
|
||||||
AC_INIT([README])
|
AC_INIT([README])
|
||||||
SRC_DIR=src
|
SRC_DIR=src
|
||||||
TST_DIR=test
|
TST_DIR=
|
||||||
DOC_DIR=doc
|
DOC_DIR=doc
|
||||||
|
|
||||||
m4_define(x_packagename, swissbrowser)
|
m4_define(x_packagename, swisssurfer)
|
||||||
m4_define(x_major, 1)
|
m4_define(x_major, 1)
|
||||||
m4_define(x_minor, 2)
|
m4_define(x_minor, 2)
|
||||||
|
|
||||||
@@ -43,13 +43,8 @@ AM_INIT_AUTOMAKE($PACKAGENAME, $MAJOR.$MINOR.$LEAST, [marc.waeckerlin@tech.swiss
|
|||||||
|
|
||||||
# files to create
|
# files to create
|
||||||
AC_CONFIG_FILES([makefile ${PACKAGENAME}.spec src/version.cxx
|
AC_CONFIG_FILES([makefile ${PACKAGENAME}.spec src/version.cxx
|
||||||
test/makefile test/qmake.pro
|
|
||||||
src/makefile
|
src/makefile
|
||||||
src/qmake.pro src/languages.qrc
|
src/qmake.pro src/languages.qrc
|
||||||
src/qbrowserlib/makefile
|
|
||||||
src/qbrowserlib/qmake.pro src/qbrowserlib/languages.qrc
|
|
||||||
src/designer/makefile
|
|
||||||
src/designer/qmake.pro src/designer/resources.qrc
|
|
||||||
doc/doxyfile doc/makefile
|
doc/doxyfile doc/makefile
|
||||||
debian/changelog])
|
debian/changelog])
|
||||||
|
|
||||||
@@ -112,37 +107,6 @@ AC_ARG_ENABLE(dot,
|
|||||||
test "$enableval" = "yes" && HAVE_DOT="YES" || HAVE_DOT="NO";
|
test "$enableval" = "yes" && HAVE_DOT="YES" || HAVE_DOT="NO";
|
||||||
AM_PATH_CPPUNIT([1.0.0], [have_cppunit="yes"], [have_cppunit="no"])
|
AM_PATH_CPPUNIT([1.0.0], [have_cppunit="yes"], [have_cppunit="no"])
|
||||||
|
|
||||||
# Qt Designer Plugin Dir
|
|
||||||
AC_MSG_CHECKING([QT_INSTALL_PLUGINS])
|
|
||||||
AC_ARG_WITH([qt-install-plugins],
|
|
||||||
[AS_HELP_STRING([--with-qt-install-plugins=DIR],
|
|
||||||
[Qt designer plugin directory])],
|
|
||||||
QT_INSTALL_PLUGINS=$withval)
|
|
||||||
# Check that QTDIR is defined or that --with-qtdir given
|
|
||||||
if test x"$QT_INSTALL_PLUGINS" = x ; then
|
|
||||||
# some usual Qt-locations
|
|
||||||
QT_SEARCH="/usr/share/qt4 /usr/lib/qt4 /usr/lib/qt /usr/X11R6 /opt/local/lib/qt4 /opt/local/share/qt4 /usr/local/Trolltech/Qt-4.0.0 /usr/local/Trolltech/Qt-4.0.1 /usr/local/Trolltech/Qt-4.1.0 /usr/local/Trolltech/Qt-4.2.0 /usr/local/Trolltech/Qt-4.2.1 /usr/local/Trolltech/Qt-4.2.2"
|
|
||||||
for p in ${QT_SEARCH}; do
|
|
||||||
if test -d ${p}/plugins/designer; then
|
|
||||||
QT_INSTALL_PLUGINS=${p}/plugins/designer
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if test x"$QT_INSTALL_PLUGINS" = x ; then
|
|
||||||
for p in ${QT_SEARCH}; do
|
|
||||||
if test -d ${p}/plugins; then
|
|
||||||
QT_INSTALL_PLUGINS=${p}/plugins/designer
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if test x"$QT_INSTALL_PLUGINS" = x ; then
|
|
||||||
AC_MSG_ERROR([*** --with-qt-install-plugins or QT_INSTALL_PLUGINS must be given])
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([$QT_INSTALL_PLUGINS])
|
|
||||||
AC_SUBST(QT_INSTALL_PLUGINS)
|
|
||||||
|
|
||||||
MINGW32=no
|
MINGW32=no
|
||||||
MAC=no
|
MAC=no
|
||||||
case $host_os in
|
case $host_os in
|
||||||
@@ -162,9 +126,7 @@ AC_SUBST(LUPDATE)
|
|||||||
|
|
||||||
# Environment Variables
|
# Environment Variables
|
||||||
AC_ARG_VAR(LUPDATE_ARGS, [arguments for qt lupdate command, e.g. -no-obsolete])
|
AC_ARG_VAR(LUPDATE_ARGS, [arguments for qt lupdate command, e.g. -no-obsolete])
|
||||||
AC_PATH_PROG(QMAKE, [qmake qmake-qt4], [],
|
AC_PATH_PROG(QMAKE, [qmake qmake-qt4], [])
|
||||||
[$PATH$PATH_SEPARATOR/usr/lib/qt4/bin]dnl
|
|
||||||
[$PATH_SEPARATOR/usr/lib64/qt4/bin])
|
|
||||||
AC_ARG_VAR(QMAKE, [path to qmake program])
|
AC_ARG_VAR(QMAKE, [path to qmake program])
|
||||||
|
|
||||||
# export macros
|
# export macros
|
||||||
|
2
debian/changelog.in
vendored
@@ -1,5 +1,5 @@
|
|||||||
@PACKAGE@ (@VERSION@-1) unstable; urgency=low
|
@PACKAGE@ (@VERSION@-1) unstable; urgency=low
|
||||||
|
|
||||||
* see https://dev.swisssign.com/projects/swissbrowser for changes
|
* see https://dev.swisssign.com/projects/swisssurfer for changes
|
||||||
|
|
||||||
-- Marc Wäckerlin (SwissSign AG) <marc.waeckerlin@tech.swisssign.com> Wed, 07 Apr 2010 10:23:02 +0200
|
-- Marc Wäckerlin (SwissSign AG) <marc.waeckerlin@tech.swisssign.com> Wed, 07 Apr 2010 10:23:02 +0200
|
||||||
|
20
debian/control
vendored
@@ -1,27 +1,21 @@
|
|||||||
Source: swissbrowser
|
Source: swisssurfer
|
||||||
Section: web
|
Section: web
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Marc Wäckerlin (SwissSign AG) <marc.waeckerlin@tech.swisssign.com>
|
Maintainer: Marc Wäckerlin (SwissSign AG) <marc.waeckerlin@tech.swisssign.com>
|
||||||
Build-Depends: debhelper (>= 7), autotools-dev
|
Build-Depends: debhelper (>= 7), autotools-dev
|
||||||
Standards-Version: 3.8.1
|
Standards-Version: 3.8.1
|
||||||
Homepage: https://dev.swisssign.com/projects/swissbrowser
|
Homepage: https://dev.swisssign.com/projects/swisssurfer
|
||||||
|
|
||||||
Package: swissbrowser-dev
|
Package: swisssurfer-dev
|
||||||
Provides: swisssurfer-dev
|
|
||||||
Conflicts: swisssurfer-dev
|
|
||||||
Replaces: swisssurfer-dev
|
|
||||||
Section: devel
|
Section: devel
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: swissbrowser (= ${binary:Version})
|
Depends: swisssurfer (= ${binary:Version})
|
||||||
Description: swissbrowser
|
Description: swisssurfer
|
||||||
.
|
.
|
||||||
|
|
||||||
Package: swissbrowser
|
Package: swisssurfer
|
||||||
Provides: swisssurfer
|
|
||||||
Conflicts: swisssurfer
|
|
||||||
Replaces: swisssurfer
|
|
||||||
Section: web
|
Section: web
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||||
Description: swissbrowser
|
Description: swisssurfer
|
||||||
.
|
.
|
||||||
|
2
debian/copyright
vendored
@@ -1,7 +1,7 @@
|
|||||||
This package was debianized by Marc Wäckerlin (SwissSign AG) <marc.waeckerlin@tech.swisssign.com> on
|
This package was debianized by Marc Wäckerlin (SwissSign AG) <marc.waeckerlin@tech.swisssign.com> on
|
||||||
Wed, 07 Apr 2010 10:23:02 +0200.
|
Wed, 07 Apr 2010 10:23:02 +0200.
|
||||||
|
|
||||||
It was downloaded from https://dev.swisssign.com/projects/swissbrowser
|
It was downloaded from https://dev.swisssign.com/projects/swisssurfer
|
||||||
|
|
||||||
Upstream Author(s):
|
Upstream Author(s):
|
||||||
|
|
||||||
|
10
debian/menu
vendored
@@ -1,8 +1,8 @@
|
|||||||
?package(swissbrowser):\
|
?package(swisssurfer):\
|
||||||
needs="X11"\
|
needs="X11"\
|
||||||
hints="Lightweight,Fast,Small,Security,SSL,Cryptoki,Certificate"\
|
hints="Lightweight,Fast,Small,Security,SSL,Cryptoki,Certificate"\
|
||||||
section="Applications/Network/Web Browsing"\
|
section="Applications/Network/Web Browsing"\
|
||||||
title="SwissBrowser"\
|
title="SwissSurfer"\
|
||||||
longtitle="SwissBrowser Internet Browser"\
|
longtitle="SwissSurfer Internet Browser"\
|
||||||
command="/usr/bin/swissbrowser"\
|
command="/usr/bin/swisssurfer"\
|
||||||
icon="/usr/share/swissbrowser/swissbrowser.xpm"
|
icon="/usr/share/swisssurfer/swisssurfer.xpm"
|
||||||
|
4
debian/rules
vendored
@@ -30,7 +30,7 @@ endif
|
|||||||
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
||||||
cp -f /usr/share/misc/config.guess config.guess
|
cp -f /usr/share/misc/config.guess config.guess
|
||||||
endif
|
endif
|
||||||
CPPFLAGS=-DALLOW_SSL_0_8 ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --with-qt-install-plugins=\$${prefix}/share/qt4/plugins/designer CFLAGS="$(CFLAGS)"
|
./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)"
|
||||||
|
|
||||||
|
|
||||||
build: build-stamp
|
build: build-stamp
|
||||||
@@ -84,7 +84,7 @@ binary-arch: install
|
|||||||
dh_compress
|
dh_compress
|
||||||
dh_fixperms
|
dh_fixperms
|
||||||
# dh_perl
|
# dh_perl
|
||||||
dh_makeshlibs
|
# dh_makeshlibs
|
||||||
dh_installdeb
|
dh_installdeb
|
||||||
dh_shlibdeps
|
dh_shlibdeps
|
||||||
dh_gencontrol
|
dh_gencontrol
|
||||||
|
3
debian/swissbrowser-dev.dirs
vendored
@@ -1,3 +0,0 @@
|
|||||||
usr/lib
|
|
||||||
usr/include
|
|
||||||
usr/share
|
|
8
debian/swissbrowser-dev.install
vendored
@@ -1,8 +0,0 @@
|
|||||||
usr/share/doc/swissbrowser/html
|
|
||||||
usr/include/*
|
|
||||||
#usr/lib/lib*.a
|
|
||||||
usr/lib/lib*.so
|
|
||||||
usr/share/qt4
|
|
||||||
#usr/lib/*.la
|
|
||||||
#usr/lib/pkgconfig
|
|
||||||
#usr/share/pkgconfig
|
|
11
debian/swissbrowser.install
vendored
@@ -1,11 +0,0 @@
|
|||||||
usr/bin/swissbrowser
|
|
||||||
usr/share/applications/swissbrowser.desktop
|
|
||||||
usr/share/swissbrowser/swissbrowser.xpm
|
|
||||||
usr/share/swissbrowser/swissbrowser.png
|
|
||||||
usr/share/doc/swissbrowser/AUTHORS
|
|
||||||
usr/share/doc/swissbrowser/NEWS
|
|
||||||
usr/share/doc/swissbrowser/README
|
|
||||||
usr/share/doc/swissbrowser/COPYING
|
|
||||||
usr/share/doc/swissbrowser/INSTALL
|
|
||||||
usr/share/doc/swissbrowser/ChangeLog
|
|
||||||
usr/lib/lib*.so.*
|
|
3
debian/swisssurfer-dev.dirs
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
#usr/lib
|
||||||
|
#usr/include
|
||||||
|
usr/share
|
7
debian/swisssurfer-dev.install
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
usr/share/doc/swisssurfer/html
|
||||||
|
#usr/include/*
|
||||||
|
#usr/lib/lib*.a
|
||||||
|
#usr/lib/lib*.so
|
||||||
|
#usr/lib/*.la
|
||||||
|
#usr/lib/pkgconfig
|
||||||
|
#usr/share/pkgconfig
|
@@ -1,3 +1,3 @@
|
|||||||
usr/lib
|
#usr/lib
|
||||||
usr/bin
|
usr/bin
|
||||||
usr/share
|
usr/share
|
@@ -1,7 +1,7 @@
|
|||||||
Document: swissbrowser
|
Document: swisssurfer
|
||||||
Title: Debian swissbrowser Manual
|
Title: Debian swisssurfer Manual
|
||||||
Author: <insert document author here>
|
Author: <insert document author here>
|
||||||
Abstract: This manual describes what swissbrowser is
|
Abstract: This manual describes what swisssurfer is
|
||||||
and how it can be used to
|
and how it can be used to
|
||||||
manage online manuals on Debian systems.
|
manage online manuals on Debian systems.
|
||||||
Section: unknown
|
Section: unknown
|
11
debian/swisssurfer.install
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
usr/bin/swisssurfer
|
||||||
|
usr/share/applications/swisssurfer.desktop
|
||||||
|
usr/share/swisssurfer/swisssurfer.xpm
|
||||||
|
usr/share/swisssurfer/swisssurfer.png
|
||||||
|
usr/share/doc/swisssurfer/AUTHORS
|
||||||
|
usr/share/doc/swisssurfer/NEWS
|
||||||
|
usr/share/doc/swisssurfer/README
|
||||||
|
usr/share/doc/swisssurfer/COPYING
|
||||||
|
usr/share/doc/swisssurfer/INSTALL
|
||||||
|
usr/share/doc/swisssurfer/ChangeLog
|
||||||
|
#usr/lib/lib*.so.*
|
@@ -640,7 +640,7 @@ FILE_PATTERNS = *.[ch]xx \
|
|||||||
# should be searched for input files as well. Possible values are YES and NO.
|
# should be searched for input files as well. Possible values are YES and NO.
|
||||||
# If left blank NO is used.
|
# If left blank NO is used.
|
||||||
|
|
||||||
RECURSIVE = YES
|
RECURSIVE = NO
|
||||||
|
|
||||||
# The EXCLUDE tag can be used to specify files and/or directories that should
|
# The EXCLUDE tag can be used to specify files and/or directories that should
|
||||||
# excluded from the INPUT source files. This way you can easily exclude a
|
# excluded from the INPUT source files. This way you can easily exclude a
|
||||||
|
Before Width: | Height: | Size: 279 KiB After Width: | Height: | Size: 279 KiB |
@@ -5,17 +5,17 @@
|
|||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>English</string>
|
<string>English</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>swissbrowser</string>
|
<string>swisssurfer</string>
|
||||||
<key>CFBundleGetInfoString</key>
|
<key>CFBundleGetInfoString</key>
|
||||||
<string>SwissSign, (c) 2011</string>
|
<string>SwissSign, (c) 2011</string>
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>swissbrowser.icns</string>
|
<string>swisssurfer.icns</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>com.swisssign.swissbrowser</string>
|
<string>com.swisssign.swisssurfer</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>SwissBrowser</string>
|
<string>SwissSurfer</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
|
920
src/browser.hxx
@@ -8,50 +8,49 @@
|
|||||||
#ifndef BROWSER_HXX
|
#ifndef BROWSER_HXX
|
||||||
#define BROWSER_HXX
|
#define BROWSER_HXX
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <smartcardauth.hxx>
|
|
||||||
#include <logincertificate.hxx>
|
|
||||||
#include <qbrowserlib/errorlog.hxx>
|
|
||||||
#include <qbrowserlib/downloadmanager.hxx>
|
|
||||||
#include <authentication.hxx>
|
|
||||||
#include <editbookmarks.hxx>
|
|
||||||
#include <proxyface/proxy.hxx>
|
|
||||||
#include <sslclientnetworkmanager.hxx>
|
|
||||||
|
|
||||||
#include <ui_browser.h>
|
#include <ui_browser.h>
|
||||||
|
|
||||||
#include <qbrowserlib/buttonlineedit.hxx>
|
|
||||||
#include <qbrowserlib/filestorage.hxx>
|
|
||||||
#include <qbrowserlib/swisswebview.hxx>
|
|
||||||
#include <qbrowserlib/settings.hxx>
|
|
||||||
#include <qbrowserlib/executor.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>
|
||||||
#include <QtGui/QPrintDialog>
|
#include <QtGui/QPrintDialog>
|
||||||
#include <QtGui/QPrintPreviewDialog>
|
#include <QtGui/QPrintPreviewDialog>
|
||||||
|
#include <QtWebKit/QWebPage>
|
||||||
|
#include <QtWebKit/QWebView>
|
||||||
#include <QtWebKit/QWebFrame>
|
#include <QtWebKit/QWebFrame>
|
||||||
#include <QtWebKit/QWebHistory>
|
#include <QtWebKit/QWebHistory>
|
||||||
#include <QtNetwork/QNetworkReply>
|
#include <QtNetwork/QNetworkReply>
|
||||||
#include <QtNetwork/QSslError>
|
#include <QtNetwork/QSslError>
|
||||||
#include <QtNetwork/QNetworkProxy>
|
#include <QtNetwork/QNetworkProxy>
|
||||||
|
#include <QtCore/QProcess>
|
||||||
#include <QtCore/QDir>
|
#include <QtCore/QDir>
|
||||||
#include <QtGui/QFileDialog>
|
#include <QtGui/QFileDialog>
|
||||||
|
|
||||||
#include <QtGui/QDesktopServices>
|
#include <smartcardauth.hxx>
|
||||||
|
#include <logincertificate.hxx>
|
||||||
|
#include <errorlog.hxx>
|
||||||
|
#include <downloadmanager.hxx>
|
||||||
|
#include <authentication.hxx>
|
||||||
|
#include <webpage.hxx>
|
||||||
|
#include <settings.hxx>
|
||||||
|
#include <editbookmarks.hxx>
|
||||||
|
#include <pluginfactory.hxx>
|
||||||
|
#include <temporaryfile.hxx>
|
||||||
|
#include <saveorrun.hxx>
|
||||||
|
#include <sslclientnetworkmanager.hxx>
|
||||||
|
#include <proxyface/proxy.hxx>
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
extern QString TMP;
|
#include <QtCore/QDebug>
|
||||||
|
#ifndef LOG
|
||||||
//! @addtogroup browser
|
#define LOG qDebug()<<__PRETTY_FUNCTION__
|
||||||
//! @{
|
#endif
|
||||||
|
|
||||||
class Browser: public QMainWindow, protected Ui::Browser {
|
class Browser: public QMainWindow, protected Ui::Browser {
|
||||||
|
|
||||||
@@ -61,29 +60,21 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
|
|
||||||
Browser(const QString& actlib, const QStringList& urls = QStringList(),
|
Browser(const QString& actlib, const QStringList& urls = QStringList(),
|
||||||
QSettings* settings=0,
|
QSettings* settings=0,
|
||||||
qbrowserlib::Settings::MimeTypes mimeTypes =
|
Settings::MimeTypes mimeTypes = Settings::MimeTypes(),
|
||||||
qbrowserlib::Settings::MimeTypes(),
|
bool kiosk = false, bool login = true, bool quirks=true):
|
||||||
bool kiosk = false, bool login = true, bool quirks=true,
|
_url(0), _find(new ButtonLineEdit),
|
||||||
QString bookmarkfile=QString()):
|
_kiosk(kiosk),
|
||||||
_url(0), _find(new qbrowserlib::ButtonLineEdit),
|
_settings(mimeTypes, this, settings, !kiosk),
|
||||||
_kiosk(kiosk),
|
_errorLog(this), _logincertificate(this),
|
||||||
_downloadManager(new qbrowserlib::DownloadManager),
|
|
||||||
_logincertificate(this),
|
|
||||||
_proxy("http://swisssign.com", this),
|
_proxy("http://swisssign.com", this),
|
||||||
_showErrorLog(0),
|
_showErrorLog(0),
|
||||||
_startUrl(urls.size()),
|
_startUrl(urls.size()),
|
||||||
_quirks(quirks), _search(new qbrowserlib::ButtonLineEdit),
|
_quirks(quirks), _search(new ButtonLineEdit),
|
||||||
_searchEngines(new QComboBox),
|
_searchEngines(new QComboBox) {
|
||||||
_bookmarkfile(bookmarkfile) {
|
LOG<<urls;
|
||||||
TRC; LOG<<urls;
|
|
||||||
qbrowserlib::Settings::instance(mimeTypes, this, settings, !kiosk);
|
|
||||||
qbrowserlib::ErrorLog::instance(this);
|
|
||||||
_home = "about:blank";
|
_home = "about:blank";
|
||||||
if (urls.size()) _home = urls.at(0);
|
if (urls.size()) _home = urls.at(0);
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
actionDebugLog->setVisible(qbrowserlib::Log::DEBUG);
|
|
||||||
actionStop->setVisible(false);
|
|
||||||
actionReload->setVisible(false);
|
|
||||||
show();
|
show();
|
||||||
try {
|
try {
|
||||||
_networkManager.scAuth(new SmartCardAuth(actlib, this, login));
|
_networkManager.scAuth(new SmartCardAuth(actlib, this, login));
|
||||||
@@ -95,20 +86,11 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
_find->add(actionClearFind);
|
_find->add(actionClearFind);
|
||||||
_find->hide();
|
_find->hide();
|
||||||
statusBar()->addPermanentWidget(_progress = new QProgressBar());
|
statusBar()->addPermanentWidget(_progress = new QProgressBar());
|
||||||
QSizePolicy sp(_progress->sizePolicy());
|
_progress -> setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
statusBar()->addPermanentWidget(new QLabel("-"));
|
||||||
_progress->setSizePolicy(sp);
|
|
||||||
QPushButton* btn(0);
|
|
||||||
statusBar()->addPermanentWidget
|
|
||||||
(btn=new QPushButton(QIcon(":/icons/16x16/butt16_09.png"), ""));
|
|
||||||
assert(connect(btn, SIGNAL(clicked(bool)), SLOT(smaller())));
|
|
||||||
statusBar()->addPermanentWidget(_zoom = new QSlider(Qt::Horizontal));
|
statusBar()->addPermanentWidget(_zoom = new QSlider(Qt::Horizontal));
|
||||||
statusBar()->addPermanentWidget
|
statusBar()->addPermanentWidget(new QLabel("+"));
|
||||||
(btn=new QPushButton(QIcon(":/icons/16x16/butt16_10.png"), ""));
|
_zoom->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||||
assert(connect(btn, SIGNAL(clicked(bool)), SLOT(larger())));
|
|
||||||
sp = _zoom->sizePolicy();
|
|
||||||
sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
|
||||||
_zoom->setSizePolicy(sp);
|
|
||||||
_zoom->setMinimum(10);
|
_zoom->setMinimum(10);
|
||||||
_zoom->setMaximum(190);
|
_zoom->setMaximum(190);
|
||||||
_zoom->setValue(100);
|
_zoom->setValue(100);
|
||||||
@@ -116,24 +98,18 @@ 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 (_kiosk||!_quirks) {
|
if (!_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);
|
|
||||||
layout->addWidget(_url);
|
|
||||||
combo->setInsertPolicy(QComboBox::NoInsert);
|
combo->setInsertPolicy(QComboBox::NoInsert);
|
||||||
combo->setLineEdit(new qbrowserlib::ButtonLineEdit(combo));
|
combo->setLineEdit(new ButtonLineEdit(combo));
|
||||||
combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
combo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
|
||||||
sp=combo->sizePolicy();
|
combo->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
|
||||||
sp.setHorizontalPolicy(QSizePolicy::Expanding);
|
QSizePolicy::Preferred));
|
||||||
combo->setSizePolicy(sp);
|
|
||||||
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))));
|
||||||
@@ -142,77 +118,69 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
assert(connect(combo->lineEdit(), SIGNAL(textChanged(QString)),
|
assert(connect(combo->lineEdit(), SIGNAL(textChanged(QString)),
|
||||||
SLOT(goodUrl())));
|
SLOT(goodUrl())));
|
||||||
if (_quirks) {
|
if (_quirks) {
|
||||||
dynamic_cast<qbrowserlib::ButtonLineEdit*>(combo->lineEdit())->add
|
dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add
|
||||||
(actionStop);
|
(actionStop);
|
||||||
dynamic_cast<qbrowserlib::ButtonLineEdit*>(combo->lineEdit())->add
|
dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add
|
||||||
(actionReload);
|
(actionReload);
|
||||||
}
|
}
|
||||||
if (!_quirks) {
|
if (!_quirks) {
|
||||||
dynamic_cast<qbrowserlib::ButtonLineEdit*>(combo->lineEdit())->add
|
dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add
|
||||||
(actionAddBookmark);
|
(actionAddBookmark);
|
||||||
dynamic_cast<qbrowserlib::ButtonLineEdit*>(combo->lineEdit())->add
|
dynamic_cast<ButtonLineEdit*>(combo->lineEdit())->add
|
||||||
(actionClearLocation);
|
(actionClearLocation);
|
||||||
}
|
}
|
||||||
_editbookmarks =
|
_editbookmarks =
|
||||||
std::auto_ptr<EditBookmarks>(new EditBookmarks(combo, this));
|
std::auto_ptr<EditBookmarks>(new EditBookmarks(combo, this));
|
||||||
assert(connect(_editbookmarks.get(), SIGNAL(startEdit(bool)),
|
|
||||||
actionAddBookmark, SLOT(setDisabled(bool))));
|
|
||||||
assert(connect(_editbookmarks.get(), SIGNAL(endEdit(bool)),
|
|
||||||
actionAddBookmark, SLOT(setEnabled(bool))));
|
|
||||||
assert(connect(_editbookmarks.get(), SIGNAL(accepted()),
|
|
||||||
SLOT(saveBookmarks())));
|
|
||||||
} else {
|
} else {
|
||||||
QLineEdit* label(new QLineEdit(_toolbar));
|
QLineEdit* label(new QLineEdit(_toolbar));
|
||||||
_url = label;
|
_url = label;
|
||||||
label->setReadOnly(true);
|
label->setReadOnly(true);
|
||||||
label->setEnabled(false);
|
_url->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
|
||||||
_toolbar->addWidget(_url);
|
QSizePolicy::Minimum));
|
||||||
}
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
_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);
|
||||||
sp=_search->sizePolicy();
|
_search->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
|
||||||
sp.setHorizontalPolicy(QSizePolicy::Minimum);
|
QSizePolicy::Minimum));
|
||||||
_search->setSizePolicy(sp);
|
|
||||||
assert(connect(_search, SIGNAL(returnPressed()),
|
assert(connect(_search, SIGNAL(returnPressed()),
|
||||||
SLOT(on_actionSearch_triggered())));
|
SLOT(on_actionSearch_triggered())));
|
||||||
if (_quirks) {
|
if (_quirks) {
|
||||||
_toolbar->setMovable(false);
|
_toolbar->addAction(actionAddBookmark);
|
||||||
_toolbar->setFloatable(false);
|
|
||||||
if (!_kiosk) _toolbar->addAction(actionAddBookmark);
|
|
||||||
_toolbar->addAction(actionHome);
|
_toolbar->addAction(actionHome);
|
||||||
}
|
}
|
||||||
(*_downloadManager)+=&_networkManager;
|
assert(connect(&_errorLog, SIGNAL(reset()), SLOT(errorReset())));
|
||||||
assert(connect(&qbrowserlib::ErrorLog::instance(),
|
|
||||||
SIGNAL(reset()), SLOT(errorReset())));
|
|
||||||
assert(connect(&_networkManager, SIGNAL(finished(QNetworkReply*)),
|
assert(connect(&_networkManager, SIGNAL(finished(QNetworkReply*)),
|
||||||
SLOT(finished(QNetworkReply*))));
|
SLOT(finished(QNetworkReply*))));
|
||||||
assert(connect(_downloadManager.data(), SIGNAL(progress(qint64, qint64)),
|
assert(connect(&_networkManager, SIGNAL(created(QNetworkReply*)),
|
||||||
|
&_downloadManager, SLOT(add(QNetworkReply*))));
|
||||||
|
assert(connect(&_downloadManager, SIGNAL(progress(qint64, qint64)),
|
||||||
SLOT(progress(qint64, qint64))));
|
SLOT(progress(qint64, qint64))));
|
||||||
assert(connect(_downloadManager.data(), SIGNAL(started()),
|
assert(connect(&_downloadManager, SIGNAL(started()),
|
||||||
SLOT(started())));
|
SLOT(started())));
|
||||||
assert(connect(_downloadManager.data(), SIGNAL(finished()),
|
assert(connect(&_downloadManager, SIGNAL(finished()),
|
||||||
SLOT(finished())));
|
SLOT(finished())));
|
||||||
assert(connect(_downloadManager.data(), SIGNAL(error(QString)),
|
assert(connect(&_downloadManager, SIGNAL(error(QString)),
|
||||||
SLOT(downloadError(QString))));
|
SLOT(downloadError(QString))));
|
||||||
assert(connect(_downloadManager.data(), SIGNAL(metaDataChanged(QNetworkReply*)),
|
assert(connect(&_downloadManager, SIGNAL(metaDataChanged(QNetworkReply*)),
|
||||||
SLOT(metaDataChanged(QNetworkReply*))));
|
SLOT(metaDataChanged(QNetworkReply*))));
|
||||||
assert(connect(&qbrowserlib::Settings::instance(),
|
assert(connect(&_settings, SIGNAL(newSettings()), SLOT(newSettings())));
|
||||||
SIGNAL(newSettings()), SLOT(newSettings())));
|
|
||||||
newSettings();
|
newSettings();
|
||||||
on_actionNewTab_triggered();
|
on_actionNewTab_triggered();
|
||||||
|
|
||||||
if (!settings || _kiosk) {
|
if (!settings || _kiosk) {
|
||||||
actionSettings->setVisible(false);
|
actionSettings->setVisible(false);
|
||||||
actionSaveWindowState->setVisible(false);
|
actionEditBookmarks->setVisible(false);
|
||||||
actionLoadWindowState->setVisible(false);
|
|
||||||
}
|
}
|
||||||
if (_kiosk) {
|
if (_kiosk) {
|
||||||
actionNew->setEnabled(false);
|
actionNew->setEnabled(false);
|
||||||
@@ -220,27 +188,30 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
actionNewTab->setEnabled(false);
|
actionNewTab->setEnabled(false);
|
||||||
actionNewTab->setVisible(false);
|
actionNewTab->setVisible(false);
|
||||||
actionCloseTab->setVisible(false);
|
actionCloseTab->setVisible(false);
|
||||||
actionEditBookmarks->setVisible(false);
|
|
||||||
delete _bookmarks; _bookmarks=0;
|
|
||||||
}
|
}
|
||||||
if (!_kiosk &&
|
if (!_kiosk && !_startUrl && _settings.flag("SaveWindowState")
|
||||||
((!_startUrl &&
|
&& _settings())
|
||||||
qbrowserlib::Settings::instance().flag("SaveWindowState") &&
|
|
||||||
qbrowserlib::Settings::instance()()) ||
|
|
||||||
_bookmarkfile.readable()))
|
|
||||||
loadWin();
|
loadWin();
|
||||||
if (urls.size()) load(urls.at(0));
|
if (urls.size()) load(urls.at(0));
|
||||||
for (int i(1); i<urls.size(); ++i) load(urls.at(i), newTab());
|
for (int i(1); i<urls.size(); ++i) load(urls.at(i), newTab());
|
||||||
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() {
|
||||||
TRC;
|
LOG;
|
||||||
QWebSettings::clearIconDatabase();
|
for (DownloadProcesses::iterator it(_downloadProcesses.begin());
|
||||||
|
it!=_downloadProcesses.end(); ++it) {
|
||||||
|
LOG<<"cleanup:"<<it->second->fileName();
|
||||||
|
it->second->setAutoRemove(_settings.flag("CloseApps"));
|
||||||
|
delete it->second;
|
||||||
|
it->second = 0;
|
||||||
|
if (_settings.flag("CloseApps")) {
|
||||||
|
it->first->terminate();
|
||||||
|
delete it->first;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Whitelisting
|
//! Whitelisting
|
||||||
@@ -248,85 +219,14 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Create new empty tab.
|
QWebView* newTab() {
|
||||||
qbrowserlib::SwissWebView* newTab() {
|
QWebView* browser(new QWebView);
|
||||||
qbrowserlib::SwissWebView* browser
|
browser->setPage(new WebPage(this, browser));
|
||||||
(new qbrowserlib::SwissWebView(0, &_networkManager));
|
browser->page()->setPluginFactory(new PluginFactory);
|
||||||
newTab(browser);
|
browser->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
|
||||||
return browser;
|
browser->page()->setNetworkAccessManager(&_networkManager);
|
||||||
}
|
browser->page()->setForwardUnsupportedContent(true);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void closeEvent(QCloseEvent *event) {
|
|
||||||
TRC;
|
|
||||||
if (!_kiosk &&
|
|
||||||
((!_startUrl &&
|
|
||||||
qbrowserlib::Settings::instance().flag("SaveWindowState") &&
|
|
||||||
qbrowserlib::Settings::instance()()) ||
|
|
||||||
_bookmarkfile.writeable()))
|
|
||||||
saveWin();
|
|
||||||
QMainWindow::closeEvent(event);
|
|
||||||
QApplication::exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
void on_actionEditBookmarks_triggered() {
|
|
||||||
_editbookmarks->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
|
|
||||||
void load() {
|
|
||||||
TRC;
|
|
||||||
if (qobject_cast<QComboBox*>(_url))
|
|
||||||
load(qobject_cast<QComboBox*>(_url)->currentText());
|
|
||||||
else
|
|
||||||
load(qobject_cast<QLineEdit*>(_url)->text());
|
|
||||||
}
|
|
||||||
|
|
||||||
void load(QString page) {
|
|
||||||
qbrowserlib::Settings::instance().replaceSearchEngine(page);
|
|
||||||
if (QUrl(page).scheme()=="") page = "http://"+page;
|
|
||||||
if (qobject_cast<QComboBox*>(_url))
|
|
||||||
qobject_cast<QComboBox*>(_url)->lineEdit()->setText(page);
|
|
||||||
else
|
|
||||||
qobject_cast<QLineEdit*>(_url)->setText(page);
|
|
||||||
load(QUrl(page));
|
|
||||||
}
|
|
||||||
|
|
||||||
void load(QUrl page, QWebView* view=0) {
|
|
||||||
TRC; LOG<<page.toString();
|
|
||||||
statusBar()->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("<p>Access denied due to security"
|
|
||||||
" considerations.</p><p>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<QWebView*>(_tabs->currentWidget());
|
|
||||||
view->load(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Slot that receives and initializes a new SwissWebView
|
|
||||||
void newTab(qbrowserlib::SwissWebView* browser) {
|
|
||||||
_url->setFocus();
|
_url->setFocus();
|
||||||
// SwissWebView
|
|
||||||
assert(connect(browser, SIGNAL(newView(qbrowserlib::SwissWebView*)),
|
|
||||||
SLOT(newTab(qbrowserlib::SwissWebView*))));
|
|
||||||
// QWebView
|
// QWebView
|
||||||
assert(connect(browser, SIGNAL(urlChanged(const QUrl&)),
|
assert(connect(browser, SIGNAL(urlChanged(const QUrl&)),
|
||||||
SLOT(urlChanged(const QUrl&))));
|
SLOT(urlChanged(const QUrl&))));
|
||||||
@@ -561,9 +461,9 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
assert(connect(browser->page(),
|
assert(connect(browser->page(),
|
||||||
SIGNAL(toolBarVisibilityChangeRequested(bool)),
|
SIGNAL(toolBarVisibilityChangeRequested(bool)),
|
||||||
SLOT(toolBarVisibilityChangeRequested(bool))));
|
SLOT(toolBarVisibilityChangeRequested(bool))));
|
||||||
assert(connect(browser->page(),
|
// assert(connect(browser->page(),
|
||||||
SIGNAL(unsupportedContent(QNetworkReply*)),
|
// SIGNAL(unsupportedContent(QNetworkReply*)),
|
||||||
SLOT(unsupportedContent(QNetworkReply*))));
|
// SLOT(unsupportedContent(QNetworkReply*))));
|
||||||
assert(connect(browser->page(), SIGNAL(windowCloseRequested()),
|
assert(connect(browser->page(), SIGNAL(windowCloseRequested()),
|
||||||
SLOT(windowCloseRequested())));
|
SLOT(windowCloseRequested())));
|
||||||
// QNetworkAccessManager
|
// QNetworkAccessManager
|
||||||
@@ -575,22 +475,70 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
assert(connect(browser->page()->networkAccessManager(),
|
assert(connect(browser->page()->networkAccessManager(),
|
||||||
SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&,
|
SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&,
|
||||||
QAuthenticator*)),
|
QAuthenticator*)),
|
||||||
&_proxy,
|
|
||||||
SLOT(proxyAuthenticationRequired(const QNetworkProxy&,
|
SLOT(proxyAuthenticationRequired(const QNetworkProxy&,
|
||||||
QAuthenticator*))));
|
QAuthenticator*))));
|
||||||
assert(connect(browser->page()->networkAccessManager(),
|
assert(connect(browser->page()->networkAccessManager(),
|
||||||
SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
|
SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)),
|
||||||
SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&))));
|
SLOT(sslErrors(QNetworkReply*, const QList<QSslError>&))));
|
||||||
_tabs->setCurrentIndex(_tabs->addTab(browser, tr("New Tab")));
|
_tabs->setCurrentIndex(_tabs->addTab(browser, tr("New Tab")));
|
||||||
_tabs->setTabsClosable(_tabs->count()>1);
|
_tabs->setTabsClosable(_tabs->count()>1);
|
||||||
//_tabs->tabBar()->setShown(_tabs->count()>1);
|
return browser;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
void closeEvent(QCloseEvent *event) {
|
||||||
|
LOG;
|
||||||
|
if (!_kiosk && !_startUrl && _settings.flag("SaveWindowState")
|
||||||
|
&& _settings())
|
||||||
|
saveWin();
|
||||||
|
QMainWindow::closeEvent(event);
|
||||||
|
QApplication::exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
|
||||||
|
void load() {
|
||||||
|
LOG;
|
||||||
|
if (qobject_cast<QComboBox*>(_url))
|
||||||
|
load(qobject_cast<QComboBox*>(_url)->currentText());
|
||||||
|
else
|
||||||
|
load(qobject_cast<QLineEdit*>(_url)->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(QString page) {
|
||||||
|
_settings.replaceSearchEngine(page);
|
||||||
|
if (QUrl(page).scheme()=="") page = "http://"+page;
|
||||||
|
load(QUrl(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
void load(QUrl page, QWebView* view=0) {
|
||||||
|
LOG<<page.toString();
|
||||||
|
statusBar()->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("<p>Access denied due to security"
|
||||||
|
" considerations.</p><p>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<QWebView*>(_tabs->currentWidget());
|
||||||
|
view->load(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
void newSettings() {
|
void newSettings() {
|
||||||
_searchEngines->clear();
|
_searchEngines->clear();
|
||||||
for (qbrowserlib::Settings::SearchEngines::const_iterator
|
for (Settings::SearchEngines::const_iterator
|
||||||
it(qbrowserlib::Settings::instance().searchEngines().begin());
|
it(_settings.searchEngines().begin());
|
||||||
it!=qbrowserlib::Settings::instance().searchEngines().end(); it++)
|
it!=_settings.searchEngines().end(); it++)
|
||||||
if (QFile(":/icons/"+it.key()).exists())
|
if (QFile(":/icons/"+it.key()).exists())
|
||||||
_searchEngines->addItem(QIcon(":/icons/"+it.key()), "", it.value());
|
_searchEngines->addItem(QIcon(":/icons/"+it.key()), "", it.value());
|
||||||
else
|
else
|
||||||
@@ -598,31 +546,24 @@ 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() {
|
||||||
QComboBox* url(qobject_cast<QComboBox*>(_url));
|
QComboBox* url(qobject_cast<QComboBox*>(_url));
|
||||||
if (!_bookmarks) return;
|
if (_url) {
|
||||||
if (_url && !url->currentText().isEmpty()) {
|
|
||||||
url->addItem(url->currentText());
|
url->addItem(url->currentText());
|
||||||
QAction* a(_bookmarks->addAction(url->currentText()));
|
QAction* a(_bookmarks->addAction(url->currentText()));
|
||||||
a->setData(url->currentText());
|
a->setData(url->currentText());
|
||||||
connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory()));
|
connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory()));
|
||||||
saveBookmarks();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void smaller() {
|
void on_actionEditBookmarks_triggered() {
|
||||||
_zoom->setValue(_zoom->value()-_zoom->pageStep());
|
_editbookmarks->show();
|
||||||
}
|
|
||||||
|
|
||||||
void larger() {
|
|
||||||
_zoom->setValue(_zoom->value()+_zoom->pageStep());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void zoom(int i) {
|
void zoom(int i) {
|
||||||
TRC; LOG<<i;
|
LOG<<i;
|
||||||
statusBar()->showMessage(tr("Zoom: %1%").arg(i));
|
statusBar()->showMessage(tr("Zoom: %1%").arg(i));
|
||||||
qobject_cast<QWebView*>(_tabs->currentWidget())->setZoomFactor(i/100.0);
|
qobject_cast<QWebView*>(_tabs->currentWidget())->setZoomFactor(i/100.0);
|
||||||
}
|
}
|
||||||
@@ -632,12 +573,12 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_actionHome_activated() {
|
void on_actionHome_activated() {
|
||||||
TRC;
|
LOG;
|
||||||
load(_home);
|
load(_home);
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionNew_triggered() {
|
void on_actionNew_triggered() {
|
||||||
TRC;
|
LOG;
|
||||||
QStringList args(QCoreApplication::arguments());
|
QStringList args(QCoreApplication::arguments());
|
||||||
QString prg(args.takeFirst());
|
QString prg(args.takeFirst());
|
||||||
statusBar()->showMessage(tr("opening new window"), 5000);
|
statusBar()->showMessage(tr("opening new window"), 5000);
|
||||||
@@ -652,26 +593,21 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
on__tabs_tabCloseRequested(_tabs->currentIndex());
|
on__tabs_tabCloseRequested(_tabs->currentIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void on__tabs_currentChanged(int) {
|
void on__tabs_currentChanged(int index) {
|
||||||
if (qobject_cast<QComboBox*>(_url)) {
|
if (qobject_cast<QComboBox*>(_url))
|
||||||
qobject_cast<QComboBox*>(_url)->setEditText
|
qobject_cast<QComboBox*>(_url)->setEditText
|
||||||
(qobject_cast<QWebView*>(_tabs->currentWidget())
|
(qobject_cast<QWebView*>(_tabs->currentWidget())
|
||||||
->url().toString());
|
->url().toString());
|
||||||
qobject_cast<QComboBox*>(_url)->lineEdit()->setCursorPosition(0);
|
else
|
||||||
} else {
|
|
||||||
qobject_cast<QLineEdit*>(_url)->setText
|
qobject_cast<QLineEdit*>(_url)->setText
|
||||||
(qobject_cast<QWebView*>(_tabs->currentWidget())
|
(qobject_cast<QWebView*>(_tabs->currentWidget())
|
||||||
->url().toString());
|
->url().toString());
|
||||||
qobject_cast<QLineEdit*>(_url)->setCursorPosition(0);
|
|
||||||
}
|
|
||||||
resetWindowTitle();
|
|
||||||
activateTab();
|
activateTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on__tabs_tabCloseRequested(int index) {
|
void on__tabs_tabCloseRequested(int index) {
|
||||||
_tabs->removeTab(index);
|
_tabs->removeTab(index);
|
||||||
_tabs->setTabsClosable(_tabs->count()>1);
|
_tabs->setTabsClosable(_tabs->count()>1);
|
||||||
//_tabs->tabBar()->setShown(_tabs->count()>1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionPrintPreview_triggered() {
|
void on_actionPrintPreview_triggered() {
|
||||||
@@ -694,17 +630,17 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_actionClose_triggered() {
|
void on_actionClose_triggered() {
|
||||||
TRC;
|
LOG;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionBack_triggered() {
|
void on_actionBack_triggered() {
|
||||||
TRC;
|
LOG;
|
||||||
qobject_cast<QWebView*>(_tabs->currentWidget())->history()->back();
|
qobject_cast<QWebView*>(_tabs->currentWidget())->history()->back();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionBack_hovered() {
|
void on_actionBack_hovered() {
|
||||||
TRC;
|
LOG;
|
||||||
if (!qobject_cast<QWebView*>(_tabs->currentWidget())->history()
|
if (!qobject_cast<QWebView*>(_tabs->currentWidget())->history()
|
||||||
->backItem().isValid())
|
->backItem().isValid())
|
||||||
return;
|
return;
|
||||||
@@ -718,12 +654,12 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_actionForward_triggered() {
|
void on_actionForward_triggered() {
|
||||||
TRC;
|
LOG;
|
||||||
qobject_cast<QWebView*>(_tabs->currentWidget())->history()->forward();
|
qobject_cast<QWebView*>(_tabs->currentWidget())->history()->forward();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionForward_hovered() {
|
void on_actionForward_hovered() {
|
||||||
TRC;
|
LOG;
|
||||||
if (!qobject_cast<QWebView*>(_tabs->currentWidget())->history()
|
if (!qobject_cast<QWebView*>(_tabs->currentWidget())->history()
|
||||||
->forwardItem().isValid())
|
->forwardItem().isValid())
|
||||||
return;
|
return;
|
||||||
@@ -737,15 +673,15 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_actionReload_triggered() {
|
void on_actionReload_triggered() {
|
||||||
TRC;
|
LOG;
|
||||||
qobject_cast<QWebView*>(_tabs->currentWidget())->reload();
|
qobject_cast<QWebView*>(_tabs->currentWidget())->reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionStop_triggered() {
|
void on_actionStop_triggered() {
|
||||||
TRC;
|
LOG;
|
||||||
for (int i(0); i<_tabs->count(); ++i)
|
for (int i(0); i<_tabs->count(); ++i)
|
||||||
qobject_cast<QWebView*>(_tabs->widget(i))->stop();
|
qobject_cast<QWebView*>(_tabs->widget(i))->stop();
|
||||||
_downloadManager->abort();
|
_downloadManager.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionClearLocation_triggered() {
|
void on_actionClearLocation_triggered() {
|
||||||
@@ -829,7 +765,7 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_actionErrorLog_triggered() {
|
void on_actionErrorLog_triggered() {
|
||||||
qbrowserlib::ErrorLog::instance().show();
|
_errorLog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionAbout_triggered() {
|
void on_actionAbout_triggered() {
|
||||||
@@ -841,7 +777,7 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
"%3\n"
|
"%3\n"
|
||||||
"%4\n"
|
"%4\n"
|
||||||
"qt-%5 (%6)\n"
|
"qt-%5 (%6)\n"
|
||||||
"openssl-%7 (%9) %10")
|
"openssl-%7")
|
||||||
.arg(VERSION)
|
.arg(VERSION)
|
||||||
.arg(BUILDDATE)
|
.arg(BUILDDATE)
|
||||||
.arg(QString::fromStdString(proxy::version()))
|
.arg(QString::fromStdString(proxy::version()))
|
||||||
@@ -849,17 +785,11 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
.arg(qVersion())
|
.arg(qVersion())
|
||||||
.arg(QT_VERSION_STR)
|
.arg(QT_VERSION_STR)
|
||||||
.arg(SHLIB_VERSION_NUMBER)
|
.arg(SHLIB_VERSION_NUMBER)
|
||||||
.arg(QApplication::applicationName())
|
.arg(QApplication::applicationName()));
|
||||||
.arg(OPENSSL_VERSION_TEXT)
|
|
||||||
.arg(QSslSocket::supportsSsl()?"ok":"failed"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void on_actionDebugLog_triggered() {
|
|
||||||
qbrowserlib::Log::show(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionSettings_triggered() {
|
void on_actionSettings_triggered() {
|
||||||
qbrowserlib::Settings::instance().show();
|
_settings.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_actionSaveWindowState_triggered() {
|
void on_actionSaveWindowState_triggered() {
|
||||||
@@ -871,43 +801,38 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void saveWin() {
|
void saveWin() {
|
||||||
TRC; LOG<<"Save Window State";
|
LOG<<"Save Window State";
|
||||||
saveBookmarks();
|
if (!_settings()) return;
|
||||||
if (!qbrowserlib::Settings::instance()()) return;
|
|
||||||
QStringList tabs;
|
|
||||||
for (int i(0); i<_tabs->count(); ++i)
|
|
||||||
tabs<<qobject_cast<QWebView*>(_tabs->widget(i))->url().toString();
|
|
||||||
qbrowserlib::Settings::instance()()->setValue("Window/Tabs", tabs);
|
|
||||||
qbrowserlib::Settings::instance()()
|
|
||||||
->setValue("Window/CurrentTab", _tabs->currentIndex());
|
|
||||||
qbrowserlib::Settings::instance()()
|
|
||||||
->setValue("Window/Geometry", saveGeometry());
|
|
||||||
qbrowserlib::Settings::instance()()
|
|
||||||
->setValue("Window/WindowState", saveState());
|
|
||||||
}
|
|
||||||
|
|
||||||
void saveBookmarks() {
|
|
||||||
TRC; LOG<<"Saving Bookmarks ...";
|
|
||||||
QStringList urls;
|
QStringList urls;
|
||||||
if (qobject_cast<QComboBox*>(_url))
|
if (qobject_cast<QComboBox*>(_url))
|
||||||
for (int i(0); i<qobject_cast<QComboBox*>(_url)->count(); ++i)
|
for (int i(0); i<qobject_cast<QComboBox*>(_url)->count(); ++i)
|
||||||
urls<<qobject_cast<QComboBox*>(_url)->itemText(i);
|
urls<<qobject_cast<QComboBox*>(_url)->itemText(i);
|
||||||
urls.removeAll("");
|
_settings()->setValue("Window/Urls", urls);
|
||||||
urls.removeDuplicates();
|
QStringList tabs;
|
||||||
if (_bookmarkfile.writeable()) {
|
for (int i(0); i<_tabs->count(); ++i)
|
||||||
LOG<<"write to bookmark file"<<_bookmarkfile.name();
|
tabs<<qobject_cast<QWebView*>(_tabs->widget(i))->url().toString();
|
||||||
_bookmarkfile.write(urls);
|
_settings()->setValue("Window/Tabs", tabs);
|
||||||
} else if (qbrowserlib::Settings::instance()()) {
|
_settings()->setValue("Window/CurrentTab", _tabs->currentIndex());
|
||||||
LOG<<"write to settings";
|
_settings()->setValue("Window/Geometry", saveGeometry());
|
||||||
qbrowserlib::Settings::instance()()->setValue("Window/Urls", urls);
|
_settings()->setValue("Window/WindowState", saveState());
|
||||||
} else LOG<<"bookmarks not saved";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadWin() {
|
void loadWin() {
|
||||||
TRC;
|
LOG;
|
||||||
loadBookmarks();
|
QStringList urls(_settings()->value("Window/Urls").toStringList());
|
||||||
if (!qbrowserlib::Settings::instance()()) return;
|
urls.sort();
|
||||||
QStringList tabs(qbrowserlib::Settings::instance()()->value("Window/Tabs").toStringList());
|
urls.removeDuplicates();
|
||||||
|
if (qobject_cast<QComboBox*>(_url)) {
|
||||||
|
qobject_cast<QComboBox*>(_url)->clear();
|
||||||
|
qobject_cast<QComboBox*>(_url)->addItems(urls);
|
||||||
|
}
|
||||||
|
_bookmarks->clear();
|
||||||
|
for (QStringList::iterator it(urls.begin()); it!=urls.end(); ++it) {
|
||||||
|
QAction* a(_bookmarks->addAction(*it));
|
||||||
|
a->setData(*it);
|
||||||
|
connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory()));
|
||||||
|
}
|
||||||
|
QStringList tabs(_settings()->value("Window/Tabs").toStringList());
|
||||||
int oldCnt(_tabs->count());
|
int oldCnt(_tabs->count());
|
||||||
for (QStringList::iterator it(tabs.begin()); it!=tabs.end(); ++it) {
|
for (QStringList::iterator it(tabs.begin()); it!=tabs.end(); ++it) {
|
||||||
LOG<<"-------------------------------------------------------------";
|
LOG<<"-------------------------------------------------------------";
|
||||||
@@ -916,116 +841,66 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
for (int i(0); i<oldCnt && _tabs->count()>1; ++i) _tabs->removeTab(0);
|
for (int i(0); i<oldCnt && _tabs->count()>1; ++i) _tabs->removeTab(0);
|
||||||
_tabs->setTabsClosable(_tabs->count()>1);
|
_tabs->setTabsClosable(_tabs->count()>1);
|
||||||
//_tabs->tabBar()->setShown(_tabs->count()>1);
|
_tabs->setCurrentIndex(_settings()->value("Window/CurrentTab").toInt());
|
||||||
_tabs->setCurrentIndex(qbrowserlib::Settings::instance()()
|
restoreGeometry(_settings()->value("Window/Geometry").toByteArray());
|
||||||
->value("Window/CurrentTab").toInt());
|
restoreState(_settings()->value("Window/WindowState").toByteArray());
|
||||||
restoreGeometry(qbrowserlib::Settings::instance()()
|
|
||||||
->value("Window/Geometry").toByteArray());
|
|
||||||
restoreState(qbrowserlib::Settings::instance()()
|
|
||||||
->value("Window/WindowState").toByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
void loadBookmarks() {
|
|
||||||
TRC; LOG<<"Loading Bookmarks ...";
|
|
||||||
QStringList urls;
|
|
||||||
if (_bookmarkfile.readable()) {
|
|
||||||
LOG<<"load from file"<<_bookmarkfile.name();
|
|
||||||
urls = _bookmarkfile.read();
|
|
||||||
} else if (qbrowserlib::Settings::instance()()) {
|
|
||||||
LOG<<"load from settings";
|
|
||||||
urls = qbrowserlib::Settings::instance()()
|
|
||||||
->value("Window/Urls").toStringList();
|
|
||||||
}
|
|
||||||
urls.removeAll("");
|
|
||||||
urls.removeDuplicates();
|
|
||||||
if (qobject_cast<QComboBox*>(_url)) {
|
|
||||||
QString ci(qobject_cast<QComboBox*>(_url)->currentText());
|
|
||||||
qobject_cast<QComboBox*>(_url)->clear();
|
|
||||||
qobject_cast<QComboBox*>(_url)->addItems(urls);
|
|
||||||
qobject_cast<QComboBox*>(_url)->lineEdit()->setText(ci);
|
|
||||||
}
|
|
||||||
if (_bookmarks) {
|
|
||||||
_bookmarks->clear();
|
|
||||||
for (QStringList::iterator it(urls.begin()); it!=urls.end(); ++it) {
|
|
||||||
QAction* a(_bookmarks->addAction(*it));
|
|
||||||
a->setData(*it);
|
|
||||||
connect(a, SIGNAL(triggered(bool)), SLOT(loadFromHistory()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//@name QWebView slots
|
//@name QWebView slots
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
void urlChanged(const QUrl& url) {
|
void urlChanged(const QUrl& url) {
|
||||||
TRC; LOG<<url.toString();
|
LOG<<url.toString();
|
||||||
if (sender()!=_tabs->currentWidget()) return;
|
if (sender()!=_tabs->currentWidget()) return;
|
||||||
LOG<<"signal on current tab";
|
LOG<<"signal on current tab";
|
||||||
if (qobject_cast<QComboBox*>(_url)) {
|
if (qobject_cast<QComboBox*>(_url))
|
||||||
qobject_cast<QComboBox*>(_url)->setEditText(url.toString());
|
qobject_cast<QComboBox*>(_url)->setEditText(url.toString());
|
||||||
qobject_cast<QComboBox*>(_url)->lineEdit()->setCursorPosition(0);
|
else
|
||||||
} else {
|
|
||||||
qobject_cast<QLineEdit*>(_url)->setText(url.toString());
|
qobject_cast<QLineEdit*>(_url)->setText(url.toString());
|
||||||
qobject_cast<QLineEdit*>(_url)->setCursorPosition(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void linkClicked(const QUrl& url) {
|
void linkClicked(const QUrl& url) {
|
||||||
TRC; LOG<<url.toString();
|
LOG<<url.toString();
|
||||||
load(url, qobject_cast<QWebView*>(sender()));
|
load(url, qobject_cast<QWebView*>(sender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void iconChanged() {
|
void iconChanged() {
|
||||||
TRC;
|
LOG;
|
||||||
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()) return _tabs->setTabIcon(index, icon);
|
if (icon.isNull()) {
|
||||||
LOG<<"icon for url is null"<<view->url();
|
LOG<<"Icon for URL is Null"<<view->url();
|
||||||
_tabs->setTabIcon(index, QWebSettings::webGraphic
|
QPixmap pixmap(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) {
|
||||||
TRC; LOG<<text;
|
LOG<<text;
|
||||||
_tabs->setTabText(_tabs->indexOf(qobject_cast<QWidget*>(sender())),
|
_tabs->setTabText(_tabs->indexOf(qobject_cast<QWidget*>(sender())),
|
||||||
trUtf8("%1").arg(text));
|
trUtf8("%1").arg(text));
|
||||||
resetWindowTitle();
|
|
||||||
}
|
|
||||||
|
|
||||||
void resetWindowTitle() {
|
|
||||||
if (qobject_cast<QWebView*>(_tabs->currentWidget()))
|
|
||||||
setWindowTitle(trUtf8("[%1] - %2 - SwissBrowser (%3)",
|
|
||||||
"main window title "
|
|
||||||
"%1 = host name "
|
|
||||||
"%2 = page title "
|
|
||||||
"%3 = number of open tabs")
|
|
||||||
.arg((qobject_cast<QWebView*>(_tabs->currentWidget())
|
|
||||||
->url().host()))
|
|
||||||
.arg((qobject_cast<QWebView*>(_tabs->currentWidget())
|
|
||||||
->title()))
|
|
||||||
.arg(_tabs->count()));
|
|
||||||
else
|
|
||||||
setWindowTitle(trUtf8("SwissBrowser", "window title with no tab"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void statusBarMessage(const QString& text) {
|
void statusBarMessage(const QString& text) {
|
||||||
TRC; LOG<<text;
|
LOG<<text;
|
||||||
if (text.size()) statusBar()->showMessage(tr("Info: %1").arg(text));
|
if (text.size()) statusBar()->showMessage(tr("Info: %1").arg(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadProgress(int i) {
|
void loadProgress(int i) {
|
||||||
TRC; LOG<<i;
|
LOG<<i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadStarted() {
|
void loadStarted() {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void loadFinished(bool ok) {
|
void loadFinished(bool ok) {
|
||||||
TRC; LOG<<(ok?"success":"error");
|
LOG<<(ok?"success":"error");
|
||||||
QSize sz(qobject_cast<QWebView*>(_tabs->currentWidget())->size());
|
QSize sz(qobject_cast<QWebView*>(_tabs->currentWidget())->size());
|
||||||
qobject_cast<QWebView*>(_tabs->currentWidget())->resize(0,0);
|
qobject_cast<QWebView*>(_tabs->currentWidget())->resize(0,0);
|
||||||
qobject_cast<QWebView*>(_tabs->currentWidget())->resize(sz);
|
qobject_cast<QWebView*>(_tabs->currentWidget())->resize(sz);
|
||||||
@@ -1042,215 +917,215 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
//@{
|
//@{
|
||||||
|
|
||||||
void triggeredOpenLink(bool) {
|
void triggeredOpenLink(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredOpenLinkInNewWindow(bool) {
|
void triggeredOpenLinkInNewWindow(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredOpenFrameInNewWindow(bool) {
|
void triggeredOpenFrameInNewWindow(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredDownloadLinkToDisk(bool) {
|
void triggeredDownloadLinkToDisk(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredCopyLinkToClipboard(bool) {
|
void triggeredCopyLinkToClipboard(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredOpenImageInNewWindow(bool) {
|
void triggeredOpenImageInNewWindow(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredDownloadImageToDisk(bool) {
|
void triggeredDownloadImageToDisk(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredCopyImageToClipboard(bool) {
|
void triggeredCopyImageToClipboard(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredBack(bool) {
|
void triggeredBack(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredForward(bool) {
|
void triggeredForward(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredStop(bool) {
|
void triggeredStop(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredReload(bool) {
|
void triggeredReload(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredCut(bool) {
|
void triggeredCut(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredCopy(bool) {
|
void triggeredCopy(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredPaste(bool) {
|
void triggeredPaste(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredUndo(bool) {
|
void triggeredUndo(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredRedo(bool) {
|
void triggeredRedo(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToNextChar(bool) {
|
void triggeredMoveToNextChar(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToPreviousChar(bool) {
|
void triggeredMoveToPreviousChar(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToNextWord(bool) {
|
void triggeredMoveToNextWord(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToPreviousWord(bool) {
|
void triggeredMoveToPreviousWord(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToNextLine(bool) {
|
void triggeredMoveToNextLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToPreviousLine(bool) {
|
void triggeredMoveToPreviousLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToStartOfLine(bool) {
|
void triggeredMoveToStartOfLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToEndOfLine(bool) {
|
void triggeredMoveToEndOfLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToStartOfBlock(bool) {
|
void triggeredMoveToStartOfBlock(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToEndOfBlock(bool) {
|
void triggeredMoveToEndOfBlock(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToStartOfDocument(bool) {
|
void triggeredMoveToStartOfDocument(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredMoveToEndOfDocument(bool) {
|
void triggeredMoveToEndOfDocument(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectNextChar(bool) {
|
void triggeredSelectNextChar(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectPreviousChar(bool) {
|
void triggeredSelectPreviousChar(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectNextWord(bool) {
|
void triggeredSelectNextWord(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectPreviousWord(bool) {
|
void triggeredSelectPreviousWord(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectNextLine(bool) {
|
void triggeredSelectNextLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectPreviousLine(bool) {
|
void triggeredSelectPreviousLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectStartOfLine(bool) {
|
void triggeredSelectStartOfLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectEndOfLine(bool) {
|
void triggeredSelectEndOfLine(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectStartOfBlock(bool) {
|
void triggeredSelectStartOfBlock(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectEndOfBlock(bool) {
|
void triggeredSelectEndOfBlock(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectStartOfDocument(bool) {
|
void triggeredSelectStartOfDocument(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectEndOfDocument(bool) {
|
void triggeredSelectEndOfDocument(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredDeleteStartOfWord(bool) {
|
void triggeredDeleteStartOfWord(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredDeleteEndOfWord(bool) {
|
void triggeredDeleteEndOfWord(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSetTextDirectionDefault(bool) {
|
void triggeredSetTextDirectionDefault(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSetTextDirectionLeftToRight(bool) {
|
void triggeredSetTextDirectionLeftToRight(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSetTextDirectionRightToLeft(bool) {
|
void triggeredSetTextDirectionRightToLeft(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredToggleBold(bool) {
|
void triggeredToggleBold(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredToggleItalic(bool) {
|
void triggeredToggleItalic(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredToggleUnderline(bool) {
|
void triggeredToggleUnderline(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredInspectElement(bool) {
|
void triggeredInspectElement(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredInsertParagraphSeparator(bool) {
|
void triggeredInsertParagraphSeparator(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredInsertLineSeparator(bool) {
|
void triggeredInsertLineSeparator(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void triggeredSelectAll(bool) {
|
void triggeredSelectAll(bool) {
|
||||||
TRC; LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
LOG<<qobject_cast<QAction*>(sender())->data().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
@@ -1259,111 +1134,117 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
//@{
|
//@{
|
||||||
|
|
||||||
void contentsChanged() {
|
void contentsChanged() {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void databaseQuotaExceeded(QWebFrame* frame, QString databaseName) {
|
void databaseQuotaExceeded(QWebFrame* frame, QString databaseName) {
|
||||||
TRC; LOG<<databaseName;
|
LOG<<databaseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void downloadRequested(const QNetworkRequest& request) {
|
void downloadRequested(const QNetworkRequest& request) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void frameCreated(QWebFrame* frame) {
|
void frameCreated(QWebFrame* frame) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void geometryChangeRequested(const QRect& geom) {
|
void geometryChangeRequested(const QRect& geom) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void linkClicked(const QUrl& url) {
|
// void linkClicked(const QUrl& url) {
|
||||||
// TRC; LOG<<url.toString();
|
// LOG<<url.toString();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void linkHovered(const QString& link, const QString& title,
|
void linkHovered(const QString& link, const QString& title,
|
||||||
const QString& textContent) {
|
const QString& textContent) {
|
||||||
TRC; LOG<<link<<title<<textContent;
|
LOG<<link<<title<<textContent;
|
||||||
statusBar()->showMessage(tr("%1", "statusbar for hovered link %1=url")
|
statusBar()->showMessage(tr("%1", "statusbar for hovered link %1=url")
|
||||||
.arg(link));
|
.arg(link));
|
||||||
}
|
}
|
||||||
|
|
||||||
// void loadFinished(bool ok) {
|
// void loadFinished(bool ok) {
|
||||||
// TRC; LOG<<(ok?"succeess":"error");
|
// LOG<<(ok?"succeess":"error");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// void loadProgress(int progress) {
|
// void loadProgress(int progress) {
|
||||||
// TRC; LOG<<progress;
|
// LOG<<progress;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// void loadStarted() {
|
// void loadStarted() {
|
||||||
// TRC;
|
// LOG;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void menuBarVisibilityChangeRequested(bool visible) {
|
void menuBarVisibilityChangeRequested(bool visible) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void microFocusChanged() {
|
void microFocusChanged() {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printRequested(QWebFrame* frame) {
|
void printRequested(QWebFrame* frame) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void repaintRequested(const QRect& dirtyRect) {
|
void repaintRequested(const QRect& dirtyRect) {
|
||||||
//TRC;
|
//LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void restoreFrameStateRequested(QWebFrame* frame) {
|
void restoreFrameStateRequested(QWebFrame* frame) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item) {
|
void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollRequested(int dx, int dy, const QRect& rectToScroll) {
|
void scrollRequested(int dx, int dy, const QRect& rectToScroll) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectionChanged() {
|
void selectionChanged() {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void statusBarMessage(const QString& text) {
|
// void statusBarMessage(const QString& text) {
|
||||||
// TRC;
|
// LOG;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void statusBarVisibilityChangeRequested(bool visible) {
|
void statusBarVisibilityChangeRequested(bool visible) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void toolBarVisibilityChangeRequested(bool visible) {
|
void toolBarVisibilityChangeRequested(bool visible) {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@name handle downloads
|
//@name handle downloads
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
void unsupportedContent(QNetworkReply* reply) {
|
void unsupportedContent(QNetworkReply* reply) {
|
||||||
TRC; LOG<<reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
LOG<<reply->header(QNetworkRequest::ContentTypeHeader).toString();
|
||||||
LOG<<"Status:"<<_downloadManager->networkError(reply->error());
|
LOG<<"Status:"<<_downloadManager.networkError(reply->error());
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
|
|
||||||
QList<QNetworkReply::RawHeaderPair> rh(reply->rawHeaderPairs());
|
QList<QNetworkReply::RawHeaderPair> rh(reply->rawHeaderPairs());
|
||||||
for(QList<QNetworkReply::RawHeaderPair>::iterator it(rh.begin());
|
for(QList<QNetworkReply::RawHeaderPair>::iterator it(rh.begin());
|
||||||
it!=rh.end(); ++it) {
|
it!=rh.end(); ++it) {
|
||||||
LOG<<"RawHeader:"<<it->first<<it->second;
|
LOG<<"RawHeader:"<<it->first<<it->second;
|
||||||
}
|
}
|
||||||
#endif
|
if (reply->isFinished())
|
||||||
|
handleContent(reply);
|
||||||
|
else
|
||||||
|
assert(connect(reply, SIGNAL(finished()), SLOT(downloadFinished())));
|
||||||
|
}
|
||||||
|
|
||||||
|
void downloadFinished() {
|
||||||
|
LOG;
|
||||||
|
QNetworkReply *reply(qobject_cast<QNetworkReply*>(sender()));
|
||||||
handleContent(reply);
|
handleContent(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! check and handle content that is defined in settings
|
//! check and handle content that is defined in settings
|
||||||
void metaDataChanged(QNetworkReply* reply) {
|
void metaDataChanged(QNetworkReply* reply) {
|
||||||
TRC;
|
|
||||||
QString filename
|
QString filename
|
||||||
(QString::fromUtf8(reply->rawHeader("Content-Disposition")));
|
(QString::fromUtf8(reply->rawHeader("Content-Disposition")));
|
||||||
if (filename.contains
|
if (filename.contains
|
||||||
@@ -1381,37 +1262,107 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
LOG<<"Filename:"<<filename;
|
LOG<<"Filename:"<<filename;
|
||||||
QStringList type
|
QStringList type
|
||||||
(qbrowserlib::Settings::instance().mimetype
|
(_settings.mimetype
|
||||||
(reply->header(QNetworkRequest::ContentTypeHeader).toString(),
|
(reply->header(QNetworkRequest::ContentTypeHeader).toString(),
|
||||||
filename));
|
filename));
|
||||||
|
if (!type.isEmpty()) unsupportedContent(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleContent(QNetworkReply* reply) {
|
void handleContent(QNetworkReply* reply) {
|
||||||
TRC; LOG<<"Location:"<<reply->header(QNetworkRequest::LocationHeader)
|
LOG<<"Location:"<<reply->header(QNetworkRequest::LocationHeader)
|
||||||
.toString();
|
.toString();
|
||||||
LOG<<"Content-Type:"<<reply->header(QNetworkRequest::ContentTypeHeader)
|
LOG<<"Content-Type:"<<reply->header(QNetworkRequest::ContentTypeHeader)
|
||||||
.toString();
|
.toString();
|
||||||
LOG<<"Content-Disposition:"<<reply->rawHeader("Content-Disposition");
|
LOG<<"Content-Disposition:"<<reply->rawHeader("Content-Disposition");
|
||||||
LOG<<"Status:"<<_downloadManager->networkError(reply->error());
|
LOG<<"Status:"<<_downloadManager.networkError(reply->error());
|
||||||
LOG<<"URL:"<<reply->url().toString();
|
LOG<<"URL:"<<reply->url().toString();
|
||||||
LOG<<"File:"<<reply->url().toLocalFile();
|
LOG<<"File:"<<reply->url().toLocalFile();
|
||||||
LOG<<"Path:"<<reply->url().path();
|
LOG<<"Path:"<<reply->url().path();
|
||||||
if (reply->error()!=QNetworkReply::NoError) {
|
if (reply->error()!=QNetworkReply::NoError) {
|
||||||
LOG<<"Error:"<<_downloadManager->networkError(reply->error());
|
LOG<<"Error:"<<_downloadManager.networkError(reply->error());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
statusBar()->showMessage(tr("handling content ..."), 5000);
|
QString filename
|
||||||
LOG<<"Show SaveOrRunDialog";
|
(QString::fromUtf8(reply->rawHeader("Content-Disposition")));
|
||||||
qbrowserlib::SaveOrRunDialog dlg
|
if (filename.contains
|
||||||
(reply, reply->header(QNetworkRequest::ContentTypeHeader).toString(),
|
(QRegExp("^\\s*attachment\\s*;\\s*filename\\s*=\\s*\"[^\"]+\""))) {
|
||||||
reply->url().host(), _kiosk, this);
|
LOG<<"From Content-Disposition";
|
||||||
if (!dlg.handlePreconfigured()) dlg.exec();
|
filename = filename.replace
|
||||||
|
(QRegExp("^\\s*attachment\\s*;\\s*filename\\s*=\\s*\"([^\"]+)\".*"),
|
||||||
|
"\\1");
|
||||||
|
} else {
|
||||||
|
LOG<<"From path";
|
||||||
|
filename =
|
||||||
|
QFileInfo(!reply->url().toLocalFile().isEmpty()
|
||||||
|
?reply->url().toLocalFile()
|
||||||
|
:reply->url().path()).fileName();
|
||||||
|
}
|
||||||
|
LOG<<"Filename:"<<filename;
|
||||||
|
QStringList type
|
||||||
|
(_settings.mimetype
|
||||||
|
(reply->header(QNetworkRequest::ContentTypeHeader).toString(),
|
||||||
|
filename));
|
||||||
|
if (!type.isEmpty()) {
|
||||||
|
filename.replace(QRegExp("^(.*)\\."+type.at(0)+"$"),
|
||||||
|
"\\1"); // remove extension
|
||||||
|
run(reply, filename+"."+type.at(0), type.at(1));
|
||||||
|
} else {
|
||||||
|
SaveOrRunDialog choice(_kiosk, this);
|
||||||
|
choice.setup(filename,
|
||||||
|
reply->header(QNetworkRequest::ContentTypeHeader)
|
||||||
|
.toString(),
|
||||||
|
reply->url().host());
|
||||||
|
if (choice.exec()==QDialog::Accepted) {
|
||||||
|
if (choice.save()) {
|
||||||
|
QFile file(choice.sor()->filename());
|
||||||
|
file.open(QIODevice::WriteOnly);
|
||||||
|
file.write(reply->readAll());
|
||||||
|
file.close();
|
||||||
|
} else if (choice.run()) {
|
||||||
|
run(reply, filename, choice.sor()->program()+" %1");
|
||||||
|
} else {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void run(QNetworkReply* reply, QString filename, QString command) {
|
||||||
|
TemporaryFile *file(new TemporaryFile
|
||||||
|
(QDir::tempPath()+QDir::separator()
|
||||||
|
+filename));
|
||||||
|
file->open();
|
||||||
|
reply->seek(0);
|
||||||
|
file->write(reply->readAll());
|
||||||
|
file->close();
|
||||||
|
LOG<<"Stored as:"<<file->fileName();
|
||||||
|
statusBar()->showMessage(tr("launching application ..."), 5000);
|
||||||
|
QProcess* process(new QProcess);
|
||||||
|
_downloadProcesses[process] = file;
|
||||||
|
assert(connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||||
|
SLOT(processFinished())));
|
||||||
|
QStringList args(command.split(" ")
|
||||||
|
.replaceInStrings("%1", file->fileName()));
|
||||||
|
QString prg(args.takeFirst());
|
||||||
|
LOG<<"Running:"<<prg<<args.join(" ");
|
||||||
|
process->start(prg, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
void processFinished() {
|
||||||
|
LOG;
|
||||||
|
if (_downloadProcesses.find(qobject_cast<QProcess*>(sender()))
|
||||||
|
== _downloadProcesses.end()) return;
|
||||||
|
if (_downloadProcesses[qobject_cast<QProcess*>(sender())])
|
||||||
|
_downloadProcesses[qobject_cast<QProcess*>(sender())]
|
||||||
|
->setAutoRemove(true);
|
||||||
|
delete _downloadProcesses[qobject_cast<QProcess*>(sender())];
|
||||||
|
_downloadProcesses.erase(qobject_cast<QProcess*>(sender()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
void windowCloseRequested() {
|
void windowCloseRequested() {
|
||||||
TRC;
|
LOG;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
@@ -1425,29 +1376,38 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void started() {
|
void started() {
|
||||||
actionStop->setVisible(true);
|
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
|
||||||
actionReload->setVisible(false);
|
if (_quirks) {
|
||||||
|
actionStop->setEnabled(true);
|
||||||
|
} 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() {
|
||||||
TRC;
|
LOG;
|
||||||
actionStop->setVisible(false);
|
QApplication::restoreOverrideCursor();
|
||||||
actionReload->setVisible(true);
|
if (_quirks) {
|
||||||
|
actionStop->setEnabled(false);
|
||||||
|
} 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void finished(QNetworkReply *r) {
|
void finished(QNetworkReply *r) {
|
||||||
TRC;
|
LOG;
|
||||||
if (r->error()!=QNetworkReply::NoError &&
|
if (r->error()!=QNetworkReply::NoError &&
|
||||||
r->error()!=QNetworkReply::OperationCanceledError) {
|
r->error()!=QNetworkReply::OperationCanceledError) {
|
||||||
statusBar()->showMessage
|
statusBar()->showMessage(DownloadManager::networkError(r->error()));
|
||||||
(qbrowserlib::DownloadManager::networkError(r->error()));
|
|
||||||
badUrl();
|
badUrl();
|
||||||
if (!_showErrorLog) {
|
if (!_showErrorLog) {
|
||||||
statusBar()->addPermanentWidget
|
statusBar()->addPermanentWidget
|
||||||
@@ -1461,13 +1421,13 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void errorReset() {
|
void errorReset() {
|
||||||
TRC;
|
LOG;
|
||||||
_showErrorLog->hide();
|
_showErrorLog->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void badUrl() {
|
void badUrl() {
|
||||||
if (qobject_cast<QComboBox*>(_url))
|
if (qobject_cast<QComboBox*>(_url))
|
||||||
dynamic_cast<qbrowserlib::ButtonLineEdit*>
|
dynamic_cast<ButtonLineEdit*>
|
||||||
(qobject_cast<QComboBox*>(_url)->lineEdit())
|
(qobject_cast<QComboBox*>(_url)->lineEdit())
|
||||||
->changeStyleSheet(tr("background-color: #F77", "invalid url"));
|
->changeStyleSheet(tr("background-color: #F77", "invalid url"));
|
||||||
else
|
else
|
||||||
@@ -1477,7 +1437,7 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
|
|
||||||
void goodUrl() {
|
void goodUrl() {
|
||||||
if (qobject_cast<QComboBox*>(_url))
|
if (qobject_cast<QComboBox*>(_url))
|
||||||
dynamic_cast<qbrowserlib::ButtonLineEdit*>
|
dynamic_cast<ButtonLineEdit*>
|
||||||
(qobject_cast<QComboBox*>(_url)->lineEdit())
|
(qobject_cast<QComboBox*>(_url)->lineEdit())
|
||||||
->changeStyleSheet(tr("background-color: white", "valid url"));
|
->changeStyleSheet(tr("background-color: white", "valid url"));
|
||||||
else
|
else
|
||||||
@@ -1486,7 +1446,7 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void downloadError(QString error) {
|
void downloadError(QString error) {
|
||||||
qbrowserlib::ErrorLog::instance().append(error);
|
_errorLog.append(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
@@ -1496,14 +1456,19 @@ class Browser: public QMainWindow, protected Ui::Browser {
|
|||||||
|
|
||||||
void authenticationRequired(QNetworkReply* reply,
|
void authenticationRequired(QNetworkReply* reply,
|
||||||
QAuthenticator* authenticator) {
|
QAuthenticator* authenticator) {
|
||||||
TRC; LOG<<reply->url().toString()<<authenticator->realm();
|
LOG<<reply->url().toString()<<authenticator->realm();
|
||||||
statusBar()->showMessage(tr("authentication required"));
|
statusBar()->showMessage(tr("authentication required"));
|
||||||
Authentication auth(authenticator, this);
|
Authentication auth(authenticator, this);
|
||||||
if (auth.exec()==QDialog::Rejected) reply->abort();
|
if (auth.exec()==QDialog::Rejected) reply->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void proxyAuthenticationRequired(const QNetworkProxy& proxy,
|
||||||
|
QAuthenticator* authenticator) {
|
||||||
|
LOG;
|
||||||
|
}
|
||||||
|
|
||||||
void sslErrors(QNetworkReply* reply, const QList<QSslError>& errors) {
|
void sslErrors(QNetworkReply* reply, const QList<QSslError>& errors) {
|
||||||
TRC;
|
LOG;
|
||||||
statusBar()->showMessage(tr("ssl error"));
|
statusBar()->showMessage(tr("ssl error"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1526,27 +1491,78 @@ 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;
|
||||||
qbrowserlib::ButtonLineEdit* _find;
|
ButtonLineEdit* _find;
|
||||||
QSlider* _zoom;
|
QSlider* _zoom;
|
||||||
QProgressBar* _progress;
|
QProgressBar* _progress;
|
||||||
QString _home;
|
QString _home;
|
||||||
bool _kiosk;
|
bool _kiosk;
|
||||||
QPrinter _printer;
|
QPrinter _printer;
|
||||||
SslClientAuthNetworkAccessManager _networkManager;
|
SslClientAuthNetworkAccessManager _networkManager;
|
||||||
QSharedPointer<qbrowserlib::DownloadManager> _downloadManager;
|
DownloadManager _downloadManager;
|
||||||
|
typedef std::map<QProcess*, TemporaryFile*> DownloadProcesses;
|
||||||
|
DownloadProcesses _downloadProcesses;
|
||||||
|
Settings _settings;
|
||||||
|
ErrorLog _errorLog;
|
||||||
LoginCertificate _logincertificate;
|
LoginCertificate _logincertificate;
|
||||||
gui::Proxy _proxy;
|
gui::Proxy _proxy;
|
||||||
QPushButton* _showErrorLog;
|
QPushButton* _showErrorLog;
|
||||||
std::auto_ptr<EditBookmarks> _editbookmarks;
|
std::auto_ptr<EditBookmarks> _editbookmarks;
|
||||||
bool _startUrl;
|
bool _startUrl;
|
||||||
bool _quirks;
|
bool _quirks;
|
||||||
qbrowserlib::ButtonLineEdit* _search;
|
ButtonLineEdit* _search;
|
||||||
QComboBox* _searchEngines;
|
QComboBox* _searchEngines;
|
||||||
FileStorage _bookmarkfile;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @}
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -11,11 +11,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>SwissBrowser</string>
|
<string>SwissSurfer</string>
|
||||||
</property>
|
|
||||||
<property name="windowIcon">
|
|
||||||
<iconset resource="resources.qrc">
|
|
||||||
<normaloff>:/icons/32x32/swissbrowser.png</normaloff>:/icons/32x32/swissbrowser.png</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
@@ -70,7 +66,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1009</width>
|
<width>1009</width>
|
||||||
<height>25</height>
|
<height>23</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menuDatei">
|
<widget class="QMenu" name="menuDatei">
|
||||||
@@ -115,7 +111,6 @@
|
|||||||
<addaction name="actionLoginCertificate"/>
|
<addaction name="actionLoginCertificate"/>
|
||||||
<addaction name="actionErrorLog"/>
|
<addaction name="actionErrorLog"/>
|
||||||
<addaction name="actionAbout"/>
|
<addaction name="actionAbout"/>
|
||||||
<addaction name="actionDebugLog"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="_bookmarks">
|
<widget class="QMenu" name="_bookmarks">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@@ -134,7 +129,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_02.png</normaloff>:/icons/32x32/butt32_02.png</iconset>
|
<normaloff>:/icons/reload</normaloff>:/icons/reload</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>neu laden</string>
|
<string>neu laden</string>
|
||||||
@@ -149,7 +144,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_05.png</normaloff>:/icons/32x32/butt32_05.png</iconset>
|
<normaloff>:/icons/stop</normaloff>:/icons/stop</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>stoppen</string>
|
<string>stoppen</string>
|
||||||
@@ -164,13 +159,13 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_03.png</normaloff>:/icons/32x32/butt32_03.png</iconset>
|
<normaloff>:/icons/back</normaloff>:/icons/back</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>zurückkehren</string>
|
<string>zurückkehren</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Alt+Left</string>
|
<string notr="true">Alt+Left</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcutContext">
|
<property name="shortcutContext">
|
||||||
<enum>Qt::WindowShortcut</enum>
|
<enum>Qt::WindowShortcut</enum>
|
||||||
@@ -182,13 +177,13 @@
|
|||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_04.png</normaloff>:/icons/32x32/butt32_04.png</iconset>
|
<normaloff>:/icons/forward</normaloff>:/icons/forward</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>weitergehen</string>
|
<string>weitergehen</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Alt+Right</string>
|
<string notr="true">Alt+Right</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcutContext">
|
<property name="shortcutContext">
|
||||||
<enum>Qt::WindowShortcut</enum>
|
<enum>Qt::WindowShortcut</enum>
|
||||||
@@ -197,7 +192,7 @@
|
|||||||
<action name="actionHome">
|
<action name="actionHome">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_01.png</normaloff>:/icons/32x32/butt32_01.png</iconset>
|
<normaloff>:/icons/gohome</normaloff>:/icons/gohome</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Startseite</string>
|
<string>Startseite</string>
|
||||||
@@ -211,7 +206,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionNew">
|
<action name="actionNew">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/newwindow</normaloff>:/icons/newwindow</iconset>
|
<normaloff>:/icons/newwindow</normaloff>:/icons/newwindow</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -226,7 +221,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionClose">
|
<action name="actionClose">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
|
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -235,7 +230,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionProxySettings">
|
<action name="actionProxySettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/settings</normaloff>:/icons/settings</iconset>
|
<normaloff>:/icons/settings</normaloff>:/icons/settings</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -244,7 +239,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionPrint">
|
<action name="actionPrint">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/print</normaloff>:/icons/print</iconset>
|
<normaloff>:/icons/print</normaloff>:/icons/print</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -253,7 +248,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionPrintPreview">
|
<action name="actionPrintPreview">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/printpreview</normaloff>:/icons/printpreview</iconset>
|
<normaloff>:/icons/printpreview</normaloff>:/icons/printpreview</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -262,7 +257,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionInstantPrint">
|
<action name="actionInstantPrint">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/print</normaloff>:/icons/print</iconset>
|
<normaloff>:/icons/print</normaloff>:/icons/print</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -290,7 +285,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionNewTab">
|
<action name="actionNewTab">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/newtab</normaloff>:/icons/newtab</iconset>
|
<normaloff>:/icons/newtab</normaloff>:/icons/newtab</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -305,7 +300,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionFind">
|
<action name="actionFind">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/find</normaloff>:/icons/find</iconset>
|
<normaloff>:/icons/find</normaloff>:/icons/find</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -320,7 +315,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionUnFind">
|
<action name="actionUnFind">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
|
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -332,7 +327,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionAbout">
|
<action name="actionAbout">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/about</normaloff>:/icons/about</iconset>
|
<normaloff>:/icons/about</normaloff>:/icons/about</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -344,7 +339,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionSettings">
|
<action name="actionSettings">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/settings</normaloff>:/icons/settings</iconset>
|
<normaloff>:/icons/settings</normaloff>:/icons/settings</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -356,7 +351,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionReverseFind">
|
<action name="actionReverseFind">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/find</normaloff>:/icons/find</iconset>
|
<normaloff>:/icons/find</normaloff>:/icons/find</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -368,7 +363,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionErrorLog">
|
<action name="actionErrorLog">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/error</normaloff>:/icons/error</iconset>
|
<normaloff>:/icons/error</normaloff>:/icons/error</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -380,7 +375,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionLoginCertificate">
|
<action name="actionLoginCertificate">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/usercert</normaloff>:/icons/usercert</iconset>
|
<normaloff>:/icons/usercert</normaloff>:/icons/usercert</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -389,7 +384,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionProxy">
|
<action name="actionProxy">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/settings</normaloff>:/icons/settings</iconset>
|
<normaloff>:/icons/settings</normaloff>:/icons/settings</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -399,7 +394,7 @@
|
|||||||
<action name="actionClearLocation">
|
<action name="actionClearLocation">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_06.png</normaloff>:/icons/32x32/butt32_06.png</iconset>
|
<normaloff>:/icons/clearlocation</normaloff>:/icons/clearlocation</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Clear Location</string>
|
<string>Clear Location</string>
|
||||||
@@ -411,7 +406,7 @@
|
|||||||
<action name="actionAddBookmark">
|
<action name="actionAddBookmark">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_08.png</normaloff>:/icons/32x32/butt32_08.png</iconset>
|
<normaloff>:/icons/addbookmark</normaloff>:/icons/addbookmark</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add Bookmark</string>
|
<string>Add Bookmark</string>
|
||||||
@@ -424,13 +419,17 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionEditBookmarks">
|
<action name="actionEditBookmarks">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources.qrc">
|
||||||
|
<normaloff>:/icons/addbookmark</normaloff>:/icons/addbookmark</iconset>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Bookmarks</string>
|
<string>&Bookmarks</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionClearFind">
|
<action name="actionClearFind">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/clearlocation</normaloff>:/icons/clearlocation</iconset>
|
<normaloff>:/icons/clearlocation</normaloff>:/icons/clearlocation</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -442,7 +441,7 @@
|
|||||||
</action>
|
</action>
|
||||||
<action name="actionCloseTab">
|
<action name="actionCloseTab">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset>
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
|
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -465,7 +464,7 @@
|
|||||||
<action name="actionSearch">
|
<action name="actionSearch">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/16x16/butt16_49.png</normaloff>:/icons/16x16/butt16_49.png</iconset>
|
<normaloff>:/icons/find</normaloff>:/icons/find</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Search</string>
|
<string>Search</string>
|
||||||
@@ -474,17 +473,12 @@
|
|||||||
<action name="actionClearSearch">
|
<action name="actionClearSearch">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset resource="resources.qrc">
|
||||||
<normaloff>:/icons/32x32/butt32_06.png</normaloff>:/icons/32x32/butt32_06.png</iconset>
|
<normaloff>:/icons/clearlocation</normaloff>:/icons/clearlocation</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Clear Search</string>
|
<string>Clear Search</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionDebugLog">
|
|
||||||
<property name="text">
|
|
||||||
<string>Debug Log</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="resources.qrc"/>
|
<include location="resources.qrc"/>
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB |
@@ -1,15 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#include <buttonlineeditwidgetifc.hxx>
|
|
||||||
|
|
||||||
//! @defgroup designer
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2(buttonlineedit, ButtonLineEditWidgetIfc);
|
|
||||||
|
|
||||||
//! @}
|
|
@@ -1,87 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __BUTTONLINEEDITWIDGETIFC_HXX
|
|
||||||
#define __BUTTONLINEEDITWIDGETIFC_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/buttonlineedit.hxx>
|
|
||||||
#include <QtDesigner>
|
|
||||||
|
|
||||||
//! @defgroup designer
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
//! Buttonlineedit widget for Qt Designer
|
|
||||||
class ButtonLineEditWidgetIfc: public QObject,
|
|
||||||
public QDesignerCustomWidgetInterface {
|
|
||||||
Q_OBJECT;
|
|
||||||
Q_INTERFACES(QDesignerCustomWidgetInterface);
|
|
||||||
public:
|
|
||||||
bool isContainer() const {
|
|
||||||
TRC;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
QIcon icon() const {
|
|
||||||
TRC;
|
|
||||||
return QIcon(":/icons/buttonlineedit.png");
|
|
||||||
}
|
|
||||||
QString domXml() const {
|
|
||||||
TRC;
|
|
||||||
return
|
|
||||||
QString
|
|
||||||
("<ui language=\"c++\" displayname=\"%2\">"
|
|
||||||
" <widget class=\"%1\" name=\"%3\"/>"
|
|
||||||
" <customwidgets>"
|
|
||||||
" <customwidget>"
|
|
||||||
" <class>%1</class>"
|
|
||||||
" </customwidget>"
|
|
||||||
" </customwidgets>"
|
|
||||||
"</ui>")
|
|
||||||
.arg(name())
|
|
||||||
.arg(className())
|
|
||||||
.arg(className().toLower());
|
|
||||||
}
|
|
||||||
QString group() const {
|
|
||||||
TRC;
|
|
||||||
return "Input Widgets";
|
|
||||||
}
|
|
||||||
QString includeFile() const {
|
|
||||||
TRC;
|
|
||||||
return "qbrowserlib/buttonlineedit.hxx";
|
|
||||||
}
|
|
||||||
QString namespaceName() const {
|
|
||||||
TRC;
|
|
||||||
return "qbrowserlib";
|
|
||||||
}
|
|
||||||
QString className() const {
|
|
||||||
TRC;
|
|
||||||
return "ButtonLineEdit";
|
|
||||||
}
|
|
||||||
QString name() const {
|
|
||||||
TRC;
|
|
||||||
return QString("%1::%2").arg(namespaceName()).arg(className());
|
|
||||||
}
|
|
||||||
QString toolTip() const {
|
|
||||||
TRC;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
QString whatsThis() const {
|
|
||||||
TRC;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
QWidget *createWidget(QWidget *parent) {
|
|
||||||
TRC;
|
|
||||||
return new qbrowserlib::ButtonLineEdit(parent);
|
|
||||||
}
|
|
||||||
bool isInitialized() {
|
|
||||||
TRC;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
#endif
|
|
@@ -1,99 +0,0 @@
|
|||||||
## @file
|
|
||||||
##
|
|
||||||
## $Id: makefile.am 7 2010-03-01 14:55:44Z marc $
|
|
||||||
##
|
|
||||||
## 1 2 3 4 5 6 7 8
|
|
||||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
include_HEADERS =
|
|
||||||
|
|
||||||
if !MINGW32
|
|
||||||
if MAC
|
|
||||||
AM_CPPFLAGS += -I/opt/local/include
|
|
||||||
# -I/Library/OpenSC/include
|
|
||||||
AM_LDFLAGS = -L/opt/local/lib
|
|
||||||
# -F/System/Library/Frameworks/PCSC.framework
|
|
||||||
else
|
|
||||||
# AM_CPPFLAGS += -I/usr/include/PCSC
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST = @srcdir@/*.[ch]xx @srcdir@/*.qrc.in @srcdir@/*.png
|
|
||||||
# @srcdir@/*.ui
|
|
||||||
|
|
||||||
#LANGS = en de fr it
|
|
||||||
ALL_SRC = @srcdir@/*.[ch]xx \
|
|
||||||
*.qrc
|
|
||||||
# @srcdir@/*.ui
|
|
||||||
|
|
||||||
QMAKE_PROJECT = qmake.pro
|
|
||||||
|
|
||||||
QMAKE_TARGET = qbrowserlib-swisswebview qbrowserlib-buttonlineedit \
|
|
||||||
qbrowserlib-swisswebwidget
|
|
||||||
TARGETS = ${QMAKE_TARGET}
|
|
||||||
QMAKE_MAKEFILE = ${QMAKE_TARGET:%=makefile.qmake.%}
|
|
||||||
|
|
||||||
all: ${TARGETS} $
|
|
||||||
#$(LANGS:%=@PACKAGENAME@_%.ts)
|
|
||||||
|
|
||||||
rebuild-ts: $(LANGS)
|
|
||||||
${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
|
|
||||||
|
|
||||||
# ${LANGS}: ${ALL_SRC}
|
|
||||||
# -rm @PACKAGENAME@_$@.qm
|
|
||||||
# svn revert @PACKAGENAME@_$@.ts
|
|
||||||
# mv @PACKAGENAME@_$@.ts translation.old
|
|
||||||
# ${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
|
|
||||||
# mv @PACKAGENAME@_$@.ts translation.new
|
|
||||||
# echo '<?xml version="1.0" encoding="utf-8"?>' > @PACKAGENAME@_$@.ts
|
|
||||||
# echo '<!DOCTYPE TS>' >> @PACKAGENAME@_$@.ts
|
|
||||||
# echo '<TS version="2.0" language="'$@'">' >> @PACKAGENAME@_$@.ts
|
|
||||||
# xqilla merge-translation.xquery >> @PACKAGENAME@_$@.ts
|
|
||||||
# echo '</TS>' >> @PACKAGENAME@_$@.ts
|
|
||||||
# rm translation.old translation.new
|
|
||||||
|
|
||||||
print:
|
|
||||||
@echo "LANGS=${LANGS}"
|
|
||||||
@echo "ALL_SRC=${ALL_SRC}"
|
|
||||||
@echo "QMAKE=${QMAKE}"
|
|
||||||
@echo "QMAKE_OPTIONS=${QMAKE_OPTIONS}"
|
|
||||||
@echo "QMAKE_MAKEFILE=${QMAKE_MAKEFILE}"
|
|
||||||
@echo "QMAKE_TARGET=${QMAKE_TARGET}"
|
|
||||||
@echo "TARGETS=${TARGETS}"
|
|
||||||
|
|
||||||
|
|
||||||
# @PACKAGENAME@_%.qm: @srcdir@/@PACKAGENAME@_%.ts
|
|
||||||
# ${LRELEASE} $< -qm $@
|
|
||||||
|
|
||||||
%.xpm: resources/%.png
|
|
||||||
convert $< $@ || cp $< $@
|
|
||||||
|
|
||||||
# %.ts: ${ALL_SRC}
|
|
||||||
# ${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
|
|
||||||
|
|
||||||
${QMAKE_MAKEFILE}: ${QMAKE_PROJECT} ${ALL_SRC}
|
|
||||||
${QMAKE} -o $@ $< CONFIG+=${@:makefile.qmake.%=%}
|
|
||||||
|
|
||||||
# $(LANGS:%=@PACKAGENAME@_%.qm)
|
|
||||||
${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC}
|
|
||||||
make -f makefile.qmake.$@
|
|
||||||
|
|
||||||
install-data-local: ${QMAKE_MAKEFILE}
|
|
||||||
${mkinstalldirs} ${DESTDIR}${QT_INSTALL_PLUGINS}
|
|
||||||
for file in ${QMAKE_TARGET:%=lib%*}; do \
|
|
||||||
if test -e $$file; then \
|
|
||||||
${INSTALL} $$file ${DESTDIR}${QT_INSTALL_PLUGINS}; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-local:
|
|
||||||
-rm -r ${QMAKE_TARGET:%=${DESTDIR}${QT_INSTALL_PLUGINS}/lib%*}
|
|
||||||
|
|
||||||
clean-local:
|
|
||||||
-rm -r ${QMAKE_TARGET:%=lib%*}
|
|
||||||
|
|
||||||
# $(LANGS:%=@PACKAGENAME@_%.qm)
|
|
||||||
CLEANFILES = ${TARGETS} ${TARGETS:%=%.exe} \
|
|
||||||
*.o *.obj qrc_*.cpp ui_*.h moc_*.cpp *.dll \
|
|
||||||
${QMAKE_TARGET:%=lib%*}
|
|
||||||
MAINTAINERCLEANFILES = makefile.in ${QMAKE_MAKEFILE}
|
|
@@ -1,64 +0,0 @@
|
|||||||
QT += gui webkit network
|
|
||||||
CONFIG += designer plugin
|
|
||||||
QMAKE_LIBS += -lproxyface -lpcscxx -lssl -lcrypto
|
|
||||||
QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter
|
|
||||||
#-std=c++0x
|
|
||||||
QMAKE_INCDIR += @top_srcdir@/src
|
|
||||||
QMAKE_INCDIR += .
|
|
||||||
QMAKE_LIBDIR += @top_builddir@/src/qbrowserlib
|
|
||||||
QMAKE_LIBDIR += @top_builddir@/src/qbrowserlib/release
|
|
||||||
QMAKE_LIBS += -lqbrowserlib
|
|
||||||
|
|
||||||
unix {
|
|
||||||
!macx {
|
|
||||||
CONFIG += debug
|
|
||||||
QMAKE_INCDIR += /usr/include/PCSC
|
|
||||||
QMAKE_INCDIR += /usr/local/include/PCSC
|
|
||||||
QMAKE_LIBS += -lpcsclite -lproxy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
macx {
|
|
||||||
QMAKE_INCDIR += /opt/local/include
|
|
||||||
QMAKE_LIBDIR += /opt/local/lib
|
|
||||||
QMAKE_LFLAGS += -F/System/Library/Frameworks/PCSC.framework
|
|
||||||
LIBS += -framework PCSC
|
|
||||||
QMAKE_INCDIR += /System/Library/Frameworks/PCSC.framework/Headers
|
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
|
||||||
CONFIG += x86
|
|
||||||
}
|
|
||||||
win32 {
|
|
||||||
QMAKE_LIBS += -lwinhttp -lgdi32 -lws2_32
|
|
||||||
QMAKE_LIBS += /opt/local/i586-mingw32msvc/lib/winscard.a
|
|
||||||
CONFIG += dll
|
|
||||||
}
|
|
||||||
|
|
||||||
FORMS =
|
|
||||||
|
|
||||||
RESOURCES = resources.qrc
|
|
||||||
|
|
||||||
TEMPLATE = lib
|
|
||||||
|
|
||||||
qbrowserlib-swisswebview {
|
|
||||||
SOURCES = webviewwidgetifc.cxx
|
|
||||||
HEADERS = webviewwidgetifc.hxx
|
|
||||||
TARGET = qbrowserlib-swisswebview
|
|
||||||
}
|
|
||||||
qbrowserlib-buttonlineedit {
|
|
||||||
SOURCES = buttonlineeditwidgetifc.cxx
|
|
||||||
HEADERS = buttonlineeditwidgetifc.hxx
|
|
||||||
TARGET = qbrowserlib-buttonlineedit
|
|
||||||
}
|
|
||||||
|
|
||||||
qbrowserlib-swisswebwidget {
|
|
||||||
SOURCES = webwidgetifc.cxx
|
|
||||||
HEADERS = webwidgetifc.hxx
|
|
||||||
TARGET = qbrowserlib-swisswebwidget
|
|
||||||
}
|
|
||||||
|
|
||||||
CODECFORSRC = UTF-8
|
|
||||||
CODECFORTR = UTF-8
|
|
||||||
|
|
||||||
DEFINES += VERSION=\'\"@VERSION@\"\' BUILDDATE=\'\"@BUILDDATE@\"\'
|
|
||||||
|
|
||||||
## DEBUG
|
|
||||||
# QMAKE_CXXFLAGS += -include iostream -D\"CRYPTOKI_LOG(X)=std::clog<<\\\"CRYPTOKI_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"PCSC_LOG(X)=std::clog<<\\\"PCSC_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"OPENSSL_LOG(X)=std::clog<<\\\"OPENSSL_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl'" @CPPFLAGS@ @CXXFLAGS@
|
|
@@ -1,7 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/icons">
|
|
||||||
<file>swisswebwidget.png</file>
|
|
||||||
<file>swisswebview.png</file>
|
|
||||||
<file>buttonlineedit.png</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
Before Width: | Height: | Size: 397 B |
Before Width: | Height: | Size: 13 KiB |
@@ -1,15 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#include <webviewwidgetifc.hxx>
|
|
||||||
|
|
||||||
//! @defgroup designer
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2(swisswebviewwidgetplugin, SwissWebViewWidgetIfc);
|
|
||||||
|
|
||||||
//! @}
|
|
@@ -1,90 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __WEBVIEWWIDGETIFC_HXX
|
|
||||||
#define __WEBVIEWWIDGETIFC_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/swisswebview.hxx>
|
|
||||||
#include <QtDesigner>
|
|
||||||
|
|
||||||
//! @defgroup designer
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
//! WebView widget for Qt Designer
|
|
||||||
class SwissWebViewWidgetIfc: public QObject,
|
|
||||||
public QDesignerCustomWidgetInterface {
|
|
||||||
Q_OBJECT;
|
|
||||||
Q_INTERFACES(QDesignerCustomWidgetInterface);
|
|
||||||
public:
|
|
||||||
SwissWebViewWidgetIfc() {}
|
|
||||||
bool isContainer() const {
|
|
||||||
TRC;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
QIcon icon() const {
|
|
||||||
TRC;
|
|
||||||
return QIcon(":/icons/swisswebview.png");
|
|
||||||
}
|
|
||||||
QString domXml() const {
|
|
||||||
TRC;
|
|
||||||
return
|
|
||||||
QString
|
|
||||||
("<ui language=\"c++\" displayname=\"%2\">"
|
|
||||||
" <widget class=\"%1\" name=\"%3\"/>"
|
|
||||||
" <customwidgets>"
|
|
||||||
" <customwidget>"
|
|
||||||
" <class>%1</class>"
|
|
||||||
" </customwidget>"
|
|
||||||
" </customwidgets>"
|
|
||||||
"</ui>")
|
|
||||||
.arg(name())
|
|
||||||
.arg(className())
|
|
||||||
.arg(className().toLower());
|
|
||||||
}
|
|
||||||
QString group() const {
|
|
||||||
TRC;
|
|
||||||
return "Display Widgets";
|
|
||||||
}
|
|
||||||
QString includeFile() const {
|
|
||||||
TRC;
|
|
||||||
return "qbrowserlib/swisswebview.hxx";
|
|
||||||
}
|
|
||||||
QString namespaceName() const {
|
|
||||||
TRC;
|
|
||||||
return "qbrowserlib";
|
|
||||||
}
|
|
||||||
QString className() const {
|
|
||||||
TRC;
|
|
||||||
return "SwissWebView";
|
|
||||||
}
|
|
||||||
QString name() const {
|
|
||||||
TRC;
|
|
||||||
return QString("%1::%2").arg(namespaceName()).arg(className());
|
|
||||||
}
|
|
||||||
QString toolTip() const {
|
|
||||||
TRC;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
QString whatsThis() const {
|
|
||||||
TRC;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
QWidget *createWidget(QWidget *parent) {
|
|
||||||
TRC;
|
|
||||||
return new qbrowserlib::SwissWebView(parent, &_net);
|
|
||||||
}
|
|
||||||
bool isInitialized() {
|
|
||||||
TRC;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
QNetworkAccessManager _net;
|
|
||||||
};
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
#endif
|
|
@@ -1,15 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#include <webwidgetifc.hxx>
|
|
||||||
|
|
||||||
//! @defgroup designer
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2(swisswebwidget, SwissWebWidgetIfc);
|
|
||||||
|
|
||||||
//! @}
|
|
@@ -1,87 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __SWISSWEBWIDGETIFC_HXX
|
|
||||||
#define __SWISSWEBWIDGETIFC_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/swisswebwidget.hxx>
|
|
||||||
#include <QtDesigner>
|
|
||||||
|
|
||||||
//! @defgroup designer
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
//! SwissWebWidget widget for Qt Designer
|
|
||||||
class SwissWebWidgetIfc: public QObject,
|
|
||||||
public QDesignerCustomWidgetInterface {
|
|
||||||
Q_OBJECT;
|
|
||||||
Q_INTERFACES(QDesignerCustomWidgetInterface);
|
|
||||||
public:
|
|
||||||
bool isContainer() const {
|
|
||||||
TRC;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
QIcon icon() const {
|
|
||||||
TRC;
|
|
||||||
return QIcon(":/icons/swisswebwidget.png");
|
|
||||||
}
|
|
||||||
QString domXml() const {
|
|
||||||
TRC;
|
|
||||||
return
|
|
||||||
QString
|
|
||||||
("<ui language=\"c++\" displayname=\"%2\">"
|
|
||||||
" <widget class=\"%1\" name=\"%3\"/>"
|
|
||||||
" <customwidgets>"
|
|
||||||
" <customwidget>"
|
|
||||||
" <class>%1</class>"
|
|
||||||
" </customwidget>"
|
|
||||||
" </customwidgets>"
|
|
||||||
"</ui>")
|
|
||||||
.arg(name())
|
|
||||||
.arg(className())
|
|
||||||
.arg(className().toLower());
|
|
||||||
}
|
|
||||||
QString group() const {
|
|
||||||
TRC;
|
|
||||||
return "Input Widgets";
|
|
||||||
}
|
|
||||||
QString includeFile() const {
|
|
||||||
TRC;
|
|
||||||
return "qbrowserlib/swisswebwidget.hxx";
|
|
||||||
}
|
|
||||||
QString namespaceName() const {
|
|
||||||
TRC;
|
|
||||||
return "qbrowserlib";
|
|
||||||
}
|
|
||||||
QString className() const {
|
|
||||||
TRC;
|
|
||||||
return "SwissWebWidget";
|
|
||||||
}
|
|
||||||
QString name() const {
|
|
||||||
TRC;
|
|
||||||
return QString("%1::%2").arg(namespaceName()).arg(className());
|
|
||||||
}
|
|
||||||
QString toolTip() const {
|
|
||||||
TRC;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
QString whatsThis() const {
|
|
||||||
TRC;
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
QWidget *createWidget(QWidget *parent) {
|
|
||||||
TRC;
|
|
||||||
return new qbrowserlib::SwissWebWidget(parent);
|
|
||||||
}
|
|
||||||
bool isInitialized() {
|
|
||||||
TRC;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
#endif
|
|
279
src/downloadmanager.hxx
Normal file
@@ -0,0 +1,279 @@
|
|||||||
|
/*! @file
|
||||||
|
|
||||||
|
@id $Id$
|
||||||
|
*/
|
||||||
|
// 1 2 3 4 5 6 7 8
|
||||||
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
|
|
||||||
|
#include <QtNetwork/QNetworkReply>
|
||||||
|
#include <QtNetwork/QSslError>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#ifndef LOG
|
||||||
|
#define LOG qDebug()<<__PRETTY_FUNCTION__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class DownloadManager: public QObject {
|
||||||
|
Q_OBJECT;
|
||||||
|
public:
|
||||||
|
|
||||||
|
DownloadManager& operator+=(QNetworkReply* reply) {
|
||||||
|
LOG;
|
||||||
|
add(reply);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString networkError(QNetworkReply::NetworkError err) {
|
||||||
|
LOG<<err;
|
||||||
|
switch (err) {
|
||||||
|
case QNetworkReply::NoError:
|
||||||
|
return tr("Network connection successful, remote host can be"
|
||||||
|
" reached.");
|
||||||
|
case QNetworkReply::ConnectionRefusedError:
|
||||||
|
return tr("The remote server refused the connection (the server is"
|
||||||
|
" not accepting requests).");
|
||||||
|
case QNetworkReply::RemoteHostClosedError:
|
||||||
|
return tr("The remote server closed the connection prematurely,"
|
||||||
|
" before the entire reply was received and processed.");
|
||||||
|
case QNetworkReply::HostNotFoundError:
|
||||||
|
return tr("The remote host name was not found (invalid hostname).");
|
||||||
|
case QNetworkReply::TimeoutError:
|
||||||
|
return tr("The connection to the remote server timed out.");
|
||||||
|
case QNetworkReply::OperationCanceledError:
|
||||||
|
return tr("The operation was canceled via calls to abort() or"
|
||||||
|
" close() before it was finished.");
|
||||||
|
case QNetworkReply::SslHandshakeFailedError:
|
||||||
|
return tr("The SSL/TLS handshake failed and the encrypted channel"
|
||||||
|
" could not be established. See SSL-Errors above.");
|
||||||
|
case QNetworkReply::ProxyConnectionRefusedError:
|
||||||
|
return tr("The connection to the proxy server was refused (the"
|
||||||
|
" proxy server is not accepting requests).");
|
||||||
|
case QNetworkReply::ProxyConnectionClosedError:
|
||||||
|
return tr("The proxy server closed the connection prematurely,"
|
||||||
|
" before the entire reply was received and processed.");
|
||||||
|
case QNetworkReply::ProxyNotFoundError:
|
||||||
|
return tr("The proxy host name was not found (invalid proxy"
|
||||||
|
" hostname).");
|
||||||
|
case QNetworkReply::ProxyTimeoutError:
|
||||||
|
return tr("The connection to the proxy timed out or the proxy did"
|
||||||
|
" not reply in time to the request sent.");
|
||||||
|
case QNetworkReply::ProxyAuthenticationRequiredError:
|
||||||
|
return tr("The proxy requires authentication in order to honour the"
|
||||||
|
" request but did not accept any credentials offered"
|
||||||
|
" (if any).");
|
||||||
|
case QNetworkReply::ContentAccessDenied:
|
||||||
|
return tr("The access to the remote content was denied (similar to"
|
||||||
|
" HTTP error 401).");
|
||||||
|
case QNetworkReply::ContentOperationNotPermittedError:
|
||||||
|
return tr("The operation requested on the remote content is not"
|
||||||
|
" permitted.");
|
||||||
|
case QNetworkReply::ContentNotFoundError:
|
||||||
|
return tr("The remote content was not found at the server (similar"
|
||||||
|
" to HTTP error 404).");
|
||||||
|
case QNetworkReply::AuthenticationRequiredError:
|
||||||
|
return tr("The remote server requires authentication to serve the"
|
||||||
|
" content but the credentials provided were not accepted"
|
||||||
|
" (if any).");
|
||||||
|
case QNetworkReply::ProtocolUnknownError:
|
||||||
|
return tr("The Network Access API cannot honor the request because"
|
||||||
|
" the protocol is not known.");
|
||||||
|
case QNetworkReply::ProtocolInvalidOperationError:
|
||||||
|
return tr("The requested operation is invalid for this protocol.");
|
||||||
|
case QNetworkReply::UnknownNetworkError:
|
||||||
|
return tr("An unknown network-related error was detected.");
|
||||||
|
case QNetworkReply::UnknownProxyError:
|
||||||
|
return tr("An unknown proxy-related error was detected.");
|
||||||
|
case QNetworkReply::UnknownContentError:
|
||||||
|
return tr("An unknonwn error related to the remote content was"
|
||||||
|
" detected.");
|
||||||
|
case QNetworkReply::ProtocolFailure:
|
||||||
|
return tr("A breakdown in protocol was detected (parsing error,"
|
||||||
|
" invalid or unexpected responses, etc.).");
|
||||||
|
default:
|
||||||
|
return tr("<strong>Unknown network error (code: %1).</string>")
|
||||||
|
.arg(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
|
||||||
|
void progress(qint64 done, qint64 total);
|
||||||
|
void started();
|
||||||
|
void finished();
|
||||||
|
void error(QString);
|
||||||
|
void metaDataChanged(QNetworkReply*);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
|
||||||
|
void add(QNetworkReply* reply) {
|
||||||
|
LOG<<_downloads.size()<<reply->url().toString();
|
||||||
|
LOG<<reply;
|
||||||
|
_downloads[reply].progress = Progress(0, 0);
|
||||||
|
assert(connect(reply, SIGNAL(downloadProgress(qint64, qint64)),
|
||||||
|
SLOT(downloadProgress(qint64, qint64))));
|
||||||
|
assert(connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
|
||||||
|
SLOT(error(QNetworkReply::NetworkError))));
|
||||||
|
assert(connect(reply, SIGNAL(destroyed(QObject*)),
|
||||||
|
SLOT(slotDestroyed(QObject*))));
|
||||||
|
assert(connect(reply, SIGNAL(finished()),
|
||||||
|
SLOT(slotFinished())));
|
||||||
|
assert(connect(reply, SIGNAL(metaDataChanged()),
|
||||||
|
SLOT(slotMetaDataChanged())));
|
||||||
|
assert(connect(reply, SIGNAL(sslErrors(const QList<QSslError>&)),
|
||||||
|
SLOT(sslErrors(const QList<QSslError>&))));
|
||||||
|
assert(connect(reply, SIGNAL(uploadProgress(qint64, qint64)),
|
||||||
|
SLOT(uploadProgress(qint64, qint64))));
|
||||||
|
if (_downloads.size()==1) started();
|
||||||
|
}
|
||||||
|
|
||||||
|
void abort() {
|
||||||
|
while (_downloads.size()) _downloads.begin()->first->abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
void calcProgress() {
|
||||||
|
//LOG;
|
||||||
|
qint64 done(0);
|
||||||
|
qint64 total(0);
|
||||||
|
for (Downloads::iterator it(_downloads.begin());
|
||||||
|
it!=_downloads.end(); ++it) {
|
||||||
|
done += it->second.progress.first;
|
||||||
|
total += it->second.progress.second;
|
||||||
|
}
|
||||||
|
progress(done, total);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
|
||||||
|
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal) {
|
||||||
|
//LOG<<bytesReceived<<bytesTotal;
|
||||||
|
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.first
|
||||||
|
= bytesReceived;
|
||||||
|
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.second
|
||||||
|
= bytesTotal;
|
||||||
|
calcProgress();
|
||||||
|
}
|
||||||
|
void error(QNetworkReply::NetworkError code) {
|
||||||
|
LOG<<"Status:"<<networkError(code);
|
||||||
|
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
||||||
|
_downloads[reply].error +=
|
||||||
|
tr("<h1>Network Error</h1>"
|
||||||
|
"<dl><dt>URL:</dt><dd>%1</dd>"
|
||||||
|
"<dt>Error Code:</dt><dd>%3</dd>"
|
||||||
|
"<dt>Error Details:</dt><dd>%2</dd></dl>")
|
||||||
|
.arg(reply->url().toString())
|
||||||
|
.arg(networkError(code))
|
||||||
|
.arg(code);
|
||||||
|
}
|
||||||
|
void slotDestroyed(QObject* obj) {
|
||||||
|
LOG<<_downloads.size();
|
||||||
|
_downloads.erase((QNetworkReply*)obj);
|
||||||
|
}
|
||||||
|
void slotFinished() {
|
||||||
|
LOG<<_downloads.size();
|
||||||
|
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
||||||
|
if (_downloads[reply].error.size())
|
||||||
|
error(_downloads[reply].error);
|
||||||
|
_downloads.erase(reply);
|
||||||
|
if (_downloads.size()==0) finished();
|
||||||
|
}
|
||||||
|
void slotMetaDataChanged() {
|
||||||
|
LOG;
|
||||||
|
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
||||||
|
if (!reply) return;
|
||||||
|
LOG<<"Location:"<<reply->header(QNetworkRequest::LocationHeader)
|
||||||
|
.toString();
|
||||||
|
LOG<<"Content-Type:"<<reply->header(QNetworkRequest::ContentTypeHeader)
|
||||||
|
.toString();
|
||||||
|
LOG<<"Content-Disposition:"<<reply->rawHeader("Content-Disposition");
|
||||||
|
LOG<<"Status:"<<networkError(reply->error());
|
||||||
|
LOG<<"URL:"<<reply->url().toString();
|
||||||
|
LOG<<"File:"<<reply->url().toLocalFile();
|
||||||
|
LOG<<"Path:"<<reply->url().path();
|
||||||
|
metaDataChanged(reply);
|
||||||
|
}
|
||||||
|
void sslErrors(const QList<QSslError> & errors) {
|
||||||
|
LOG;
|
||||||
|
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
||||||
|
for (QList<QSslError>::const_iterator err(errors.begin());
|
||||||
|
err!=errors.end(); ++err) {
|
||||||
|
LOG<<"SSL-Error: "<<(int)err->error()<<": "<<err->errorString();
|
||||||
|
LOG<<"Certificate Issuer: "
|
||||||
|
<<"O="<<err->certificate().issuerInfo(QSslCertificate::Organization)
|
||||||
|
<<"CN="<<err->certificate().issuerInfo(QSslCertificate::CommonName)
|
||||||
|
<<"L="<<err->certificate().issuerInfo(QSslCertificate::LocalityName)
|
||||||
|
<<"OU="<<err->certificate().issuerInfo(QSslCertificate::OrganizationalUnitName)
|
||||||
|
<<"C="<<err->certificate().issuerInfo(QSslCertificate::CountryName)
|
||||||
|
<<"ST="<<err->certificate().issuerInfo(QSslCertificate::StateOrProvinceName);
|
||||||
|
LOG<<"Certificate Subject: "
|
||||||
|
<<"O="<<err->certificate().subjectInfo(QSslCertificate::Organization)
|
||||||
|
<<"CN="<<err->certificate().subjectInfo(QSslCertificate::CommonName)
|
||||||
|
<<"L="<<err->certificate().subjectInfo(QSslCertificate::LocalityName)
|
||||||
|
<<"OU="<<err->certificate().subjectInfo(QSslCertificate::OrganizationalUnitName)
|
||||||
|
<<"C="<<err->certificate().subjectInfo(QSslCertificate::CountryName)
|
||||||
|
<<"ST="<<err->certificate().subjectInfo(QSslCertificate::StateOrProvinceName);
|
||||||
|
LOG<<"Certificate:\n"<<err->certificate().toPem();
|
||||||
|
_downloads[reply].error +=
|
||||||
|
tr("<h1>SSL Error</h1>"
|
||||||
|
"<dl><dt>URL:</dt><dd>%1</dd>"
|
||||||
|
"<dt>Error Code:</dt><dd>%3</dd>"
|
||||||
|
"<dt>Error Details:</dt><dd>%2</dd></dl>"
|
||||||
|
"<table>"
|
||||||
|
"<caption>Certificate Issuer</caption>"
|
||||||
|
"<tr><th>Organization:</th><td>%4</td></tr>"
|
||||||
|
"<tr><th>Common Name:</th><td>%5</td></tr>"
|
||||||
|
"<tr><th>Location:</th><td>%6</td></tr>"
|
||||||
|
"<tr><th>Organizational Unit:</th><td>%7</td></tr>"
|
||||||
|
"<tr><th>Country:</th><td>%8</td></tr>"
|
||||||
|
"<tr><th>State or Provive:</th><td>%9</td></tr>"
|
||||||
|
"</table>"
|
||||||
|
"<table>"
|
||||||
|
"<caption>Certificate Subject</caption>"
|
||||||
|
"<tr><th>Organization:</th><td>%10</td></tr>"
|
||||||
|
"<tr><th>Common Name:</th><td>%11</td></tr>"
|
||||||
|
"<tr><th>Location:</th><td>%12</td></tr>"
|
||||||
|
"<tr><th>Organizational Unit:</th><td>%13</td></tr>"
|
||||||
|
"<tr><th>Country:</th><td>%14</td></tr>"
|
||||||
|
"<tr><th>State or Provive:</th><td>%15</td></tr>"
|
||||||
|
"</table>")
|
||||||
|
.arg(reply->url().toString())
|
||||||
|
.arg(err->errorString())
|
||||||
|
.arg(err->error())
|
||||||
|
.arg(err->certificate().issuerInfo(QSslCertificate::Organization))
|
||||||
|
.arg(err->certificate().issuerInfo(QSslCertificate::CommonName))
|
||||||
|
.arg(err->certificate().issuerInfo(QSslCertificate::LocalityName))
|
||||||
|
.arg(err->certificate().issuerInfo(QSslCertificate::OrganizationalUnitName))
|
||||||
|
.arg(err->certificate().issuerInfo(QSslCertificate::CountryName))
|
||||||
|
.arg(err->certificate().issuerInfo(QSslCertificate::StateOrProvinceName))
|
||||||
|
.arg(err->certificate().subjectInfo(QSslCertificate::Organization))
|
||||||
|
.arg(err->certificate().subjectInfo(QSslCertificate::CommonName))
|
||||||
|
.arg(err->certificate().subjectInfo(QSslCertificate::LocalityName))
|
||||||
|
.arg(err->certificate().subjectInfo(QSslCertificate::OrganizationalUnitName))
|
||||||
|
.arg(err->certificate().subjectInfo(QSslCertificate::CountryName))
|
||||||
|
.arg(err->certificate().subjectInfo(QSslCertificate::StateOrProvinceName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void uploadProgress(qint64 bytesSent, qint64 bytesTotal) {
|
||||||
|
//LOG<<bytesSent<<bytesTotal;
|
||||||
|
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.first
|
||||||
|
= bytesSent;
|
||||||
|
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.second
|
||||||
|
= bytesTotal;
|
||||||
|
calcProgress();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
typedef std::pair<qint64, qint64> Progress;
|
||||||
|
struct Download {
|
||||||
|
Progress progress;
|
||||||
|
QString error;
|
||||||
|
};
|
||||||
|
typedef std::map<QNetworkReply*, Download> Downloads;
|
||||||
|
|
||||||
|
Downloads _downloads;
|
||||||
|
};
|
@@ -17,9 +17,6 @@
|
|||||||
|
|
||||||
class EditBookmarks: public QDialog, protected Ui::EditBookmarks {
|
class EditBookmarks: public QDialog, protected Ui::EditBookmarks {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
Q_SIGNALS:
|
|
||||||
void startEdit(bool=true);
|
|
||||||
void endEdit(bool=true);
|
|
||||||
public:
|
public:
|
||||||
EditBookmarks(QComboBox* url, QWidget* p=0): QDialog(p), _url(url) {
|
EditBookmarks(QComboBox* url, QWidget* p=0): QDialog(p), _url(url) {
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
@@ -32,11 +29,15 @@ class EditBookmarks: public QDialog, protected Ui::EditBookmarks {
|
|||||||
QString current(_url->currentText());
|
QString current(_url->currentText());
|
||||||
_url->clear();
|
_url->clear();
|
||||||
_url->addItems(urls);
|
_url->addItems(urls);
|
||||||
_url->setEditText(current);
|
_url->lineEdit()->setText(current);
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
virtual void reject() {
|
virtual void reject() {
|
||||||
reset();
|
QStringList urls;
|
||||||
|
for (int i(0); i<_url->count(); ++i)
|
||||||
|
urls<<_url->itemText(i);
|
||||||
|
_bookmarks->clear();
|
||||||
|
_bookmarks->addItems(urls);
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
@@ -50,26 +51,8 @@ class EditBookmarks: public QDialog, protected Ui::EditBookmarks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void on__add_clicked(bool) {
|
void on__add_clicked(bool) {
|
||||||
if (_url->currentText().isEmpty()) return;
|
|
||||||
_bookmarks->addItem(_url->currentText());
|
_bookmarks->addItem(_url->currentText());
|
||||||
}
|
}
|
||||||
protected:
|
|
||||||
virtual void hideEvent(QHideEvent *event) {
|
|
||||||
QDialog::hideEvent(event);
|
|
||||||
endEdit();
|
|
||||||
}
|
|
||||||
virtual void showEvent(QShowEvent *event) {
|
|
||||||
startEdit();
|
|
||||||
reset();
|
|
||||||
QDialog::showEvent(event);
|
|
||||||
}
|
|
||||||
void reset() {
|
|
||||||
QStringList urls;
|
|
||||||
for (int i(0); i<_url->count(); ++i)
|
|
||||||
urls<<_url->itemText(i);
|
|
||||||
_bookmarks->clear();
|
|
||||||
_bookmarks->addItems(urls);
|
|
||||||
}
|
|
||||||
private:
|
private:
|
||||||
QComboBox* _url;
|
QComboBox* _url;
|
||||||
};
|
};
|
||||||
|
@@ -21,6 +21,10 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>+</string>
|
<string>+</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources.qrc">
|
||||||
|
<normaloff>:/icons/addbookmark</normaloff>:/icons/addbookmark</iconset>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -41,6 +45,10 @@
|
|||||||
<property name="text">
|
<property name="text">
|
||||||
<string>-</string>
|
<string>-</string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources.qrc">
|
||||||
|
<normaloff>:/icons/close</normaloff>:/icons/close</iconset>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
@@ -53,9 +61,6 @@
|
|||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Use Drag/Drop to move, double-click to edit.</string>
|
<string>Use Drag/Drop to move, double-click to edit.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::AllEditTriggers</set>
|
|
||||||
</property>
|
|
||||||
<property name="dragEnabled">
|
<property name="dragEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
38
src/errorlog.hxx
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*! @file
|
||||||
|
|
||||||
|
@id $Id$
|
||||||
|
*/
|
||||||
|
// 1 2 3 4 5 6 7 8
|
||||||
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
|
|
||||||
|
#ifndef ERRORLOG_HXX
|
||||||
|
#define ERRORLOG_HXX
|
||||||
|
|
||||||
|
#include <ui_errorlog.h>
|
||||||
|
#include <QtGui/QDialog>
|
||||||
|
|
||||||
|
class ErrorLog: public QDialog, protected Ui::ErrorLog {
|
||||||
|
public:
|
||||||
|
Q_OBJECT;
|
||||||
|
Q_SIGNALS:
|
||||||
|
void reset();
|
||||||
|
public:
|
||||||
|
ErrorLog(QWidget* p): QDialog(p) {
|
||||||
|
setupUi(this);
|
||||||
|
}
|
||||||
|
void append(QString text) {
|
||||||
|
_errors->append(text);
|
||||||
|
}
|
||||||
|
protected Q_SLOTS:
|
||||||
|
void on__buttons_clicked(QAbstractButton* button) {
|
||||||
|
switch (_buttons->buttonRole(button)) {
|
||||||
|
case QDialogButtonBox::ResetRole: {
|
||||||
|
_errors->clear();
|
||||||
|
reset();
|
||||||
|
} break;
|
||||||
|
default:;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -8,18 +8,15 @@
|
|||||||
#ifndef LOGINCERTIFICATE_HXX
|
#ifndef LOGINCERTIFICATE_HXX
|
||||||
#define LOGINCERTIFICATE_HXX
|
#define LOGINCERTIFICATE_HXX
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <ui_logincertificate.h>
|
#include <ui_logincertificate.h>
|
||||||
|
|
||||||
class LoginCertificate: public QDialog, protected Ui::LoginCertificate {
|
class LoginCertificate: public QDialog, protected Ui::LoginCertificate {
|
||||||
public:
|
public:
|
||||||
LoginCertificate(QWidget* p): QDialog(p) {
|
LoginCertificate(QWidget* p): QDialog(p) {
|
||||||
TRC;
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
LoginCertificate& setup() {
|
LoginCertificate& setup() {
|
||||||
TRC;
|
|
||||||
QSslCertificate c(QSslConfiguration::defaultConfiguration()
|
QSslCertificate c(QSslConfiguration::defaultConfiguration()
|
||||||
.localCertificate());
|
.localCertificate());
|
||||||
_cert->certificate(c);
|
_cert->certificate(c);
|
||||||
@@ -27,7 +24,6 @@ class LoginCertificate: public QDialog, protected Ui::LoginCertificate {
|
|||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
virtual void showEvent(QShowEvent *event) {
|
virtual void showEvent(QShowEvent *event) {
|
||||||
TRC;
|
|
||||||
setup();
|
setup();
|
||||||
QDialog::showEvent(event);
|
QDialog::showEvent(event);
|
||||||
}
|
}
|
||||||
|
416
src/main.cxx
@@ -8,9 +8,6 @@
|
|||||||
// 1 2 3 4 5 6 7 8
|
// 1 2 3 4 5 6 7 8
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <browser.hxx>
|
|
||||||
|
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtCore/QTranslator>
|
#include <QtCore/QTranslator>
|
||||||
#include <QtCore/QTextCodec>
|
#include <QtCore/QTextCodec>
|
||||||
@@ -23,110 +20,278 @@
|
|||||||
#include <QtNetwork/QSslKey>
|
#include <QtNetwork/QSslKey>
|
||||||
#include <QtWebKit/QWebSettings>
|
#include <QtWebKit/QWebSettings>
|
||||||
|
|
||||||
|
#include <browser.hxx>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
|
const QByteArray SWISSSIGN_EV_GOLD_CA_2009_G2
|
||||||
|
("-----BEGIN CERTIFICATE-----\n"
|
||||||
|
"MIIGvzCCBaegAwIBAgIQAPI39KUS4aGJo+mkR4+YuTANBgkqhkiG9w0BAQUFADBN\n"
|
||||||
|
"MQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFHMScwJQYDVQQDEx5T\n"
|
||||||
|
"d2lzc1NpZ24gRVYgR29sZCBDQSAyMDA5IC0gRzIwHhcNMTAwNDI5MDgyMzA2WhcN\n"
|
||||||
|
"MTIwNDI5MDgyMzA2WjCCASQxCzAJBgNVBAYTAkNIMQ0wCwYDVQQIEwRCZXJuMQ0w\n"
|
||||||
|
"CwYDVQQHEwRCZXJuMSAwHgYDVQQKExdEaWUgU2Nod2VpemVyaXNjaGUgUG9zdDEa\n"
|
||||||
|
"MBgGA1UEAxMRaWRwLnN3aXNzc2lnbi5uZXQxJzAlBgkqhkiG9w0BCQEWGG9wZXJh\n"
|
||||||
|
"dGlvbnNAc3dpc3NzaWduLmNvbTEbMBkGA1UECRMSVmlrdG9yaWFzdHJhc3NlIDIx\n"
|
||||||
|
"MQ0wCwYDVQQREwQzMDMwMRUwEwYLKwYBBAGCNzwCAQITBEJlcm4xEzARBgsrBgEE\n"
|
||||||
|
"AYI3PAIBAxMCQ0gxGzAZBgNVBA8TElYxLjAsIENsYXVzZSA1LihiKTEbMBkGA1UE\n"
|
||||||
|
"BRMSQ0gtMDM1LjguMDE3LjIxNy03MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\n"
|
||||||
|
"CgKCAQEA6vtopNyjugIQb+OwsjcAN60Uo1ClcnFa+0Eme5MOCQg8khGwux42aRTL\n"
|
||||||
|
"kUfcTrOye4J8ThE5/9Qm32hagA+mPQRWAkQqZKDJCPU7LMEQKzClZs4LYA04Vv32\n"
|
||||||
|
"WFbeSVh3tK6j92tQ8mbtUep1S/dye9j72P1WQxdd2uJrwzQgA3ftEoVJ6lOMEcBS\n"
|
||||||
|
"cR4lfCdFbQMSwfRI3g2BKPfuYZ+Vp90rF/0Si2kNd1CrBYdLhoZFvPFBapdcK9g/\n"
|
||||||
|
"QzBXfoLQb7MZkR3o8HtUOzcmEl7fhvO/8PEh5hJgn/hnLlFW0TIrqd/ag+n4U17V\n"
|
||||||
|
"isDHS13eaSPE7qq1xhfeTda2QBk9/wIDAQABo4ICwDCCArwwHAYDVR0RBBUwE4IR\n"
|
||||||
|
"aWRwLnN3aXNzc2lnbi5uZXQwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsG\n"
|
||||||
|
"AQUFBwMBBggrBgEFBQcDAjAdBgNVHQ4EFgQUs/yd7N1TLOjtmtcB+S16SzcX5W8w\n"
|
||||||
|
"HwYDVR0jBBgwFoAUiHRGbcd8tfpycRnevydeDWjg9ycwgf8GA1UdHwSB9zCB9DBH\n"
|
||||||
|
"oEWgQ4ZBaHR0cDovL2NybC5zd2lzc3NpZ24ubmV0Lzg4NzQ0NjZEQzc3Q0I1RkE3\n"
|
||||||
|
"MjcxMTlERUJGMjc1RTBENjhFMEY3MjcwgaiggaWggaKGgZ9sZGFwOi8vZGlyZWN0\n"
|
||||||
|
"b3J5LnN3aXNzc2lnbi5uZXQvQ049ODg3NDQ2NkRDNzdDQjVGQTcyNzExOURFQkYy\n"
|
||||||
|
"NzVFMEQ2OEUwRjcyNyUyQ089U3dpc3NTaWduJTJDQz1DSD9jZXJ0aWZpY2F0ZVJl\n"
|
||||||
|
"dm9jYXRpb25MaXN0P2Jhc2U/b2JqZWN0Q2xhc3M9Y1JMRGlzdHJpYnV0aW9uUG9p\n"
|
||||||
|
"bnQwYgYDVR0gBFswWTBXBglghXQBWQECAQEwSjBIBggrBgEFBQcCARY8aHR0cDov\n"
|
||||||
|
"L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS9Td2lzc1NpZ24tR29sZC1DUC1DUFMt\n"
|
||||||
|
"UjQucGRmMIHGBggrBgEFBQcBAQSBuTCBtjBkBggrBgEFBQcwAoZYaHR0cDovL3N3\n"
|
||||||
|
"aXNzc2lnbi5uZXQvY2dpLWJpbi9hdXRob3JpdHkvZG93bmxvYWQvODg3NDQ2NkRD\n"
|
||||||
|
"NzdDQjVGQTcyNzExOURFQkYyNzVFMEQ2OEUwRjcyNzBOBggrBgEFBQcwAYZCaHR0\n"
|
||||||
|
"cDovL29jc3Auc3dpc3NzaWduLm5ldC84ODc0NDY2REM3N0NCNUZBNzI3MTE5REVC\n"
|
||||||
|
"RjI3NUUwRDY4RTBGNzI3MA0GCSqGSIb3DQEBBQUAA4IBAQCNpT2u/s/IKqXrWmHX\n"
|
||||||
|
"TTVbW2Kh8xul9jLole+hWXtx8Ln4E8oW+bV25HGUjt8QrC1wXGABRCijgIjQ8PtR\n"
|
||||||
|
"CQrcwJCmC9ShcckP7KXiaETaT67TUB8qIQ/pf3akNeWKcdFGcD6CDYM7umuu1Q1X\n"
|
||||||
|
"326mufNviiqlU0uoK1LJQHhme3HMHarYdzkuIeShvIYHUYP3JnorXaizcCqjBhdF\n"
|
||||||
|
"rj4QcCZx8hKE6gmNL+dJkBM/5CSqByy15tMs2qa0iMdwkPUiNxlL0VuZkwzooVQx\n"
|
||||||
|
"1eKQwsSx3807MkQMKs+4v1LexkY+5/xU9dvtyRysjuSEWS8yCx3+E3fOOVAIX5jD\n"
|
||||||
|
"0uSX\n"
|
||||||
|
"-----END CERTIFICATE-----");
|
||||||
|
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/L227JH4SMaOwVcJd0rkvMTi1bWa1XFp\n"
|
||||||
|
"Q3lIlxW91JBEKqBKsru1h7wOq81VwIa3a2pdFgWY8F45G7M2Om9bLL5TiJ3Emkbl\n"
|
||||||
|
"gKIFRX+GztmnQdKdY8c8rpknh/jWr6YiqYm+jV6+crGhAgMBAAGjggJEMIICQDAO\n"
|
||||||
|
"BgNVHQ8BAf8EBAMCAQYwEgYDVR0TAQH/BAgwBgEB/wIBADAdBgNVHQ4EFgQUl3be\n"
|
||||||
|
"CjTlEJpAxOvYnVpTeyHMRz4wHwYDVR0jBBgwFoAUWyV7lqRlUX64OfPAeGZe6Drn\n"
|
||||||
|
"8O4wgf8GA1UdHwSB9zCB9DBHoEWgQ4ZBaHR0cDovL2NybC5zd2lzc3NpZ24ubmV0\n"
|
||||||
|
"LzVCMjU3Qjk2QTQ2NTUxN0VCODM5RjNDMDc4NjY1RUU4M0FFN0YwRUUwgaiggaWg\n"
|
||||||
|
"gaKGgZ9sZGFwOi8vZGlyZWN0b3J5LnN3aXNzc2lnbi5uZXQvQ049NUIyNTdCOTZB\n"
|
||||||
|
"NDY1NTE3RUI4MzlGM0MwNzg2NjVFRTgzQUU3RjBFRSUyQ089U3dpc3NTaWduJTJD\n"
|
||||||
|
"Qz1DSD9jZXJ0aWZpY2F0ZVJldm9jYXRpb25MaXN0P2Jhc2U/b2JqZWN0Q2xhc3M9\n"
|
||||||
|
"Y1JMRGlzdHJpYnV0aW9uUG9pbnQwYgYDVR0gBFswWTBXBglghXQBWQECAQMwSjBI\n"
|
||||||
|
"BggrBgEFBQcCARY8aHR0cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS9Td2lz\n"
|
||||||
|
"c1NpZ24tR29sZC1DUC1DUFMtUjMucGRmMHQGCCsGAQUFBwEBBGgwZjBkBggrBgEF\n"
|
||||||
|
"BQcwAoZYaHR0cDovL3N3aXNzc2lnbi5uZXQvY2dpLWJpbi9hdXRob3JpdHkvZG93\n"
|
||||||
|
"bmxvYWQvNUIyNTdCOTZBNDY1NTE3RUI4MzlGM0MwNzg2NjVFRTgzQUU3RjBFRTAN\n"
|
||||||
|
"BgkqhkiG9w0BAQUFAAOCAgEAPuJBwXDS9McQwt5Gp0xHGpeiTCr4qmBwIKM33x8J\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"
|
||||||
|
"BgNVBAYTAkNIMRUwEwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3\n"
|
||||||
|
"aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcNMDYxMDI1MDgzMDM1WhcNMzYxMDI1\n"
|
||||||
|
"MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWduIEFH\n"
|
||||||
|
"MR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG\n"
|
||||||
|
"9w0BAQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJC\n"
|
||||||
|
"Eyq8ZVeCQD5XJM1QiyUqt2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9\n"
|
||||||
|
"lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5CjCA12UNNhPqE21Is8w4ndwtr\n"
|
||||||
|
"vxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpgvd21mWRT\n"
|
||||||
|
"uKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbL\n"
|
||||||
|
"tK/tREDFylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpK\n"
|
||||||
|
"xVKJ+STnnXepgv9VHKVxaSvRAiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdV\n"
|
||||||
|
"xVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuendjIj3o02yMszYF9rNt85m\n"
|
||||||
|
"ndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkOpeUD\n"
|
||||||
|
"DniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59\n"
|
||||||
|
"je883WX0XaxR7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxM\n"
|
||||||
|
"gI93e2CaHt+28kgeDrpOVG2Y4OGiGqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOB\n"
|
||||||
|
"rDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E\n"
|
||||||
|
"FgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64\n"
|
||||||
|
"OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEF\n"
|
||||||
|
"BQcCARYgaHR0cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZI\n"
|
||||||
|
"hvcNAQEFBQADggIBACe645R88a7A3hfm5djV9VSwg/S7zV4Fe0+fdWavPOhW\n"
|
||||||
|
"fvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr44OE5iKHjn3g\n"
|
||||||
|
"7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8\n"
|
||||||
|
"AYOfMke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS\n"
|
||||||
|
"2S6K8RTGRI0Vqbe/vd6mGu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5\n"
|
||||||
|
"JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxpmo/a77KwPJ+HbBIrZXAVUjEa\n"
|
||||||
|
"JM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJkvC24JdVU\n"
|
||||||
|
"orgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7X\n"
|
||||||
|
"dVAyksLfKzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG\n"
|
||||||
|
"2mqeSz53OiATIgHQv2ieY2BrNU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEB\n"
|
||||||
|
"nunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6LqjviOvrv1vA+ACOzB2+htt\n"
|
||||||
|
"Qc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ\n"
|
||||||
|
"-----END CERTIFICATE-----\n");
|
||||||
|
const QByteArray SWISSSIGN_PLATINUM_CA_G2
|
||||||
|
("-----BEGIN CERTIFICATE-----\n"
|
||||||
|
"MIIFwTCCA6mgAwIBAgIITrIAZwwDXU8wDQYJKoZIhvcNAQEFBQAwSTELMAkG\n"
|
||||||
|
"A1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEjMCEGA1UEAxMaU3dp\n"
|
||||||
|
"c3NTaWduIFBsYXRpbnVtIENBIC0gRzIwHhcNMDYxMDI1MDgzNjAwWhcNMzYx\n"
|
||||||
|
"MDI1MDgzNjAwWjBJMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dpc3NTaWdu\n"
|
||||||
|
"IEFHMSMwIQYDVQQDExpTd2lzc1NpZ24gUGxhdGludW0gQ0EgLSBHMjCCAiIw\n"
|
||||||
|
"DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMrfogLi2vj8Bxax3mCq3pZc\n"
|
||||||
|
"ZB/HL37PZ/pEQtZ2Y5Wu669yIIpFR4ZieIbWIDkm9K6j/SPnpZy1IiEZtzeT\n"
|
||||||
|
"IsBQnIJ71NUERFzLtMKfkr4k2HtnIuJpX+UFeNSH2XFwMyVTtIc7KZAoNppV\n"
|
||||||
|
"RDBopIOXfw0enHb/FZ1glwCNioUD7IC+6ixuEFGSzH7VozPY1kneWCqv9hbr\n"
|
||||||
|
"S3uQMpe5up1Y8fhXSQQeol0GcN1x2/ndi5objM89o03Oy3z2u5yg+gnOI2Ky\n"
|
||||||
|
"6Q0f4nIoj5+saCB9bzuohTEJfwvH6GXp43gOCWcwizSC+13gzJ2BbWLuCB4E\n"
|
||||||
|
"LE6b7P6pT1/9aXjvCR+htL/68++QHkwFix7qepF6w9fl+zC8bBsQWJj3Gl/Q\n"
|
||||||
|
"KTIDE0ZNYWqFTFJ0LwYfexHihJfGmfNtf9dng34TaNhxKFrYzt3oEBSa/m0j\n"
|
||||||
|
"h26OWnA81Y0JAKeqvLAxN23IhBQeW71FYyBrS3SMvds6DsHPWhaPpZjydomy\n"
|
||||||
|
"ExI7C3d3rLvlPClKknLKYRorXkzig3R3+jVIeoVNjZpTxN94ypeRSCtFKwH3\n"
|
||||||
|
"HBqi7Ri6Cr2D+m+8jVeTO9TUps4e8aCxzqv9KyiaTxvXw3LbpMS/XUz13XuW\n"
|
||||||
|
"ae5ogObnmLo2t/5u7Su9IPhlGdpVCX4l3P5hYnL5fhgC72O00Puv5TtjjGeP\n"
|
||||||
|
"AgMBAAGjgawwgakwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w\n"
|
||||||
|
"HQYDVR0OBBYEFFCvzAeHFUdvOMW0ZdHelarp35zMMB8GA1UdIwQYMBaAFFCv\n"
|
||||||
|
"zAeHFUdvOMW0ZdHelarp35zMMEYGA1UdIAQ/MD0wOwYJYIV0AVkBAQEBMC4w\n"
|
||||||
|
"LAYIKwYBBQUHAgEWIGh0dHA6Ly9yZXBvc2l0b3J5LnN3aXNzc2lnbi5jb20v\n"
|
||||||
|
"MA0GCSqGSIb3DQEBBQUAA4ICAQAIhab1Fgz8RBrBY+D5VUYI/HAcQiiWjrfF\n"
|
||||||
|
"wUF1TglxeeVtlspLpYhg0DB0uMoI3LQwnkAHFmtllXcBrqS3NQuB2nEVqXQX\n"
|
||||||
|
"OHtYyvkv+8Bldo1bAbl93oI9ZLi+FHSjClTTLJUYFzX1UWs/j6KWYTl4a0vl\n"
|
||||||
|
"pqD4U99REJNi54Av4tHgvI42Rncz7Lj7jposiU0xEQ8mngS7twSNC/K5/Fqd\n"
|
||||||
|
"Oxa3L8iYq/6KUFkuozv8KV2LwUvJ4ooTHbG/u0IdUt1O2BReEMYxB+9xJ/cb\n"
|
||||||
|
"OQncguqLs5WGXv312l0xpuAxtpTmREl0xRbl9x8DYSjFyMsSoEJL+WuICI20\n"
|
||||||
|
"MhjzdZ/EfwBPBZWcoxcCw7NTm6ogOSkrZvqdr16zktK1puEa+S1BaYEUtLS1\n"
|
||||||
|
"7Yk9zvupnTVCRLEcFHOBzyoBNZox1S2PbYTfgE1X4z/FhHXaicYwu+uPyyII\n"
|
||||||
|
"oK6q8QNsOktNCaUOcsZWayFCTiMlFGiudgp8DAdwZPmaL/YFOSbGDI8Zf0Ne\n"
|
||||||
|
"bvRbFS/bYV3mZy8/CJT5YLSYMdp08YSTcU1f+2BY0fvEwW2JorsgH51xkcsy\n"
|
||||||
|
"mxM9Pn2SUjWskpSi0xjCfMfqr3YFFt1nJ8J+HAciIfNAChs0B0QTwoRqjt8Z\n"
|
||||||
|
"Wr9/6x3iGjjRXK9HkmuAtTClyY3YqzGBH9/CZjfTk6mFhnll0g==\n"
|
||||||
|
"-----END CERTIFICATE-----\n");
|
||||||
|
const QByteArray SWISSSIGN_SILVER_CA_G2
|
||||||
|
("-----BEGIN CERTIFICATE-----\n"
|
||||||
|
"MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkG\n"
|
||||||
|
"A1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dp\n"
|
||||||
|
"c3NTaWduIFNpbHZlciBDQSAtIEcyMB4XDTA2MTAyNTA4MzI0NloXDTM2MTAy\n"
|
||||||
|
"NTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3aXNzU2lnbiBB\n"
|
||||||
|
"RzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkq\n"
|
||||||
|
"hkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dO\n"
|
||||||
|
"cbpLj6VzHVxumK4DV644N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gRE\n"
|
||||||
|
"pzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm+/pe7R20nqA1W6GSy/BJkv6F\n"
|
||||||
|
"CgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH6INaUFjp\n"
|
||||||
|
"iou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2\n"
|
||||||
|
"kUpCe2UuMGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aD\n"
|
||||||
|
"Cyr0NQp4yVXPQbBH6TCfmb5hqAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jM\n"
|
||||||
|
"qDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5FZGkECwJMoBgs5PAKrYY\n"
|
||||||
|
"C51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBsROop\n"
|
||||||
|
"N4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFu\n"
|
||||||
|
"sB3hB48IHpmccelM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb6\n"
|
||||||
|
"5i/4z3GcRm25xBWNOHkDRUjvxF3XCO6HOSKGsg0PWEP3calILv3q1h8CAwEA\n"
|
||||||
|
"AaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV\n"
|
||||||
|
"HQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB\n"
|
||||||
|
"tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggr\n"
|
||||||
|
"BgEFBQcCARYgaHR0cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJ\n"
|
||||||
|
"KoZIhvcNAQEFBQADggIBAHPGgeAn0i0P4JUw4ppBf1AsX19iYamGamkYDHRJ\n"
|
||||||
|
"1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39FkWnZfrt4csEG\n"
|
||||||
|
"DyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcS\n"
|
||||||
|
"H9/L3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpH\n"
|
||||||
|
"kXkzuoLcMmkDlm4fS/Bx/uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE\n"
|
||||||
|
"790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFaDGi8aRl5xB9+lwW/xekkUV7U\n"
|
||||||
|
"1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqPe97Dh4kQ\n"
|
||||||
|
"mUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNV\n"
|
||||||
|
"V4n+SsuuWxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29\n"
|
||||||
|
"MC/HpeZBoNquBYeaoKRlbEwJDIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm\n"
|
||||||
|
"0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ubDgEj8Z+7fNzcbBGXJbLy\n"
|
||||||
|
"tGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u\n"
|
||||||
|
"-----END CERTIFICATE-----\n");
|
||||||
|
|
||||||
//! @defgroup browser The SwissBrowser Executable and Main Window
|
void notrace(QtMsgType, const char*) {
|
||||||
//! @defgroup pkcs11 The PKCS#11 Client Authentication
|
return;
|
||||||
//! @defgroup qbrowserlib The Swiss Browser Library
|
}
|
||||||
//! @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
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
QString TMP;
|
|
||||||
|
|
||||||
extern QWEBKIT_EXPORT void qt_drt_overwritePluginDirectories();
|
extern QWEBKIT_EXPORT void qt_drt_overwritePluginDirectories();
|
||||||
|
|
||||||
QMap<QString, QString>& env() {
|
|
||||||
static QStringList l(QProcess::systemEnvironment());
|
|
||||||
static QMap<QString, QString> env;
|
|
||||||
if (env.isEmpty())
|
|
||||||
for (QStringList::iterator it(l.begin()); it!=l.end(); ++it) {
|
|
||||||
QStringList v(it->split('='));
|
|
||||||
QString key(*v.begin());
|
|
||||||
QString value((v.pop_front(), v.join("=")));
|
|
||||||
env.insert(key, value);
|
|
||||||
}
|
|
||||||
return env;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString helptext() {
|
|
||||||
return QObject::trUtf8
|
|
||||||
("Usage: %1 [OPTIONS...] [<url> ...]\n"
|
|
||||||
"Options:\n"
|
|
||||||
" -h, --help show this help text\n"
|
|
||||||
" -d, --debug enable verbose debug mode\n"
|
|
||||||
" -t --tmp path temporary folder for data caching\n"
|
|
||||||
" -k, --kiosk no url bar\n"
|
|
||||||
" if you sepcify -k and -s, -k must be first\n"
|
|
||||||
" -q, --quirks alternate user interface\n"
|
|
||||||
" -n, --no-settings don't load or store any settings\n"
|
|
||||||
" --login ask for smartcard password at startup\n"
|
|
||||||
" -l, --lib <file> path to file libengine_act.so\n"
|
|
||||||
" -s, --settings <file>\n"
|
|
||||||
" load settings from <file>\n"
|
|
||||||
" if you sepcify -k and -s, -k must be first\n"
|
|
||||||
" -c, --cert <file> load local client certificate from <file>\n"
|
|
||||||
" -y, --key <file> load local certificate key from <file>\n"
|
|
||||||
" -m, --mime <mime> <ext> <tool>\n"
|
|
||||||
" start <tool> for mimetype <mime>\n"
|
|
||||||
" -b, --bookmarks <file>\n"
|
|
||||||
" load and save bookmarks from and to <file>\n"
|
|
||||||
" -e, --edit-bookmarks\n"
|
|
||||||
" start in bookmark-edition mode\n"
|
|
||||||
" <url> optional full URL\n"
|
|
||||||
"Environment:\n"
|
|
||||||
" LANGUAGE \"de\", \"en\", ... "
|
|
||||||
"(actual: %5)\n"
|
|
||||||
" PROXY_TYPE \"http\" or \"socks\" or \"\" "
|
|
||||||
"(actual: %2)\n"
|
|
||||||
" PROXY_PORT proxy port number (actual: %3)\n"
|
|
||||||
" PROXY_HOST proxy host name (actual: %4)\n"
|
|
||||||
" SWISS_USERAGENT fake user agent (actual: %6)\n"
|
|
||||||
" QT_PLUGIN_PATH path to plugins dir (actual: %7)\n"
|
|
||||||
" QTWEBKIT_PLUGIN_PATH path to netscape plugins (actual: %8)")
|
|
||||||
.arg(QFileInfo(QCoreApplication::arguments().at(0)).fileName())
|
|
||||||
.arg(env()["PROXY_TYPE"]).arg(env()["PROXY_PORT"]).arg(env()["PROXY_HOST"])
|
|
||||||
.arg(env()["LANGUAGE"]).arg(env()["SWISS_USERAGENT"])
|
|
||||||
.arg(env()["QT_PLUGIN_PATH"]).arg(env()["QTWEBKIT_PLUGIN_PATH"]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argv, char** argc) try {
|
int main(int argv, char** argc) try {
|
||||||
|
// qInstallMsgHandler(notrace);
|
||||||
|
// std::cout.rdbuf((new std::stringstream)->rdbuf());
|
||||||
|
// std::cerr.rdbuf((new std::stringstream)->rdbuf());
|
||||||
|
// std::clog.rdbuf((new std::stringstream)->rdbuf());
|
||||||
//............................................................................
|
//............................................................................
|
||||||
QSslConfiguration sslConfig(QSslConfiguration::defaultConfiguration());
|
QSslConfiguration sslConfig(QSslConfiguration::defaultConfiguration());
|
||||||
sslConfig.setProtocol(QSsl::AnyProtocol);
|
sslConfig.setProtocol(QSsl::AnyProtocol);
|
||||||
sslConfig.setPeerVerifyMode(QSslSocket::AutoVerifyPeer);
|
sslConfig.setPeerVerifyMode(QSslSocket::AutoVerifyPeer);
|
||||||
|
QList<QSslCertificate> certs(sslConfig.caCertificates());
|
||||||
|
for (QList<QSslCertificate>::iterator cert(certs.begin());
|
||||||
|
cert!=certs.end(); ++cert) {
|
||||||
|
qDebug()<<"CERTIFICATE: "
|
||||||
|
<<cert->issuerInfo(QSslCertificate::Organization)
|
||||||
|
<<cert->issuerInfo(QSslCertificate::CommonName)
|
||||||
|
<<cert->subjectInfo(QSslCertificate::Organization)
|
||||||
|
<<cert->subjectInfo(QSslCertificate::CommonName);
|
||||||
|
}
|
||||||
|
// certs.push_back(QSslCertificate(SWISSSIGN_EV_GOLD_CA_2009_G2));
|
||||||
|
// 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);
|
||||||
|
//............................................................................
|
||||||
|
QStringList l(QProcess::systemEnvironment());
|
||||||
|
QMap<QString, QString> env;
|
||||||
|
for (QStringList::iterator it(l.begin()); it!=l.end(); ++it) {
|
||||||
|
QStringList v(it->split('='));
|
||||||
|
QString key(*v.begin());
|
||||||
|
QString value((v.pop_front(), v.join("=")));
|
||||||
|
env.insert(key, value);
|
||||||
|
qDebug()<<"env:"<<key<<"="<<value;
|
||||||
|
}
|
||||||
//............................................................................
|
//............................................................................
|
||||||
QTextCodec* utf8(QTextCodec::codecForName("UTF-8"));
|
QTextCodec* utf8(QTextCodec::codecForName("UTF-8"));
|
||||||
QTextCodec::setCodecForCStrings(utf8);
|
QTextCodec::setCodecForCStrings(utf8);
|
||||||
QTextCodec::setCodecForLocale(utf8);
|
QTextCodec::setCodecForLocale(utf8);
|
||||||
QTextCodec::setCodecForTr(utf8);
|
QTextCodec::setCodecForTr(utf8);
|
||||||
QApplication app(argv, argc);
|
QApplication app(argv, argc);
|
||||||
app.setWindowIcon(QIcon(":/icons/32x32/swissbrowser.png"));
|
app.setWindowIcon(QIcon(":/icons/appicon"));
|
||||||
app.setApplicationName(QObject::trUtf8("SwissBrowser", "application name"));
|
app.setApplicationName(QObject::trUtf8("SwissSurfer", "application name"));
|
||||||
app.setApplicationVersion(VERSION);
|
app.setApplicationVersion(VERSION);
|
||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
if (env().contains("LANGUAGE")) QLocale::setDefault(env()["LANGUAGE"]);
|
if (env.contains("LANGUAGE")) QLocale::setDefault(env["LANGUAGE"]);
|
||||||
qtTranslator.load(":/language/qt_" + QLocale().name());
|
qtTranslator.load(":/language/qt_" + QLocale().name());
|
||||||
app.installTranslator(&qtTranslator);
|
app.installTranslator(&qtTranslator);
|
||||||
QTranslator appTranslator;
|
QTranslator appTranslator;
|
||||||
appTranslator.load(":/language/swissbrowser_"+ QLocale().name());
|
appTranslator.load(":/language/swisssurfer_"+ QLocale().name());
|
||||||
app.installTranslator(&appTranslator);
|
app.installTranslator(&appTranslator);
|
||||||
|
//............................................................................
|
||||||
|
if (env["PROXY_TYPE"]=="http")
|
||||||
|
QNetworkProxy::setApplicationProxy
|
||||||
|
(QNetworkProxy
|
||||||
|
(QNetworkProxy::HttpProxy,
|
||||||
|
env["PROXY_HOST"], env["PROXY_PORT"].toInt()));
|
||||||
|
if (env["PROXY_TYPE"]=="socks")
|
||||||
|
QNetworkProxy::setApplicationProxy
|
||||||
|
(QNetworkProxy
|
||||||
|
(QNetworkProxy::Socks5Proxy,
|
||||||
|
env["PROXY_HOST"], env["PROXY_PORT"].toInt()));
|
||||||
|
else
|
||||||
|
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
||||||
|
qDebug()<<"***************************************************************";
|
||||||
|
qDebug()<<"Start - Proxy:"
|
||||||
|
<<(QNetworkProxy::applicationProxy().type()==QNetworkProxy::NoProxy
|
||||||
|
? "No Proxy"
|
||||||
|
: (QNetworkProxy::applicationProxy().type()
|
||||||
|
==QNetworkProxy::Socks5Proxy ? "socks" : "http"))
|
||||||
|
<<"Hostname"<<QNetworkProxy::applicationProxy().hostName()
|
||||||
|
<<"Port"<<QNetworkProxy::applicationProxy().port();
|
||||||
|
qDebug()<<"***************************************************************";
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
TMP=QDir::toNativeSeparators(QDir::tempPath());
|
|
||||||
QStringList urls;
|
QStringList urls;
|
||||||
QString actlib
|
QString actlib
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
@@ -146,20 +311,42 @@ int main(int argv, char** argc) try {
|
|||||||
bool silent(false);
|
bool silent(false);
|
||||||
bool quirks(false);
|
bool quirks(false);
|
||||||
bool login(false);
|
bool login(false);
|
||||||
qbrowserlib::Settings::MimeTypes mimetypes;
|
Settings::MimeTypes mimetypes;
|
||||||
QString bookmarks;
|
|
||||||
bool editbookmarks(false);
|
|
||||||
QStringList args(app.arguments());
|
QStringList args(app.arguments());
|
||||||
std::auto_ptr<QSettings> settings
|
std::auto_ptr<QSettings> settings
|
||||||
(std::auto_ptr<QSettings>(new QSettings("SwissSign", "SwissBrowser")));
|
(std::auto_ptr<QSettings>(new QSettings("SwissSign", "SwissSurfer")));
|
||||||
for (QStringList::iterator it(args.begin()); ++it!=args.end();)
|
for (QStringList::iterator it(args.begin()); ++it!=args.end();)
|
||||||
if (*it=="-h" || *it=="--help" || *it=="-help" || *it=="/?") {
|
if (*it=="-h" || *it=="--help" || *it=="-help" || *it=="/?") {
|
||||||
std::cout<<helptext().toStdString()<<std::endl;
|
std::cout<<QObject::trUtf8
|
||||||
|
("Usage: %1 [OPTIONS...] [<url> ...]\n"
|
||||||
|
"Options:\n"
|
||||||
|
" -h, --help show this help text\n"
|
||||||
|
" -k, --kiosk no url bar\n"
|
||||||
|
" if you sepcify -k and -s, -k must be first\n"
|
||||||
|
" -q, --quirks alternate user interface\n"
|
||||||
|
" -n, --no-settings don't load or store any settings\n"
|
||||||
|
" --login ask for smartcard password at startup\n"
|
||||||
|
" -l, --lib <file> path to file libengine_act.so\n"
|
||||||
|
" -s, --settings <file>\n"
|
||||||
|
" load settings from <file>\n"
|
||||||
|
" if you sepcify -k and -s, -k must be first\n"
|
||||||
|
" -c, --cert <file> load local client certificate from <file>\n"
|
||||||
|
" -y, --key <file> load local certificate key from <file>\n"
|
||||||
|
" -m, --mime <mime> <ext> <tool>\n"
|
||||||
|
" start <tool> for mimetype <mime>\n"
|
||||||
|
" <url> optional full URL\n"
|
||||||
|
"Environment:\n"
|
||||||
|
" LANGUAGE \"de\", \"en\", ... (actual: %5)\n"
|
||||||
|
" PROXY_TYPE \"http\" or \"socks\" or \"\" (actual: %2)\n"
|
||||||
|
" PROXY_PORT proxy port number (actual: %3)\n"
|
||||||
|
" PROXY_HOST proxy host name (actual: %4)\n"
|
||||||
|
" SWISSSURFER_USERAGENT fake user agent (actual: %6)\n")
|
||||||
|
.arg(QFileInfo(argc[0]).fileName())
|
||||||
|
.arg(env["PROXY_TYPE"]).arg(env["PROXY_PORT"]).arg(env["PROXY_HOST"])
|
||||||
|
.arg(env["LANGUAGE"]).arg(env["SWISSSURFER_USERAGENT"])
|
||||||
|
.toStdString()
|
||||||
|
<<std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (*it=="-d" || *it=="--debug") {
|
|
||||||
qbrowserlib::Log::DEBUG = true;
|
|
||||||
} 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();
|
||||||
@@ -171,10 +358,6 @@ int main(int argv, char** argc) try {
|
|||||||
login = true;
|
login = true;
|
||||||
} else if ((*it=="-l" || *it=="--lib") && ++it!=args.end()) {
|
} else if ((*it=="-l" || *it=="--lib") && ++it!=args.end()) {
|
||||||
actlib = *it;
|
actlib = *it;
|
||||||
} else if ((*it=="-b" || *it=="--bookmarks") && ++it!=args.end()) {
|
|
||||||
bookmarks = *it;
|
|
||||||
} else if ((*it=="-e" || *it=="--edit-bookmarks")) {
|
|
||||||
editbookmarks = true;
|
|
||||||
} else if ((*it=="-s" || *it=="--settings") && ++it!=args.end()) {
|
} else if ((*it=="-s" || *it=="--settings") && ++it!=args.end()) {
|
||||||
settings = std::auto_ptr<QSettings>
|
settings = std::auto_ptr<QSettings>
|
||||||
(new QSettings(*it, QSettings::IniFormat));
|
(new QSettings(*it, QSettings::IniFormat));
|
||||||
@@ -212,58 +395,21 @@ int main(int argv, char** argc) try {
|
|||||||
} else if (it!=args.end()) {
|
} else if (it!=args.end()) {
|
||||||
urls<<*it;
|
urls<<*it;
|
||||||
} else {
|
} else {
|
||||||
std::cerr<<QObject::trUtf8("Too few arguments.\nTry: %1 --help")
|
std::cout<<QObject::trUtf8("Too few arguments.\nTry: %1 --help")
|
||||||
.arg(QFileInfo(argc[0]).fileName()).toStdString()<<std::endl;
|
.arg(QFileInfo(argc[0]).fileName()).toStdString()<<std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
TRC_FN;
|
|
||||||
QList<QSslCertificate> certs(sslConfig.caCertificates());
|
|
||||||
for (QList<QSslCertificate>::iterator cert(certs.begin());
|
|
||||||
cert!=certs.end(); ++cert) {
|
|
||||||
LOG<<"CERTIFICATE: "
|
|
||||||
<<cert->issuerInfo(QSslCertificate::Organization)
|
|
||||||
<<cert->issuerInfo(QSslCertificate::CommonName)
|
|
||||||
<<cert->subjectInfo(QSslCertificate::Organization)
|
|
||||||
<<cert->subjectInfo(QSslCertificate::CommonName);
|
|
||||||
}
|
|
||||||
QSslConfiguration::setDefaultConfiguration(sslConfig);
|
QSslConfiguration::setDefaultConfiguration(sslConfig);
|
||||||
//............................................................................
|
//............................................................................
|
||||||
if (env()["PROXY_TYPE"]=="http")
|
if (env.contains("QTWEBKIT_PLUGIN_PATH")) qt_drt_overwritePluginDirectories();
|
||||||
QNetworkProxy::setApplicationProxy
|
|
||||||
(QNetworkProxy
|
|
||||||
(QNetworkProxy::HttpProxy,
|
|
||||||
env()["PROXY_HOST"], env()["PROXY_PORT"].toInt()));
|
|
||||||
if (env()["PROXY_TYPE"]=="socks")
|
|
||||||
QNetworkProxy::setApplicationProxy
|
|
||||||
(QNetworkProxy
|
|
||||||
(QNetworkProxy::Socks5Proxy,
|
|
||||||
env()["PROXY_HOST"], env()["PROXY_PORT"].toInt()));
|
|
||||||
else
|
|
||||||
QNetworkProxyFactory::setUseSystemConfiguration(true);
|
|
||||||
LOG<<"Start - Proxy:"
|
|
||||||
<<(QNetworkProxy::applicationProxy().type()==QNetworkProxy::NoProxy
|
|
||||||
? "No Proxy"
|
|
||||||
: (QNetworkProxy::applicationProxy().type()
|
|
||||||
==QNetworkProxy::Socks5Proxy ? "socks" : "http"))
|
|
||||||
<<"Hostname"<<QNetworkProxy::applicationProxy().hostName()
|
|
||||||
<<"Port"<<QNetworkProxy::applicationProxy().port();
|
|
||||||
//............................................................................
|
|
||||||
if (env().contains("QTWEBKIT_PLUGIN_PATH"))
|
|
||||||
qt_drt_overwritePluginDirectories();
|
|
||||||
Browser browser(actlib, urls, settings.get(), mimetypes, silent,
|
Browser browser(actlib, urls, settings.get(), mimetypes, silent,
|
||||||
login, quirks, bookmarks);
|
login, quirks);
|
||||||
if (editbookmarks) browser.on_actionEditBookmarks_triggered();
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
} catch (std::exception& x) {
|
} catch (std::exception& x) {
|
||||||
TRC_FN; LOG<<"Terminated with Exception"<<x.what();
|
std::cerr<<"**** Error: "<<x.what()<<std::endl;
|
||||||
std::cerr<<"**** Terminated with Error:"
|
|
||||||
<<std::endl<<x.what()<<std::endl;
|
|
||||||
return 1;
|
return 1;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// unexpected exception - just terminate
|
// unexpected exception - just terminate
|
||||||
TRC_FN; LOG<<"Terminated with unknown Exception";
|
std::cerr<<"**** Error"<<std::endl;
|
||||||
std::cerr<<"**** Terminated with unknown Error"<<std::endl;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! @}
|
|
||||||
|
@@ -5,11 +5,7 @@
|
|||||||
## 1 2 3 4 5 6 7 8
|
## 1 2 3 4 5 6 7 8
|
||||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
|
|
||||||
SUBDIRS = qbrowserlib designer
|
include_HEADERS =
|
||||||
|
|
||||||
UI_FILES=@srcdir@/qbrowserlib/*.ui
|
|
||||||
qbrowserlibdir=${includedir}/qbrowserlib
|
|
||||||
qbrowserlib_HEADERS = @srcdir@/qbrowserlib/*.hxx $(shell ls qbrowserlib/ui_*.h)
|
|
||||||
|
|
||||||
if !MINGW32
|
if !MINGW32
|
||||||
if MAC
|
if MAC
|
||||||
@@ -29,8 +25,7 @@ mypkg_DATA = @PACKAGENAME@.xpm resources/@PACKAGENAME@.png
|
|||||||
applicationsdir = ${datarootdir}/applications
|
applicationsdir = ${datarootdir}/applications
|
||||||
dist_applications_DATA = @PACKAGENAME@.desktop
|
dist_applications_DATA = @PACKAGENAME@.desktop
|
||||||
|
|
||||||
EXTRA_DIST = @srcdir@/resources @srcdir@/*.cxx @srcdir@/*.hxx \
|
EXTRA_DIST = resources *.cxx *.hxx *.ui *.ts *.qrc
|
||||||
@srcdir@/*.ui @srcdir@/*.ts @srcdir@/*.qrc
|
|
||||||
|
|
||||||
LANGS = en de fr it
|
LANGS = en de fr it
|
||||||
ALL_SRC = ${top_srcdir}/src/*.[ch]xx ${top_srcdir}/src/*.ui $(shell find ${top_srcdir}/src/resources -name .svn -prune -o \( -type f -o -type l \) -print)
|
ALL_SRC = ${top_srcdir}/src/*.[ch]xx ${top_srcdir}/src/*.ui $(shell find ${top_srcdir}/src/resources -name .svn -prune -o \( -type f -o -type l \) -print)
|
||||||
@@ -38,8 +33,7 @@ ALL_SRC = ${top_srcdir}/src/*.[ch]xx ${top_srcdir}/src/*.ui $(shell find ${top_s
|
|||||||
QMAKE_PROJECT = qmake.pro
|
QMAKE_PROJECT = qmake.pro
|
||||||
QMAKE_MAKEFILE = makefile.qmake
|
QMAKE_MAKEFILE = makefile.qmake
|
||||||
|
|
||||||
bin_SCRIPTS = swissbrowser
|
QMAKE_TARGET = @PACKAGENAME@
|
||||||
QMAKE_TARGET = ${bin_SCRIPTS}
|
|
||||||
|
|
||||||
TARGETS = ${QMAKE_TARGET}
|
TARGETS = ${QMAKE_TARGET}
|
||||||
|
|
||||||
@@ -86,24 +80,23 @@ ${QMAKE_MAKEFILE}: ${QMAKE_PROJECT} ${ALL_SRC}
|
|||||||
${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC} $(LANGS:%=@PACKAGENAME@_%.qm)
|
${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC} $(LANGS:%=@PACKAGENAME@_%.qm)
|
||||||
make -f ${QMAKE_MAKEFILE}
|
make -f ${QMAKE_MAKEFILE}
|
||||||
|
|
||||||
install-data-local:
|
clean-local:
|
||||||
${mkinstalldirs} ${DESTDIR}${bindir}
|
-rm -r ${QMAKE_TARGET}.app
|
||||||
for file in ${QMAKE_TARGET}{,.app,.exe}; do \
|
|
||||||
if test -d $$file; then \
|
maintainer-clean-local:
|
||||||
rsync -a --delete $$file ${DESTDIR}${bindir}/; \
|
-rm -rf ${QMAKE_TARGET}.app
|
||||||
elif test -e $$file; then \
|
|
||||||
${INSTALL} $$file ${DESTDIR}${bindir}; \
|
install-exec-local:
|
||||||
fi; \
|
test -d ${bindir} || mkdir -p ${bindir}
|
||||||
done
|
( test -f @PACKAGENAME@ && cp @PACKAGENAME@ ${bindir}/ ) \
|
||||||
|
|| ( test -f @PACKAGENAME@.exe && cp @PACKAGENAME@.exe ${bindir}/ ) \
|
||||||
|
|| ( test -d @PACKAGENAME@.app && cp -r @PACKAGENAME@.app ${bindir}/ )
|
||||||
|
|
||||||
uninstall-local:
|
uninstall-local:
|
||||||
-rm -r ${DESTDIR}${bindir}/${QMAKE_TARGET}*
|
-rm -rf ${bindir}/@PACKAGENAME@{,.exe,.app}
|
||||||
|
|
||||||
clean-local:
|
|
||||||
-rm -r ${QMAKE_TARGET}{,.app,.exe}
|
|
||||||
|
|
||||||
CLEANFILES = ${TARGETS} ${TARGETS:%=%.exe} $(LANGS:%=@PACKAGENAME@_%.qm) \
|
CLEANFILES = ${TARGETS} ${TARGETS:%=%.exe} $(LANGS:%=@PACKAGENAME@_%.qm) \
|
||||||
*.o *.obj qrc_*.cpp ui_*.h moc_*.cpp \
|
*.o *.obj qrc_*.cpp ui_*.h moc_*.cpp \
|
||||||
${QMAKE_TARGET} object_script.swissbrowser \
|
${QMAKE_TARGET} \
|
||||||
@PACKAGENAME@.xpm
|
@PACKAGENAME@.xpm
|
||||||
MAINTAINERCLEANFILES = makefile.in ${QMAKE_MAKEFILE}
|
MAINTAINERCLEANFILES = makefile.in ${QMAKE_MAKEFILE}
|
||||||
|
@@ -8,25 +8,23 @@
|
|||||||
#ifndef __PINDIALOG_HXX__
|
#ifndef __PINDIALOG_HXX__
|
||||||
#define __PINDIALOG_HXX__
|
#define __PINDIALOG_HXX__
|
||||||
|
|
||||||
#include <cryptoki.hxx>
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <ui_pinentry.h>
|
#include <ui_pinentry.h>
|
||||||
#include <QtGui/QDialog>
|
#include <QtGui/QDialog>
|
||||||
#include <QtCore/QDateTime>
|
#include <QtCore/QDateTime>
|
||||||
#include <QtNetwork/QSslCertificate>
|
#include <QtNetwork/QSslCertificate>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#ifndef LOG
|
||||||
|
#define LOG qDebug()<<__PRETTY_FUNCTION__
|
||||||
|
#endif
|
||||||
|
|
||||||
class PinEntry: public QDialog, public Ui::PinEntry {
|
class PinEntry: public QDialog, public Ui::PinEntry {
|
||||||
Q_OBJECT;
|
Q_OBJECT;
|
||||||
public:
|
public:
|
||||||
PinEntry(const QSslCertificate& cert, QWidget *parent=0):
|
PinEntry(const QSslCertificate& cert, QWidget *parent=0): QDialog(parent) {
|
||||||
QDialog(parent),
|
|
||||||
_maxPinLen(-1), _minPinLen(0) {
|
|
||||||
setModal(true);
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
_cert->certificate(cert);
|
_cert->certificate(cert);
|
||||||
on__showDetails_toggled(false);
|
|
||||||
_name->setText(utfConv(cert.subjectInfo(QSslCertificate::CommonName))
|
_name->setText(utfConv(cert.subjectInfo(QSslCertificate::CommonName))
|
||||||
.remove(" (Authentication)"));
|
.remove(" (Authentication)"));
|
||||||
_mail->setText(utfConv(cert.alternateSubjectNames()
|
_mail->setText(utfConv(cert.alternateSubjectNames()
|
||||||
@@ -40,12 +38,6 @@ class PinEntry: public QDialog, public Ui::PinEntry {
|
|||||||
_certSerial->setText(cert.serialNumber());
|
_certSerial->setText(cert.serialNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PinEntry& tokeninfo(const cryptoki::TokenInfo& ti) {
|
|
||||||
_maxPinLen = ti.maxPinLen;
|
|
||||||
_minPinLen = ti.minPinLen;
|
|
||||||
on__pin_textChanged(_pin->text());
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
PinEntry& retries(int num) {
|
PinEntry& retries(int num) {
|
||||||
_pinstatus->setCurrentIndex(num==-1?1:(num==-2?2:0));
|
_pinstatus->setCurrentIndex(num==-1?1:(num==-2?2:0));
|
||||||
_retries->setText(tr("there are %1 PIN attempts left").arg(num));
|
_retries->setText(tr("there are %1 PIN attempts left").arg(num));
|
||||||
@@ -55,8 +47,7 @@ class PinEntry: public QDialog, public Ui::PinEntry {
|
|||||||
return _pin->text();
|
return _pin->text();
|
||||||
}
|
}
|
||||||
int myexec() {
|
int myexec() {
|
||||||
TRC;
|
LOG;
|
||||||
_pin->clear();
|
|
||||||
show();
|
show();
|
||||||
LOG<<"SSSSSSSSSTTTTTTTAAAAAAAAAAAAARRRRRRRRRRTTTTTTTTTT";
|
LOG<<"SSSSSSSSSTTTTTTTAAAAAAAAAAAAARRRRRRRRRRTTTTTTTTTT";
|
||||||
int res(_run.exec(QEventLoop::ExcludeSocketNotifiers));
|
int res(_run.exec(QEventLoop::ExcludeSocketNotifiers));
|
||||||
@@ -66,29 +57,23 @@ class PinEntry: public QDialog, public Ui::PinEntry {
|
|||||||
}
|
}
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
virtual void accept() {
|
virtual void accept() {
|
||||||
TRC;
|
LOG;
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
virtual void done(int r) {
|
virtual void done(int r) {
|
||||||
TRC; LOG<<r;
|
LOG<<r;
|
||||||
_run.exit(r);
|
_run.exit(r);
|
||||||
assert(!_run.isRunning());
|
assert(!_run.isRunning());
|
||||||
LOG<<"DDDDDDDDOOOOOOOOOOOONNNNNNNNNNNEEEEEEE";
|
LOG<<"DDDDDDDDOOOOOOOOOOOONNNNNNNNNNNEEEEEEE";
|
||||||
QDialog::done(r);
|
QDialog::done(r);
|
||||||
}
|
}
|
||||||
virtual void reject() {
|
virtual void reject() {
|
||||||
TRC;
|
LOG;
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void on__showDetails_toggled(bool s) {
|
void on__showDetails_toggled(bool s) {
|
||||||
_cert->setVisible(s);
|
_certStack->setCurrentIndex(s?1:0);
|
||||||
adjustSize();
|
|
||||||
}
|
|
||||||
void on__pin_textChanged(const QString &text) {
|
|
||||||
_buttonBox->button(QDialogButtonBox::Ok)
|
|
||||||
->setEnabled((unsigned long)text.size()>=_minPinLen &&
|
|
||||||
(unsigned long)text.size()<=_maxPinLen);
|
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
QString utfConv(const QString& txt) {
|
QString utfConv(const QString& txt) {
|
||||||
@@ -99,8 +84,6 @@ class PinEntry: public QDialog, public Ui::PinEntry {
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
QEventLoop _run;
|
QEventLoop _run;
|
||||||
unsigned long _maxPinLen;
|
|
||||||
unsigned long _minPinLen;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>688</width>
|
<width>603</width>
|
||||||
<height>594</height>
|
<height>494</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -169,17 +169,29 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="Certificate" name="_cert" native="true">
|
<widget class="QStackedWidget" name="_certStack">
|
||||||
<property name="sizePolicy">
|
<property name="currentIndex">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<number>0</number>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
</property>
|
||||||
|
<widget class="QWidget" name="page_4"/>
|
||||||
|
<widget class="QWidget" name="page_5">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="Certificate" name="_cert" native="true">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="_buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -203,7 +215,7 @@
|
|||||||
</resources>
|
</resources>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>_buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>accepted()</signal>
|
<signal>accepted()</signal>
|
||||||
<receiver>PinEntry</receiver>
|
<receiver>PinEntry</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
@@ -219,7 +231,7 @@
|
|||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>_buttonBox</sender>
|
<sender>buttonBox</sender>
|
||||||
<signal>rejected()</signal>
|
<signal>rejected()</signal>
|
||||||
<receiver>PinEntry</receiver>
|
<receiver>PinEntry</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
|
60
src/pluginfactory.hxx
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*! @file
|
||||||
|
|
||||||
|
@id $Id$
|
||||||
|
*/
|
||||||
|
// 1 2 3 4 5 6 7 8
|
||||||
|
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
||||||
|
|
||||||
|
#ifndef __PLUGINFACTORY_HXX__
|
||||||
|
#define __PLUGINFACTORY_HXX__
|
||||||
|
|
||||||
|
#include <QtWebKit/QWebPluginFactory>
|
||||||
|
#include <saveorrun.hxx>
|
||||||
|
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#ifndef LOG
|
||||||
|
#define LOG qDebug()<<__PRETTY_FUNCTION__
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define foreach(A, B) \
|
||||||
|
auto foreach_loopvar_##A(B); \
|
||||||
|
for (auto A(foreach_loopvar_##A.begin()); A!=foreach_loopvar_##A.end(); ++A)
|
||||||
|
|
||||||
|
class PluginFactory: public QWebPluginFactory {
|
||||||
|
public:
|
||||||
|
PluginFactory(QObject* p=0): QWebPluginFactory(p) {
|
||||||
|
LOG;
|
||||||
|
Plugin plugin;
|
||||||
|
plugin.name = "Show PDF-Document";
|
||||||
|
plugin.description = "Plugin for PDF documents";
|
||||||
|
MimeType mime;
|
||||||
|
mime.fileExtensions<<"pdf";
|
||||||
|
mime.name = "application/pdf";
|
||||||
|
mime.description = "PDF-Document";
|
||||||
|
plugin.mimeTypes<<mime;
|
||||||
|
_plugins.push_back(plugin);
|
||||||
|
}
|
||||||
|
virtual QObject* create(const QString& mimeType, const QUrl& url,
|
||||||
|
const QStringList& argumentNames,
|
||||||
|
const QStringList& argumentValues ) const {
|
||||||
|
LOG<<"mimeType:"<<mimeType
|
||||||
|
<<"url:"<<url
|
||||||
|
<<"argumentNames:"<<argumentNames.join(", ")
|
||||||
|
<<"argumentValues:"<<argumentValues.join(", ");
|
||||||
|
if (mimeType=="application/pdf") {
|
||||||
|
return new SaveOrRunPlugin(url, mimeType);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
virtual QList<Plugin> plugins() const {
|
||||||
|
LOG;
|
||||||
|
return _plugins;
|
||||||
|
}
|
||||||
|
virtual void refreshPlugins() {
|
||||||
|
LOG;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
QList<Plugin> _plugins;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@@ -1,77 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __BUTTONLINEEDIT_HXX__
|
|
||||||
#define __BUTTONLINEEDIT_HXX__
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <QtGui/QLineEdit>
|
|
||||||
#include <QtGui/QToolButton>
|
|
||||||
#include <QtGui/QAction>
|
|
||||||
#include <QtGui/QStyle>
|
|
||||||
#include <QtCore/QDebug>
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
namespace 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) {
|
|
||||||
TRC;
|
|
||||||
}
|
|
||||||
QToolButton* add(QAction* a) {
|
|
||||||
TRC;
|
|
||||||
QToolButton* b(new QToolButton(this));
|
|
||||||
b->setDefaultAction(a);
|
|
||||||
add(b);
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
ButtonLineEdit& add(QToolButton* b) {
|
|
||||||
TRC;
|
|
||||||
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) {
|
|
||||||
TRC;
|
|
||||||
_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
|
|
@@ -1,20 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#include <qbrowserlib/certs.hxx>
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
const QString LIBNAME("libcvP11.so");
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
const QString LIBNAME("libcvP11.dylib");
|
|
||||||
#elif defined(Q_OS_WIN)
|
|
||||||
const QString LIBNAME("cvP11.dll");
|
|
||||||
#else
|
|
||||||
const QString LIBNAME;
|
|
||||||
#endif
|
|
||||||
}
|
|
@@ -1,68 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __QBROWSERLIB_CERTS_HXX__
|
|
||||||
#define __QBROWSERLIB_CERTS_HXX__
|
|
||||||
|
|
||||||
#include <cryptoki.hxx>
|
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtNetwork/QSslCertificate>
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
extern const QString LIBNAME;
|
|
||||||
|
|
||||||
//! Access certificate information from cryptoki library.
|
|
||||||
/*! Advice: Keep one instance per executable, because library is
|
|
||||||
loaded, instanciated and unloaded on each object creation or
|
|
||||||
deletion. */
|
|
||||||
class Certs {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! Initialize cryptoki library.
|
|
||||||
/*! Advice: Keep one instance per executable, because library is
|
|
||||||
loaded, instanciated and unloaded on each object creation or
|
|
||||||
deletion.
|
|
||||||
|
|
||||||
@throws throws std::exception in case of error */
|
|
||||||
Certs(const QString& lib = LIBNAME): _cryptoki(lib.toStdString()) {}
|
|
||||||
|
|
||||||
//! Get a list of authentification certificates.
|
|
||||||
/*! @throws throws std::exception in case of error */
|
|
||||||
QList<QSslCertificate> auth() {
|
|
||||||
QList<QSslCertificate> authCerts;
|
|
||||||
cryptoki::SlotList slotlist(_cryptoki.slotList());
|
|
||||||
for (cryptoki::SlotList::iterator slot(slotlist.begin());
|
|
||||||
slot!=slotlist.end(); ++slot) {
|
|
||||||
cryptoki::Session session(*slot);
|
|
||||||
cryptoki::ObjectList certs(session.find
|
|
||||||
(cryptoki::Attribute(CKA_CLASS)
|
|
||||||
.from<CK_OBJECT_CLASS>(CKO_CERTIFICATE)));
|
|
||||||
for (cryptoki::ObjectList::iterator cert(certs.begin());
|
|
||||||
cert!=certs.end(); ++cert) {
|
|
||||||
cryptoki::Attribute label(cert->attribute(CKA_LABEL));
|
|
||||||
if (label.value.find("auth")==0 ||
|
|
||||||
label.value.find("Authentication")!=std::string::npos) {
|
|
||||||
std::string data(cert->attribute(CKA_VALUE).value);
|
|
||||||
authCerts.push_back(QSslCertificate(QByteArray(data.data(),
|
|
||||||
data.size()),
|
|
||||||
QSsl::Der));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return authCerts;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
cryptoki::Init _cryptoki;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
|
@@ -1,341 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __DOWNLOAD_MANAGER_HXX
|
|
||||||
#define __DOWNLOAD_MANAGER_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <QtNetwork/QNetworkReply>
|
|
||||||
#include <QtNetwork/QSslError>
|
|
||||||
#include <QtNetwork/QSslConfiguration>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
class DownloadManager: public QObject {
|
|
||||||
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! Append a Network Manager
|
|
||||||
DownloadManager& operator+=(QNetworkAccessManager* n) {
|
|
||||||
TRC;
|
|
||||||
assert(connect(n, SIGNAL(created(QNetworkReply*)),
|
|
||||||
SLOT(add(QNetworkReply*))));
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Append a Network Reply
|
|
||||||
DownloadManager& operator+=(QNetworkReply* reply) {
|
|
||||||
TRC;
|
|
||||||
add(reply);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QString networkError(QNetworkReply::NetworkError err) {
|
|
||||||
TRC_FN; LOG<<err;
|
|
||||||
switch (err) {
|
|
||||||
case QNetworkReply::NoError:
|
|
||||||
return tr("Network connection successful, remote host can be"
|
|
||||||
" reached.");
|
|
||||||
case QNetworkReply::ConnectionRefusedError:
|
|
||||||
return tr("The remote server refused the connection (the server is"
|
|
||||||
" not accepting requests).");
|
|
||||||
case QNetworkReply::RemoteHostClosedError:
|
|
||||||
return tr("The remote server closed the connection prematurely,"
|
|
||||||
" before the entire reply was received and processed.");
|
|
||||||
case QNetworkReply::HostNotFoundError:
|
|
||||||
return tr("The remote host name was not found (invalid hostname).");
|
|
||||||
case QNetworkReply::TimeoutError:
|
|
||||||
return tr("The connection to the remote server timed out.");
|
|
||||||
case QNetworkReply::OperationCanceledError:
|
|
||||||
return tr("The operation was canceled via calls to abort() or"
|
|
||||||
" close() before it was finished.");
|
|
||||||
case QNetworkReply::SslHandshakeFailedError:
|
|
||||||
return tr("The SSL/TLS handshake failed and the encrypted channel"
|
|
||||||
" could not be established. See SSL-Errors above.");
|
|
||||||
case QNetworkReply::ProxyConnectionRefusedError:
|
|
||||||
return tr("The connection to the proxy server was refused (the"
|
|
||||||
" proxy server is not accepting requests).");
|
|
||||||
case QNetworkReply::ProxyConnectionClosedError:
|
|
||||||
return tr("The proxy server closed the connection prematurely,"
|
|
||||||
" before the entire reply was received and processed.");
|
|
||||||
case QNetworkReply::ProxyNotFoundError:
|
|
||||||
return tr("The proxy host name was not found (invalid proxy"
|
|
||||||
" hostname).");
|
|
||||||
case QNetworkReply::ProxyTimeoutError:
|
|
||||||
return tr("The connection to the proxy timed out or the proxy did"
|
|
||||||
" not reply in time to the request sent.");
|
|
||||||
case QNetworkReply::ProxyAuthenticationRequiredError:
|
|
||||||
return tr("The proxy requires authentication in order to honour the"
|
|
||||||
" request but did not accept any credentials offered"
|
|
||||||
" (if any).");
|
|
||||||
case QNetworkReply::ContentAccessDenied:
|
|
||||||
return tr("The access to the remote content was denied (similar to"
|
|
||||||
" HTTP error 401).");
|
|
||||||
case QNetworkReply::ContentOperationNotPermittedError:
|
|
||||||
return tr("The operation requested on the remote content is not"
|
|
||||||
" permitted.");
|
|
||||||
case QNetworkReply::ContentNotFoundError:
|
|
||||||
return tr("The remote content was not found at the server (similar"
|
|
||||||
" to HTTP error 404).");
|
|
||||||
case QNetworkReply::AuthenticationRequiredError:
|
|
||||||
return tr("The remote server requires authentication to serve the"
|
|
||||||
" content but the credentials provided were not accepted"
|
|
||||||
" (if any).");
|
|
||||||
case QNetworkReply::ProtocolUnknownError:
|
|
||||||
return tr("The Network Access API cannot honor the request because"
|
|
||||||
" the protocol is not known.");
|
|
||||||
case QNetworkReply::ProtocolInvalidOperationError:
|
|
||||||
return tr("The requested operation is invalid for this protocol.");
|
|
||||||
case QNetworkReply::UnknownNetworkError:
|
|
||||||
return tr("An unknown network-related error was detected.");
|
|
||||||
case QNetworkReply::UnknownProxyError:
|
|
||||||
return tr("An unknown proxy-related error was detected.");
|
|
||||||
case QNetworkReply::UnknownContentError:
|
|
||||||
return tr("An unknonwn error related to the remote content was"
|
|
||||||
" detected.");
|
|
||||||
case QNetworkReply::ProtocolFailure:
|
|
||||||
return tr("A breakdown in protocol was detected (parsing error,"
|
|
||||||
" invalid or unexpected responses, etc.).");
|
|
||||||
default:
|
|
||||||
return tr("Unknown network error (code: %1).").arg(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
|
|
||||||
void progress(qint64 done, qint64 total);
|
|
||||||
void started();
|
|
||||||
void finished();
|
|
||||||
void error(QString);
|
|
||||||
void metaDataChanged(QNetworkReply*);
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
void add(QNetworkReply* reply) {
|
|
||||||
TRC; LOG<<_downloads.size()<<reply->url().toString();
|
|
||||||
LOG<<reply;
|
|
||||||
_downloads[reply].progress = Progress(0, 0);
|
|
||||||
assert(connect(reply, SIGNAL(downloadProgress(qint64, qint64)),
|
|
||||||
SLOT(downloadProgress(qint64, qint64))));
|
|
||||||
assert(connect(reply, SIGNAL(error(QNetworkReply::NetworkError)),
|
|
||||||
SLOT(error(QNetworkReply::NetworkError))));
|
|
||||||
assert(connect(reply, SIGNAL(destroyed(QObject*)),
|
|
||||||
SLOT(slotDestroyed(QObject*))));
|
|
||||||
assert(connect(reply, SIGNAL(finished()),
|
|
||||||
SLOT(slotFinished())));
|
|
||||||
assert(connect(reply, SIGNAL(metaDataChanged()),
|
|
||||||
SLOT(slotMetaDataChanged())));
|
|
||||||
assert(connect(reply, SIGNAL(sslErrors(const QList<QSslError>&)),
|
|
||||||
SLOT(sslErrors(const QList<QSslError>&))));
|
|
||||||
assert(connect(reply, SIGNAL(uploadProgress(qint64, qint64)),
|
|
||||||
SLOT(uploadProgress(qint64, qint64))));
|
|
||||||
if (_downloads.size()==1) started();
|
|
||||||
}
|
|
||||||
|
|
||||||
void abort() {
|
|
||||||
while (_downloads.size()) _downloads.begin()->first->abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
void calcProgress() {
|
|
||||||
//TRC;
|
|
||||||
qint64 done(0);
|
|
||||||
qint64 total(0);
|
|
||||||
for (Downloads::iterator it(_downloads.begin());
|
|
||||||
it!=_downloads.end(); ++it) {
|
|
||||||
done += it->second.progress.first;
|
|
||||||
total += it->second.progress.second;
|
|
||||||
}
|
|
||||||
progress(done, total);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
|
|
||||||
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal) {
|
|
||||||
//TRC; LOG<<bytesReceived<<bytesTotal;
|
|
||||||
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.first
|
|
||||||
= bytesReceived;
|
|
||||||
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.second
|
|
||||||
= bytesTotal;
|
|
||||||
calcProgress();
|
|
||||||
}
|
|
||||||
void error(QNetworkReply::NetworkError code) {
|
|
||||||
TRC; LOG<<"Status:"<<networkError(code);
|
|
||||||
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
|
||||||
_downloads[reply].error +=
|
|
||||||
tr("<h1>Network Error</h1>"
|
|
||||||
"<dl><dt>URL:</dt><dd>%1</dd>"
|
|
||||||
"<dt>Error Code:</dt><dd>%3</dd>"
|
|
||||||
"<dt>Error Details:</dt><dd>%2</dd></dl>")
|
|
||||||
.arg(reply->url().toString())
|
|
||||||
.arg(networkError(code))
|
|
||||||
.arg(code);
|
|
||||||
}
|
|
||||||
void slotDestroyed(QObject* obj) {
|
|
||||||
TRC; LOG<<_downloads.size();
|
|
||||||
_downloads.erase((QNetworkReply*)obj);
|
|
||||||
}
|
|
||||||
void slotFinished() {
|
|
||||||
TRC; LOG<<_downloads.size();
|
|
||||||
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
|
||||||
if (_downloads[reply].error.size())
|
|
||||||
error(_downloads[reply].error);
|
|
||||||
_downloads.erase(reply);
|
|
||||||
if (_downloads.size()==0) finished();
|
|
||||||
}
|
|
||||||
void slotMetaDataChanged() {
|
|
||||||
TRC;
|
|
||||||
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
|
||||||
if (!reply) return;
|
|
||||||
LOG<<"Location:"<<reply->header(QNetworkRequest::LocationHeader)
|
|
||||||
.toString();
|
|
||||||
LOG<<"Content-Type:"<<reply->header(QNetworkRequest::ContentTypeHeader)
|
|
||||||
.toString();
|
|
||||||
LOG<<"Content-Disposition:"<<reply->rawHeader("Content-Disposition");
|
|
||||||
LOG<<"Status:"<<networkError(reply->error());
|
|
||||||
LOG<<"URL:"<<reply->url().toString();
|
|
||||||
LOG<<"File:"<<reply->url().toLocalFile();
|
|
||||||
LOG<<"Path:"<<reply->url().path();
|
|
||||||
metaDataChanged(reply);
|
|
||||||
}
|
|
||||||
void sslErrors(const QList<QSslError> & errors) {
|
|
||||||
TRC;
|
|
||||||
QNetworkReply* reply(qobject_cast<QNetworkReply*>(sender()));
|
|
||||||
for (QList<QSslError>::const_iterator err(errors.begin());
|
|
||||||
err!=errors.end(); ++err) {
|
|
||||||
LOG<<"SSL-Error: "<<(int)err->error()<<": "<<err->errorString();
|
|
||||||
LOG<<"Certificate Issuer: "
|
|
||||||
<<"O="
|
|
||||||
<<err->certificate().issuerInfo(QSslCertificate::Organization)
|
|
||||||
<<"CN="<<err->certificate().issuerInfo(QSslCertificate::CommonName)
|
|
||||||
<<"L="
|
|
||||||
<<err->certificate().issuerInfo(QSslCertificate::LocalityName)
|
|
||||||
<<"OU="
|
|
||||||
<<err->certificate()
|
|
||||||
.issuerInfo(QSslCertificate::OrganizationalUnitName)
|
|
||||||
<<"C="<<err->certificate().issuerInfo(QSslCertificate::CountryName)
|
|
||||||
<<"ST="
|
|
||||||
<<err->certificate()
|
|
||||||
.issuerInfo(QSslCertificate::StateOrProvinceName);
|
|
||||||
LOG<<"Certificate Subject: "
|
|
||||||
<<"O="
|
|
||||||
<<err->certificate().subjectInfo(QSslCertificate::Organization)
|
|
||||||
<<"CN="
|
|
||||||
<<err->certificate().subjectInfo(QSslCertificate::CommonName)
|
|
||||||
<<"L="
|
|
||||||
<<err->certificate().subjectInfo(QSslCertificate::LocalityName)
|
|
||||||
<<"OU="
|
|
||||||
<<err->certificate()
|
|
||||||
.subjectInfo(QSslCertificate::OrganizationalUnitName)
|
|
||||||
<<"C="
|
|
||||||
<<err->certificate().subjectInfo(QSslCertificate::CountryName)
|
|
||||||
<<"ST="
|
|
||||||
<<err->certificate()
|
|
||||||
.subjectInfo(QSslCertificate::StateOrProvinceName);
|
|
||||||
LOG<<"Certificate:\n"<<err->certificate().toPem();
|
|
||||||
switch (err->error()) {
|
|
||||||
case QSslError::SelfSignedCertificate:
|
|
||||||
case QSslError::SelfSignedCertificateInChain: {
|
|
||||||
QSslConfiguration sslConfig
|
|
||||||
(QSslConfiguration::defaultConfiguration());
|
|
||||||
QList<QSslCertificate> certs(sslConfig.caCertificates());
|
|
||||||
for (QList<QSslCertificate>::iterator cert(certs.begin());
|
|
||||||
cert!=certs.end(); ++cert) {
|
|
||||||
if (err->certificate().subjectInfo(QSslCertificate::CommonName)
|
|
||||||
== cert->subjectInfo(QSslCertificate::CommonName)) {
|
|
||||||
LOG<<"Found matching CN:"
|
|
||||||
<<cert->subjectInfo(QSslCertificate::CommonName);
|
|
||||||
if (err->certificate()==*cert) {
|
|
||||||
LOG<<"QT-BUG! Certificate matches known certificate";
|
|
||||||
//! @bug work around qt bug (Qt Mac 4.8.2)
|
|
||||||
reply->ignoreSslErrors(errors);
|
|
||||||
} else {
|
|
||||||
LOG<<"CERTIFICATE ERROR! Certificates are different";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} break;
|
|
||||||
default:; // ignore
|
|
||||||
}
|
|
||||||
_downloads[reply].error +=
|
|
||||||
tr("<h1>SSL Error</h1>"
|
|
||||||
"<dl><dt>URL:</dt><dd>%1</dd>"
|
|
||||||
"<dt>Error Code:</dt><dd>%3</dd>"
|
|
||||||
"<dt>Error Details:</dt><dd>%2</dd></dl>"
|
|
||||||
"<table>"
|
|
||||||
"<caption>Certificate Issuer</caption>"
|
|
||||||
"<tr><th>Organization:</th><td>%4</td></tr>"
|
|
||||||
"<tr><th>Common Name:</th><td>%5</td></tr>"
|
|
||||||
"<tr><th>Location:</th><td>%6</td></tr>"
|
|
||||||
"<tr><th>Organizational Unit:</th><td>%7</td></tr>"
|
|
||||||
"<tr><th>Country:</th><td>%8</td></tr>"
|
|
||||||
"<tr><th>State or Provive:</th><td>%9</td></tr>"
|
|
||||||
"</table>"
|
|
||||||
"<table>"
|
|
||||||
"<caption>Certificate Subject</caption>"
|
|
||||||
"<tr><th>Organization:</th><td>%10</td></tr>"
|
|
||||||
"<tr><th>Common Name:</th><td>%11</td></tr>"
|
|
||||||
"<tr><th>Location:</th><td>%12</td></tr>"
|
|
||||||
"<tr><th>Organizational Unit:</th><td>%13</td></tr>"
|
|
||||||
"<tr><th>Country:</th><td>%14</td></tr>"
|
|
||||||
"<tr><th>State or Province:</th><td>%15</td></tr>"
|
|
||||||
"</table>")
|
|
||||||
.arg(reply->url().toString())
|
|
||||||
.arg(err->errorString())
|
|
||||||
.arg(err->error())
|
|
||||||
.arg(err->certificate().issuerInfo(QSslCertificate::Organization))
|
|
||||||
.arg(err->certificate().issuerInfo(QSslCertificate::CommonName))
|
|
||||||
.arg(err->certificate().issuerInfo(QSslCertificate::LocalityName))
|
|
||||||
.arg(err->certificate()
|
|
||||||
.issuerInfo(QSslCertificate::OrganizationalUnitName))
|
|
||||||
.arg(err->certificate().issuerInfo(QSslCertificate::CountryName))
|
|
||||||
.arg(err->certificate()
|
|
||||||
.issuerInfo(QSslCertificate::StateOrProvinceName))
|
|
||||||
.arg(err->certificate().subjectInfo(QSslCertificate::Organization))
|
|
||||||
.arg(err->certificate().subjectInfo(QSslCertificate::CommonName))
|
|
||||||
.arg(err->certificate().subjectInfo(QSslCertificate::LocalityName))
|
|
||||||
.arg(err->certificate()
|
|
||||||
.subjectInfo(QSslCertificate::OrganizationalUnitName))
|
|
||||||
.arg(err->certificate().subjectInfo(QSslCertificate::CountryName))
|
|
||||||
.arg(err->certificate()
|
|
||||||
.subjectInfo(QSslCertificate::StateOrProvinceName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void uploadProgress(qint64 bytesSent, qint64 bytesTotal) {
|
|
||||||
//TRC; LOG<<bytesSent<<bytesTotal;
|
|
||||||
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.first
|
|
||||||
= bytesSent;
|
|
||||||
_downloads[qobject_cast<QNetworkReply*>(sender())].progress.second
|
|
||||||
= bytesTotal;
|
|
||||||
calcProgress();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
typedef std::pair<qint64, qint64> Progress;
|
|
||||||
struct Download {
|
|
||||||
Progress progress;
|
|
||||||
QString error;
|
|
||||||
};
|
|
||||||
typedef std::map<QNetworkReply*, Download> Downloads;
|
|
||||||
|
|
||||||
Downloads _downloads;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
//! @}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,59 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef ERRORLOG_HXX
|
|
||||||
#define ERRORLOG_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/ui_errorlog.h>
|
|
||||||
#include <QtGui/QDialog>
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
//! Collect and Show Errors
|
|
||||||
/*! Singleton */
|
|
||||||
class ErrorLog: public QDialog, protected Ui::ErrorLog {
|
|
||||||
Q_OBJECT;
|
|
||||||
Q_SIGNALS:
|
|
||||||
void reset();
|
|
||||||
public:
|
|
||||||
//! Singleton
|
|
||||||
static ErrorLog& instance(QWidget* p=0) {
|
|
||||||
static ErrorLog _instance(p);
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
private: // singleton
|
|
||||||
ErrorLog(const ErrorLog&);
|
|
||||||
ErrorLog(QWidget* p): QDialog(p) {
|
|
||||||
TRC;
|
|
||||||
setupUi(this);
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
void append(QString text) {
|
|
||||||
TRC; LOG<<text;
|
|
||||||
_errors->append(text);
|
|
||||||
}
|
|
||||||
protected Q_SLOTS:
|
|
||||||
void on__buttons_clicked(QAbstractButton* button) {
|
|
||||||
TRC;
|
|
||||||
switch (_buttons->buttonRole(button)) {
|
|
||||||
case QDialogButtonBox::ResetRole: {
|
|
||||||
_errors->clear();
|
|
||||||
reset();
|
|
||||||
} break;
|
|
||||||
default:;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,125 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef QBROWSERLIB_EXECUTOR_HXX
|
|
||||||
#define QBROWSERLIB_EXECUTOR_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/settings.hxx>
|
|
||||||
#include <qbrowserlib/temporaryfile.hxx>
|
|
||||||
|
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtCore/QProcess>
|
|
||||||
#include <QtNetwork/QNetworkReply>
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
//! Execute external processes
|
|
||||||
/*! Implements a singleton pattern */
|
|
||||||
class Executor: public QObject {
|
|
||||||
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
void applicationStarted();
|
|
||||||
void applicationFinished();
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Executor() {} // singleton
|
|
||||||
Executor(const Executor&); // singleton
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
static Executor& instance() {
|
|
||||||
static Executor _instance;
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
~Executor() {
|
|
||||||
TRC;
|
|
||||||
for (DownloadProcesses::iterator it(_downloadProcesses.begin());
|
|
||||||
it!=_downloadProcesses.end(); ++it) {
|
|
||||||
LOG<<"cleanup:"<<it->second->fileName();
|
|
||||||
it->second->setAutoRemove(qbrowserlib::Settings::instance()
|
|
||||||
.flag("CloseApps"));
|
|
||||||
delete it->second;
|
|
||||||
it->second = 0;
|
|
||||||
if (qbrowserlib::Settings::instance().flag("CloseApps")) {
|
|
||||||
LOG<<"terminate process";
|
|
||||||
it->first->terminate();
|
|
||||||
delete it->first;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
void run(QNetworkReply* reply, QString filename, QString command) {
|
|
||||||
TRC; LOG<<filename<<command;
|
|
||||||
_reply = reply;
|
|
||||||
_filename = filename;
|
|
||||||
_command = command;
|
|
||||||
if (_reply->isFinished()) {
|
|
||||||
LOG<<"run immediate";
|
|
||||||
downloadFinished();
|
|
||||||
} else {
|
|
||||||
LOG<<"run later";
|
|
||||||
assert(connect(reply, SIGNAL(finished()), SLOT(downloadFinished())));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
|
|
||||||
void downloadFinished() {
|
|
||||||
TRC;
|
|
||||||
TemporaryFile *file(new TemporaryFile
|
|
||||||
(QDir::tempPath()+QDir::separator()
|
|
||||||
+QFileInfo(_filename).fileName()));
|
|
||||||
file->open();
|
|
||||||
_reply->seek(0);
|
|
||||||
file->write(_reply->readAll());
|
|
||||||
file->close();
|
|
||||||
LOG<<"Stored as:"<<file->fileName();
|
|
||||||
QProcess* process(new QProcess);
|
|
||||||
_downloadProcesses[process] = file;
|
|
||||||
assert(connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
|
|
||||||
SLOT(processFinished())));
|
|
||||||
QStringList args(_command.split(" ")
|
|
||||||
.replaceInStrings("%1", file->fileName()));
|
|
||||||
QString prg(args.takeFirst());
|
|
||||||
LOG<<"Running:"<<prg<<args.join(" ");
|
|
||||||
process->start(prg, args);
|
|
||||||
applicationStarted();
|
|
||||||
}
|
|
||||||
|
|
||||||
void processFinished() {
|
|
||||||
TRC;
|
|
||||||
if (_downloadProcesses.find(qobject_cast<QProcess*>(sender()))
|
|
||||||
== _downloadProcesses.end()) return;
|
|
||||||
if (_downloadProcesses[qobject_cast<QProcess*>(sender())])
|
|
||||||
_downloadProcesses[qobject_cast<QProcess*>(sender())]
|
|
||||||
->setAutoRemove(qbrowserlib::Settings::instance()
|
|
||||||
.flag("CloseApps"));
|
|
||||||
delete _downloadProcesses[qobject_cast<QProcess*>(sender())];
|
|
||||||
_downloadProcesses.erase(qobject_cast<QProcess*>(sender()));
|
|
||||||
applicationFinished();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
typedef std::map<QProcess*, TemporaryFile*> DownloadProcesses;
|
|
||||||
DownloadProcesses _downloadProcesses;
|
|
||||||
QNetworkReply* _reply;
|
|
||||||
QString _filename;
|
|
||||||
QString _command;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,113 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QString>
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtCore/QTimer>
|
|
||||||
#include <QtCore/QDateTime>
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
//! Store string lists.
|
|
||||||
/** Abstract storage interface to string lists, such as bookmarks. */
|
|
||||||
class Storage: public QObject {
|
|
||||||
Q_OBJECT;
|
|
||||||
Q_SIGNALS:
|
|
||||||
//! Emitted if file content has changed.
|
|
||||||
void changed();
|
|
||||||
public:
|
|
||||||
Storage() {
|
|
||||||
TRC;
|
|
||||||
}
|
|
||||||
~Storage() {
|
|
||||||
TRC;
|
|
||||||
}
|
|
||||||
/*! @return true if readable or writable */
|
|
||||||
bool valid() {
|
|
||||||
return readable() || writeable();
|
|
||||||
}
|
|
||||||
/*! @return true if valid */
|
|
||||||
operator bool() {
|
|
||||||
return valid();
|
|
||||||
}
|
|
||||||
/*! @return name of the storage, e.g. filename */
|
|
||||||
virtual QString name() = 0;
|
|
||||||
/*! @return true if storage object already exists */
|
|
||||||
virtual bool readable() = 0;
|
|
||||||
/*! @return true if storage object exists or could be created */
|
|
||||||
virtual bool writeable() = 0;
|
|
||||||
/*! @return storage content as string list */
|
|
||||||
virtual QStringList read() = 0;
|
|
||||||
//! Writes storage content from string list.
|
|
||||||
virtual bool write(const QStringList& out) = 0;
|
|
||||||
public Q_SLOTS:
|
|
||||||
void emitChanged() {
|
|
||||||
TRC;
|
|
||||||
changed();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//! Implement @ref Storage for files.
|
|
||||||
class FileStorage: public Storage {
|
|
||||||
Q_OBJECT;
|
|
||||||
public:
|
|
||||||
/*! @param file full path to storage file */
|
|
||||||
FileStorage(QString file, int msec=1000): _file(file) {
|
|
||||||
TRC; LOG<<"file: "<<file;
|
|
||||||
assert(connect(&_timer, SIGNAL(timeout()), SLOT(check())));
|
|
||||||
_timer.setInterval(msec);
|
|
||||||
_timer.start();
|
|
||||||
}
|
|
||||||
QString name() {
|
|
||||||
return _file.fileName();
|
|
||||||
}
|
|
||||||
bool readable() {
|
|
||||||
return QFileInfo(_file).exists();
|
|
||||||
}
|
|
||||||
bool writeable() {
|
|
||||||
return readable() ||
|
|
||||||
(!_file.fileName().isEmpty() &&
|
|
||||||
QFileInfo(_file).absoluteDir().exists());
|
|
||||||
}
|
|
||||||
QStringList read() {
|
|
||||||
TRC;
|
|
||||||
QStringList res;
|
|
||||||
if (readable()) {
|
|
||||||
if (_file.open(QIODevice::ReadOnly))
|
|
||||||
res=QString::fromUtf8(_file.readAll()).split("\n");
|
|
||||||
_file.close();
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
bool write(const QStringList& out) {
|
|
||||||
TRC;
|
|
||||||
bool res(false);
|
|
||||||
if (writeable()) {
|
|
||||||
if (_file.open(QIODevice::WriteOnly))
|
|
||||||
if (_file.write(out.join("\n").toUtf8())>=0) res=true;
|
|
||||||
_file.close();
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
private Q_SLOTS:
|
|
||||||
void check() {
|
|
||||||
if (_modified!=QFileInfo(_file).lastModified()) {
|
|
||||||
TRC;
|
|
||||||
_modified = QFileInfo(_file).lastModified();
|
|
||||||
LOG<<"file has been modified"<<_modified.toString();
|
|
||||||
emitChanged();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
QFile _file;
|
|
||||||
QDateTime _modified;
|
|
||||||
QTimer _timer;
|
|
||||||
};
|
|
@@ -1,8 +0,0 @@
|
|||||||
<RCC>
|
|
||||||
<qresource prefix="/language">
|
|
||||||
<file>qbrowserlib_de.qm</file>
|
|
||||||
<file>qbrowserlib_fr.qm</file>
|
|
||||||
<file>qbrowserlib_it.qm</file>
|
|
||||||
<file>qbrowserlib_en.qm</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
|
@@ -1,100 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
bool Log::DEBUG(false);
|
|
||||||
LogDialog* Log::_dialog(0);
|
|
||||||
unsigned int Log::_level(0);
|
|
||||||
|
|
||||||
Log::Log(const void* addr, const std::string& name,
|
|
||||||
const std::string& file, unsigned long line):
|
|
||||||
_debug(DEBUG), _addr(addr), _name(name), _file(file), _line(line) {
|
|
||||||
if (!_debug) return;
|
|
||||||
++_level;
|
|
||||||
std::stringstream ss;
|
|
||||||
init(ss);
|
|
||||||
indent(ss)<<"\\ "<<_name;
|
|
||||||
std::clog<<close(ss).str()<<std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
Log::~Log() throw() {
|
|
||||||
if (!_debug) return;
|
|
||||||
std::stringstream ss;
|
|
||||||
init(ss);
|
|
||||||
indent(ss)<<"/ "<<_name;
|
|
||||||
std::clog<<close(ss).str()<<std::endl;
|
|
||||||
--_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Log::show(QWidget* p) {
|
|
||||||
if (!_dialog)
|
|
||||||
_dialog = new LogDialog(p);
|
|
||||||
_dialog->_logs->resizeColumnsToContents();
|
|
||||||
_dialog->_logs->resizeRowsToContents();
|
|
||||||
_dialog->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::stringstream& Log::init(std::stringstream& ss) {
|
|
||||||
if (_addr)
|
|
||||||
ss<<std::hex<<std::setw(15)<<_addr<<": "<<std::dec;
|
|
||||||
else
|
|
||||||
ss<<std::setw(17)<<' ';
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::stringstream& Log::indent(std::stringstream& ss) {
|
|
||||||
ss<<std::setw(2+_level)<<std::setfill(' ');
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::stringstream& Log::close(std::stringstream& ss) {
|
|
||||||
ss<<" ("<<_file<<':'<<_line<<')';
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> LogDialog& LogDialog::append
|
|
||||||
(const Log& log, std::string arg) {
|
|
||||||
return append(log, QString::fromStdString(arg));
|
|
||||||
}
|
|
||||||
template<> LogDialog& LogDialog::append
|
|
||||||
(const Log& log, const char* arg) {
|
|
||||||
return append(log, QString(arg));
|
|
||||||
}
|
|
||||||
template<> LogDialog& LogDialog::append
|
|
||||||
(const Log& log, unsigned long arg) {
|
|
||||||
return append(log, (qulonglong)arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QString arg) {
|
|
||||||
ss<<'"'<<arg.toStdString()<<'"';
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QStringList arg) {
|
|
||||||
ss<<"{ ";
|
|
||||||
for (QStringList::iterator item(arg.begin()); item!=arg.end();) {
|
|
||||||
ss<<*item;
|
|
||||||
if (++item!=arg.end()) ss<<", ";
|
|
||||||
}
|
|
||||||
ss<<" }";
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QUrl arg) {
|
|
||||||
ss<<arg.toString();
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QByteArray arg) {
|
|
||||||
ss<<QString::fromUtf8(arg);
|
|
||||||
return ss;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,217 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef QBROWSERLIB_LOG
|
|
||||||
#define QBROWSERLIB_LOG
|
|
||||||
|
|
||||||
#ifdef QT_GUI_LIB
|
|
||||||
#include <qbrowserlib/ui_log.h>
|
|
||||||
#include <QtGui/QDialog>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <typeinfo>
|
|
||||||
|
|
||||||
// supported Qt logging types
|
|
||||||
#include <QtCore/QString>
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtCore/QUrl>
|
|
||||||
#include <QtCore/QByteArray>
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
#ifndef LOG
|
|
||||||
#define LOG \
|
|
||||||
QBROWSERLIB_LOCAL_TRACER
|
|
||||||
// #define LOG
|
|
||||||
// qbrowserlib::Log(1, __PRETTY_FUNCTION__, __FILE__, __LINE__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRC
|
|
||||||
#define TRC \
|
|
||||||
qbrowserlib::Log QBROWSERLIB_LOCAL_TRACER \
|
|
||||||
(this, __PRETTY_FUNCTION__, __FILE__, __LINE__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef TRC_FN
|
|
||||||
#define TRC_FN \
|
|
||||||
qbrowserlib::Log QBROWSERLIB_LOCAL_TRACER \
|
|
||||||
(0, __PRETTY_FUNCTION__, __FILE__, __LINE__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class LogDialog;
|
|
||||||
|
|
||||||
class Log {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
static bool DEBUG;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
Log(const void* addr, const std::string& name,
|
|
||||||
const std::string& file, unsigned long line);
|
|
||||||
|
|
||||||
template<typename TYPE> Log& operator<<(TYPE arg);
|
|
||||||
|
|
||||||
~Log() throw();
|
|
||||||
|
|
||||||
static void show(QWidget* p);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::stringstream& init(std::stringstream& ss);
|
|
||||||
|
|
||||||
std::stringstream& indent(std::stringstream& ss);
|
|
||||||
|
|
||||||
std::stringstream& close(std::stringstream& ss);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
friend class LogDialog;
|
|
||||||
|
|
||||||
static LogDialog* _dialog;
|
|
||||||
static unsigned int _level;
|
|
||||||
bool _debug;
|
|
||||||
const void* _addr;
|
|
||||||
const std::string _name;
|
|
||||||
const std::string _file;
|
|
||||||
unsigned long _line;
|
|
||||||
};
|
|
||||||
|
|
||||||
class LogDialog:
|
|
||||||
#ifdef QT_GUI_LIB
|
|
||||||
public QDialog, public Ui::LogDialog
|
|
||||||
#else
|
|
||||||
public QObject
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
#ifdef QT_GUI_LIB
|
|
||||||
LogDialog(QWidget* p=0): QDialog(p) {
|
|
||||||
setupUi(this);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
template<typename TYPE> LogDialog& append(const Log& log, TYPE* arg) {
|
|
||||||
std::ostringstream ss;
|
|
||||||
ss<<"("<<typeid(TYPE*).name()<<")"<<arg;
|
|
||||||
return append(log, ss.str());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename TYPE> LogDialog& append(const Log& log, TYPE arg) {
|
|
||||||
#ifdef QT_GUI_LIB
|
|
||||||
int pos(_logs->rowCount());
|
|
||||||
_logs->insertRow(pos);
|
|
||||||
_logs->setItem
|
|
||||||
(pos, FILE,
|
|
||||||
new QTableWidgetItem(QString::fromStdString(log._file)));
|
|
||||||
_logs->setItem
|
|
||||||
(pos, LINE, new QTableWidgetItem(QString::number(log._line)));
|
|
||||||
if (log._addr) _logs->setItem
|
|
||||||
(pos, INSTANCE,
|
|
||||||
new QTableWidgetItem
|
|
||||||
(QString::number((qulonglong)log._addr)));
|
|
||||||
_logs->setItem
|
|
||||||
(pos, FUNCTION,
|
|
||||||
new QTableWidgetItem(QString::fromStdString(log._name)));
|
|
||||||
_logs->setItem
|
|
||||||
(pos, MESSAGE,
|
|
||||||
new QTableWidgetItem(QVariant(arg).toString()));
|
|
||||||
#endif
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
|
||||||
|
|
||||||
#ifdef QT_GUI_LIB
|
|
||||||
void on__fileLine_toggled(bool checked) {
|
|
||||||
if (checked) {
|
|
||||||
_logs->showColumn(FILE);
|
|
||||||
_logs->showColumn(LINE);
|
|
||||||
} else {
|
|
||||||
_logs->hideColumn(FILE);
|
|
||||||
_logs->hideColumn(LINE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__instance_toggled(bool checked) {
|
|
||||||
if (checked) {
|
|
||||||
_logs->showColumn(INSTANCE);
|
|
||||||
} else {
|
|
||||||
_logs->hideColumn(INSTANCE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__function_toggled(bool checked) {
|
|
||||||
if (checked) {
|
|
||||||
_logs->showColumn(FUNCTION);
|
|
||||||
} else {
|
|
||||||
_logs->hideColumn(FUNCTION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__buttons_clicked(QAbstractButton* button) {
|
|
||||||
if (_buttons->buttonRole(button)==QDialogButtonBox::ResetRole)
|
|
||||||
for (int i(_logs->rowCount()); i>1; --i)
|
|
||||||
_logs->removeRow(i-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__find_clicked(bool) {
|
|
||||||
setCursor(QCursor(Qt::BusyCursor));
|
|
||||||
QList<QTableWidgetItem*> items
|
|
||||||
(_logs->findItems(_search->text(),
|
|
||||||
Qt::MatchWrap|Qt::MatchContains
|
|
||||||
|Qt::MatchFixedString));
|
|
||||||
_logs->clearSelection();
|
|
||||||
foreach (QTableWidgetItem* item, items) {
|
|
||||||
item->setSelected(true);
|
|
||||||
}
|
|
||||||
if (!items.isEmpty()) _logs->scrollToItem(items[0]);
|
|
||||||
unsetCursor();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
friend class Log;
|
|
||||||
enum {FILE, LINE, INSTANCE, FUNCTION, MESSAGE} Columns;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
// note: template class method must be defined in the header
|
|
||||||
template<typename TYPE> Log& Log::operator<<(TYPE arg) {
|
|
||||||
if (!_debug) return *this;
|
|
||||||
std::stringstream ss;
|
|
||||||
init(ss);
|
|
||||||
indent(ss)<<" → "<<arg;
|
|
||||||
std::clog<<close(ss).str()<<std::endl;
|
|
||||||
if (!_dialog) _dialog = new LogDialog;
|
|
||||||
_dialog->append(*this, arg);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<> LogDialog& LogDialog::append
|
|
||||||
(const Log& log, const char* arg);
|
|
||||||
template<> LogDialog& LogDialog::append
|
|
||||||
(const Log& log, std::string arg);
|
|
||||||
template<> LogDialog& LogDialog::append
|
|
||||||
(const Log& log, unsigned long arg);
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QString arg);
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QStringList arg);
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QUrl arg);
|
|
||||||
std::ostream& operator<<(std::ostream& ss, QByteArray arg);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,203 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>LogDialog</class>
|
|
||||||
<widget class="QDialog" name="LogDialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>957</width>
|
|
||||||
<height>736</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Debug Log</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox">
|
|
||||||
<property name="title">
|
|
||||||
<string>Show Columns</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="_fileLine">
|
|
||||||
<property name="text">
|
|
||||||
<string>File/Line</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="_instance">
|
|
||||||
<property name="text">
|
|
||||||
<string>Instance</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="_function">
|
|
||||||
<property name="text">
|
|
||||||
<string>Function</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
|
||||||
<property name="title">
|
|
||||||
<string>Find Text</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
|
||||||
<widget class="QLineEdit" name="_search"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_find">
|
|
||||||
<property name="text">
|
|
||||||
<string>Find</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTableWidget" name="_logs">
|
|
||||||
<property name="editTriggers">
|
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
|
||||||
</property>
|
|
||||||
<property name="showDropIndicator" stdset="0">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="dragDropOverwriteMode">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::NoSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior">
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
|
||||||
<bool>true</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="horizontalHeaderStretchLastSection">
|
|
||||||
<bool>true</bool>
|
|
||||||
</attribute>
|
|
||||||
<attribute name="verticalHeaderCascadingSectionResizes">
|
|
||||||
<bool>true</bool>
|
|
||||||
</attribute>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>File</string>
|
|
||||||
</property>
|
|
||||||
<property name="textAlignment">
|
|
||||||
<set>AlignLeft|AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Line</string>
|
|
||||||
</property>
|
|
||||||
<property name="textAlignment">
|
|
||||||
<set>AlignLeft|AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Instance</string>
|
|
||||||
</property>
|
|
||||||
<property name="textAlignment">
|
|
||||||
<set>AlignLeft|AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Function</string>
|
|
||||||
</property>
|
|
||||||
<property name="textAlignment">
|
|
||||||
<set>AlignLeft|AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
<column>
|
|
||||||
<property name="text">
|
|
||||||
<string>Message</string>
|
|
||||||
</property>
|
|
||||||
<property name="textAlignment">
|
|
||||||
<set>AlignJustify|AlignTop</set>
|
|
||||||
</property>
|
|
||||||
</column>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="_buttons">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Close|QDialogButtonBox::Reset</set>
|
|
||||||
</property>
|
|
||||||
<property name="centerButtons">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>_buttons</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>LogDialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>227</x>
|
|
||||||
<y>640</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>_buttons</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>LogDialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>295</x>
|
|
||||||
<y>646</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@@ -1,95 +0,0 @@
|
|||||||
## @file
|
|
||||||
##
|
|
||||||
## $Id: makefile.am 7 2010-03-01 14:55:44Z marc $
|
|
||||||
##
|
|
||||||
## 1 2 3 4 5 6 7 8
|
|
||||||
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
include_HEADERS =
|
|
||||||
|
|
||||||
if !MINGW32
|
|
||||||
if MAC
|
|
||||||
AM_CPPFLAGS += -I/opt/local/include
|
|
||||||
# -I/Library/OpenSC/include
|
|
||||||
AM_LDFLAGS = -L/opt/local/lib
|
|
||||||
# -F/System/Library/Frameworks/PCSC.framework
|
|
||||||
else
|
|
||||||
# AM_CPPFLAGS += -I/usr/include/PCSC
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST = @srcdir@/*.[ch]xx @srcdir@/*.ui @srcdir@/*.ts @srcdir@/languages.qrc.in
|
|
||||||
|
|
||||||
LANGS = en de fr it
|
|
||||||
ALL_SRC = @srcdir@/*.[ch]xx \
|
|
||||||
languages.qrc \
|
|
||||||
@srcdir@/*.ui
|
|
||||||
|
|
||||||
QMAKE_PROJECT = @srcdir@/qmake.pro
|
|
||||||
QMAKE_MAKEFILE = makefile.qmake
|
|
||||||
|
|
||||||
QMAKE_TARGET = qbrowserlib
|
|
||||||
|
|
||||||
TARGETS = ${QMAKE_TARGET}
|
|
||||||
|
|
||||||
all: ${TARGETS} $(LANGS:%=@srcdir@/qbrowserlib_%.ts)
|
|
||||||
|
|
||||||
rebuild-ts: $(LANGS)
|
|
||||||
${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
|
|
||||||
|
|
||||||
${LANGS}: ${ALL_SRC}
|
|
||||||
-rm qbrowserlib_$@.qm
|
|
||||||
svn revert @srcdir@/qbrowserlib_$@.ts
|
|
||||||
mv @srcdir@/qbrowserlib_$@.ts translation.old
|
|
||||||
${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
|
|
||||||
mv @srcdir@/qbrowserlib_$@.ts translation.new
|
|
||||||
echo '<?xml version="1.0" encoding="utf-8"?>' > @srcdir@/qbrowserlib_$@.ts
|
|
||||||
echo '<!DOCTYPE TS>' >> @srcdir@/qbrowserlib_$@.ts
|
|
||||||
echo '<TS version="2.0" language="'$@'">' >> @srcdir@/qbrowserlib_$@.ts
|
|
||||||
xqilla merge-translation.xquery >> @srcdir@/qbrowserlib_$@.ts
|
|
||||||
echo '</TS>' >> @srcdir@/qbrowserlib_$@.ts
|
|
||||||
rm translation.old translation.new
|
|
||||||
|
|
||||||
print:
|
|
||||||
@echo "LANGS=${LANGS}"
|
|
||||||
@echo "ALL_SRC=${ALL_SRC}"
|
|
||||||
@echo "QMAKE=${QMAKE}"
|
|
||||||
@echo "QMAKE_OPTIONS=${QMAKE_OPTIONS}"
|
|
||||||
@echo "QMAKE_MAKEFILE=${QMAKE_MAKEFILE}"
|
|
||||||
@echo "QMAKE_TARGET=${QMAKE_TARGET}"
|
|
||||||
@echo "TARGETS=${TARGETS}"
|
|
||||||
|
|
||||||
|
|
||||||
qbrowserlib_%.qm: @srcdir@/qbrowserlib_%.ts
|
|
||||||
${LRELEASE} $< -qm $@
|
|
||||||
|
|
||||||
%.xpm: resources/%.png
|
|
||||||
convert $< $@ || cp $< $@
|
|
||||||
|
|
||||||
@srcdir@/%.ts: ${ALL_SRC}
|
|
||||||
${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
|
|
||||||
|
|
||||||
${QMAKE_MAKEFILE}: ${QMAKE_PROJECT} ${ALL_SRC}
|
|
||||||
${QMAKE} -o $@ $<
|
|
||||||
|
|
||||||
${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC} $(LANGS:%=qbrowserlib_%.qm)
|
|
||||||
make -f ${QMAKE_MAKEFILE}
|
|
||||||
|
|
||||||
install-data-local:
|
|
||||||
${mkinstalldirs} ${DESTDIR}${libdir}
|
|
||||||
for file in *${QMAKE_TARGET}{*.a,*.la,.so*,*.dylib,*.dll}; do \
|
|
||||||
if test -e $$file; then \
|
|
||||||
${INSTALL} $$file ${DESTDIR}${libdir}; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
|
|
||||||
uninstall-local:
|
|
||||||
-rm -r ${DESTDIR}${libdir}/*${QMAKE_TARGET}*
|
|
||||||
|
|
||||||
clean-local:
|
|
||||||
-rm -r *${QMAKE_TARGET}{.so*,*.dylib,*.dll}
|
|
||||||
|
|
||||||
CLEANFILES = ${TARGETS} ${TARGETS:%=%.exe} $(LANGS:%=qbrowserlib_%.qm) \
|
|
||||||
*.o *.obj qrc_*.cpp ui_*.h moc_*.cpp *.qrc *.dll \
|
|
||||||
${QMAKE_TARGET}* \
|
|
||||||
MAINTAINERCLEANFILES = makefile.in ${QMAKE_MAKEFILE}
|
|
@@ -1,75 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __PLUGINFACTORY_HXX__
|
|
||||||
#define __PLUGINFACTORY_HXX__
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <QtWebKit/QWebPluginFactory>
|
|
||||||
#include <qbrowserlib/saveorrun.hxx>
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
//! Handle PDF Documents
|
|
||||||
/*! */
|
|
||||||
class PluginFactory: public QWebPluginFactory {
|
|
||||||
Q_OBJECT;
|
|
||||||
signals:
|
|
||||||
void done();
|
|
||||||
public:
|
|
||||||
PluginFactory(QNetworkAccessManager* net, QObject* p=0):
|
|
||||||
QWebPluginFactory(p), _net(net) {
|
|
||||||
TRC;
|
|
||||||
// Plugin plugin;
|
|
||||||
// plugin.name = "Show PDF-Document";
|
|
||||||
// plugin.description = "Plugin for PDF documents";
|
|
||||||
// MimeType mime;
|
|
||||||
// mime.fileExtensions<<"pdf";
|
|
||||||
// mime.name = "application/pdf";
|
|
||||||
// mime.description = "PDF-Document";
|
|
||||||
// plugin.mimeTypes<<mime;
|
|
||||||
// _plugins.push_back(plugin);
|
|
||||||
}
|
|
||||||
virtual QObject* create(const QString& mimeType, const QUrl& url,
|
|
||||||
const QStringList& argumentNames,
|
|
||||||
const QStringList& argumentValues ) const {
|
|
||||||
TRC; LOG<<"mimeType:"<<mimeType
|
|
||||||
<<"url:"<<url
|
|
||||||
<<"argumentNames:"<<argumentNames.join(", ")
|
|
||||||
<<"argumentValues:"<<argumentValues.join(", ");
|
|
||||||
// if (mimeType=="application/pdf") {
|
|
||||||
// return new SaveOrRunPlugin(url, mimeType);
|
|
||||||
// }
|
|
||||||
QNetworkRequest req(url);
|
|
||||||
QNetworkReply* reply(_net->get(QNetworkRequest(url)));
|
|
||||||
SaveOrRunPlugin* p(new SaveOrRunPlugin(reply, url, mimeType));
|
|
||||||
assert(connect(p, SIGNAL(accept()), SIGNAL(done())));
|
|
||||||
if (p->handlePreconfigured()) {
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
delete p; p=0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
virtual QList<Plugin> plugins() const {
|
|
||||||
TRC;
|
|
||||||
return _plugins;
|
|
||||||
}
|
|
||||||
virtual void refreshPlugins() {
|
|
||||||
TRC;
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
QList<Plugin> _plugins;
|
|
||||||
QNetworkAccessManager* _net;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
#endif
|
|
@@ -1,62 +0,0 @@
|
|||||||
QT += webkit network gui
|
|
||||||
QMAKE_LIBS += -lproxyface -lpcscxx -lssl -lcrypto
|
|
||||||
QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter
|
|
||||||
#-std=c++0x
|
|
||||||
QMAKE_INCDIR += @srcdir@/.. ..
|
|
||||||
|
|
||||||
unix {
|
|
||||||
!macx {
|
|
||||||
CONFIG += debug
|
|
||||||
QMAKE_INCDIR += /usr/include/PCSC
|
|
||||||
QMAKE_INCDIR += /usr/local/include/PCSC
|
|
||||||
QMAKE_LIBS += -lpcsclite -lproxy
|
|
||||||
}
|
|
||||||
}
|
|
||||||
macx {
|
|
||||||
QMAKE_INCDIR += /opt/local/include
|
|
||||||
QMAKE_LIBDIR += /opt/local/lib
|
|
||||||
QMAKE_LFLAGS += -F/System/Library/Frameworks/PCSC.framework
|
|
||||||
LIBS += -framework PCSC
|
|
||||||
QMAKE_INCDIR += /System/Library/Frameworks/PCSC.framework/Headers
|
|
||||||
QMAKE_INFO_PLIST = Info.plist
|
|
||||||
CONFIG += x86
|
|
||||||
}
|
|
||||||
win32 {
|
|
||||||
QMAKE_LIBS += -lwinhttp -lgdi32 -lws2_32
|
|
||||||
QMAKE_LIBS += /opt/local/i586-mingw32msvc/lib/winscard.a
|
|
||||||
CONFIG += release dll
|
|
||||||
}
|
|
||||||
|
|
||||||
TRANSLATIONS = @srcdir@/qbrowserlib_en.ts \
|
|
||||||
@srcdir@/qbrowserlib_de.ts \
|
|
||||||
@srcdir@/qbrowserlib_fr.ts \
|
|
||||||
@srcdir@/qbrowserlib_it.ts
|
|
||||||
|
|
||||||
SOURCES = @srcdir@/log.cxx @srcdir@/certs.cxx
|
|
||||||
|
|
||||||
HEADERS = @srcdir@/log.hxx @srcdir@/downloadmanager.hxx \
|
|
||||||
@srcdir@/swisswebview.hxx @srcdir@/swisswebpage.hxx \
|
|
||||||
@srcdir@/swisswebwidget.hxx \
|
|
||||||
@srcdir@/pluginfactory.hxx @srcdir@/saveorrun.hxx \
|
|
||||||
@srcdir@/settings.hxx @srcdir@/errorlog.hxx \
|
|
||||||
@srcdir@/buttonlineedit.hxx \
|
|
||||||
@srcdir@/filestorage.hxx @srcdir@/certs.hxx \
|
|
||||||
@srcdir@/executor.hxx \
|
|
||||||
@srcdir@/temporaryfile.hxx
|
|
||||||
|
|
||||||
FORMS = @srcdir@/saveorrun.ui @srcdir@/settings.ui @srcdir@/log.ui \
|
|
||||||
@srcdir@/swisswebwidget.ui @srcdir@/errorlog.ui
|
|
||||||
|
|
||||||
RESOURCES = languages.qrc
|
|
||||||
|
|
||||||
TEMPLATE=lib
|
|
||||||
TARGET = qbrowserlib
|
|
||||||
|
|
||||||
CODECFORSRC = UTF-8
|
|
||||||
CODECFORTR = UTF-8
|
|
||||||
|
|
||||||
DEFINES += VERSION=\'\"@VERSION@\"\' BUILDDATE=\'\"@BUILDDATE@\"\'
|
|
||||||
|
|
||||||
## DEBUG
|
|
||||||
# QMAKE_CXXFLAGS += -include iostream -D\"CRYPTOKI_LOG(X)=std::clog<<\\\"CRYPTOKI_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"PCSC_LOG(X)=std::clog<<\\\"PCSC_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"OPENSSL_LOG(X)=std::clog<<\\\"OPENSSL_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl'" @CPPFLAGS@ @CXXFLAGS@
|
|
||||||
QMAKE_CXXFLAGS += @CPPFLAGS@ @CXXFLAGS@
|
|
@@ -1,282 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __SAVEORRUN_HXX__
|
|
||||||
#define __SAVEORRUN_HXX__
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/ui_saveorrun.h>
|
|
||||||
#include <qbrowserlib/executor.hxx>
|
|
||||||
|
|
||||||
#include <QtCore/QUrl>
|
|
||||||
#include <QtNetwork/QNetworkReply>
|
|
||||||
#include <QtGui/QDialog>
|
|
||||||
#include <QtGui/QFileDialog>
|
|
||||||
#include <QtGui/QFileSystemModel>
|
|
||||||
#include <QtGui/QDialogButtonBox>
|
|
||||||
#include <QtGui/QMessageBox>
|
|
||||||
#include <QtGui/QDesktopServices>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
//! Ask User for Saving or Opening a Download
|
|
||||||
class SaveOrRun: public QWidget, public Ui::SaveOrRun {
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
void accept();
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SaveOrRun(QNetworkReply* reply, QString type, QString src, QWidget* p=0):
|
|
||||||
QWidget(p), _reply(reply) {
|
|
||||||
TRC;
|
|
||||||
setupUi(this);
|
|
||||||
QString obj(remoteFilename());
|
|
||||||
_rememberPath->setVisible(false);
|
|
||||||
_rememberTool->setVisible(false);
|
|
||||||
// _program->setText(QDesktopServices::storageLocation
|
|
||||||
// (QDesktopServices::ApplicationsLocation));
|
|
||||||
delete _openInExternalApplication; _openInExternalApplication = 0;
|
|
||||||
_object->setText(obj);
|
|
||||||
_type->setText(type);
|
|
||||||
_source->setText(src);
|
|
||||||
_filename->setText(savePath()+QDir::separator()+obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Run configured application if mime type is preconfigured.
|
|
||||||
bool handlePreconfigured() {
|
|
||||||
TRC;
|
|
||||||
QString filename(remoteFilename());
|
|
||||||
QStringList type
|
|
||||||
(qbrowserlib::Settings::instance().mimetype
|
|
||||||
(_reply->header(QNetworkRequest::ContentTypeHeader).toString(),
|
|
||||||
filename));
|
|
||||||
if (!type.isEmpty()) {
|
|
||||||
LOG<<"Start Application";
|
|
||||||
hide();
|
|
||||||
filename.replace(QRegExp("^(.*)\\."+type.at(0)+"$"),
|
|
||||||
"\\1"); // remove extension
|
|
||||||
assert(connect(&qbrowserlib::Executor::instance(),
|
|
||||||
SIGNAL(applicationStarted()),
|
|
||||||
SIGNAL(accept())));
|
|
||||||
qbrowserlib::Executor::instance().run
|
|
||||||
(_reply, filename+"."+type.at(0), type.at(1));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString remoteFilename() {
|
|
||||||
TRC;
|
|
||||||
QString filename
|
|
||||||
(QString::fromUtf8(_reply->rawHeader("Content-Disposition")));
|
|
||||||
if (filename.contains
|
|
||||||
(QRegExp("^\\s*attachment\\s*;\\s*filename\\s*=\\s*\"[^\"]+\""))) {
|
|
||||||
LOG<<"From Content-Disposition";
|
|
||||||
filename = filename.replace
|
|
||||||
(QRegExp("^\\s*attachment\\s*;\\s*filename\\s*=\\s*\"([^\"]+)\".*"),
|
|
||||||
"\\1");
|
|
||||||
} else {
|
|
||||||
LOG<<"From path";
|
|
||||||
filename =
|
|
||||||
QFileInfo(!_reply->url().toLocalFile().isEmpty()
|
|
||||||
?_reply->url().toLocalFile()
|
|
||||||
:_reply->url().path()).fileName();
|
|
||||||
}
|
|
||||||
LOG<<"Filename:"<<filename;
|
|
||||||
return filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString filename() {
|
|
||||||
TRC;
|
|
||||||
return _filename->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString program() {
|
|
||||||
TRC;
|
|
||||||
return QString();
|
|
||||||
// return _program->text();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
void save() {
|
|
||||||
TRC;
|
|
||||||
QFile file(filename());
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
file.write(_reply->readAll());
|
|
||||||
file.close();
|
|
||||||
accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void open() {
|
|
||||||
TRC;
|
|
||||||
QFile file(filename());
|
|
||||||
file.open(QIODevice::WriteOnly);
|
|
||||||
file.write(_reply->readAll());
|
|
||||||
file.close();
|
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(file.fileName()));
|
|
||||||
accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
void run() {
|
|
||||||
TRC; LOG<<program()<<filename();
|
|
||||||
qbrowserlib::Executor::instance().run
|
|
||||||
(_reply, filename(), program()+" %1");
|
|
||||||
accept();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
|
||||||
|
|
||||||
void on__saveFileAs_clicked(bool=true) {
|
|
||||||
TRC;
|
|
||||||
if (QFileInfo(filename()).exists()
|
|
||||||
&& QMessageBox::question(this, tr("File Exists"),
|
|
||||||
tr("File already exists:\n\n"
|
|
||||||
"%1\n\n"
|
|
||||||
"Overwrite?").arg(filename()),
|
|
||||||
QMessageBox::Yes|QMessageBox::No)
|
|
||||||
== QMessageBox::No) return;
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__openFolder_clicked(bool=true) {
|
|
||||||
TRC;
|
|
||||||
if (QFileInfo(filename()).exists()
|
|
||||||
&& QMessageBox::question(this, tr("File Exists"),
|
|
||||||
tr("File already exists:\n\n"
|
|
||||||
"%1\n\n"
|
|
||||||
"Overwrite?").arg(filename()),
|
|
||||||
QMessageBox::Yes|QMessageBox::No)
|
|
||||||
== QMessageBox::No) return;
|
|
||||||
open();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__openFileIn_clicked(bool=true) {
|
|
||||||
TRC;
|
|
||||||
if (!QFile::exists(program())
|
|
||||||
|| !QFileInfo(program()).isExecutable()) {
|
|
||||||
QMessageBox::warning(this, tr("No Program"),
|
|
||||||
tr("Not an executable Program:\n\n"
|
|
||||||
"%1\n\n"
|
|
||||||
"Specify full path to executable program")
|
|
||||||
.arg(program()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
run();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__browseSaveAs_clicked(bool) {
|
|
||||||
TRC;
|
|
||||||
QString saveFile
|
|
||||||
(QFileDialog::getSaveFileName(this, tr("Save File As ..."),
|
|
||||||
_filename->text(), QString(), 0,
|
|
||||||
QFileDialog::DontConfirmOverwrite));
|
|
||||||
if (!saveFile.size()) return;
|
|
||||||
if (QFileInfo(saveFile).isDir())
|
|
||||||
saveFile += QDir::separator()+_object->text();
|
|
||||||
_filename->setText(saveFile);
|
|
||||||
on__saveFileAs_clicked();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__browseOpenWith_clicked(bool) {
|
|
||||||
TRC;
|
|
||||||
QString openFile
|
|
||||||
(QFileDialog::getOpenFileName(this, tr("Open File With ..."),
|
|
||||||
program()));
|
|
||||||
if (!openFile.size()) return;
|
|
||||||
// _program->setText(openFile);
|
|
||||||
on__openFileIn_clicked();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString savePath() {
|
|
||||||
TRC;
|
|
||||||
QString path(QDir::homePath());
|
|
||||||
QStringList defpaths;
|
|
||||||
defpaths<<"downloads"<<"Downloads"<<"Documents"
|
|
||||||
<<tr("Dokumente", "Documents folder in local language")
|
|
||||||
<<"Desktop"
|
|
||||||
<<tr("Arbeitsfläche", "Desktop folder in local language");
|
|
||||||
for (QStringList::iterator it(defpaths.begin()); it!=defpaths.end(); ++it)
|
|
||||||
if (QFile::exists(QDir::homePath()+QDir::separator()+*it)) {
|
|
||||||
path = QDir::homePath()+QDir::separator()+*it;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
friend class SaveOrRunDialog;
|
|
||||||
QNetworkReply* _reply;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SaveOrRunPlugin: public SaveOrRun {
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SaveOrRunPlugin(QNetworkReply* reply,
|
|
||||||
const QUrl& url, const QString& mime,
|
|
||||||
bool kiosk=false, QWidget* p=0):
|
|
||||||
SaveOrRun(reply, mime, url.toString(), p) {
|
|
||||||
TRC;
|
|
||||||
setAutoFillBackground(true);
|
|
||||||
_type->setText(mime);
|
|
||||||
_source->setText(url.host());
|
|
||||||
assert(connect(this, SIGNAL(accept()), SLOT(hide())));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
|
||||||
|
|
||||||
void hide() {
|
|
||||||
_stack->setCurrentIndex(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
class SaveOrRunDialog: public QDialog {
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SaveOrRunDialog(QNetworkReply* reply, QString type, QString src,
|
|
||||||
bool kiosk=false, QWidget* p=0):
|
|
||||||
QDialog(p), _sor(new SaveOrRun(reply, type, src)) {
|
|
||||||
TRC;
|
|
||||||
setWindowTitle(tr("Unknown File Type"));
|
|
||||||
QVBoxLayout* l(new QVBoxLayout(this));
|
|
||||||
l->addWidget(_sor);
|
|
||||||
l->addWidget(_buttons = new QDialogButtonBox(QDialogButtonBox::Cancel));
|
|
||||||
assert(connect(_sor, SIGNAL(accept()), SLOT(accept())));
|
|
||||||
assert(connect(_buttons, SIGNAL(rejected()), SLOT(reject())));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool handlePreconfigured() {
|
|
||||||
return _sor->handlePreconfigured();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
SaveOrRun* _sor;
|
|
||||||
QDialogButtonBox* _buttons;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,328 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>SaveOrRun</class>
|
|
||||||
<widget class="QWidget" name="SaveOrRun">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>719</width>
|
|
||||||
<height>169</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Download</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_5">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QStackedWidget" name="_stack">
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="page">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Save As</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLineEdit" name="_filename">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>400</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="_browseSaveAs">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>browse ...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QCommandLinkButton" name="_saveFileAs">
|
|
||||||
<property name="text">
|
|
||||||
<string>Save As File</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="_rememberPath">
|
|
||||||
<property name="text">
|
|
||||||
<string>remember save path</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QCommandLinkButton" name="_openFolder">
|
|
||||||
<property name="text">
|
|
||||||
<string>Open File</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="_openInExternalApplication">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Open in External Application</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="_rememberTool">
|
|
||||||
<property name="text">
|
|
||||||
<string>remember tool for this type</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLineEdit" name="_program">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QPushButton" name="_browseOpenWith">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>browse ...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2" rowspan="2">
|
|
||||||
<widget class="QCommandLinkButton" name="_openFileIn">
|
|
||||||
<property name="text">
|
|
||||||
<string>Run</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_3">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Information</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>File:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLabel" name="_object">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Type:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="_type">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Source</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLabel" name="_source">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
<property name="textInteractionFlags">
|
|
||||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="page_2">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_6">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Done</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>_filename</sender>
|
|
||||||
<signal>returnPressed()</signal>
|
|
||||||
<receiver>_saveFileAs</receiver>
|
|
||||||
<slot>click()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>320</x>
|
|
||||||
<y>78</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>430</x>
|
|
||||||
<y>108</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>_program</sender>
|
|
||||||
<signal>returnPressed()</signal>
|
|
||||||
<receiver>_openFileIn</receiver>
|
|
||||||
<slot>click()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>320</x>
|
|
||||||
<y>78</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>430</x>
|
|
||||||
<y>108</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
@@ -1,399 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef QBROWSERLIB_SETTINGS_HXX
|
|
||||||
#define QBROWSERLIB_SETTINGS_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/ui_settings.h>
|
|
||||||
|
|
||||||
#include <QtWebKit/QWebSettings>
|
|
||||||
#include <QtCore/QSettings>
|
|
||||||
#include <QtCore/QMap>
|
|
||||||
#include <QtCore/QList>
|
|
||||||
#include <QtGui/QLineEdit>
|
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
class Settings: public QDialog, protected Ui::Settings {
|
|
||||||
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
typedef QMap<QString, QVariant> MimeTypes;
|
|
||||||
typedef QMap<QString, QVariant> SearchEngines;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
|
|
||||||
void newSettings();
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//! Singleton
|
|
||||||
static Settings& instance(MimeTypes mimetypes=MimeTypes(), QWidget* p=0,
|
|
||||||
QSettings* settings=0, bool autoWrite=true) {
|
|
||||||
static Settings _instance(mimetypes, p, settings, autoWrite);
|
|
||||||
return _instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
Settings(const Settings&); // singleton
|
|
||||||
|
|
||||||
Settings(MimeTypes mimetypes, QWidget* p=0,
|
|
||||||
QSettings* settings=0, bool autoWrite=true):
|
|
||||||
QDialog(p), _settings(settings),
|
|
||||||
_autoWrite(autoWrite), _mimetypes(mimetypes) {
|
|
||||||
|
|
||||||
setupUi(this);
|
|
||||||
|
|
||||||
// Web Attributes
|
|
||||||
_attributes[QWebSettings::AutoLoadImages] =
|
|
||||||
_settingAutoLoadImages;
|
|
||||||
_attributes[QWebSettings::DnsPrefetchEnabled] =
|
|
||||||
_settingDnsPrefetchEnabled;
|
|
||||||
_attributes[QWebSettings::JavascriptEnabled] =
|
|
||||||
_settingJavascriptEnabled;
|
|
||||||
_attributes[QWebSettings::JavaEnabled] =
|
|
||||||
_settingJavaEnabled;
|
|
||||||
_attributes[QWebSettings::PluginsEnabled] =
|
|
||||||
_settingPluginsEnabled;
|
|
||||||
_attributes[QWebSettings::PrivateBrowsingEnabled] =
|
|
||||||
_settingPrivateBrowsingEnabled;
|
|
||||||
_attributes[QWebSettings::JavascriptCanOpenWindows] =
|
|
||||||
_settingJavascriptCanOpenWindows;
|
|
||||||
_attributes[QWebSettings::JavascriptCanAccessClipboard] =
|
|
||||||
_settingJavascriptCanAccessClipboard;
|
|
||||||
_attributes[QWebSettings::DeveloperExtrasEnabled] =
|
|
||||||
_settingDeveloperExtrasEnabled;
|
|
||||||
_attributes[QWebSettings::LinksIncludedInFocusChain] =
|
|
||||||
_settingLinksIncludedInFocusChain;
|
|
||||||
_attributes[QWebSettings::ZoomTextOnly] =
|
|
||||||
_settingZoomTextOnly;
|
|
||||||
_attributes[QWebSettings::PrintElementBackgrounds] =
|
|
||||||
_settingPrintElementBackgrounds;
|
|
||||||
_attributes[QWebSettings::OfflineStorageDatabaseEnabled] =
|
|
||||||
_settingOfflineStorageDatabaseEnabled;
|
|
||||||
_attributes[QWebSettings::OfflineWebApplicationCacheEnabled] =
|
|
||||||
_settingOfflineWebApplicationCacheEnabled;
|
|
||||||
_attributes[QWebSettings::LocalStorageEnabled] =
|
|
||||||
_settingLocalStorageEnabled;
|
|
||||||
_attributes[QWebSettings::LocalContentCanAccessRemoteUrls] =
|
|
||||||
_settingLocalContentCanAccessRemoteUrls;
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
|
|
||||||
_attributes[QWebSettings::SpatialNavigationEnabled] =
|
|
||||||
_settingSpatialNavigationEnabled;
|
|
||||||
_attributes[QWebSettings::LocalContentCanAccessFileUrls] =
|
|
||||||
_settingLocalContentCanAccessFileUrls;
|
|
||||||
_attributes[QWebSettings::AcceleratedCompositingEnabled] =
|
|
||||||
_settingAcceleratedCompositingEnabled;
|
|
||||||
_attributes[QWebSettings::TiledBackingStoreEnabled] =
|
|
||||||
_settingTiledBackingStoreEnabled;
|
|
||||||
_attributes[QWebSettings::FrameFlatteningEnabled] =
|
|
||||||
_settingFrameFlatteningEnabled;
|
|
||||||
#else
|
|
||||||
_settingSpatialNavigationEnabled->hide();
|
|
||||||
_settingLocalContentCanAccessFileUrls->hide();
|
|
||||||
_settingAcceleratedCompositingEnabled->hide();
|
|
||||||
_settingTiledBackingStoreEnabled->hide();
|
|
||||||
_settingFrameFlatteningEnabled->hide();
|
|
||||||
#endif
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)
|
|
||||||
_attributes[QWebSettings::XSSAuditingEnabled] =
|
|
||||||
_settingXSSAuditingEnabled;
|
|
||||||
_attributes[QWebSettings::SiteSpecificQuirksEnabled] =
|
|
||||||
_settingSiteSpecificQuirksEnabled;
|
|
||||||
#else
|
|
||||||
_settingXSSAuditingEnabled->hide();
|
|
||||||
_settingSiteSpecificQuirksEnabled->hide();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// CheckBoxes
|
|
||||||
_checkboxes["SaveWindowState"] =
|
|
||||||
std::make_pair(_saveWindowState, _saveWindowState->isChecked());
|
|
||||||
_checkboxes["CloseApps"] =
|
|
||||||
std::make_pair(_closeApps, _closeApps->isChecked());
|
|
||||||
|
|
||||||
load(!_mimetypes.size());
|
|
||||||
on__buttons_rejected();
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
static bool DEBUG;
|
|
||||||
|
|
||||||
void setSettings(QSettings* settings) {
|
|
||||||
_settings = settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
QSettings* operator()() {
|
|
||||||
return _settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setAttribute(QWebSettings::WebAttribute attr, bool state) {
|
|
||||||
//TRC;
|
|
||||||
QWebSettings::globalSettings()->setAttribute(attr, state);
|
|
||||||
_attributes[attr]->setChecked(state);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool flag(const QString& name) {
|
|
||||||
assert(_checkboxes.find(name)!=_checkboxes.end());
|
|
||||||
return _checkboxes[name].second;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString& text(const QString& name) {
|
|
||||||
assert(_lineedits.find(name)!=_lineedits.end());
|
|
||||||
return _lineedits[name].second;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MimeTypes& mimetypes() const {
|
|
||||||
return _mimetypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList mimetype(QString mimetype, QString filename) const {
|
|
||||||
Settings::MimeTypes::const_iterator
|
|
||||||
it(_mimetypes.find(mimetype.split(';')[0]));
|
|
||||||
if (it!=_mimetypes.end()) return it.value().toStringList();
|
|
||||||
for (it=_mimetypes.begin(); it!=_mimetypes.end(); ++it)
|
|
||||||
if (filename.endsWith("."+it.value().toStringList().at(0)))
|
|
||||||
return it.value().toStringList();
|
|
||||||
return QStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString& replaceSearchEngine(QString& url) {
|
|
||||||
TRC;
|
|
||||||
int len(url.indexOf(QRegExp("[ :]")));
|
|
||||||
if (len<=0) return url;
|
|
||||||
QString scheme(url.left(len));
|
|
||||||
LOG<<"scheme:"<<scheme;
|
|
||||||
if (!_searchEngines.contains(scheme)) return url;
|
|
||||||
QString query(url.right(url.size()-len-1));
|
|
||||||
LOG<<"query:"<<query;
|
|
||||||
url = QString(_searchEngines[scheme].toString())
|
|
||||||
.arg(query).arg(QLocale::system().name().left(2));
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
const SearchEngines& searchEngines() const {
|
|
||||||
return _searchEngines;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool save() {
|
|
||||||
TRC;
|
|
||||||
if (!_settings || !_settings->isWritable()) return false;
|
|
||||||
// Attributes
|
|
||||||
for (Attributes::iterator it(_attributes.begin());
|
|
||||||
it!=_attributes.end(); ++it)
|
|
||||||
_settings->setValue
|
|
||||||
(QString("QWebSettings/%1").arg(it->first),
|
|
||||||
QWebSettings::globalSettings()->testAttribute(it->first));
|
|
||||||
// CheckBoxes
|
|
||||||
for (CheckBoxes::iterator it(_checkboxes.begin());
|
|
||||||
it!=_checkboxes.end(); ++it)
|
|
||||||
_settings->setValue
|
|
||||||
(QString("Flags/%1").arg(it->first), it->second.second);
|
|
||||||
// LineEdits
|
|
||||||
for (LineEdits::iterator it(_lineedits.begin());
|
|
||||||
it!=_lineedits.end(); ++it)
|
|
||||||
_settings->setValue
|
|
||||||
(QString("Texts/%1").arg(it->first), it->second.second);
|
|
||||||
// MimeTypes
|
|
||||||
_settings->setValue("QWebSettings/MimeTypes", _mimetypes);
|
|
||||||
// Search Engines
|
|
||||||
_settings->setValue("QWebSettings/SearchEngines", _searchEngines);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool load(bool overwriteMimeTypes=true) {
|
|
||||||
TRC;
|
|
||||||
if (!_settings) return false;
|
|
||||||
// Attributes
|
|
||||||
for (Attributes::iterator it(_attributes.begin());
|
|
||||||
it!=_attributes.end(); ++it) {
|
|
||||||
QVariant val
|
|
||||||
(_settings->value
|
|
||||||
(QString("QWebSettings/%1").arg(it->first),
|
|
||||||
QWebSettings::globalSettings()->testAttribute(it->first)));
|
|
||||||
if (val.isValid() && val.canConvert(QVariant::Bool))
|
|
||||||
setAttribute(it->first, val.toBool());
|
|
||||||
}
|
|
||||||
// CheckBoxes
|
|
||||||
for (CheckBoxes::iterator it(_checkboxes.begin());
|
|
||||||
it!=_checkboxes.end(); ++it) {
|
|
||||||
QVariant val
|
|
||||||
(_settings->value
|
|
||||||
(QString("Flags/%1").arg(it->first), it->second.second));
|
|
||||||
if (val.isValid() && val.canConvert(QVariant::Bool)) {
|
|
||||||
it->second.first->setChecked(val.toBool());
|
|
||||||
it->second.second = val.toBool();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// LineEdits
|
|
||||||
for (LineEdits::iterator it(_lineedits.begin());
|
|
||||||
it!=_lineedits.end(); ++it) {
|
|
||||||
QVariant val
|
|
||||||
(_settings->value
|
|
||||||
(QString("Texts/%1").arg(it->first), it->second.second));
|
|
||||||
if (val.isValid() && val.canConvert(QVariant::String)) {
|
|
||||||
it->second.first->setText(val.toString());
|
|
||||||
it->second.second = val.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// MimeTypes
|
|
||||||
if (overwriteMimeTypes) {
|
|
||||||
QVariant val(_settings->value("QWebSettings/MimeTypes"));
|
|
||||||
if (val.isValid() && val.canConvert(QVariant::Map))
|
|
||||||
_mimetypes = val.toMap();
|
|
||||||
}
|
|
||||||
// SearchEngines
|
|
||||||
QVariant val(_settings->value("QWebSettings/SearchEngines"));
|
|
||||||
if (val.isValid() && val.canConvert(QVariant::Map))
|
|
||||||
_searchEngines = val.toMap();
|
|
||||||
newSettings();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
|
|
||||||
void on__buttons_accepted() {
|
|
||||||
TRC;
|
|
||||||
// Attributes
|
|
||||||
for (Attributes::iterator it(_attributes.begin());
|
|
||||||
it!=_attributes.end(); ++it)
|
|
||||||
QWebSettings::globalSettings()
|
|
||||||
->setAttribute(it->first, it->second->isChecked());
|
|
||||||
// CheckBoxes
|
|
||||||
for (CheckBoxes::iterator it(_checkboxes.begin());
|
|
||||||
it!=_checkboxes.end(); ++it)
|
|
||||||
it->second.second = it->second.first->isChecked();
|
|
||||||
// LineEdits
|
|
||||||
for (LineEdits::iterator it(_lineedits.begin());
|
|
||||||
it!=_lineedits.end(); ++it)
|
|
||||||
it->second.second = it->second.first->text();
|
|
||||||
// MimeTypes
|
|
||||||
_mimetypes.clear();
|
|
||||||
for (int row(_mimeTypeTable->rowCount()); row--;)
|
|
||||||
_mimetypes[_mimeTypeTable->item(row, 0)->text()] =
|
|
||||||
QStringList()
|
|
||||||
<<_mimeTypeTable->item(row, 1)->text()
|
|
||||||
<<_mimeTypeTable->item(row, 2)->text();
|
|
||||||
// SearchEngines
|
|
||||||
_searchEngines.clear();
|
|
||||||
for (int row(_searchEngineTable->rowCount()); row--;)
|
|
||||||
_searchEngines[_searchEngineTable->item(row, 0)->text()] =
|
|
||||||
_searchEngineTable->item(row, 1)->text();
|
|
||||||
// Save
|
|
||||||
if (_autoWrite) save();
|
|
||||||
newSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__buttons_rejected() {
|
|
||||||
TRC;
|
|
||||||
// Attributes
|
|
||||||
for (Attributes::iterator it(_attributes.begin());
|
|
||||||
it!=_attributes.end(); ++it)
|
|
||||||
it->second->setChecked
|
|
||||||
(QWebSettings::globalSettings()->testAttribute(it->first));
|
|
||||||
// CheckBoxes
|
|
||||||
for (CheckBoxes::iterator it(_checkboxes.begin());
|
|
||||||
it!=_checkboxes.end(); ++it)
|
|
||||||
it->second.first->setChecked(it->second.second);
|
|
||||||
// LineEdits
|
|
||||||
for (LineEdits::iterator it(_lineedits.begin());
|
|
||||||
it!=_lineedits.end(); ++it)
|
|
||||||
it->second.first->setText(it->second.second);
|
|
||||||
// MimeTypes
|
|
||||||
_mimeTypeTable->setRowCount(_mimetypes.size());
|
|
||||||
_mimeTypeTable->verticalHeader()->show();
|
|
||||||
_mimeTypeTable->horizontalHeader()->show();
|
|
||||||
_mimeTypeTable->horizontalHeader()->setStretchLastSection(true);
|
|
||||||
int row(0);
|
|
||||||
for (MimeTypes::iterator it(_mimetypes.begin());
|
|
||||||
it!=_mimetypes.end(); ++it, ++row) {
|
|
||||||
LOG<<"MimeType:"<<it.key()<<it.value().toStringList();
|
|
||||||
_mimeTypeTable->setItem
|
|
||||||
(row, 0, new QTableWidgetItem(it.key()));
|
|
||||||
_mimeTypeTable->setItem
|
|
||||||
(row, 1, new QTableWidgetItem(it.value().toStringList().at(0)));
|
|
||||||
_mimeTypeTable->setItem
|
|
||||||
(row, 2, new QTableWidgetItem(it.value().toStringList().at(1)));
|
|
||||||
}
|
|
||||||
// SearchEngines
|
|
||||||
_searchEngineTable->setRowCount(_searchEngines.size());
|
|
||||||
_searchEngineTable->verticalHeader()->show();
|
|
||||||
_searchEngineTable->horizontalHeader()->show();
|
|
||||||
_searchEngineTable->horizontalHeader()->setStretchLastSection(true);
|
|
||||||
row = 0;
|
|
||||||
for (MimeTypes::iterator it(_searchEngines.begin());
|
|
||||||
it!=_searchEngines.end(); ++it, ++row) {
|
|
||||||
LOG<<"SearchEngine:"<<it.key()<<it.value().toString();
|
|
||||||
_searchEngineTable->setItem
|
|
||||||
(row, 0, new QTableWidgetItem(it.key()));
|
|
||||||
_searchEngineTable->setItem
|
|
||||||
(row, 1, new QTableWidgetItem(it.value().toString()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__addMimeType_pressed() {
|
|
||||||
_mimeTypeTable->setRowCount(_mimeTypeTable->rowCount()+1);
|
|
||||||
_mimeTypeTable->setItem(_mimeTypeTable->rowCount()-1, 0,
|
|
||||||
new QTableWidgetItem);
|
|
||||||
_mimeTypeTable->setItem(_mimeTypeTable->rowCount()-1, 1,
|
|
||||||
new QTableWidgetItem);
|
|
||||||
_mimeTypeTable->setItem(_mimeTypeTable->rowCount()-1, 2,
|
|
||||||
new QTableWidgetItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__removeMimeType_pressed() {
|
|
||||||
QList<QTableWidgetSelectionRange> ranges
|
|
||||||
(_mimeTypeTable->selectedRanges());
|
|
||||||
if (ranges.isEmpty()) return;
|
|
||||||
for (int begin(ranges.at(0).topRow()), count(ranges.at(0).rowCount());
|
|
||||||
count; --count)
|
|
||||||
_mimeTypeTable->removeRow(begin);
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__addSearchEngine_pressed() {
|
|
||||||
_searchEngineTable->setRowCount(_searchEngineTable->rowCount()+1);
|
|
||||||
_searchEngineTable->setItem(_searchEngineTable->rowCount()-1, 0,
|
|
||||||
new QTableWidgetItem);
|
|
||||||
_searchEngineTable->setItem(_searchEngineTable->rowCount()-1, 1,
|
|
||||||
new QTableWidgetItem);
|
|
||||||
_searchEngineTable->setItem(_searchEngineTable->rowCount()-1, 2,
|
|
||||||
new QTableWidgetItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
void on__removeSearchEngine_pressed() {
|
|
||||||
QList<QTableWidgetSelectionRange> ranges
|
|
||||||
(_searchEngineTable->selectedRanges());
|
|
||||||
if (ranges.isEmpty()) return;
|
|
||||||
for (int begin(ranges.at(0).topRow()), count(ranges.at(0).rowCount());
|
|
||||||
count; --count)
|
|
||||||
_searchEngineTable->removeRow(begin);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
typedef std::map<QWebSettings::WebAttribute, QCheckBox*> Attributes ;
|
|
||||||
Attributes _attributes;
|
|
||||||
typedef std::map<QString, std::pair<QCheckBox*, bool> > CheckBoxes;
|
|
||||||
CheckBoxes _checkboxes;
|
|
||||||
typedef std::map<QString, std::pair<QLineEdit*, QString> > LineEdits;
|
|
||||||
LineEdits _lineedits;
|
|
||||||
QSettings* _settings;
|
|
||||||
bool _autoWrite;
|
|
||||||
MimeTypes _mimetypes;
|
|
||||||
SearchEngines _searchEngines;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,83 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __SWISSWEBPAGE_HXX__
|
|
||||||
#define __SWISSWEBPAGE_HXX__
|
|
||||||
|
|
||||||
#include <qbrowserlib/log.hxx>
|
|
||||||
#include <qbrowserlib/pluginfactory.hxx>
|
|
||||||
|
|
||||||
#include <QtWebKit/QWebPage>
|
|
||||||
#include <QtWebKit/QWebHistory>
|
|
||||||
#include <QtCore/QProcessEnvironment>
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
//! QWebPage with additional features and better default behaviour.
|
|
||||||
/*! SwissWebPage is designed to be used by SwissWebView.
|
|
||||||
|
|
||||||
This QWebPage supports the folloing additional features:
|
|
||||||
- Handling of plugins through PluginFactory
|
|
||||||
- Processing of unsupportedContent
|
|
||||||
- Delegation of all links
|
|
||||||
- Signals @ref newPage if a new window should be created
|
|
||||||
- Set useragent from environment variable @c SWISS_USERAGENT */
|
|
||||||
class SwissWebPage: public QWebPage {
|
|
||||||
Q_OBJECT;
|
|
||||||
signals:
|
|
||||||
void newPage(SwissWebPage*);
|
|
||||||
public:
|
|
||||||
SwissWebPage(QNetworkAccessManager* net, QObject *parent = 0):
|
|
||||||
QWebPage(parent), _net(net) {
|
|
||||||
setNetworkAccessManager(_net);
|
|
||||||
PluginFactory* pf(new PluginFactory(_net, this));
|
|
||||||
assert(connect(pf, SIGNAL(done()), SLOT(back())));
|
|
||||||
setPluginFactory(pf);
|
|
||||||
setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
|
|
||||||
setForwardUnsupportedContent(true);
|
|
||||||
}
|
|
||||||
public Q_SLOTS:
|
|
||||||
void back() {
|
|
||||||
history()->back();
|
|
||||||
}
|
|
||||||
protected:
|
|
||||||
virtual QWebPage* createWindow(WebWindowType type) {
|
|
||||||
switch (type) {
|
|
||||||
case QWebPage::WebBrowserWindow:
|
|
||||||
case QWebPage::WebModalDialog: {
|
|
||||||
SwissWebPage *page(new SwissWebPage(_net, parent()));
|
|
||||||
newPage(page);
|
|
||||||
return page;
|
|
||||||
} break;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
virtual QString userAgentForUrl(const QUrl& url) const {
|
|
||||||
QString add(QProcessEnvironment::systemEnvironment()
|
|
||||||
.value("SWISS_USERAGENT"));
|
|
||||||
return QWebPage::userAgentForUrl(url)+(add.size()?" "+add:QString());
|
|
||||||
}
|
|
||||||
QObject* createPlugin(const QString& classid, const QUrl& url,
|
|
||||||
const QStringList& paramNames,
|
|
||||||
const QStringList& paramValues) {
|
|
||||||
TRC; LOG<<"classid:"<<classid
|
|
||||||
<<"url:"<<url
|
|
||||||
<<"paramNames:"<<paramNames.join(", ")
|
|
||||||
<<"paramValues:"<<paramValues.join(", ");
|
|
||||||
return QWebPage::createPlugin(classid, url, paramNames, paramValues);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
QNetworkAccessManager* _net;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
#endif
|
|
@@ -1,80 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef SWISSWEBVIEW_HXX
|
|
||||||
#define SWISSWEBVIEW_HXX
|
|
||||||
|
|
||||||
#include <qbrowserlib/swisswebpage.hxx>
|
|
||||||
|
|
||||||
#include <QtWebKit>
|
|
||||||
#include <QtDesigner/QDesignerExportWidget>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
//! QWebViev class with additional features.
|
|
||||||
/*! This QWebView class contains a @ref SwissWebPage and adds a new
|
|
||||||
signal @refs newView that sends the view whenever the a new view
|
|
||||||
(new window, new tab) must be opened.
|
|
||||||
|
|
||||||
\copydetails SwissWebView::newView(SwissWebView*)
|
|
||||||
*/
|
|
||||||
class SwissWebView: public QWebView {
|
|
||||||
Q_OBJECT;
|
|
||||||
signals:
|
|
||||||
//! Signals that a new window (or tab) must be opened
|
|
||||||
/*! @note You @b must connect to @ref newView and assign the new
|
|
||||||
@ref SwissWebView instance to a partent widget or at least
|
|
||||||
delete it, otherwise you'll have a memory leak! */
|
|
||||||
void newView(qbrowserlib::SwissWebView*);
|
|
||||||
public:
|
|
||||||
//! Default construction, creates new @ref SwissWebView
|
|
||||||
SwissWebView(QWidget *parent=0,
|
|
||||||
QNetworkAccessManager* net=0): QWebView(parent) {
|
|
||||||
if (!net) net = (_fallbackNetworkAccessManager =
|
|
||||||
std::auto_ptr<QNetworkAccessManager>
|
|
||||||
(new QNetworkAccessManager)).get();
|
|
||||||
//! @bugfix, gcc does not yet support constructor calling
|
|
||||||
x(new SwissWebPage(net, this));
|
|
||||||
}
|
|
||||||
//! Construction with externally allocated @ref SwissWebPage
|
|
||||||
/*! SwissWebView takes ownership of SwissWebPage. */
|
|
||||||
SwissWebView(SwissWebPage* webpage) {
|
|
||||||
//! @bugfix, gcc does not yet support constructor calling
|
|
||||||
x(webpage);
|
|
||||||
}
|
|
||||||
private:
|
|
||||||
//! @bugfix, gcc does not yet support constructor calling
|
|
||||||
/*! @see http://en.wikipedia.org/wiki/C++11#Object_construction_improvement
|
|
||||||
*/
|
|
||||||
void x(SwissWebPage* webpage) {
|
|
||||||
webpage->setParent(this);
|
|
||||||
setPage(webpage);
|
|
||||||
// create a new SwissWebView when a new SwissWebPage has been created
|
|
||||||
assert(connect(page(), SIGNAL(newPage(SwissWebPage*)),
|
|
||||||
SLOT(newPage(SwissWebPage*))));
|
|
||||||
}
|
|
||||||
private slots:
|
|
||||||
void newPage(SwissWebPage* p) {
|
|
||||||
// memory will be lost if signal is not handled and SwissWebView
|
|
||||||
// is not assigned
|
|
||||||
newView(new SwissWebView(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
std::auto_ptr<QNetworkAccessManager> _fallbackNetworkAccessManager;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
#endif
|
|
@@ -1,198 +0,0 @@
|
|||||||
/*! @file
|
|
||||||
|
|
||||||
@id $Id$
|
|
||||||
*/
|
|
||||||
// 1 2 3 4 5 6 7 8
|
|
||||||
// 45678901234567890123456789012345678901234567890123456789012345678901234567890
|
|
||||||
|
|
||||||
#ifndef __SWISSWEBWIDGET_HXX__
|
|
||||||
#define __SWISSWEBWIDGET_HXX__
|
|
||||||
|
|
||||||
#include <qbrowserlib/ui_swisswebwidget.h>
|
|
||||||
#include <qbrowserlib/downloadmanager.hxx>
|
|
||||||
#include <qbrowserlib/errorlog.hxx>
|
|
||||||
|
|
||||||
#include <QtGui/QMainWindow>
|
|
||||||
#include <QtGui/QToolBar>
|
|
||||||
#include <QtGui/QStatusBar>
|
|
||||||
|
|
||||||
#include <QtDebug>
|
|
||||||
|
|
||||||
#ifndef CREATE_QT_PROPERTY
|
|
||||||
#define CREATE_QT_PROPERTY(type, name) \
|
|
||||||
Q_PROPERTY(type _##name READ name WRITE name USER true) \
|
|
||||||
public: \
|
|
||||||
void name(const type& v) { \
|
|
||||||
_##name = v; \
|
|
||||||
} \
|
|
||||||
type name() { \
|
|
||||||
return _##name; \
|
|
||||||
} \
|
|
||||||
private: \
|
|
||||||
type _##name
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//! @addtogroup qbrowserlib
|
|
||||||
//! @{
|
|
||||||
|
|
||||||
namespace qbrowserlib {
|
|
||||||
|
|
||||||
//! Window Widget for complete page witghin a webbrowser.
|
|
||||||
/*! Contains a toolbar, a status bar and @refs
|
|
||||||
SwissWebView. Instanciate this and you have a complete
|
|
||||||
browser. To be used inside a QTabBar, as main window or as
|
|
||||||
docking widget. */
|
|
||||||
class SwissWebWidget: public QWidget, private Ui::SwissWebWidget {
|
|
||||||
|
|
||||||
Q_OBJECT;
|
|
||||||
|
|
||||||
//..............................................................properties
|
|
||||||
CREATE_QT_PROPERTY(QUrl, homeUrl);
|
|
||||||
|
|
||||||
//................................................................methods
|
|
||||||
public:
|
|
||||||
|
|
||||||
SwissWebWidget(QWidget* p=0): QWidget(p) {
|
|
||||||
setupUi(this);
|
|
||||||
/*! Within a QMainWindow, the widget automatically reparents
|
|
||||||
the top buttons to the toolbar and the bottom status
|
|
||||||
line to the window's status bar. */
|
|
||||||
moveToMain(qobject_cast<QMainWindow*>(p?p->parentWidget():p));
|
|
||||||
connects();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Moves status widgets to status bar, tool widgets to toolbar
|
|
||||||
/*! You can use this method to reparent the tools and the status
|
|
||||||
part of the widget into the toolbar and statusbar of your
|
|
||||||
main window.
|
|
||||||
|
|
||||||
@note If used as central widget of a QMainWindow, status and
|
|
||||||
tools are automatically reparented in the constructor. */
|
|
||||||
void moveToMain(QMainWindow* w) {
|
|
||||||
if (!w || !_statusbar || !_tools) return;
|
|
||||||
QToolBar* t(w->addToolBar(trUtf8("Browser Tools",
|
|
||||||
"name of the browser's toolbar")));
|
|
||||||
while (_tools->count())
|
|
||||||
t->addWidget(_tools->itemAt(0)->widget());
|
|
||||||
delete _tools; _tools=0;
|
|
||||||
_statusbar->removeWidget(_status); delete _status; _status=0;
|
|
||||||
while (_statusbar->count())
|
|
||||||
w->statusBar()->addWidget(_statusbar->itemAt(0)->widget());
|
|
||||||
delete _statusbar; _statusbar=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Q_SLOTS:
|
|
||||||
|
|
||||||
void load() {
|
|
||||||
_webview->load(_url->text());
|
|
||||||
}
|
|
||||||
|
|
||||||
void goHome() {
|
|
||||||
_webview->load(_homeUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
void progress(qint64 total, qint64 done) {
|
|
||||||
TRC;
|
|
||||||
_progress->setMaximum(total);
|
|
||||||
_progress->setValue(done);
|
|
||||||
}
|
|
||||||
|
|
||||||
void started() {
|
|
||||||
TRC;
|
|
||||||
_abort->setVisible(true);
|
|
||||||
_reload->setVisible(false);
|
|
||||||
_progress->setRange(0, 0);
|
|
||||||
_progress->setValue(0);
|
|
||||||
_progress->setEnabled(true);
|
|
||||||
_progress->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void finished() {
|
|
||||||
TRC;
|
|
||||||
_abort->setVisible(false);
|
|
||||||
_reload->setVisible(true);
|
|
||||||
_progress->setRange(0, 1);
|
|
||||||
_progress->setValue(1);
|
|
||||||
_progress->setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void finished(QNetworkReply *r) {
|
|
||||||
TRC;
|
|
||||||
if (r->error()!=QNetworkReply::NoError &&
|
|
||||||
r->error()!=QNetworkReply::OperationCanceledError) {
|
|
||||||
// statusBar()->showMessage
|
|
||||||
// (qbrowserlib::DownloadManager::networkError(r->error()));
|
|
||||||
// badUrl();
|
|
||||||
// if (!_showErrorLog) {
|
|
||||||
// statusBar()->addPermanentWidget
|
|
||||||
// ((_showErrorLog = new QPushButton(QIcon(":/icons/error"),
|
|
||||||
// tr("errors", "show error log"))));
|
|
||||||
// assert(connect(_showErrorLog, SIGNAL(clicked(bool)),
|
|
||||||
// actionErrorLog, SLOT(trigger())));
|
|
||||||
// }
|
|
||||||
// _showErrorLog->show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void metaDataChanged(QNetworkReply* reply) {
|
|
||||||
TRC;
|
|
||||||
QString filename
|
|
||||||
(QString::fromUtf8(reply->rawHeader("Content-Disposition")));
|
|
||||||
if (filename.contains
|
|
||||||
(QRegExp("^\\s*attachment\\s*;\\s*filename\\s*=\\s*\"[^\"]+\""))) {
|
|
||||||
LOG<<"From Content-Disposition";
|
|
||||||
filename = filename.replace
|
|
||||||
(QRegExp("^\\s*attachment\\s*;\\s*filename\\s*=\\s*\"([^\"]+)\".*"),
|
|
||||||
"\\1");
|
|
||||||
} else {
|
|
||||||
LOG<<"From path";
|
|
||||||
filename =
|
|
||||||
QFileInfo(!reply->url().toLocalFile().isEmpty()
|
|
||||||
?reply->url().toLocalFile()
|
|
||||||
:reply->url().path()).fileName();
|
|
||||||
}
|
|
||||||
LOG<<"Filename:"<<filename;
|
|
||||||
QStringList type
|
|
||||||
(qbrowserlib::Settings::instance().mimetype
|
|
||||||
(reply->header(QNetworkRequest::ContentTypeHeader).toString(),
|
|
||||||
filename));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
void connects() {
|
|
||||||
_downloadmanager+=_webview->page()->networkAccessManager();
|
|
||||||
assert(connect(_webview->page()->networkAccessManager(),
|
|
||||||
SIGNAL(finished(QNetworkReply*)),
|
|
||||||
SLOT(finished(QNetworkReply*))));
|
|
||||||
assert(connect(_url, SIGNAL(returnPressed()), SLOT(load())));
|
|
||||||
assert(connect(_home, SIGNAL(pressed()), SLOT(goHome())));
|
|
||||||
assert(connect(_abort, SIGNAL(pressed()),
|
|
||||||
&_downloadmanager, SLOT(abort())));
|
|
||||||
assert(connect(&_downloadmanager, SIGNAL(progress(qint64, qint64)),
|
|
||||||
SLOT(progress(qint64, qint64))));
|
|
||||||
assert(connect(&_downloadmanager, SIGNAL(started()),
|
|
||||||
SLOT(started())));
|
|
||||||
assert(connect(&_downloadmanager, SIGNAL(finished()),
|
|
||||||
SLOT(finished())));
|
|
||||||
assert(connect(&_downloadmanager, SIGNAL(error(QString)),
|
|
||||||
&qbrowserlib::ErrorLog::instance(),
|
|
||||||
SLOT(append(QString))));
|
|
||||||
assert(connect(&_downloadmanager,
|
|
||||||
SIGNAL(metaDataChanged(QNetworkReply*)),
|
|
||||||
SLOT(metaDataChanged(QNetworkReply*))));
|
|
||||||
}
|
|
||||||
|
|
||||||
//..............................................................variables
|
|
||||||
protected:
|
|
||||||
|
|
||||||
qbrowserlib::DownloadManager _downloadmanager;
|
|
||||||
QPushButton _showErrorLog;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//! @}
|
|
||||||
|
|
||||||
#endif
|
|
@@ -1,209 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>SwissWebWidget</class>
|
|
||||||
<widget class="QWidget" name="SwissWebWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>677</width>
|
|
||||||
<height>555</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="_tools">
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_home">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>H</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_back">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>B</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_forward">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>F</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_abort">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>X</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_reload">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>R</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="qbrowserlib::ButtonLineEdit" name="_url">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QComboBox" name="_searchMachine">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>gg</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="qbrowserlib::ButtonLineEdit" name="_search">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="qbrowserlib::SwissWebView" name="_webview"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="_statusbar">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="_status">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>status</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QProgressBar" name="_progress">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="value">
|
|
||||||
<number>24</number>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_smaller">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>-</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QSlider" name="_zoom">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="_larger">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>-</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<customwidgets>
|
|
||||||
<customwidget>
|
|
||||||
<class>QWebView</class>
|
|
||||||
<extends>QWidget</extends>
|
|
||||||
<header>QtWebKit/QWebView</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>qbrowserlib::ButtonLineEdit</class>
|
|
||||||
<extends>QLineEdit</extends>
|
|
||||||
<header>qbrowserlib/buttonlineedit.hxx</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>qbrowserlib::SwissWebView</class>
|
|
||||||
<extends>QWebView</extends>
|
|
||||||
<header>qbrowserlib/swisswebview.hxx</header>
|
|
||||||
<container>1</container>
|
|
||||||
</customwidget>
|
|
||||||
</customwidgets>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
@@ -1,11 +1,7 @@
|
|||||||
QT += webkit network gui
|
QT += webkit network gui
|
||||||
|
CONFIG += no_keywords
|
||||||
QMAKE_LIBS += -lproxyface -lpcscxx -lssl -lcrypto
|
QMAKE_LIBS += -lproxyface -lpcscxx -lssl -lcrypto
|
||||||
QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter
|
QMAKE_CXXFLAGS += -Wno-parentheses -Wno-unused-parameter
|
||||||
#-std=c++0x
|
|
||||||
QMAKE_INCDIR += @top_srcdir@/src
|
|
||||||
QMAKE_LIBDIR += @top_builddir@/src/qbrowserlib
|
|
||||||
QMAKE_LIBDIR += @top_builddir@/src/qbrowserlib/release
|
|
||||||
QMAKE_LIBS += -lqbrowserlib
|
|
||||||
|
|
||||||
unix {
|
unix {
|
||||||
!macx {
|
!macx {
|
||||||
@@ -29,30 +25,25 @@ win32 {
|
|||||||
QMAKE_LIBS += /opt/local/i586-mingw32msvc/lib/winscard.a
|
QMAKE_LIBS += /opt/local/i586-mingw32msvc/lib/winscard.a
|
||||||
CONFIG += release
|
CONFIG += release
|
||||||
}
|
}
|
||||||
ICON = swissbrowser.icns
|
ICON = swisssurfer.icns
|
||||||
|
|
||||||
TRANSLATIONS = @PACKAGENAME@_en.ts \
|
TRANSLATIONS = @PACKAGENAME@_en.ts \
|
||||||
@PACKAGENAME@_de.ts \
|
@PACKAGENAME@_de.ts \
|
||||||
@PACKAGENAME@_fr.ts \
|
@PACKAGENAME@_fr.ts \
|
||||||
@PACKAGENAME@_it.ts
|
@PACKAGENAME@_it.ts
|
||||||
|
|
||||||
SOURCES = @srcdir@/main.cxx
|
SOURCES = main.cxx webpage.cxx
|
||||||
|
|
||||||
HEADERS = @srcdir@/browser.hxx @srcdir@/smartcardauth.hxx \
|
HEADERS = browser.hxx smartcardauth.hxx pinentry.hxx \
|
||||||
@srcdir@/pinentry.hxx \
|
downloadmanager.hxx settings.hxx sslclientnetworkmanager.hxx \
|
||||||
@srcdir@/sslclientnetworkmanager.hxx \
|
authentication.hxx webpage.hxx errorlog.hxx \
|
||||||
@srcdir@/authentication.hxx \
|
certificate.hxx logincertificate.hxx editbookmarks.hxx \
|
||||||
@srcdir@/certificate.hxx \
|
pluginfactory.hxx pdfdisplay.hpp saveorrun.hxx temporaryfile.hxx
|
||||||
@srcdir@/logincertificate.hxx \
|
|
||||||
@srcdir@/editbookmarks.hxx @srcdir@/pdfdisplay.hpp
|
|
||||||
|
|
||||||
FORMS = @srcdir@/browser.ui \
|
FORMS = browser.ui settings.ui pinentry.ui authentication.ui errorlog.ui \
|
||||||
@srcdir@/pinentry.ui @srcdir@/authentication.ui \
|
certificate.ui logincertificate.ui editbookmarks.ui saveorrun.ui
|
||||||
@srcdir@/certificate.ui \
|
|
||||||
@srcdir@/logincertificate.ui \
|
|
||||||
@srcdir@/editbookmarks.ui
|
|
||||||
|
|
||||||
RESOURCES = languages.qrc @srcdir@/resources.qrc
|
RESOURCES = languages.qrc resources.qrc
|
||||||
|
|
||||||
TARGET = @PACKAGENAME@
|
TARGET = @PACKAGENAME@
|
||||||
|
|
||||||
@@ -63,4 +54,3 @@ DEFINES += VERSION=\'\"@VERSION@\"\' BUILDDATE=\'\"@BUILDDATE@\"\'
|
|||||||
|
|
||||||
## DEBUG
|
## DEBUG
|
||||||
# QMAKE_CXXFLAGS += -include iostream -D\"CRYPTOKI_LOG(X)=std::clog<<\\\"CRYPTOKI_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"PCSC_LOG(X)=std::clog<<\\\"PCSC_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"OPENSSL_LOG(X)=std::clog<<\\\"OPENSSL_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl'" @CPPFLAGS@ @CXXFLAGS@
|
# QMAKE_CXXFLAGS += -include iostream -D\"CRYPTOKI_LOG(X)=std::clog<<\\\"CRYPTOKI_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"PCSC_LOG(X)=std::clog<<\\\"PCSC_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl\" -D\"OPENSSL_LOG(X)=std::clog<<\\\"OPENSSL_\\\"<<X<<\\\"_@_\\\"<<__PRETTY_FUNCTION__<<std::endl'" @CPPFLAGS@ @CXXFLAGS@
|
||||||
QMAKE_CXXFLAGS += @CPPFLAGS@ @CXXFLAGS@
|
|
||||||
|
@@ -1,36 +1,26 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="icons/32x32">
|
<qresource prefix="icons">
|
||||||
<file alias="butt32_49.png">resources/icons/32x32/butt32_49.png</file>
|
<file alias="gg">resources/icons/gg.png</file>
|
||||||
<file alias="swissbrowser.png">resources/icons/32x32/swissbrowser.png</file>
|
<file alias="tel">resources/icons/tel.png</file>
|
||||||
<file alias="butt32_01.png">resources/icons/32x32/butt32_01.png</file>
|
<file alias="wp">resources/icons/wp.png</file>
|
||||||
<file alias="butt32_02.png">resources/icons/32x32/butt32_02.png</file>
|
<file alias="about">resources/icons/about.png</file>
|
||||||
<file alias="butt32_03.png">resources/icons/32x32/butt32_03.png</file>
|
<file alias="addbookmark">resources/icons/addbookmark.png</file>
|
||||||
<file alias="butt32_04.png">resources/icons/32x32/butt32_04.png</file>
|
<file alias="back">resources/icons/back.png</file>
|
||||||
<file alias="butt32_05.png">resources/icons/32x32/butt32_05.png</file>
|
<file alias="clearlocation">resources/icons/clearlocation.png</file>
|
||||||
<file alias="butt32_06.png">resources/icons/32x32/butt32_06.png</file>
|
<file alias="close">resources/icons/close.png</file>
|
||||||
<file alias="butt32_07.png">resources/icons/32x32/butt32_07.png</file>
|
<file alias="error">resources/icons/error.png</file>
|
||||||
<file alias="butt32_08.png">resources/icons/32x32/butt32_08.png</file>
|
<file alias="find">resources/icons/find.png</file>
|
||||||
<file alias="butt32_09.png">resources/icons/32x32/butt32_09.png</file>
|
<file alias="forward">resources/icons/forward.png</file>
|
||||||
<file alias="butt32_09_sw.png">resources/icons/32x32/butt32_09_sw.png</file>
|
<file alias="gohome">resources/icons/gohome.png</file>
|
||||||
<file alias="butt32_10.png">resources/icons/32x32/butt32_10.png</file>
|
<file alias="newtab">resources/icons/newtab.png</file>
|
||||||
<file alias="butt32_10_sw.png">resources/icons/32x32/butt32_10_sw.png</file>
|
<file alias="newwindow">resources/icons/newwindow.png</file>
|
||||||
<file alias="butt32_11.png">resources/icons/32x32/butt32_11.png</file>
|
<file alias="print">resources/icons/print.png</file>
|
||||||
</qresource>
|
<file alias="printpreview">resources/icons/printpreview.png</file>
|
||||||
<qresource prefix="icons/16x16">
|
<file alias="reload">resources/icons/reload.png</file>
|
||||||
<file alias="butt16_49.png">resources/icons/16x16/butt16_49.png</file>
|
<file alias="settings">resources/icons/settings.png</file>
|
||||||
<file alias="swissbrowser.png">resources/icons/16x16/swissbrowser.png</file>
|
<file alias="stop">resources/icons/stop.png</file>
|
||||||
<file alias="butt16_01.png">resources/icons/16x16/butt16_01.png</file>
|
<file alias="up">resources/icons/up.png</file>
|
||||||
<file alias="butt16_02.png">resources/icons/16x16/butt16_02.png</file>
|
<file alias="usercert">resources/icons/usercert.png</file>
|
||||||
<file alias="butt16_03.png">resources/icons/16x16/butt16_03.png</file>
|
<file alias="appicon">resources/icons/swisssurfer_32x32x32.png</file>
|
||||||
<file alias="butt16_04.png">resources/icons/16x16/butt16_04.png</file>
|
|
||||||
<file alias="butt16_05.png">resources/icons/16x16/butt16_05.png</file>
|
|
||||||
<file alias="butt16_06.png">resources/icons/16x16/butt16_06.png</file>
|
|
||||||
<file alias="butt16_07.png">resources/icons/16x16/butt16_07.png</file>
|
|
||||||
<file alias="butt16_08.png">resources/icons/16x16/butt16_08.png</file>
|
|
||||||
<file alias="butt16_09.png">resources/icons/16x16/butt16_09.png</file>
|
|
||||||
<file alias="butt16_09_sw.png">resources/icons/16x16/butt16_09_sw.png</file>
|
|
||||||
<file alias="butt16_10.png">resources/icons/16x16/butt16_10.png</file>
|
|
||||||
<file alias="butt16_10_sw.png">resources/icons/16x16/butt16_10_sw.png</file>
|
|
||||||
<file alias="butt16_11.png">resources/icons/16x16/butt16_11.png</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 527 B |
Before Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 422 B |
Before Width: | Height: | Size: 425 B |
Before Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 475 B |
Before Width: | Height: | Size: 546 B |
Before Width: | Height: | Size: 569 B |
Before Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 550 B |
Before Width: | Height: | Size: 512 B |
Before Width: | Height: | Size: 412 B |
Before Width: | Height: | Size: 577 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 942 B |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 651 B |
Before Width: | Height: | Size: 805 B |
Before Width: | Height: | Size: 433 B |
Before Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 518 B |
Before Width: | Height: | Size: 640 B |
Before Width: | Height: | Size: 628 B |
Before Width: | Height: | Size: 662 B |
Before Width: | Height: | Size: 798 B |
Before Width: | Height: | Size: 657 B |
Before Width: | Height: | Size: 729 B |
Before Width: | Height: | Size: 620 B |
Before Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 1.1 KiB |