diff --git a/kio.categories b/kio.categories --- a/kio.categories +++ b/kio.categories @@ -5,6 +5,7 @@ kf5.kio.core.sambashare sambashare (KIO) DEFAULT_SEVERITY [WARNING] IDENTIFIER [KIO_CORE_SAMBASHARE] kf5.kiod KIO Daemon (KIO) IDENTIFIER [KIOD_CATEGORY] kf5.kio.favicons FavIcons (KIO) IDENTIFIER [FAVICONS_LOG] +kf5.kio.kdirmodel KDirModel (KIO) IDENTIFIER [category] kf5.kio.kio_file kiofile (KIO) IDENTIFIER [KIO_FILE] kf5.kio.kio_ftp kio ftp (KIO) DEFAULT_SEVERITY [WARNING] IDENTIFIER [KIO_FTP] kf5.kio.kio_http KIO HTTP slave (KIO) DEFAULT_SEVERITY [WARNING] IDENTIFIER [KIO_HTTP] diff --git a/src/widgets/kdirmodel.cpp b/src/widgets/kdirmodel.cpp --- a/src/widgets/kdirmodel.cpp +++ b/src/widgets/kdirmodel.cpp @@ -20,29 +20,33 @@ #include "kdirmodel.h" #include "kdirlister.h" #include "kfileitem.h" -#include "kio_widgets_debug.h" + #include #include #include #include #include "joburlcache_p.h" #include #include + #include #include #include #include #include #include #include +#include #include #include #ifdef Q_OS_WIN #include #endif +static QLoggingCategory category("kf5.kio.kdirmodel", QtInfoMsg); + class KDirModelNode; class KDirModelDirNode; @@ -294,7 +298,7 @@ nodePath += QLatin1Char('/'); } if (!pathStr.startsWith(nodePath)) { - qCWarning(KIO_WIDGETS) << "The kioslave for" << url.scheme() << "violates the hierarchy structure:" + qCWarning(category) << "The kioslave for" << url.scheme() << "violates the hierarchy structure:" << "I arrived at node" << nodePath << ", but" << pathStr << "does not start with that path."; return nullptr; } @@ -329,11 +333,11 @@ #ifndef NDEBUG void KDirModelPrivate::dump() { - qCDebug(KIO_WIDGETS) << "Dumping contents of KDirModel" << q << "dirLister url:" << m_dirLister->url(); + qCDebug(category) << "Dumping contents of KDirModel" << q << "dirLister url:" << m_dirLister->url(); QHashIterator it(m_nodeHash); while (it.hasNext()) { it.next(); - qDebug(KIO_WIDGETS) << it.key() << it.value(); + qCDebug(category) << it.key() << it.value(); } } #endif @@ -437,7 +441,7 @@ // If the directory containing the items wasn't found, then we have a big problem. // Are you calling KDirLister::openUrl(url,true,false)? Please use expandToUrl() instead. if (!result) { - qCWarning(KIO_WIDGETS) << "Items emitted in directory" << directoryUrl + qCWarning(category) << "Items emitted in directory" << directoryUrl << "but that directory isn't in KDirModel!" << "Root directory:" << urlForNode(m_rootNode); for (const KFileItem &item : items) { @@ -454,17 +458,16 @@ const QModelIndex index = indexForNode(dirNode); // O(n) const int newItemsCount = items.count(); const int newRowCount = dirNode->m_childNodes.count() + newItemsCount; -#if 0 + #ifndef NDEBUG // debugIndex only defined in debug mode - //qDebug() << items.count() << "in" << directoryUrl - << "index=" << debugIndex(index) << "newRowCount=" << newRowCount; -#endif + qCDebug(category) << items.count() << "in" << directoryUrl + << "index=" << debugIndex(index) << "newRowCount=" << newRowCount; #endif q->beginInsertRows(index, newRowCount - newItemsCount, newRowCount - 1); // parent, first, last const QList urlsBeingFetched = m_urlsBeingFetched.value(dirNode); - //qDebug() << "urlsBeingFetched for dir" << dirNode << directoryUrl << ":" << urlsBeingFetched; + qCDebug(category) << "urlsBeingFetched for dir" << dirNode << directoryUrl << ":" << urlsBeingFetched; QList emitExpandFor; @@ -481,15 +484,14 @@ // not sure if/how it ever happened. //if (dirNode->m_childNodes.count() && // dirNode->m_childNodes.last()->item().name() == (*it).name()) { - // qCWarning(KIO_WIDGETS) << "Already having" << (*it).name() << "in" << directoryUrl + // qCWarning(category) << "Already having" << (*it).name() << "in" << directoryUrl // << "url=" << dirNode->m_childNodes.last()->item().url(); // abort(); //} #endif dirNode->m_childNodes.append(node); const QUrl url = it->url(); m_nodeHash.insert(cleanupUrl(url), node); - //qDebug() << url; if (!urlsBeingFetched.isEmpty()) { const QUrl &dirUrl = url; @@ -527,16 +529,16 @@ void KDirModelPrivate::_k_slotDeleteItems(const KFileItemList &items) { - //qDebug() << items.count(); + qCDebug(category) << items.count() << "items"; // I assume all items are from the same directory. // From KDirLister's code, this should be the case, except maybe emitChanges? const KFileItem item = items.first(); Q_ASSERT(!item.isNull()); QUrl url = item.url(); KDirModelNode *node = nodeForUrl(url); // O(depth) if (!node) { - qCWarning(KIO_WIDGETS) << "No node found for item that was just removed:" << url; + qCWarning(category) << "No node found for item that was just removed:" << url; return; } @@ -566,7 +568,7 @@ url = item.url(); node = nodeForUrl(url); if (!node) { - qCWarning(KIO_WIDGETS) << "No node found for item that was just removed:" << url; + qCWarning(category) << "No node found for item that was just removed:" << url; continue; } if (!node->parent()) { @@ -1170,7 +1172,7 @@ } else { KFileItem item = itemForIndex(index); if (item.isNull()) { - qCWarning(KIO_WIDGETS) << "Invalid item returned for index"; + qCWarning(category) << "Invalid item returned for index"; } else if (item.isDir()) { if (d->m_dropsAllowed & DropOnDirectory) { f |= Qt::ItemIsDropEnabled;