┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuca Gugelmann <[email protected]>2007-03-25 13:49:38 +0000
committerLuca Gugelmann <[email protected]>2007-03-25 13:49:38 +0000
commit297e0582aa3f09171f7102afa5d4cf5066b70bd5 (patch)
tree5c78f132bcfa3a7203a87889cb07082f3329811e /src
parentb7bfa46353f8c7e0f20cea4374b990174c35164d (diff)
* Fixed a bug that caused dolphin to crash when clicking on the "Root" button
in the url navigation bar. * As a side effect this also prevents a small graphics glitch, where the path labels in the navigation bar would shift a few pixels to the left when clicked twice. svn path=/trunk/KDE/kdebase/apps/; revision=646362
Diffstat (limited to 'src')
-rw-r--r--src/urlnavigator.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/urlnavigator.cpp b/src/urlnavigator.cpp
index f1b39fb32..ee06f558a 100644
--- a/src/urlnavigator.cpp
+++ b/src/urlnavigator.cpp
@@ -150,15 +150,19 @@ const KUrl& UrlNavigator::url() const
KUrl UrlNavigator::url(int index) const
{
assert(index >= 0);
- QString path(url().pathOrUrl());
- path = path.section('/', 0, index);
+ // keep scheme, hostname etc. maybe we will need this in the future
+ // for e.g. browsing ftp repositories.
+ QString pre(((QUrl)url()).toString(QUrl::RemovePath));
+ QString path(url().path());
- if ( path.length() >= 1 && path.at(path.length()-1) != '/')
- {
- path.append('/');
+ if (!path.isEmpty()) {
+ if (index == 0) //prevent the last "/" from being stripped
+ path = "/"; //or we end up with an empty path
+ else
+ path = path.section('/', 0, index);
}
- return path;
+ return KUrl(pre + path);
}
const QLinkedList<UrlNavigator::HistoryElem>& UrlNavigator::history(int& index) const