mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
f613c8ae44
@ -231,13 +231,18 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
|
||||
QString path;
|
||||
if (reply->hasRawHeader("Content-Disposition")) {
|
||||
QString value = QString::fromLatin1(reply->rawHeader("Content-Disposition"));
|
||||
int pos = value.indexOf("filename=");
|
||||
if (pos != -1) {
|
||||
QString name = value.mid(pos + 9);
|
||||
if (name.startsWith('"') && name.endsWith('"')) {
|
||||
name = name.mid(1, name.size() - 2);
|
||||
}
|
||||
path = name;
|
||||
|
||||
// We try to use UTF-8 encoded filename first if present
|
||||
if (value.contains("filename*=UTF-8")) {
|
||||
QRegExp reg("filename\\*=UTF-8''([^;]*)");
|
||||
reg.indexIn(value);
|
||||
path = QUrl::fromPercentEncoding(reg.cap(1).toUtf8()).trimmed();
|
||||
}
|
||||
else if (value.contains("filename=\"")) {
|
||||
QRegExp reg("filename=\"(.*)\"");
|
||||
reg.setMinimal(true);
|
||||
reg.indexIn(value);
|
||||
path = reg.cap(1).trimmed();
|
||||
}
|
||||
}
|
||||
if (path.isEmpty()) {
|
||||
@ -257,10 +262,7 @@ QString DownloadFileHelper::getFileName(QNetworkReply* reply)
|
||||
}
|
||||
|
||||
QString name = baseName + endName;
|
||||
if (name.startsWith("\"")) {
|
||||
name = name.mid(1);
|
||||
}
|
||||
if (name.endsWith("\";")) {
|
||||
if (name.contains("\"")) {
|
||||
name.remove("\";");
|
||||
}
|
||||
|
||||
|
@ -199,14 +199,14 @@ void LocationBar::showUrl(const QUrl &url)
|
||||
return;
|
||||
}
|
||||
|
||||
QString encodedUrl = url.toEncoded();
|
||||
QString stringUrl = url.toString();
|
||||
|
||||
if (url.toString() == "qupzilla:speeddial" || url.toString() == "about:blank") {
|
||||
encodedUrl = "";
|
||||
if (stringUrl == "qupzilla:speeddial" || stringUrl == "about:blank") {
|
||||
stringUrl = "";
|
||||
}
|
||||
|
||||
if (url.toEncoded() != text()) {
|
||||
setText(encodedUrl);
|
||||
setText(stringUrl);
|
||||
}
|
||||
|
||||
p_QupZilla->statusBarMessage()->clearMessage();
|
||||
@ -303,7 +303,7 @@ void LocationBar::contextMenuEvent(QContextMenuEvent* event)
|
||||
++i;
|
||||
}
|
||||
|
||||
delete tempMenu;
|
||||
tempMenu->deleteLater();
|
||||
|
||||
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
|
||||
|
||||
|
@ -249,7 +249,7 @@ void WebSearchBar::contextMenuEvent(QContextMenuEvent* event)
|
||||
++i;
|
||||
}
|
||||
|
||||
delete tempMenu;
|
||||
tempMenu->deleteLater();
|
||||
|
||||
m_pasteAndGoAction->setEnabled(!QApplication::clipboard()->text().isEmpty());
|
||||
|
||||
|
@ -62,7 +62,7 @@ void PopupLocationBar::setView(PopupWebView* view)
|
||||
|
||||
void PopupLocationBar::showUrl(const QUrl &url)
|
||||
{
|
||||
setText(url.toEncoded());
|
||||
setText(url.toString());
|
||||
setCursorPosition(0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user