mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 04:36:34 +01:00
Fixed bug when page with null icon could get "error page" siteicon
- also fixed deleting history entries
This commit is contained in:
parent
6b79ca55bf
commit
c9b28f31e6
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,6 +1,5 @@
|
|||||||
build
|
build
|
||||||
DEBIAN
|
DEBIAN
|
||||||
tools_
|
|
||||||
*.deb
|
*.deb
|
||||||
*.pro.user
|
*.pro.user
|
||||||
*.autosave
|
*.autosave
|
||||||
@ -12,12 +11,8 @@ tools_
|
|||||||
headers*.tar.gz
|
headers*.tar.gz
|
||||||
license_template
|
license_template
|
||||||
Makefile*
|
Makefile*
|
||||||
TestPlugin-build
|
|
||||||
search_*
|
|
||||||
src-*
|
|
||||||
bin/qupzilla
|
bin/qupzilla
|
||||||
*.so
|
lib*.so*
|
||||||
libqupzilla.*
|
|
||||||
bin/core
|
bin/core
|
||||||
qupzilla.sh
|
qupzilla.sh
|
||||||
git_revision
|
git_revision
|
||||||
|
@ -306,9 +306,9 @@ void HistoryManager::slotRefreshTable()
|
|||||||
item->setText(1, url.toEncoded());
|
item->setText(1, url.toEncoded());
|
||||||
item->setToolTip(0, title);
|
item->setToolTip(0, title);
|
||||||
item->setToolTip(1, url.toEncoded());
|
item->setToolTip(1, url.toEncoded());
|
||||||
|
|
||||||
item->setData(0, Qt::UserRole + 10, id);
|
item->setData(0, Qt::UserRole + 10, id);
|
||||||
item->setIcon(0, _iconForUrl(url));
|
item->setIcon(0, _iconForUrl(url));
|
||||||
|
|
||||||
ui->historyTree->addTopLevelItem(item);
|
ui->historyTree->addTopLevelItem(item);
|
||||||
|
|
||||||
++counter;
|
++counter;
|
||||||
|
@ -30,9 +30,6 @@ HistoryModel::HistoryModel(QupZilla* mainClass)
|
|||||||
, p_QupZilla(mainClass)
|
, p_QupZilla(mainClass)
|
||||||
{
|
{
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
connect(this, SIGNAL(signalAddHistoryEntry(QUrl, QString)), this, SLOT(slotAddHistoryEntry(QUrl, QString)));
|
|
||||||
connect(this, SIGNAL(signalDeleteHistoryEntry(QList<int>)), this, SLOT(slotDeleteHistoryEntry(QList<int>)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryModel::loadSettings()
|
void HistoryModel::loadSettings()
|
||||||
@ -46,7 +43,7 @@ void HistoryModel::loadSettings()
|
|||||||
// AddHistoryEntry
|
// AddHistoryEntry
|
||||||
void HistoryModel::addHistoryEntry(WebView* view)
|
void HistoryModel::addHistoryEntry(WebView* view)
|
||||||
{
|
{
|
||||||
if (!m_isSaving) {
|
if (!m_isSaving || view->loadingError()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,17 +54,11 @@ void HistoryModel::addHistoryEntry(WebView* view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HistoryModel::addHistoryEntry(const QUrl &url, QString title)
|
void HistoryModel::addHistoryEntry(const QUrl &url, QString title)
|
||||||
{
|
|
||||||
emit signalAddHistoryEntry(url, title);
|
|
||||||
}
|
|
||||||
|
|
||||||
void HistoryModel::slotAddHistoryEntry(const QUrl &url, QString title)
|
|
||||||
{
|
{
|
||||||
if (!m_isSaving) {
|
if (!m_isSaving) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (url.scheme() == "file:" || url.scheme() == "qupzilla" || url.scheme() == "about" ||
|
if (url.scheme() == "qupzilla" || url.scheme() == "about" || url.isEmpty()) {
|
||||||
title.contains(tr("Failed loading page")) || url.isEmpty()) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (title == "") {
|
if (title == "") {
|
||||||
@ -125,7 +116,35 @@ void HistoryModel::deleteHistoryEntry(int index)
|
|||||||
|
|
||||||
void HistoryModel::deleteHistoryEntry(const QList<int> &list)
|
void HistoryModel::deleteHistoryEntry(const QList<int> &list)
|
||||||
{
|
{
|
||||||
emit signalDeleteHistoryEntry(list);
|
QSqlDatabase db = QSqlDatabase::database();
|
||||||
|
db.transaction();
|
||||||
|
|
||||||
|
foreach(int index, list) {
|
||||||
|
QSqlQuery query;
|
||||||
|
query.prepare("SELECT id, count, date, url, title FROM history WHERE id=?");
|
||||||
|
query.addBindValue(index);
|
||||||
|
query.exec();
|
||||||
|
|
||||||
|
query.next();
|
||||||
|
HistoryEntry entry;
|
||||||
|
entry.id = query.value(0).toInt();
|
||||||
|
entry.count = query.value(1).toInt();
|
||||||
|
entry.date = QDateTime::fromMSecsSinceEpoch(query.value(2).toLongLong());
|
||||||
|
entry.url = query.value(3).toUrl();
|
||||||
|
entry.title = query.value(4).toString();
|
||||||
|
|
||||||
|
query.prepare("DELETE FROM history WHERE id=?");
|
||||||
|
query.addBindValue(index);
|
||||||
|
query.exec();
|
||||||
|
|
||||||
|
query.prepare("DELETE FROM icons WHERE url=?");
|
||||||
|
query.addBindValue(entry.url.toEncoded(QUrl::RemoveFragment));
|
||||||
|
query.exec();
|
||||||
|
|
||||||
|
emit historyEntryDeleted(entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
db.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryModel::deleteHistoryEntry(const QString &url, const QString &title)
|
void HistoryModel::deleteHistoryEntry(const QString &url, const QString &title)
|
||||||
@ -141,38 +160,6 @@ void HistoryModel::deleteHistoryEntry(const QString &url, const QString &title)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryModel::slotDeleteHistoryEntry(const QList<int> &list)
|
|
||||||
{
|
|
||||||
QSqlDatabase db = QSqlDatabase::database();
|
|
||||||
db.transaction();
|
|
||||||
|
|
||||||
foreach(int index, list) {
|
|
||||||
QSqlQuery query;
|
|
||||||
query.prepare("SELECT id, count, date, url, title FROM history WHERE id=?");
|
|
||||||
query.bindValue(0, index);
|
|
||||||
query.exec();
|
|
||||||
|
|
||||||
HistoryEntry entry;
|
|
||||||
entry.id = query.value(0).toInt();
|
|
||||||
entry.count = query.value(1).toInt();
|
|
||||||
entry.date = QDateTime::fromMSecsSinceEpoch(query.value(2).toLongLong());
|
|
||||||
entry.url = query.value(3).toUrl();
|
|
||||||
entry.title = query.value(4).toString();
|
|
||||||
|
|
||||||
query.prepare("DELETE FROM history WHERE id=?");
|
|
||||||
query.bindValue(0, index);
|
|
||||||
query.exec();
|
|
||||||
|
|
||||||
query.prepare("DELETE FROM icons WHERE url=?");
|
|
||||||
query.bindValue(0, entry.url.toEncoded(QUrl::RemoveFragment));
|
|
||||||
query.exec();
|
|
||||||
|
|
||||||
emit historyEntryDeleted(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
db.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool HistoryModel::urlIsStored(const QString &url)
|
bool HistoryModel::urlIsStored(const QString &url)
|
||||||
{
|
{
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
|
@ -64,10 +64,6 @@ public:
|
|||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void slotAddHistoryEntry(const QUrl &url, QString title);
|
|
||||||
void slotDeleteHistoryEntry(const QList<int> &list);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void historyEntryAdded(HistoryEntry entry);
|
void historyEntryAdded(HistoryEntry entry);
|
||||||
void historyEntryDeleted(HistoryEntry entry);
|
void historyEntryDeleted(HistoryEntry entry);
|
||||||
|
@ -82,8 +82,6 @@ void TabbedWebView::slotIconChanged()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
mApp->iconProvider()->saveIcon(this);
|
|
||||||
|
|
||||||
showIcon();
|
showIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,6 @@ WebPage::WebPage(QupZilla* mainClass)
|
|||||||
, m_runningLoop(0)
|
, m_runningLoop(0)
|
||||||
, m_blockAlerts(false)
|
, m_blockAlerts(false)
|
||||||
, m_secureStatus(false)
|
, m_secureStatus(false)
|
||||||
, m_isClosing(false)
|
|
||||||
{
|
{
|
||||||
m_networkProxy = new NetworkManagerProxy(this);
|
m_networkProxy = new NetworkManagerProxy(this);
|
||||||
m_networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager());
|
m_networkProxy->setPrimaryNetworkAccessManager(mApp->networkManager());
|
||||||
@ -135,6 +134,11 @@ void WebPage::scheduleAdjustPage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WebPage::loadingError() const
|
||||||
|
{
|
||||||
|
return !mainFrame()->findFirstElement("span[id=\"qupzilla-error-page\"]").isNull();
|
||||||
|
}
|
||||||
|
|
||||||
bool WebPage::isRunningLoop()
|
bool WebPage::isRunningLoop()
|
||||||
{
|
{
|
||||||
return m_runningLoop;
|
return m_runningLoop;
|
||||||
@ -553,7 +557,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
|
|||||||
errString.replace("%RULE%", tr("Blocked by rule <i>%1</i>").arg(rule));
|
errString.replace("%RULE%", tr("Blocked by rule <i>%1</i>").arg(rule));
|
||||||
|
|
||||||
exReturn->baseUrl = exOption->url;
|
exReturn->baseUrl = exOption->url;
|
||||||
exReturn->content = errString.toUtf8();
|
exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8();
|
||||||
|
|
||||||
if (PopupWebPage* popupPage = qobject_cast<PopupWebPage*>(exOption->frame->page())) {
|
if (PopupWebPage* popupPage = qobject_cast<PopupWebPage*>(exOption->frame->page())) {
|
||||||
WebView* view = qobject_cast<WebView*>(popupPage->view());
|
WebView* view = qobject_cast<WebView*>(popupPage->view());
|
||||||
@ -599,7 +603,7 @@ bool WebPage::extension(Extension extension, const ExtensionOption* option, Exte
|
|||||||
errString.replace("%LI-3%", tr("If your computer or network is protected by a firewall or proxy, make sure that QupZilla is permitted to access the Web."));
|
errString.replace("%LI-3%", tr("If your computer or network is protected by a firewall or proxy, make sure that QupZilla is permitted to access the Web."));
|
||||||
errString.replace("%TRY-AGAIN%", tr("Try Again"));
|
errString.replace("%TRY-AGAIN%", tr("Try Again"));
|
||||||
|
|
||||||
exReturn->content = errString.toUtf8();
|
exReturn->content = QString(errString + "<span id=\"qupzilla-error-page\"></span>").toUtf8();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,7 +635,7 @@ bool WebPage::javaScriptPrompt(QWebFrame* originatingFrame, const QString &msg,
|
|||||||
m_runningLoop = &eLoop;
|
m_runningLoop = &eLoop;
|
||||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), &eLoop, SLOT(quit()));
|
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), &eLoop, SLOT(quit()));
|
||||||
|
|
||||||
if (eLoop.exec() == 1 || m_isClosing) {
|
if (eLoop.exec() == 1) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
m_runningLoop = 0;
|
m_runningLoop = 0;
|
||||||
@ -673,7 +677,7 @@ bool WebPage::javaScriptConfirm(QWebFrame* originatingFrame, const QString &msg)
|
|||||||
m_runningLoop = &eLoop;
|
m_runningLoop = &eLoop;
|
||||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), &eLoop, SLOT(quit()));
|
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), &eLoop, SLOT(quit()));
|
||||||
|
|
||||||
if (eLoop.exec() == 1 || m_isClosing) {
|
if (eLoop.exec() == 1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_runningLoop = 0;
|
m_runningLoop = 0;
|
||||||
@ -728,7 +732,7 @@ void WebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString &msg)
|
|||||||
m_runningLoop = &eLoop;
|
m_runningLoop = &eLoop;
|
||||||
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), &eLoop, SLOT(quit()));
|
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), &eLoop, SLOT(quit()));
|
||||||
|
|
||||||
if (eLoop.exec() == 1 || m_isClosing) {
|
if (eLoop.exec() == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_runningLoop = 0;
|
m_runningLoop = 0;
|
||||||
|
@ -66,6 +66,8 @@ public:
|
|||||||
void scheduleAdjustPage();
|
void scheduleAdjustPage();
|
||||||
bool isRunningLoop();
|
bool isRunningLoop();
|
||||||
|
|
||||||
|
bool loadingError() const;
|
||||||
|
|
||||||
static void setUserAgent(const QString &agent);
|
static void setUserAgent(const QString &agent);
|
||||||
QString userAgentForUrl(const QUrl &url) const;
|
QString userAgentForUrl(const QUrl &url) const;
|
||||||
|
|
||||||
@ -126,8 +128,6 @@ private:
|
|||||||
bool m_blockAlerts;
|
bool m_blockAlerts;
|
||||||
bool m_secureStatus;
|
bool m_secureStatus;
|
||||||
bool m_adjustingScheduled;
|
bool m_adjustingScheduled;
|
||||||
|
|
||||||
bool m_isClosing;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WEBPAGE_H
|
#endif // WEBPAGE_H
|
||||||
|
@ -224,8 +224,9 @@ void WebTab::restoreTab(const WebTab::SavedTab &tab)
|
|||||||
m_savedTab = tab;
|
m_savedTab = tab;
|
||||||
int index = tabIndex();
|
int index = tabIndex();
|
||||||
|
|
||||||
m_view->tabWidget()->setTabIcon(tabIndex(), tab.icon);
|
m_view->tabWidget()->setTabIcon(index, tab.icon);
|
||||||
m_view->tabWidget()->setTabText(index, tab.title);
|
m_view->tabWidget()->setTabText(index, tab.title);
|
||||||
|
m_view->tabWidget()->setTabToolTip(index, tab.title);
|
||||||
m_locationBar.data()->showUrl(tab.url);
|
m_locationBar.data()->showUrl(tab.url);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -155,6 +155,11 @@ void WebView::load(const QNetworkRequest &request, QNetworkAccessManager::Operat
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WebView::loadingError() const
|
||||||
|
{
|
||||||
|
return page()->loadingError();
|
||||||
|
}
|
||||||
|
|
||||||
bool WebView::isLoading() const
|
bool WebView::isLoading() const
|
||||||
{
|
{
|
||||||
return m_isLoading;
|
return m_isLoading;
|
||||||
@ -343,8 +348,12 @@ void WebView::emitChangedUrl()
|
|||||||
|
|
||||||
void WebView::slotIconChanged()
|
void WebView::slotIconChanged()
|
||||||
{
|
{
|
||||||
|
if (!loadingError()) {
|
||||||
m_siteIcon = icon();
|
m_siteIcon = icon();
|
||||||
m_siteIconUrl = url();
|
m_siteIconUrl = url();
|
||||||
|
|
||||||
|
mApp->iconProvider()->saveIcon(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebView::openUrlInNewWindow()
|
void WebView::openUrlInNewWindow()
|
||||||
|
@ -41,6 +41,7 @@ public:
|
|||||||
|
|
||||||
void load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray &body = QByteArray());
|
void load(const QNetworkRequest &request, QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, const QByteArray &body = QByteArray());
|
||||||
|
|
||||||
|
bool loadingError() const;
|
||||||
bool isLoading() const;
|
bool isLoading() const;
|
||||||
int loadProgress() const;
|
int loadProgress() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user