mirror of
https://invent.kde.org/system/dolphin
synced 2024-10-28 03:21:56 +00:00
Revive folderpanel when outside $HOME
Summary: Currently the folderpanel is inert when browsing outside of home because urls end up as 'file:////a/b/c' and since Qt 5.10 this is an invalid URL: http://code.qt.io/cgit/qt/qtbase.git/commit/?id=f62768d046528636789f901ac79e2cfa1843a7b7 Premptive bug fix. Test Plan: Open dolphin Leave home directory Reviewers: #dolphin, elvisangelaccio Subscribers: dfaure, elvisangelaccio, ngraham, anthonyfieroni Tags: #dolphin Differential Revision: https://phabricator.kde.org/D9610
This commit is contained in:
parent
9d3a019445
commit
7b595b3387
|
@ -629,20 +629,24 @@ void KFileItemModel::restoreExpandedDirectories(const QSet<QUrl> &urls)
|
|||
|
||||
void KFileItemModel::expandParentDirectories(const QUrl &url)
|
||||
{
|
||||
const int pos = m_dirLister->url().path().length();
|
||||
|
||||
// Assure that each sub-path of the URL that should be
|
||||
// expanded is added to m_urlsToExpand. KDirLister
|
||||
// does not care whether the parent-URL has already been
|
||||
// expanded.
|
||||
QUrl urlToExpand = m_dirLister->url();
|
||||
const int pos = urlToExpand.path().length();
|
||||
|
||||
// first subdir can be empty, if m_dirLister->url().path() does not end with '/'
|
||||
// this happens if baseUrl is not root but a home directory, see FoldersPanel,
|
||||
// so using QString::SkipEmptyParts
|
||||
const QStringList subDirs = url.path().mid(pos).split(QDir::separator(), QString::SkipEmptyParts);
|
||||
for (int i = 0; i < subDirs.count() - 1; ++i) {
|
||||
urlToExpand.setPath(urlToExpand.path() + '/' + subDirs.at(i));
|
||||
QString path = urlToExpand.path();
|
||||
if (!path.endsWith(QLatin1Char('/'))) {
|
||||
path.append(QLatin1Char('/'));
|
||||
}
|
||||
urlToExpand.setPath(path + subDirs.at(i));
|
||||
m_urlsToExpand.insert(urlToExpand);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue