PATCH: Entering the same url in Konqueror's location bar...

View: New views
2 Messages — Rating Filter:   Alert me  

PATCH: Entering the same url in Konqueror's location bar...

by Bugzilla from adawit@kde.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The attached patch fixes the problem where typing the same url or simply
pressing the "Go" button beside the location bar causes addresses to be
duplicated in the history list. With this patch such requests will simply be
interpreted as if the user pressed the reload.

[konqmainwindow.patch]

Index: konqmainwindow.cpp
=========================
--- konqmainwindow.cpp (revision 1044576)
+++ konqmainwindow.cpp (working copy)
@@ -469,7 +469,7 @@
     if (m_currentDir.isEmpty() && m_currentView)
        m_currentDir = m_currentView->url().path( KUrl::AddTrailingSlash );
 
-    KUrl filteredURL ( KonqMisc::konqFilteredURL( this, url, m_currentDir ) );
+    const QString filteredURL = KonqMisc::konqFilteredURL( this, url, m_currentDir );
     kDebug(1202) << "url" << url << "filtered into" << filteredURL;
 
     if ( filteredURL.isEmpty() ) // initially empty, or error (e.g. ~unknown_user)
@@ -477,8 +477,16 @@
 
     m_currentDir.clear();
 
-    openUrl(0, filteredURL, QString(), req);
+    const QString prevFilteredURL = KonqMisc::konqFilteredURL(this, m_currentView->typedUrl(), m_currentDir);
+    kDebug(1202) << "previous url" << m_currentView->typedUrl() << "filtered into" << prevFilteredURL;
 
+    // If the current url in the view is the same as the one being displayed
+    // simply do a reload instead of calling openUrl...
+    if (urlcmp(filteredURL, prevFilteredURL, KUrl::CompareWithoutTrailingSlash))
+      slotReload();
+    else
+      openUrl(0, KUrl(filteredURL), QString(), req);
+
     // #4070: Give focus to view after URL was entered manually
     // Note: we do it here if the view mode (i.e. part) wasn't changed
     // If it is changed, then it's done in KonqView::changePart


Re: PATCH: Entering the same url in Konqueror's location bar...

by Bugzilla from adawit@kde.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 04 November 2009 10:37:45 Dawit A. wrote:
> The attached patch fixes the problem where typing the same url or simply
> pressing the "Go" button beside the location bar causes addresses to be
> duplicated in the history list. With this patch such requests will simply
>  be interpreted as if the user pressed the reload.
>

Updated patch based on issues pointed out by Maks. For details, see
http://lists.kde.org/?l=kde-core-devel&m=125744641812425&w=2

[konqmainwindow.patch]

Index: konqmainwindow.cpp
=========================
--- konqmainwindow.cpp (revision 1044576)
+++ konqmainwindow.cpp (working copy)
@@ -469,7 +469,7 @@
     if (m_currentDir.isEmpty() && m_currentView)
        m_currentDir = m_currentView->url().path( KUrl::AddTrailingSlash );
 
-    KUrl filteredURL ( KonqMisc::konqFilteredURL( this, url, m_currentDir ) );
+    const QString filteredURL = KonqMisc::konqFilteredURL( this, url, m_currentDir );
     kDebug(1202) << "url" << url << "filtered into" << filteredURL;
 
     if ( filteredURL.isEmpty() ) // initially empty, or error (e.g. ~unknown_user)
@@ -477,8 +477,16 @@
 
     m_currentDir.clear();
 
-    openUrl(0, filteredURL, QString(), req);
+    const QString prevFilteredURL = KonqMisc::konqFilteredURL(this, m_currentView->typedUrl(), m_currentDir);
+    kDebug(1202) << "previous url" << m_currentView->typedUrl() << "filtered into" << prevFilteredURL;
 
+    // If the current url in the view is the same as the one being displayed
+    // simply do a reload instead of calling openUrl...
+    if (urlcmp(filteredURL, prevFilteredURL))
+      slotReload();
+    else
+      openUrl(0, KUrl(filteredURL), QString(), req);
+
     // #4070: Give focus to view after URL was entered manually
     // Note: we do it here if the view mode (i.e. part) wasn't changed
     // If it is changed, then it's done in KonqView::changePart