From kfm-devel Wed Nov 04 15:37:45 2009 From: "Dawit A." Date: Wed, 04 Nov 2009 15:37:45 +0000 To: kfm-devel Subject: PATCH: Entering the same url in Konqueror's location bar... Message-Id: <200911041037.45521.adawit () kde ! org> X-MARC-Message: https://marc.info/?l=kfm-devel&m=125734929920038 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--Boundary-00=_J/Z8KuuH7haQhR1" --Boundary-00=_J/Z8KuuH7haQhR1 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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. --Boundary-00=_J/Z8KuuH7haQhR1 Content-Type: text/x-patch; charset="UTF-8"; name="konqmainwindow.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="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 --Boundary-00=_J/Z8KuuH7haQhR1--