diff --git a/src/lib/bookmarks/bookmarkitem.cpp b/src/lib/bookmarks/bookmarkitem.cpp index b3e241dd7..74d74e97c 100644 --- a/src/lib/bookmarks/bookmarkitem.cpp +++ b/src/lib/bookmarks/bookmarkitem.cpp @@ -72,12 +72,14 @@ QList BookmarkItem::children() const QIcon BookmarkItem::icon() { + // Cache icon for 20 seconds + const int iconCacheTime = 20 * 1000; + switch (m_type) { case Url: - // Cache icon for 20 seconds - if (m_iconTime < QTime::currentTime().addSecs(-20)) { + if (m_iconTime.isNull() || m_iconTime.elapsed() > iconCacheTime) { m_icon = _iconForUrl(m_url); - m_iconTime = QTime::currentTime(); + m_iconTime.restart(); } return m_icon; case Folder: diff --git a/src/lib/webview/webpage.cpp b/src/lib/webview/webpage.cpp index 77c43b86a..b43a50ac0 100644 --- a/src/lib/webview/webpage.cpp +++ b/src/lib/webview/webpage.cpp @@ -387,6 +387,7 @@ void WebPage::handleUnknownProtocol(const QUrl &url) qzSettings->saveSettings(); } + QDesktopServices::openUrl(url); break; @@ -406,10 +407,11 @@ void WebPage::handleUnknownProtocol(const QUrl &url) void WebPage::desktopServicesOpen(const QUrl &url) { // Open same url only once in 2 secs + const int sameUrlTimeout = 2 * 1000; - if (s_lastUnsupportedUrl != url || QTime::currentTime() > s_lastUnsupportedUrlTime.addSecs(2)) { + if (s_lastUnsupportedUrl != url || s_lastUnsupportedUrlTime.isNull() || s_lastUnsupportedUrlTime.elapsed() > sameUrlTimeout) { s_lastUnsupportedUrl = url; - s_lastUnsupportedUrlTime = QTime::currentTime(); + s_lastUnsupportedUrlTime.restart(); QDesktopServices::openUrl(url); } else { diff --git a/src/plugins/AccessKeysNavigation/akn_handler.cpp b/src/plugins/AccessKeysNavigation/akn_handler.cpp index e6b0ce785..8c10480b4 100644 --- a/src/plugins/AccessKeysNavigation/akn_handler.cpp +++ b/src/plugins/AccessKeysNavigation/akn_handler.cpp @@ -110,13 +110,15 @@ bool AKN_Handler::handleKeyPress(QObject* obj, QKeyEvent* event) triggerShowAccessKeys(); } else { - if (!m_lastKeyPressTime.isValid()) { + const int doublePressInterval = 500; // 500 msecs + + if (m_lastKeyPressTime.isNull()) { // It is the first press of our button - m_lastKeyPressTime = QTime::currentTime(); + m_lastKeyPressTime.start(); } else { // It is the second press of our button - if (QTime(m_lastKeyPressTime).addMSecs(500) >= QTime::currentTime()) { + if (m_lastKeyPressTime.elapsed() <= doublePressInterval) { triggerShowAccessKeys(); } else {