|
|
@ -239,6 +239,60 @@ void notrace(QtMsgType, const char*) { |
|
|
|
|
|
|
|
|
|
|
|
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)\n") |
|
|
|
|
|
|
|
.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);
|
|
|
|
// qInstallMsgHandler(notrace);
|
|
|
|
// std::cout.rdbuf((new std::stringstream)->rdbuf());
|
|
|
|
// std::cout.rdbuf((new std::stringstream)->rdbuf());
|
|
|
@ -264,16 +318,6 @@ int main(int argv, char** argc) try { |
|
|
|
// certs.push_back(QSslCertificate(SWISSSIGN_PLATINUM_CA_G2));
|
|
|
|
// certs.push_back(QSslCertificate(SWISSSIGN_PLATINUM_CA_G2));
|
|
|
|
// sslConfig.setCaCertificates(certs);
|
|
|
|
// 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); |
|
|
@ -283,23 +327,23 @@ int main(int argv, char** argc) try { |
|
|
|
app.setApplicationName(QObject::trUtf8("SwissBrowser", "application name")); |
|
|
|
app.setApplicationName(QObject::trUtf8("SwissBrowser", "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/swissbrowser_"+ QLocale().name()); |
|
|
|
app.installTranslator(&appTranslator); |
|
|
|
app.installTranslator(&appTranslator); |
|
|
|
//............................................................................
|
|
|
|
//............................................................................
|
|
|
|
if (env["PROXY_TYPE"]=="http") |
|
|
|
if (env()["PROXY_TYPE"]=="http") |
|
|
|
QNetworkProxy::setApplicationProxy |
|
|
|
QNetworkProxy::setApplicationProxy |
|
|
|
(QNetworkProxy |
|
|
|
(QNetworkProxy |
|
|
|
(QNetworkProxy::HttpProxy, |
|
|
|
(QNetworkProxy::HttpProxy, |
|
|
|
env["PROXY_HOST"], env["PROXY_PORT"].toInt())); |
|
|
|
env()["PROXY_HOST"], env()["PROXY_PORT"].toInt())); |
|
|
|
if (env["PROXY_TYPE"]=="socks") |
|
|
|
if (env()["PROXY_TYPE"]=="socks") |
|
|
|
QNetworkProxy::setApplicationProxy |
|
|
|
QNetworkProxy::setApplicationProxy |
|
|
|
(QNetworkProxy |
|
|
|
(QNetworkProxy |
|
|
|
(QNetworkProxy::Socks5Proxy, |
|
|
|
(QNetworkProxy::Socks5Proxy, |
|
|
|
env["PROXY_HOST"], env["PROXY_PORT"].toInt())); |
|
|
|
env()["PROXY_HOST"], env()["PROXY_PORT"].toInt())); |
|
|
|
else |
|
|
|
else |
|
|
|
QNetworkProxyFactory::setUseSystemConfiguration(true); |
|
|
|
QNetworkProxyFactory::setUseSystemConfiguration(true); |
|
|
|
qDebug()<<"***************************************************************"; |
|
|
|
qDebug()<<"***************************************************************"; |
|
|
@ -332,7 +376,7 @@ 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); |
|
|
|
Settings::MimeTypes mimetypes; |
|
|
|
qbrowserlib::Settings::MimeTypes mimetypes; |
|
|
|
QString bookmarks; |
|
|
|
QString bookmarks; |
|
|
|
bool editbookmarks(false); |
|
|
|
bool editbookmarks(false); |
|
|
|
QStringList args(app.arguments()); |
|
|
|
QStringList args(app.arguments()); |
|
|
@ -340,44 +384,7 @@ int main(int argv, char** argc) try { |
|
|
|
(std::auto_ptr<QSettings>(new QSettings("SwissSign", "SwissBrowser"))); |
|
|
|
(std::auto_ptr<QSettings>(new QSettings("SwissSign", "SwissBrowser"))); |
|
|
|
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<<QObject::trUtf8 |
|
|
|
std::cout<<helptext().toStdString()<<std::endl; |
|
|
|
("Usage: %1 [OPTIONS...] [<url> ...]\n" |
|
|
|
|
|
|
|
"Options:\n" |
|
|
|
|
|
|
|
" -h, --help show this help text\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)\n") |
|
|
|
|
|
|
|
.arg(QFileInfo(argc[0]).fileName()) |
|
|
|
|
|
|
|
.arg(env["PROXY_TYPE"]).arg(env["PROXY_PORT"]).arg(env["PROXY_HOST"]) |
|
|
|
|
|
|
|
.arg(env["LANGUAGE"]).arg(env["SWISS_USERAGENT"]) |
|
|
|
|
|
|
|
.toStdString() |
|
|
|
|
|
|
|
<<std::endl; |
|
|
|
|
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} else if ((*it=="-t" || *it=="--tmp") && ++it!=args.end()) { |
|
|
|
} else if ((*it=="-t" || *it=="--tmp") && ++it!=args.end()) { |
|
|
|
TMP=*it; |
|
|
|
TMP=*it; |
|
|
@ -441,8 +448,8 @@ int main(int argv, char** argc) try { |
|
|
|
//............................................................................
|
|
|
|
//............................................................................
|
|
|
|
std::cerr<<"LIBRARY PATHES:\n"<<app.libraryPaths().join("\n").toStdString() |
|
|
|
std::cerr<<"LIBRARY PATHES:\n"<<app.libraryPaths().join("\n").toStdString() |
|
|
|
<<std::endl;
|
|
|
|
<<std::endl;
|
|
|
|
if (env.contains("QT_PLUGIN_PATH")) { |
|
|
|
if (env().contains("QT_PLUGIN_PATH")) { |
|
|
|
foreach (QString path, env["QT_PLUGIN_PATH"].split(":")) { |
|
|
|
foreach (QString path, env()["QT_PLUGIN_PATH"].split(":")) { |
|
|
|
std::cerr<<"**** Setting: PLUGIN-PATH to "<<path.toStdString()<<std::endl; |
|
|
|
std::cerr<<"**** Setting: PLUGIN-PATH to "<<path.toStdString()<<std::endl; |
|
|
|
app.addLibraryPath(path); |
|
|
|
app.addLibraryPath(path); |
|
|
|
} |
|
|
|
} |
|
|
@ -450,7 +457,8 @@ int main(int argv, char** argc) try { |
|
|
|
std::cerr<<"**** Error: PLUGIN-PATH is not defined"<<std::endl; |
|
|
|
std::cerr<<"**** Error: PLUGIN-PATH is not defined"<<std::endl; |
|
|
|
abort(); |
|
|
|
abort(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (env.contains("QTWEBKIT_PLUGIN_PATH")) qt_drt_overwritePluginDirectories(); |
|
|
|
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, bookmarks); |
|
|
|
if (editbookmarks) browser.on_actionEditBookmarks_triggered(); |
|
|
|
if (editbookmarks) browser.on_actionEditBookmarks_triggered(); |
|
|
|