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
KUrl UrlNavigator::url(int index) const
{
assert(index >= 0);
KUrl UrlNavigator::url(int index) const
{
assert(index >= 0);
- QString path(url().pathOrUrl());
- path = path.section('/', 0, index);
-
- if ( path.length() >= 1 && path.at(path.length()-1) != '/')
- {
- path.append('/');
+ // 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.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 KUrl(pre + path);
}
const QLinkedList<UrlNavigator::HistoryElem>& UrlNavigator::history(int& index) const
}
const QLinkedList<UrlNavigator::HistoryElem>& UrlNavigator::history(int& index) const