1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Fix:] Fixed loading urls with special characters from history

- also made possible to load files from qrc: scheme
- improved source viewer:
   * fixed incomplete source code loaded when opening window
     (it loads the whole source only after reloading)
   * improved performance, source is now highlighted much faster
- using .ico favicon in all qupzilla: pages (no longer png)
  it should fix problems when favicon wasn't loaded on some systems
- fixed alignment of site icon in navigation bar when compiling
  with Qt 4.8
- fixed deleting of local certifications in ssl manager
This commit is contained in:
nowrep 2011-12-04 16:54:57 +01:00
parent 934e6ea5a1
commit 8eb164fb26
39 changed files with 2281 additions and 2294 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -50,7 +50,7 @@ void CommandLineOptions::showHelp()
" For more informations please visit wiki at \n"
" https://github.com/nowrep/QupZilla/wiki \n";
cout << help << " > " << QupZilla::WWWADDRESS.toAscii().data() << endl;
cout << help << " > " << QupZilla::WWWADDRESS.toUtf8().data() << endl;
}
void CommandLineOptions::parseActions()
@ -79,8 +79,8 @@ void CommandLineOptions::parseActions()
break;
}
if (arg == "-v" || arg == "--version") {
cout << "QupZilla v" << QupZilla::VERSION.toAscii().data()
<< "(build " << QupZilla::BUILDTIME.toAscii().data() << ")"
cout << "QupZilla v" << QupZilla::VERSION.toUtf8().data()
<< "(build " << QupZilla::BUILDTIME.toUtf8().data() << ")"
<< endl;
found = true;
ActionPair pair;
@ -93,7 +93,7 @@ void CommandLineOptions::parseActions()
arg.remove("-p=");
arg.remove("--profile=");
found = true;
cout << "starting with profile " << arg.toAscii().data() << endl;
cout << "starting with profile " << arg.toUtf8().data() << endl;
ActionPair pair;
pair.action = StartWithProfile;
pair.text = arg;
@ -136,7 +136,7 @@ void CommandLineOptions::parseActions()
QString url(m_argv[m_argc - 1]);
if (m_argc > 1 && !url.isEmpty() && !url.startsWith("-")) {
found = true;
cout << "starting with url " << url.toAscii().data() << endl;
cout << "starting with url " << url.toUtf8().data() << endl;
ActionPair pair;
pair.action = OpenUrl;
pair.text = url;

View File

@ -50,7 +50,7 @@ void ProfileUpdater::checkProfile()
}
versionFile.open(QFile::WriteOnly);
versionFile.write(QupZilla::VERSION.toAscii());
versionFile.write(QupZilla::VERSION.toUtf8());
versionFile.close();
}

View File

@ -421,7 +421,7 @@ void QupZilla::loadSettings()
//Url settings
settings.beginGroup("Web-URL-Settings");
m_homepage = settings.value("homepage", "qupzilla:start").toUrl();
m_newtab = settings.value("newTabUrl", "").toUrl();
m_newtab = settings.value("newTabUrl", "qupzilla:speeddial").toUrl();
settings.endGroup();
QWebSettings* websettings = mApp->webSettings();

View File

@ -151,8 +151,8 @@ void AutoFillModel::completePage(WebView* view)
QList<QPair<QString, QString> > arguments = QUrl::fromEncoded(QByteArray("http://bla.com/?" + data)).queryItems();
for (int i = 0; i < arguments.count(); i++) {
QString key = QUrl::fromEncoded(arguments.at(i).first.toAscii()).toString();
QString value = QUrl::fromEncoded(arguments.at(i).second.toAscii()).toString();
QString key = QUrl::fromEncoded(arguments.at(i).first.toUtf8()).toString();
QString value = QUrl::fromEncoded(arguments.at(i).second.toUtf8()).toString();
//key.replace("+"," ");
//value.replace("+"," ");
@ -264,7 +264,7 @@ QString AutoFillModel::getValueFromData(const QByteArray &data, QWebElement elem
QueryItem item = queryItems.at(i);
if (item.first == name) {
value = item.second.toAscii();
value = item.second.toUtf8();
}
}
}

View File

@ -18,5 +18,6 @@
<file>html/plus.png</file>
<file>html/loading.gif</file>
<file>html/reload.png</file>
<file>html/qupzilla.ico</file>
</qresource>
</RCC>

BIN
src/data/html/qupzilla.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -7,21 +7,22 @@ html * {font-size: 100%;line-height: 1.6;}
#box {max-width: 650px;overflow:auto;margin: 25px auto 10px auto;padding: 10px 40px;border-width: 20px;-webkit-border-image: url(%BOX-BORDER%) 25;text-align: left;}
h1 {color: #1a4ba4;font-size: 160%;margin-bottom: 0px;}
p {margin-left: 1%;}
input {width: 200px;}
.submit {width: 100px;}
select {width: 200px;}
textarea {width: 400px;height: 100px;}
textarea {width: 400px;height: 100px; border: 1px solid #babcb8;}
textarea:focus {border-color: #579eea;}
input[type="text"], input[type="email"] {width: 200px;height: 25px;border: 1px solid #babcb8;}
input[type="text"]:focus, input[type="email"]:focus {border-color: #579eea;}
</style>
<script>
function checkFields()
{
var type = document.getElementById("type").value;
var priority = document.getElementById("priority").value;
var description = document.getElementById("text").value;
if (type == null || type == "" || priority == null || priority == "" || description == null || description == "") {
alert("%FIELDS-ARE-REQUIRED%");
return false;
if (type == null || type == "" || description == null || description == "") {
alert("%FIELDS-ARE-REQUIRED%");
return false;
}
return true;
}
@ -36,10 +37,9 @@ function checkFields()
<p>
<table>
<form action="http://qupzilla.co.cc/reportbug.php" onsubmit="return checkFields()" method="POST">
<tr><td>%EMAIL%*:</td><td><input type="text" id="mail" name="mail"> </tr>
<tr><td>%TYPE%:</td><td><input type="text" id="type" name="type"> </tr>
<tr><td>%PRIORITY%:</td><td><select id="priority" name="priority"> <option>%LOW%</option><option>%NORMAL%</option><option>%HIGH%</option> </select></tr>
<tr><td>%DESCRIPTION%:</td><td><textarea id="text" name="text"> </textarea> </tr>
<tr><td>%EMAIL%*:</td><td><input type="text" id="mail" name="mail" required> </tr>
<tr><td>%TYPE%:</td><td><input type="text" id="type" name="type" required> </tr>
<tr><td>%DESCRIPTION%:</td><td><textarea id="text" name="text" required></textarea> </tr>
<tr><td colspan=2 align=right><input class="submit" type="submit" name="ok" value="%SEND%"> </tr>
</form>
</table>

View File

@ -74,7 +74,9 @@ void HistoryManager::itemDoubleClicked(QTreeWidgetItem* item)
if (!item || item->text(1).isEmpty()) {
return;
}
getQupZilla()->tabWidget()->addView(QUrl(item->text(1)));
QUrl url = QUrl::fromEncoded(item->text(1).toUtf8());
getQupZilla()->tabWidget()->addView(url);
}
void HistoryManager::loadInNewTab()
@ -89,7 +91,7 @@ void HistoryManager::contextMenuRequested(const QPoint &position)
if (!ui->historyTree->itemAt(position)) {
return;
}
QString link = ui->historyTree->itemAt(position)->text(1);
QUrl link = QUrl::fromEncoded(ui->historyTree->itemAt(position)->text(1).toUtf8());
if (link.isEmpty()) {
return;
}

View File

@ -36,12 +36,13 @@ void HistoryModel::loadSettings()
settings.endGroup();
}
int HistoryModel::addHistoryEntry(const QString &url, QString &title)
int HistoryModel::addHistoryEntry(const QUrl &url, QString &title)
{
if (!m_isSaving) {
return -2;
}
if (url.startsWith("file:") || url.startsWith("qupzilla:") || title.contains(tr("Failed loading page")) || url.isEmpty() || url.contains("about:blank")) {
if (url.scheme() == "file:" || url.scheme() == "qupzilla" || url.scheme() == "about" ||
title.contains(tr("Failed loading page")) || url.isEmpty()) {
return -1;
}
if (title == "") {
@ -86,6 +87,7 @@ int HistoryModel::addHistoryEntry(const QString &url, QString &title)
after.title = title;
emit historyEntryEdited(before, after);
}
return query.lastInsertId().toInt();
}
@ -95,7 +97,7 @@ int HistoryModel::addHistoryEntry(WebView* view)
return -2;
}
QString url = view->url().toEncoded();
QUrl url = view->url();
QString title = view->title();
return addHistoryEntry(url, title);
}

View File

@ -45,7 +45,7 @@ public:
static QString titleCaseLocalizedMonth(int month);
int addHistoryEntry(WebView* view);
int addHistoryEntry(const QString &url, QString &title);
int addHistoryEntry(const QUrl &url, QString &title);
bool deleteHistoryEntry(int index);
bool deleteHistoryEntry(const QString &url, const QString &title);
bool urlIsStored(const QString &url);

View File

@ -41,7 +41,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
setObjectName("locationbar");
m_siteIcon = new ToolButton(this);
m_siteIcon->setObjectName("locationbar-siteicon");
m_siteIcon->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
m_siteIcon->setToolButtonStyle(Qt::ToolButtonIconOnly);
m_siteIcon->setCursor(Qt::ArrowCursor);
m_siteIcon->setToolTip(tr("Show informations about this page"));
m_siteIcon->setFocusPolicy(Qt::ClickFocus);

View File

@ -30,6 +30,15 @@
#include "globalfunctions.h"
#include "acceptlanguage.h"
QString fileNameForCert(const QSslCertificate &cert)
{
QString certFileName = CertificateInfoWidget::certificateItemText(cert);
certFileName.remove(" ");
certFileName.append(".crt");
certFileName = qz_filterCharsFromFilename(certFileName);
return certFileName;
}
NetworkManager::NetworkManager(QupZilla* mainClass, QObject* parent)
: NetworkManagerProxy(parent)
, m_adblockNetwork(0)
@ -316,7 +325,8 @@ void NetworkManager::removeLocalCertificate(const QSslCertificate &cert)
QSslSocket::setDefaultCaCertificates(certs);
//Delete cert file from profile
QString certFileName = CertificateInfoWidget::certificateItemText(cert);
bool deleted = false;
QString certFileName = fileNameForCert(cert);
int startIndex = 0;
QDirIterator it(mApp->getActiveProfilPath() + "certificates", QDir::Files, QDirIterator::FollowSymlinks | QDirIterator::Subdirectories);
while (it.hasNext()) {
@ -326,9 +336,16 @@ void NetworkManager::removeLocalCertificate(const QSslCertificate &cert)
}
QFile file(filePath);
file.remove();
if (!file.remove()) {
qWarning() << "NetworkManager::removeLocalCertificate cannot remove file" << filePath;
}
deleted = true;
break;
}
if (!deleted) {
qWarning() << "NetworkManager::removeLocalCertificate cannot find file" << certFileName;
}
}
void NetworkManager::addLocalCertificate(const QSslCertificate &cert)
@ -345,8 +362,7 @@ void NetworkManager::addLocalCertificate(const QSslCertificate &cert)
dir.mkdir("certificates");
}
QString certFileName = CertificateInfoWidget::certificateItemText(cert).remove(" ") + ".crt";
certFileName = qz_filterCharsFromFilename(certFileName);
QString certFileName = fileNameForCert(cert);
QString fileName = qz_ensureUniqueFilename(mApp->getActiveProfilPath() + "certificates/" + certFileName);
QFile file(fileName);

View File

@ -117,19 +117,15 @@ QString QupZillaSchemeReply::reportbugPage()
{
QString page;
page.append(qz_readAllFileContents(":html/reportbug.html"));
page.replace("%FAVICON%", "qrc:icons/qupzilla.png");
page.replace("%FAVICON%", "qrc:html/qupzilla.ico");
page.replace("%BOX-BORDER%", "qrc:html/box-border.png");
page.replace("%TITLE%", tr("Report issue"));
page.replace("%REPORT-ISSUE%", tr("Report issue"));
page.replace("%TITLE%", tr("Report Issue"));
page.replace("%REPORT-ISSUE%", tr("Report Issue"));
page.replace("%PLUGINS-TEXT%", tr("If you are experiencing problems with QupZilla, please try first disable"
" all plugins. <br/>If it won't help, then please fill this form: "));
page.replace("%EMAIL%", tr("Your E-mail"));
page.replace("%TYPE%", tr("Issue type"));
page.replace("%PRIORITY%", tr("Priority"));
page.replace("%LOW%", tr("Low"));
page.replace("%NORMAL%", tr("Normal"));
page.replace("%HIGH%", tr("High"));
page.replace("%DESCRIPTION%", tr("Issue description"));
page.replace("%SEND%", tr("Send"));
page.replace("%E-MAIL-OPTIONAL%", tr("E-mail is optional"));
@ -141,7 +137,7 @@ QString QupZillaSchemeReply::startPage()
{
QString page;
page.append(qz_readAllFileContents(":html/start.html"));
page.replace("%FAVICON%", "qrc:icons/qupzilla.png");
page.replace("%FAVICON%", "qrc:html/qupzilla.ico");
page.replace("%BOX-BORDER%", "qrc:html/box-border.png");
page.replace("%ABOUT-IMG%", "qrc:icons/other/about.png");
@ -158,7 +154,7 @@ QString QupZillaSchemeReply::aboutPage()
{
QString page;
page.append(qz_readAllFileContents(":html/about.html"));
page.replace("%FAVICON%", "qrc:icons/qupzilla.png");
page.replace("%FAVICON%", "qrc:html/qupzilla.ico");
page.replace("%BOX-BORDER%", "qrc:html/box-border.png");
page.replace("%ABOUT-IMG%", "qrc:icons/other/about.png");
page.replace("%COPYRIGHT-INCLUDE%", qz_readAllFileContents(":html/copyright"));
@ -210,7 +206,7 @@ QString QupZillaSchemeReply::speeddialPage()
{
QString page;
page.append(qz_readAllFileContents(":html/speeddial.html"));
page.replace("%FAVICON%", "qrc:icons/qupzilla.png");
page.replace("%FAVICON%", "qrc:html/qupzilla.ico");
page.replace("%IMG_PLUS%", "qrc:html/plus.png");
page.replace("%BOX-BORDER%", "qrc:html/box-border-small.png");
page.replace("%IMG_CLOSE%", "qrc:html/close.png");

View File

@ -41,10 +41,6 @@ SourceViewer::SourceViewer(QWebPage* page, const QString &selectedHtml) :
m_layout->setSpacing(0);
m_layout->setMenuBar(menuBar);
m_sourceEdit->setUndoRedoEnabled(false);
m_sourceEdit->insertPlainText(m_page->mainFrame()->toHtml());
m_sourceEdit->setUndoRedoEnabled(true);
this->resize(650, 600);
m_sourceEdit->setReadOnly(true);
m_sourceEdit->moveCursor(QTextCursor::Start);
@ -86,7 +82,11 @@ SourceViewer::SourceViewer(QWebPage* page, const QString &selectedHtml) :
menuView->actions().at(3)->setChecked(true);
menuBar->addMenu(menuView);
qz_centerWidgetOnScreen(this);
qz_centerWidgetToParent(this, page->view());
m_sourceEdit->setUndoRedoEnabled(false);
m_sourceEdit->insertPlainText(m_page->mainFrame()->toHtml());
m_sourceEdit->setUndoRedoEnabled(true);
//Highlight selectedHtml
if (!selectedHtml.isEmpty()) {
@ -107,7 +107,7 @@ void SourceViewer::save()
m_statusBar->showMessage(tr("Error writing to file"));
return;
}
file.write(m_sourceEdit->toPlainText().toAscii());
file.write(m_sourceEdit->toPlainText().toUtf8());
file.close();
m_statusBar->showMessage(tr("Source successfully saved"));

View File

@ -211,7 +211,7 @@ bool ClickToFlash::checkUrlOnElement(QWebElement el)
checkString = m_page->getView()->url().resolved(QUrl(checkString)).toString(QUrl::RemoveQuery);
return m_url.toEncoded().contains(checkString.toAscii());
return m_url.toEncoded().contains(checkString.toUtf8());
}
bool ClickToFlash::checkElement(QWebElement el)

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 David Rosca
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "speeddial.h"
#include "mainapplication.h"
#include "pagethumbnailer.h"
@ -75,7 +92,7 @@ QString SpeedDial::initialScript()
QString url = tmp.at(0).mid(5);
QString title = tmp.at(1).mid(7);
QString imgSource = m_thumbnailsDir + QCryptographicHash::hash(url.toAscii(), QCryptographicHash::Md4).toHex() + ".png";
QString imgSource = m_thumbnailsDir + QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
if (!QFile(imgSource).exists()) {
loadThumbnail(url);
@ -116,7 +133,7 @@ void SpeedDial::loadThumbnail(const QString &url)
void SpeedDial::removeImageForUrl(const QString &url)
{
QString fileName = m_thumbnailsDir + QCryptographicHash::hash(url.toAscii(), QCryptographicHash::Md4).toHex() + ".png";
QString fileName = m_thumbnailsDir + QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
if (QFile(fileName).exists()) {
QFile(fileName).remove();
@ -131,7 +148,7 @@ void SpeedDial::thumbnailCreated(const QPixmap &image)
}
QString url = thumbnailer->url().toString();
QString fileName = m_thumbnailsDir + QCryptographicHash::hash(url.toAscii(), QCryptographicHash::Md4).toHex() + ".png";
QString fileName = m_thumbnailsDir + QCryptographicHash::hash(url.toUtf8(), QCryptographicHash::Md4).toHex() + ".png";
if (!image.save(fileName)) {
qWarning() << "SpeedDial::thumbnailCreated Cannot save thumbnail to " << fileName;

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 David Rosca
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef SPEEDDIAL_H
#define SPEEDDIAL_H

View File

@ -142,7 +142,7 @@ void AutoFillManager::editPass()
QByteArray data = query.value(0).toByteArray();
QByteArray oldPass = "=" + QUrl::toPercentEncoding(query.value(1).toByteArray());
data.replace(oldPass, "=" + QUrl::toPercentEncoding(text.toAscii()));
data.replace(oldPass, "=" + QUrl::toPercentEncoding(text.toUtf8()));
query.prepare("UPDATE autofill SET data=?, password=? WHERE id=?");
query.bindValue(0, data);

View File

@ -96,7 +96,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
//GENERAL URLs
settings.beginGroup("Web-URL-Settings");
m_homepage = settings.value("homepage", "qupzilla:start").toString();
m_newTabUrl = settings.value("newTabUrl", "").toString();
m_newTabUrl = settings.value("newTabUrl", "qupzilla:speeddial").toString();
ui->homepage->setText(m_homepage);
ui->newTabUrl->setText(m_newTabUrl);
int afterLaunch = settings.value("afterLaunch", 1).toInt();

View File

@ -56,7 +56,9 @@ void BookmarksSideBar::itemControlClicked(QTreeWidgetItem* item)
if (!item || item->text(1).isEmpty()) {
return;
}
p_QupZilla->tabWidget()->addView(QUrl(item->text(1)));
QUrl url = QUrl::fromEncoded(item->text(1).toUtf8());
p_QupZilla->tabWidget()->addView(url);
}
void BookmarksSideBar::itemDoubleClicked(QTreeWidgetItem* item)
@ -64,7 +66,9 @@ void BookmarksSideBar::itemDoubleClicked(QTreeWidgetItem* item)
if (!item || item->text(1).isEmpty()) {
return;
}
p_QupZilla->loadAddress(QUrl(item->text(1)));
QUrl url = QUrl::fromEncoded(item->text(1).toUtf8());
p_QupZilla->loadAddress(url);
}
void BookmarksSideBar::loadInNewTab()
@ -77,7 +81,7 @@ void BookmarksSideBar::loadInNewTab()
void BookmarksSideBar::copyAddress()
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
QApplication::clipboard()->setText(action->data().toString());
QApplication::clipboard()->setText(action->data().toUrl().toEncoded());
}
}
@ -97,7 +101,7 @@ void BookmarksSideBar::contextMenuRequested(const QPoint &position)
if (!ui->bookmarksTree->itemAt(position)) {
return;
}
QString link = ui->bookmarksTree->itemAt(position)->text(1);
QUrl link = QUrl::fromEncoded(ui->bookmarksTree->itemAt(position)->text(1).toUtf8());
if (link.isEmpty()) {
return;
}

View File

@ -49,7 +49,9 @@ void HistorySideBar::itemDoubleClicked(QTreeWidgetItem* item)
if (!item || item->text(1).isEmpty()) {
return;
}
p_QupZilla->loadAddress(QUrl(item->text(1)));
QUrl url = QUrl::fromEncoded(item->text(1).toUtf8());
p_QupZilla->loadAddress(url);
}
void HistorySideBar::itemControlClicked(QTreeWidgetItem* item)
@ -57,7 +59,9 @@ void HistorySideBar::itemControlClicked(QTreeWidgetItem* item)
if (!item || item->text(1).isEmpty()) {
return;
}
p_QupZilla->tabWidget()->addView(QUrl(item->text(1)));
QUrl url = QUrl::fromEncoded(item->text(1).toUtf8());
p_QupZilla->tabWidget()->addView(url);
}
void HistorySideBar::loadInNewTab()
@ -70,7 +74,7 @@ void HistorySideBar::loadInNewTab()
void HistorySideBar::copyAddress()
{
if (QAction* action = qobject_cast<QAction*>(sender())) {
QApplication::clipboard()->setText(action->data().toString());
QApplication::clipboard()->setText(action->data().toUrl().toEncoded());
}
}
@ -79,7 +83,8 @@ void HistorySideBar::contextMenuRequested(const QPoint &position)
if (!ui->historyTree->itemAt(position)) {
return;
}
QString link = ui->historyTree->itemAt(position)->text(1);
QUrl link = QUrl::fromEncoded(ui->historyTree->itemAt(position)->text(1).toUtf8());
if (link.isEmpty()) {
return;
}

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 David Rosca
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "pagethumbnailer.h"
#include "mainapplication.h"
#include "networkmanagerproxy.h"

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 David Rosca
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef PAGETHUMBNAILER_H
#define PAGETHUMBNAILER_H

View File

@ -197,7 +197,7 @@ void SiteInfo::showImagePreview(QTreeWidgetItem* item)
QGraphicsScene* scene = new QGraphicsScene(ui->mediaPreview);
if (imageUrl.scheme() == "data") {
QByteArray encodedUrl = item->text(1).toAscii();
QByteArray encodedUrl = item->text(1).toUtf8();
QByteArray imageData = encodedUrl.mid(encodedUrl.indexOf(",") + 1);
m_activePixmap = qz_pixmapFromByteArray(imageData);
}

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 David Rosca
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#include "webhistorywrapper.h"
WebHistoryWrapper::WebHistoryWrapper(QObject* parent)

View File

@ -1,3 +1,20 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2011 David Rosca
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* ============================================================ */
#ifndef WEBHISTORYWRAPPER_H
#define WEBHISTORYWRAPPER_H

View File

@ -216,6 +216,47 @@ void WebView::loadStarted()
// m_loadingTimer->start(1000*20); //20 seconds timeout to automatically "stop" loading animation
}
void WebView::loadFinished(bool state)
{
Q_UNUSED(state);
if (mApp->isClosing() || p_QupZilla->isClosing()) {
return;
}
if (animationLoading(tabIndex(), false)->movie()) {
animationLoading(tabIndex(), false)->movie()->stop();
}
m_isLoading = false;
if (m_lastUrl != url()) {
mApp->history()->addHistoryEntry(this);
}
emit showUrl(url());
iconChanged();
m_lastUrl = url();
//Icon is sometimes not available at the moment of finished loading
if (icon().isNull()) {
QTimer::singleShot(1000, this, SLOT(iconChanged()));
}
titleChanged();
mApp->autoFill()->completePage(this);
QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo)));
if (isCurrent()) {
p_QupZilla->progressBar()->setVisible(false);
p_QupZilla->navigationBar()->showReloadButton();
p_QupZilla->ipLabel()->show();
}
emit urlChanged(url());
}
QLabel* WebView::animationLoading(int index, bool addMovie)
{
if (-1 == index) {
@ -264,47 +305,6 @@ void WebView::setIp(const QHostInfo &info)
}
}
void WebView::loadFinished(bool state)
{
Q_UNUSED(state);
if (mApp->isClosing() || p_QupZilla->isClosing()) {
return;
}
if (animationLoading(tabIndex(), false)->movie()) {
animationLoading(tabIndex(), false)->movie()->stop();
}
m_isLoading = false;
if (m_lastUrl != url()) {
mApp->history()->addHistoryEntry(this);
}
emit showUrl(url());
iconChanged();
m_lastUrl = url();
//Icon is sometimes not available at the moment of finished loading
if (icon().isNull()) {
QTimer::singleShot(1000, this, SLOT(iconChanged()));
}
titleChanged();
mApp->autoFill()->completePage(this);
QHostInfo::lookupHost(url().host(), this, SLOT(setIp(QHostInfo)));
if (isCurrent()) {
p_QupZilla->progressBar()->setVisible(false);
p_QupZilla->navigationBar()->showReloadButton();
p_QupZilla->ipLabel()->show();
}
emit urlChanged(url());
}
void WebView::titleChanged()
{
QString title_ = title();
@ -354,8 +354,9 @@ QIcon WebView::siteIcon()
void WebView::linkHovered(const QString &link, const QString &title, const QString &content)
{
Q_UNUSED(title);
Q_UNUSED(content);
Q_UNUSED(title)
Q_UNUSED(content)
if (isCurrent()) {
if (link != "") {
p_QupZilla->statusBarMessage()->showMessage(link);
@ -453,7 +454,7 @@ void WebView::mousePressEvent(QMouseEvent* event)
break;
case Qt::MiddleButton:
if (isUrlValid(QUrl(m_hoveredLink))) {
tabWidget()->addView(QUrl::fromEncoded(m_hoveredLink.toAscii()), tr("New tab"), TabWidget::NewNotSelectedTab);
tabWidget()->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), tr("New tab"), TabWidget::NewNotSelectedTab);
event->accept();
}
#ifdef Q_WS_WIN
@ -464,7 +465,7 @@ void WebView::mousePressEvent(QMouseEvent* event)
break;
case Qt::LeftButton:
if (event->modifiers() == Qt::ControlModifier && isUrlValid(QUrl(m_hoveredLink))) {
tabWidget()->addView(QUrl::fromEncoded(m_hoveredLink.toAscii()), tr("New tab"), TabWidget::NewNotSelectedTab);
tabWidget()->addView(QUrl::fromEncoded(m_hoveredLink.toUtf8()), tr("New tab"), TabWidget::NewNotSelectedTab);
return;
}
default:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff