diff --git a/src/lib/history/history.cpp b/src/lib/history/history.cpp index f8a8a88c1..2fb8c5a4b 100644 --- a/src/lib/history/history.cpp +++ b/src/lib/history/history.cpp @@ -1,6 +1,6 @@ /* ============================================================ * QupZilla - WebKit based browser -* Copyright (C) 2010-2012 David Rosca +* Copyright (C) 2010-2013 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 @@ -68,7 +68,10 @@ void History::addHistoryEntry(const QUrl &url, QString title) if (!m_isSaving) { return; } - if (url.scheme() == QLatin1String("qupzilla") || url.scheme() == QLatin1String("about") || url.isEmpty()) { + if (url.scheme() == QLatin1String("qupzilla") || + url.scheme() == QLatin1String("about") || + url.scheme() == QLatin1String("data") || + url.isEmpty()) { return; } if (title.isEmpty()) { diff --git a/src/lib/navigation/completer/locationcompleterdelegate.cpp b/src/lib/navigation/completer/locationcompleterdelegate.cpp index 036193dce..e22e5ad48 100644 --- a/src/lib/navigation/completer/locationcompleterdelegate.cpp +++ b/src/lib/navigation/completer/locationcompleterdelegate.cpp @@ -108,7 +108,11 @@ void LocationCompleterDelegate::paint(QPainter* painter, const QStyleOptionViewI // Draw link const int infoYPos = titleRect.bottom() + opt.fontMetrics.leading() + 2; QRect linkRect(titleRect.x(), infoYPos, titleRect.width(), opt.fontMetrics.height()); - QString link(opt.fontMetrics.elidedText(index.data(Qt::DisplayRole).toString(), Qt::ElideRight, linkRect.width())); + // Let's assume that more than 500 characters won't fit in line on any display... + // Fixes performance when trying to get elidedText for a really long + // (length() > 1000000) urls - data: urls can get that long + const QString &linkUrl = index.data(Qt::DisplayRole).toString().left(500); + QString link(opt.fontMetrics.elidedText(linkUrl, Qt::ElideRight, linkRect.width())); painter->setFont(opt.font); TabPosition pos = index.data(LocationCompleterModel::TabPositionRole).value(); if (m_drawSwitchToTab && pos.windowIndex != -1) {