1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

SpeedDial: Correctly emit load error when trying to load invalid url

This commit is contained in:
David Rosca 2017-02-07 14:52:56 +01:00
parent c7b323b79b
commit 335c6b66c5
2 changed files with 8 additions and 12 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2016 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* 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
@ -264,10 +264,6 @@ void SpeedDial::changed(const QString &allPages)
void SpeedDial::loadThumbnail(const QString &url, bool loadTitle)
{
if (url.isEmpty()) {
return;
}
PageThumbnailer* thumbnailer = new PageThumbnailer(this);
thumbnailer->setUrl(QUrl::fromEncoded(url.toUtf8()));
thumbnailer->setLoadTitle(loadTitle);

View File

@ -1,6 +1,6 @@
/* ============================================================
* QupZilla - WebKit based browser
* Copyright (C) 2010-2014 David Rosca <nowrep@gmail.com>
* QupZilla - Qt web browser
* Copyright (C) 2010-2017 David Rosca <nowrep@gmail.com>
*
* 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
@ -17,6 +17,7 @@
* ============================================================ */
#include "pagethumbnailer.h"
#include "scripts.h"
#include "webview.h"
#include <QTimer>
#include <QApplication>
@ -77,11 +78,10 @@ QString PageThumbnailer::title()
void PageThumbnailer::start()
{
if (m_view->rootObject()) {
if (m_view->rootObject() && WebView::isUrlValid(m_url)) {
m_view->rootObject()->setProperty("url", m_url);
}
else {
QTimer::singleShot(0, this, [this]() {
} else {
QTimer::singleShot(500, this, [this]() {
emit thumbnailCreated(QPixmap());
});
}