diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-10 10:32:26 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-07-10 10:32:26 (GMT) |
commit | fdf5fd0cc63c20579250087905331eb76385d528 (patch) | |
tree | 34719d275d42131cb92e9e86b3385dc9ce021338 /src/gui/dialogs | |
parent | f9128d973f60e225045bebb97a19d292395b865d (diff) | |
download | Qt-fdf5fd0cc63c20579250087905331eb76385d528.zip Qt-fdf5fd0cc63c20579250087905331eb76385d528.tar.gz Qt-fdf5fd0cc63c20579250087905331eb76385d528.tar.bz2 |
QFileDialog: the side urls are now always cleaned when they are local
Task-number: 257579
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r-- | src/gui/dialogs/qsidebar.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/gui/dialogs/qsidebar.cpp b/src/gui/dialogs/qsidebar.cpp index 1915e21..e4821ad 100644 --- a/src/gui/dialogs/qsidebar.cpp +++ b/src/gui/dialogs/qsidebar.cpp @@ -247,11 +247,16 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move) QUrl url = list.at(i); if (!url.isValid() || url.scheme() != QLatin1String("file")) continue; + //this makes sure the url is clean + const QString cleanUrl = QDir::cleanPath(url.toLocalFile()); + url = QUrl::fromLocalFile(cleanUrl); + for (int j = 0; move && j < rowCount(); ++j) { + QString local = index(j, 0).data(UrlRole).toUrl().toLocalFile(); #if defined(Q_OS_WIN) - if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()).toLower() == QDir::cleanPath(url.toLocalFile()).toLower()) { + if (index(j, 0).data(UrlRole).toUrl().toLocalFile().toLower() == cleanUrl.toLower()) { #else - if (QDir::cleanPath(index(j, 0).data(UrlRole).toUrl().toLocalFile()) == QDir::cleanPath(url.toLocalFile())) { + if (index(j, 0).data(UrlRole).toUrl().toLocalFile() == cleanUrl) { #endif removeRow(j); if (j <= row) @@ -260,12 +265,12 @@ void QUrlModel::addUrls(const QList<QUrl> &list, int row, bool move) } } row = qMax(row, 0); - QModelIndex idx = fileSystemModel->index(url.toLocalFile()); + QModelIndex idx = fileSystemModel->index(cleanUrl); if (!fileSystemModel->isDir(idx)) continue; insertRows(row, 1); setUrl(index(row, 0), url, idx); - watching.append(QPair<QModelIndex, QString>(idx, url.toLocalFile())); + watching.append(qMakePair(idx, cleanUrl)); } } |