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

Fix showing speed dials in bookmarks icon

This commit is contained in:
David Rosca 2015-10-14 19:37:01 +02:00
parent ccabc336c0
commit 5024ada696
3 changed files with 13 additions and 4 deletions

View File

@ -59,7 +59,7 @@ void BookmarksIcon::checkBookmark(const QUrl &url, bool forceCheck)
QList<BookmarkItem*> items = mApp->bookmarks()->searchBookmarks(url);
m_bookmark = items.isEmpty() ? 0 : items.first();
if (m_bookmark /*|| !mApp->plugins()->speedDial()->pageForUrl(url).url.isEmpty()*/) {
if (m_bookmark || mApp->plugins()->speedDial()->pageForUrl(url).isValid()) {
setBookmarkSaved();
}
else {

View File

@ -101,7 +101,9 @@ SpeedDial::Page SpeedDial::pageForUrl(const QUrl &url)
{
ENSURE_LOADED;
const QString urlString = url.toString();
QString urlString = url.toString();
if (urlString.endsWith(QL1C('/')))
urlString = urlString.left(urlString.size() - 1);
foreach (const Page &page, m_pages) {
if (page.url == urlString) {
@ -145,7 +147,7 @@ void SpeedDial::removePage(const Page &page)
{
ENSURE_LOADED;
if (page.url.isEmpty()) {
if (!page.isValid()) {
return;
}
@ -213,7 +215,7 @@ QString SpeedDial::initialScript()
if (!QFile(imgSource).exists()) {
imgSource = "qrc:html/loading.gif";
if (page.url.isEmpty()) {
if (!page.isValid()) {
imgSource.clear();
}
}
@ -250,6 +252,9 @@ void SpeedDial::changed(const QString &allPages)
page.url = tmp.at(0).mid(5);
page.title = tmp.at(1).mid(7);
if (page.url.endsWith(QL1C('/')))
page.url = page.url.left(page.url.size() - 1);
m_pages.append(page);
}

View File

@ -38,6 +38,10 @@ public:
QString title;
QString url;
bool isValid() const {
return !url.isEmpty();
}
bool operator==(const Page &other) {
return (this->title == other.title &&
this->url == other.url);