diff options
| author | Ilya Bizyaev <[email protected]> | 2017-01-03 11:28:20 +0100 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2017-01-03 11:28:20 +0100 |
| commit | 962f6d7160e3de69c67964296d5e412f36037131 (patch) | |
| tree | fe301ed7a3394fd3043e571a9fa89fd31df00cf6 /src/kitemviews/kfileitemmodel.cpp | |
| parent | 67c007889ecc4eada434cbe390110b2e7566aa41 (diff) | |
Fix 2 container-anti-pattern clazy warnings
REVIEW: 129752
Diffstat (limited to 'src/kitemviews/kfileitemmodel.cpp')
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 05f85a633..7b252a346 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -416,12 +416,15 @@ int KFileItemModel::index(const QUrl& url) const foreach (const QUrl& url, indexesForUrl.uniqueKeys()) { if (indexesForUrl.count(url) > 1) { qCWarning(DolphinDebug) << "Multiple items found with the URL" << url; - foreach (int index, indexesForUrl.values(url)) { - const ItemData* data = m_itemData.at(index); - qCWarning(DolphinDebug) << "index" << index << ":" << data->item; + + auto it = indexesForUrl.find(url); + while (it != indexesForUrl.end() && it.key() == url) { + const ItemData* data = m_itemData.at(it.value()); + qCWarning(DolphinDebug) << "index" << it.value() << ":" << data->item; if (data->parent) { qCWarning(DolphinDebug) << "parent" << data->parent->item; } + ++it; } } } @@ -590,7 +593,12 @@ int KFileItemModel::expandedParentsCount(int index) const QSet<QUrl> KFileItemModel::expandedDirectories() const { - return m_expandedDirs.values().toSet(); + QSet<QUrl> result; + const auto dirs = m_expandedDirs; + for (const auto &dir : dirs) { + result.insert(dir); + } + return result; } void KFileItemModel::restoreExpandedDirectories(const QSet<QUrl> &urls) |
