Changeset View
Changeset View
Standalone View
Standalone View
src/core/kcoredirlister.cpp
Show First 20 Lines • Show All 1542 Lines • ▼ Show 20 Line(s) | 1536 | { | |||
---|---|---|---|---|---|
1543 | //emitRedirections( oldUrl, url ); | 1543 | //emitRedirections( oldUrl, url ); | ||
1544 | 1544 | | |||
1545 | QLinkedList<ItemInUseChange> itemsToChange; | 1545 | QLinkedList<ItemInUseChange> itemsToChange; | ||
1546 | QSet<KCoreDirLister *> listers; | 1546 | QSet<KCoreDirLister *> listers; | ||
1547 | 1547 | | |||
1548 | // Look at all dirs being listed/shown | 1548 | // Look at all dirs being listed/shown | ||
1549 | for (auto itu = itemsInUse.begin(), ituend = itemsInUse.end(); itu != ituend; ++itu) { | 1549 | for (auto itu = itemsInUse.begin(), ituend = itemsInUse.end(); itu != ituend; ++itu) { | ||
1550 | DirItem *dir = itu.value(); | 1550 | DirItem *dir = itu.value(); | ||
1551 | QUrl oldDirUrl(itu.key()); | 1551 | const QUrl &oldDirUrl = itu.key(); | ||
kossebau: For consistency I would make this an assignment, IMHO also easier to read and not to be mixed… | |||||
1552 | qCDebug(KIO_CORE_DIRLISTER) << "itemInUse:" << oldDirUrl; | 1552 | qCDebug(KIO_CORE_DIRLISTER) << "itemInUse:" << oldDirUrl; | ||
1553 | // Check if this dir is oldUrl, or a subfolder of it | 1553 | // Check if this dir is oldUrl, or a subfolder of it | ||
1554 | if (oldDirUrl == oldUrl || oldUrl.isParentOf(oldDirUrl)) { | 1554 | if (oldDirUrl == oldUrl || oldUrl.isParentOf(oldDirUrl)) { | ||
1555 | // TODO should use KUrl::cleanpath like isParentOf does | 1555 | // TODO should use KUrl::cleanpath like isParentOf does | ||
1556 | QString relPath = oldDirUrl.path().mid(oldUrl.path().length()+1); | 1556 | QString relPath = oldDirUrl.path().mid(oldUrl.path().length()+1); | ||
1557 | 1557 | | |||
1558 | QUrl newDirUrl(newUrl); // take new base | 1558 | QUrl newDirUrl(newUrl); // take new base | ||
1559 | if (!relPath.isEmpty()) { | 1559 | if (!relPath.isEmpty()) { | ||
▲ Show 20 Lines • Show All 376 Lines • ▼ Show 20 Line(s) | 1930 | { | |||
1936 | QUrl dirUrl(_dirUrl.adjusted(QUrl::StripTrailingSlash)); | 1936 | QUrl dirUrl(_dirUrl.adjusted(QUrl::StripTrailingSlash)); | ||
1937 | 1937 | | |||
1938 | // Separate itemsInUse iteration and calls to forgetDirs (which modify itemsInUse) | 1938 | // Separate itemsInUse iteration and calls to forgetDirs (which modify itemsInUse) | ||
1939 | QList<QUrl> affectedItems; | 1939 | QList<QUrl> affectedItems; | ||
1940 | 1940 | | |||
1941 | auto itu = itemsInUse.begin(); | 1941 | auto itu = itemsInUse.begin(); | ||
1942 | const auto ituend = itemsInUse.end(); | 1942 | const auto ituend = itemsInUse.end(); | ||
1943 | for (; itu != ituend; ++itu) { | 1943 | for (; itu != ituend; ++itu) { | ||
1944 | const QUrl deletedUrl(itu.key()); | 1944 | const QUrl &deletedUrl = itu.key(); | ||
kossebau: dito | |||||
1945 | if (dirUrl == deletedUrl || dirUrl.isParentOf(deletedUrl)) { | 1945 | if (dirUrl == deletedUrl || dirUrl.isParentOf(deletedUrl)) { | ||
1946 | affectedItems.append(deletedUrl); | 1946 | affectedItems.append(deletedUrl); | ||
1947 | } | 1947 | } | ||
1948 | } | 1948 | } | ||
1949 | 1949 | | |||
1950 | for (const QUrl &deletedUrl : qAsConst(affectedItems)) { | 1950 | for (const QUrl &deletedUrl : qAsConst(affectedItems)) { | ||
1951 | // stop all jobs for deletedUrlStr | 1951 | // stop all jobs for deletedUrlStr | ||
1952 | DirectoryDataHash::iterator dit = directoryData.find(deletedUrl); | 1952 | DirectoryDataHash::iterator dit = directoryData.find(deletedUrl); | ||
▲ Show 20 Lines • Show All 860 Lines • Show Last 20 Lines |
For consistency I would make this an assignment, IMHO also easier to read and not to be mixed up with a function call on quick sight (quick sights might be a problem of mine, but surely also others :) ):