closes #51, closes #47

master
Marc Wäckerlin 14 years ago
parent 1713781422
commit 7e6cdea4f2
  1. 57
      swisssurfer/src/browser.hxx
  2. 40
      swisssurfer/src/swisssurfer_de.ts
  3. 40
      swisssurfer/src/swisssurfer_en.ts
  4. 40
      swisssurfer/src/swisssurfer_fr.ts
  5. 40
      swisssurfer/src/swisssurfer_it.ts

@ -73,7 +73,6 @@ class Browser: public QMainWindow, protected Ui::Browser {
_zoom->setSingleStep(1);
_zoom->setPageStep(10);
_zoom->setTickPosition(QSlider::TicksBothSides);
//_zoom->setTickInterval(10);
assert(connect(_zoom, SIGNAL(valueChanged(int)), SLOT(zoom(int))));
_toolbar->addWidget(_url = new QComboBox(_toolbar));
on_actionNewTab_triggered();
@ -84,12 +83,6 @@ class Browser: public QMainWindow, protected Ui::Browser {
_url->addItems(urls);
assert(connect(_url, SIGNAL(currentIndexChanged(const QString&)),
SLOT(load(QString))));
// assert(connect(&_networkManager,
// SIGNAL(extendedContextInitialization(ssl_ctx_st*,
// QSslSocket*)),
// &_scAuth,
// SLOT(extendedContextInitialization(ssl_ctx_st*,
// QSslSocket*))));
assert(connect(&_networkManager, SIGNAL(created(QNetworkReply*)),
&_downloadManager, SLOT(add(QNetworkReply*))));
@ -123,15 +116,15 @@ class Browser: public QMainWindow, protected Ui::Browser {
~Browser() {
LOG;
if (_settings.flag("CloseApps"))
for (DownloadProcesses::iterator it(_downloadProcesses.begin());
it!=_downloadProcesses.end(); ++it) {
LOG<<"delete:"<<it->second->fileName();
delete it->second;
it->second = 0;
it->first->terminate();
delete it->first;
}
for (DownloadProcesses::iterator it(_downloadProcesses.begin());
it!=_downloadProcesses.end(); ++it) {
LOG<<"delete:"<<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
@ -1017,22 +1010,43 @@ class Browser: public QMainWindow, protected Ui::Browser {
.toString();
LOG<<"Content-Type:"<<reply->header(QNetworkRequest::ContentTypeHeader)
.toString();
LOG<<"Content-Disposition:"<<reply->rawHeader("Content-Disposition");
LOG<<"Status:"<<_downloadManager.networkError(reply->error());
LOG<<"URL:"<<reply->url().toString();
LOG<<"File:"<<reply->url().toLocalFile();
LOG<<"Path:"<<reply->url().path();
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;
Settings::MimeTypes::const_iterator it
(_settings.mimetypes().find
(reply->header(QNetworkRequest::ContentTypeHeader).toString()
.split(';')[0]));
if (it!=_settings.mimetypes().end()) {
filename.replace(QRegExp("^(.*)\\."+it.value().toStringList()
.at(0)+"$"),
"\\1"); // remove extension
QTemporaryFile *file =
new QTemporaryFile(QDir::tempPath()+QDir::separator()
+"swisssurferXXXXXX"
+filename+"_XXXXXX."
+it.value().toStringList().at(0), this);
file->open();
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)),
@ -1045,9 +1059,7 @@ class Browser: public QMainWindow, protected Ui::Browser {
} else {
QString saveFile
(QFileDialog::getSaveFileName(this, tr("Save File As ..."),
!reply->url().toLocalFile().isEmpty()
?reply->url().toLocalFile()
:reply->url().path()));
filename));
if (!saveFile.isEmpty()) {
QFile file(saveFile);
file.open(QIODevice::WriteOnly);
@ -1059,8 +1071,9 @@ class Browser: public QMainWindow, protected Ui::Browser {
void processFinished() {
LOG;
if (_settings.flag("CloseApps"))
delete _downloadProcesses[qobject_cast<QProcess*>(sender())];
_downloadProcesses[qobject_cast<QProcess*>(sender())]->setAutoRemove
(_settings.flag("CloseApps"));
delete _downloadProcesses[qobject_cast<QProcess*>(sender())];
_downloadProcesses.erase(qobject_cast<QProcess*>(sender()));
}

@ -226,88 +226,88 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="431"/>
<location filename="browser.hxx" line="432"/>
<source>Checking: %1</source>
<oldsource>Opening: %1</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="446"/>
<location filename="browser.hxx" line="447"/>
<source>Reading: %1</source>
<oldsource>Reading: %1%</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="461"/>
<location filename="browser.hxx" line="462"/>
<source>Zoom: %1%</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="448"/>
<location filename="browser.hxx" line="449"/>
<source>Illegal URL: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="512"/>
<location filename="browser.hxx" line="513"/>
<source>Print Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="533"/>
<location filename="browser.hxx" line="534"/>
<source>%1 - %2</source>
<oldsource>Back to %1 - %2</oldsource>
<comment>statusbar actionBack_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="671"/>
<location filename="browser.hxx" line="672"/>
<source>Info: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>done.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>page load error.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="937"/>
<location filename="browser.hxx" line="938"/>
<source>%1</source>
<comment>statusbar for hovered link %1=url</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="438"/>
<location filename="browser.hxx" line="439"/>
<source>Forbidden: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="439"/>
<location filename="browser.hxx" line="440"/>
<source>Access Denied</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="440"/>
<location filename="browser.hxx" line="441"/>
<source>&lt;p&gt;Access denied due to security considerations.&lt;/p&gt;&lt;p&gt;You are not allowed to connect to %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="552"/>
<location filename="browser.hxx" line="553"/>
<source>%1 - %2</source>
<comment>statusbar actionForward_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="616"/>
<location filename="browser.hxx" line="617"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="617"/>
<location filename="browser.hxx" line="618"/>
<source>SwissSurfer %1 (%2)
%3
@ -321,22 +321,22 @@ Compiled: qt-%5</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="666"/>
<location filename="browser.hxx" line="667"/>
<source>%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1047"/>
<location filename="browser.hxx" line="1069"/>
<source>Save File As ...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1107"/>
<location filename="browser.hxx" line="1128"/>
<source>authentication required</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1119"/>
<location filename="browser.hxx" line="1140"/>
<source>ssl error</source>
<translation type="unfinished"></translation>
</message>

@ -226,88 +226,88 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="431"/>
<location filename="browser.hxx" line="432"/>
<source>Checking: %1</source>
<oldsource>Opening: %1</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="446"/>
<location filename="browser.hxx" line="447"/>
<source>Reading: %1</source>
<oldsource>Reading: %1%</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="461"/>
<location filename="browser.hxx" line="462"/>
<source>Zoom: %1%</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="448"/>
<location filename="browser.hxx" line="449"/>
<source>Illegal URL: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="512"/>
<location filename="browser.hxx" line="513"/>
<source>Print Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="533"/>
<location filename="browser.hxx" line="534"/>
<source>%1 - %2</source>
<oldsource>Back to %1 - %2</oldsource>
<comment>statusbar actionBack_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="671"/>
<location filename="browser.hxx" line="672"/>
<source>Info: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>done.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>page load error.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="937"/>
<location filename="browser.hxx" line="938"/>
<source>%1</source>
<comment>statusbar for hovered link %1=url</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="438"/>
<location filename="browser.hxx" line="439"/>
<source>Forbidden: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="439"/>
<location filename="browser.hxx" line="440"/>
<source>Access Denied</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="440"/>
<location filename="browser.hxx" line="441"/>
<source>&lt;p&gt;Access denied due to security considerations.&lt;/p&gt;&lt;p&gt;You are not allowed to connect to %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="552"/>
<location filename="browser.hxx" line="553"/>
<source>%1 - %2</source>
<comment>statusbar actionForward_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="616"/>
<location filename="browser.hxx" line="617"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="617"/>
<location filename="browser.hxx" line="618"/>
<source>SwissSurfer %1 (%2)
%3
@ -321,22 +321,22 @@ Compiled: qt-%5</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="666"/>
<location filename="browser.hxx" line="667"/>
<source>%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1047"/>
<location filename="browser.hxx" line="1069"/>
<source>Save File As ...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1107"/>
<location filename="browser.hxx" line="1128"/>
<source>authentication required</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1119"/>
<location filename="browser.hxx" line="1140"/>
<source>ssl error</source>
<translation type="unfinished"></translation>
</message>

@ -226,88 +226,88 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="431"/>
<location filename="browser.hxx" line="432"/>
<source>Checking: %1</source>
<oldsource>Opening: %1</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="446"/>
<location filename="browser.hxx" line="447"/>
<source>Reading: %1</source>
<oldsource>Reading: %1%</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="461"/>
<location filename="browser.hxx" line="462"/>
<source>Zoom: %1%</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="448"/>
<location filename="browser.hxx" line="449"/>
<source>Illegal URL: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="512"/>
<location filename="browser.hxx" line="513"/>
<source>Print Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="533"/>
<location filename="browser.hxx" line="534"/>
<source>%1 - %2</source>
<oldsource>Back to %1 - %2</oldsource>
<comment>statusbar actionBack_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="671"/>
<location filename="browser.hxx" line="672"/>
<source>Info: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>done.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>page load error.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="937"/>
<location filename="browser.hxx" line="938"/>
<source>%1</source>
<comment>statusbar for hovered link %1=url</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="438"/>
<location filename="browser.hxx" line="439"/>
<source>Forbidden: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="439"/>
<location filename="browser.hxx" line="440"/>
<source>Access Denied</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="440"/>
<location filename="browser.hxx" line="441"/>
<source>&lt;p&gt;Access denied due to security considerations.&lt;/p&gt;&lt;p&gt;You are not allowed to connect to %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="552"/>
<location filename="browser.hxx" line="553"/>
<source>%1 - %2</source>
<comment>statusbar actionForward_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="616"/>
<location filename="browser.hxx" line="617"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="617"/>
<location filename="browser.hxx" line="618"/>
<source>SwissSurfer %1 (%2)
%3
@ -321,22 +321,22 @@ Compiled: qt-%5</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="666"/>
<location filename="browser.hxx" line="667"/>
<source>%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1047"/>
<location filename="browser.hxx" line="1069"/>
<source>Save File As ...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1107"/>
<location filename="browser.hxx" line="1128"/>
<source>authentication required</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1119"/>
<location filename="browser.hxx" line="1140"/>
<source>ssl error</source>
<translation type="unfinished"></translation>
</message>

@ -226,88 +226,88 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="431"/>
<location filename="browser.hxx" line="432"/>
<source>Checking: %1</source>
<oldsource>Opening: %1</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="446"/>
<location filename="browser.hxx" line="447"/>
<source>Reading: %1</source>
<oldsource>Reading: %1%</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="461"/>
<location filename="browser.hxx" line="462"/>
<source>Zoom: %1%</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="448"/>
<location filename="browser.hxx" line="449"/>
<source>Illegal URL: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="512"/>
<location filename="browser.hxx" line="513"/>
<source>Print Document</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="533"/>
<location filename="browser.hxx" line="534"/>
<source>%1 - %2</source>
<oldsource>Back to %1 - %2</oldsource>
<comment>statusbar actionBack_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="671"/>
<location filename="browser.hxx" line="672"/>
<source>Info: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>done.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="684"/>
<location filename="browser.hxx" line="685"/>
<source>page load error.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="937"/>
<location filename="browser.hxx" line="938"/>
<source>%1</source>
<comment>statusbar for hovered link %1=url</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="438"/>
<location filename="browser.hxx" line="439"/>
<source>Forbidden: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="439"/>
<location filename="browser.hxx" line="440"/>
<source>Access Denied</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="440"/>
<location filename="browser.hxx" line="441"/>
<source>&lt;p&gt;Access denied due to security considerations.&lt;/p&gt;&lt;p&gt;You are not allowed to connect to %1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="552"/>
<location filename="browser.hxx" line="553"/>
<source>%1 - %2</source>
<comment>statusbar actionForward_hovered %1=url %2=title</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="616"/>
<location filename="browser.hxx" line="617"/>
<source>About</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="617"/>
<location filename="browser.hxx" line="618"/>
<source>SwissSurfer %1 (%2)
%3
@ -321,22 +321,22 @@ Compiled: qt-%5</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="666"/>
<location filename="browser.hxx" line="667"/>
<source>%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1047"/>
<location filename="browser.hxx" line="1069"/>
<source>Save File As ...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1107"/>
<location filename="browser.hxx" line="1128"/>
<source>authentication required</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="browser.hxx" line="1119"/>
<location filename="browser.hxx" line="1140"/>
<source>ssl error</source>
<translation type="unfinished"></translation>
</message>

Loading…
Cancel
Save