From 751103f77e64e1562de1b291d99ee1e262d0d5b4 Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Tue, 24 Aug 2010 23:12:38 +0530 Subject: Switch to faster comparisons of about: URL's with QByteArray, thanks to Harald Sitter modified: src/application.cpp --- src/application.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index e5677a0d..6bc512ca 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -341,20 +341,22 @@ KIcon Application::icon(const KUrl &url) if (url.isEmpty()) return KIcon("text-html"); + QByteArray encodedUrl = url.toEncoded(); // rekonq icons.. - if (url == KUrl("about:home")) + if (encodedUrl == QByteArray("about:home")) return KIcon("go-home"); - if (url == KUrl("about:closedTabs")) + if (encodedUrl == QByteArray("about:closedTabs")) return KIcon("tab-close"); - if (url == KUrl("about:history")) + if (encodedUrl == QByteArray("about:history")) return KIcon("view-history"); - if (url == KUrl("about:bookmarks")) + if (encodedUrl == QByteArray("about:bookmarks")) return KIcon("bookmarks"); - if (url == KUrl("about:favorites")) + if (encodedUrl == QByteArray("about:favorites")) return KIcon("emblem-favorite"); - if (url == KUrl("about:downloads")) + if (encodedUrl == QByteArray("about:downloads")) return KIcon("download"); + KIcon icon = KIcon(QWebSettings::iconForUrl(url)); if (icon.isNull()) { -- cgit v1.2.1 From f687d43abdf8467b448c8922a3d0b85a3068225c Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Tue, 24 Aug 2010 23:18:27 +0530 Subject: Formatting++ modified: src/application.cpp --- src/application.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/application.cpp b/src/application.cpp index 6bc512ca..df4c3d51 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -356,7 +356,6 @@ KIcon Application::icon(const KUrl &url) if (encodedUrl == QByteArray("about:downloads")) return KIcon("download"); - KIcon icon = KIcon(QWebSettings::iconForUrl(url)); if (icon.isNull()) { -- cgit v1.2.1 From 1bd58ad4f6cf61e4b4dcab9def14eed58e5098d0 Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Tue, 24 Aug 2010 23:23:16 +0530 Subject: Fix urlbar to make about:foo the first entry instead of the googling modified: src/urlbar/urlresolver.cpp --- src/urlbar/urlresolver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/urlbar/urlresolver.cpp b/src/urlbar/urlresolver.cpp index d60dc563..84c9e20b 100644 --- a/src/urlbar/urlresolver.cpp +++ b/src/urlbar/urlresolver.cpp @@ -71,7 +71,7 @@ UrlResolver::UrlResolver(const QString &typedUrl) { kDebug() << "browse regexp empty. Setting value.."; - QString protocol = "^(http://|https://|file://|ftp://|man:|info:|apt:)"; + QString protocol = "^(http://|https://|file://|ftp://|man:|info:|apt:|about:)"; QString localhost = "^localhost"; -- cgit v1.2.1 From f5d3aa574af43eea408163da02100e5e24305de1 Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Tue, 24 Aug 2010 23:40:35 +0530 Subject: Replace with QByteArray for faster searches modified: src/newtabpage.cpp --- src/newtabpage.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp index 44b76e11..51081816 100644 --- a/src/newtabpage.cpp +++ b/src/newtabpage.cpp @@ -134,27 +134,28 @@ void NewTabPage::generate(const KUrl &url) browsingMenu(url); QString title; - if (url == KUrl("about:favorites")) + QByteArray encodedUrl = url.toEncoded(); + if (encodedUrl == QByteArray("about:favorites")) { favoritesPage(); title = i18n("Favorites"); } - else if (url == KUrl("about:closedTabs")) + else if (encodedUrl == QByteArray("about:closedTabs")) { closedTabsPage(); title = i18n("Closed Tabs"); } - else if (url == KUrl("about:history")) + else if (encodedUrl == QByteArray("about:history")) { historyPage(); title = i18n("History"); } - else if (url == KUrl("about:bookmarks")) + else if (encodedUrl == QByteArray("about:bookmarks")) { bookmarksPage(); title = i18n("Bookmarks"); } - else if (url == KUrl("about:downloads")) + else if (encodedUrl == QByteArray("about:downloads")) { downloadsPage(); title = i18n("Downloads"); -- cgit v1.2.1 From 88a1c1932c046ca7a3173b93b798280fb229d588 Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Tue, 24 Aug 2010 23:50:24 +0530 Subject: Replace more of KUrl by QByteArray... modified: src/protocolhandler.cpp --- src/protocolhandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index 1f84b420..eb6e513d 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -142,16 +142,17 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra return true; } + QByteArray encodedUrl = _url.toEncoded(); // "about" handling if (_url.protocol() == QL1S("about")) { // let webkit manage the about:blank url... - if (_url == KUrl("about:blank")) + if (encodedUrl == QByteArray("about:blank")) { return false; } - if (_url == KUrl("about:home")) + if (encodedUrl == QByteArray("about:home")) { switch (ReKonfig::newTabStartPage()) { -- cgit v1.2.1 From dd9c6fd94a290a087496ebd8615c699d00fe040f Mon Sep 17 00:00:00 2001 From: Rohan Garg Date: Tue, 24 Aug 2010 23:56:03 +0530 Subject: Move encodedUrl inside if block, better memory usage modified: src/protocolhandler.cpp --- src/protocolhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp index eb6e513d..5cc09f44 100644 --- a/src/protocolhandler.cpp +++ b/src/protocolhandler.cpp @@ -142,10 +142,10 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra return true; } - QByteArray encodedUrl = _url.toEncoded(); // "about" handling if (_url.protocol() == QL1S("about")) { + QByteArray encodedUrl = _url.toEncoded(); // let webkit manage the about:blank url... if (encodedUrl == QByteArray("about:blank")) { -- cgit v1.2.1