Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/kdirmodel.cpp
Show First 20 Lines • Show All 142 Lines • ▼ Show 20 Line(s) | 112 | public: | |||
---|---|---|---|---|---|
143 | { | 143 | { | ||
144 | return item().isSlow(); | 144 | return item().isSlow(); | ||
145 | } | 145 | } | ||
146 | 146 | | |||
147 | // For removing all child urls from the global hash. | 147 | // For removing all child urls from the global hash. | ||
148 | void collectAllChildUrls(QList<QUrl> &urls) const | 148 | void collectAllChildUrls(QList<QUrl> &urls) const | ||
149 | { | 149 | { | ||
150 | urls.reserve(urls.size() + m_childNodes.size()); | 150 | urls.reserve(urls.size() + m_childNodes.size()); | ||
151 | Q_FOREACH (KDirModelNode *node, m_childNodes) { | 151 | for (KDirModelNode *node : m_childNodes) { | ||
dfaure: qAsConst not needed, method is const | |||||
152 | const KFileItem &item = node->item(); | 152 | const KFileItem &item = node->item(); | ||
153 | urls.append(cleanupUrl(item.url())); | 153 | urls.append(cleanupUrl(item.url())); | ||
154 | if (item.isDir()) { | 154 | if (item.isDir()) { | ||
155 | static_cast<KDirModelDirNode *>(node)->collectAllChildUrls(urls); | 155 | static_cast<KDirModelDirNode *>(node)->collectAllChildUrls(urls); | ||
156 | } | 156 | } | ||
157 | } | 157 | } | ||
158 | } | 158 | } | ||
159 | 159 | | |||
▲ Show 20 Lines • Show All 328 Lines • ▼ Show 20 Line(s) | |||||
488 | #endif | 488 | #endif | ||
489 | dirNode->m_childNodes.append(node); | 489 | dirNode->m_childNodes.append(node); | ||
490 | const QUrl url = it->url(); | 490 | const QUrl url = it->url(); | ||
491 | m_nodeHash.insert(cleanupUrl(url), node); | 491 | m_nodeHash.insert(cleanupUrl(url), node); | ||
492 | //qDebug() << url; | 492 | //qDebug() << url; | ||
493 | 493 | | |||
494 | if (!urlsBeingFetched.isEmpty()) { | 494 | if (!urlsBeingFetched.isEmpty()) { | ||
495 | const QUrl dirUrl(url); | 495 | const QUrl dirUrl(url); | ||
496 | foreach (const QUrl &urlFetched, urlsBeingFetched) { | 496 | for (const QUrl &urlFetched : qAsConst(urlsBeingFetched)) { | ||
497 | if (dirUrl.matches(urlFetched, QUrl::StripTrailingSlash) || dirUrl.isParentOf(urlFetched)) { | 497 | if (dirUrl.matches(urlFetched, QUrl::StripTrailingSlash) || dirUrl.isParentOf(urlFetched)) { | ||
498 | //qDebug() << "Listing found" << dirUrl.url() << "which is a parent of fetched url" << urlFetched; | 498 | //qDebug() << "Listing found" << dirUrl.url() << "which is a parent of fetched url" << urlFetched; | ||
499 | const QModelIndex parentIndex = indexForNode(node, dirNode->m_childNodes.count() - 1); | 499 | const QModelIndex parentIndex = indexForNode(node, dirNode->m_childNodes.count() - 1); | ||
500 | Q_ASSERT(parentIndex.isValid()); | 500 | Q_ASSERT(parentIndex.isValid()); | ||
501 | emitExpandFor.append(parentIndex); | 501 | emitExpandFor.append(parentIndex); | ||
502 | if (isDir && dirUrl != urlFetched) { | 502 | if (isDir && dirUrl != urlFetched) { | ||
503 | q->fetchMore(parentIndex); | 503 | q->fetchMore(parentIndex); | ||
504 | m_urlsBeingFetched[node].append(urlFetched); | 504 | m_urlsBeingFetched[node].append(urlFetched); | ||
505 | } | 505 | } | ||
506 | } | 506 | } | ||
507 | } | 507 | } | ||
508 | } | 508 | } | ||
509 | } | 509 | } | ||
510 | 510 | | |||
511 | q->endInsertRows(); | 511 | q->endInsertRows(); | ||
512 | 512 | | |||
513 | // Emit expand signal after rowsInserted signal has been emitted, | 513 | // Emit expand signal after rowsInserted signal has been emitted, | ||
514 | // so that any proxy model will have updated its mapping already | 514 | // so that any proxy model will have updated its mapping already | ||
515 | Q_FOREACH (const QModelIndex &idx, emitExpandFor) { | 515 | for (const QModelIndex &idx : qAsConst(emitExpandFor)) { | ||
516 | emit q->expand(idx); | 516 | emit q->expand(idx); | ||
517 | } | 517 | } | ||
518 | } | 518 | } | ||
519 | 519 | | |||
520 | void KDirModelPrivate::_k_slotCompleted(const QUrl &directoryUrl) | 520 | void KDirModelPrivate::_k_slotCompleted(const QUrl &directoryUrl) | ||
521 | { | 521 | { | ||
522 | KDirModelNode *result = nodeForUrl(directoryUrl); // O(depth) | 522 | KDirModelNode *result = nodeForUrl(directoryUrl); // O(depth) | ||
523 | Q_ASSERT(isDir(result)); | 523 | Q_ASSERT(isDir(result)); | ||
▲ Show 20 Lines • Show All 787 Lines • Show Last 20 Lines |
qAsConst not needed, method is const