From: Kai Uwe Broulik Date: Tue, 27 Aug 2019 11:26:26 +0000 (+0200) Subject: Always periodically dispatch pending items X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/f4a1d1b0222eeec4391d307820e8f56bc2d30038 Always periodically dispatch pending items "Local" URLs can also be slow. This might jeopardize loading large local directories where a resorting could take place but imho it's better than leaving the user wondering when files will finally show up. However, it takes some time for KDirLister to initially signal items having been added, and only then our 2 second timer starts. Also, stop the timer when loading has completed. Differential Revision: https://phabricator.kde.org/D23460 --- diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index de974e7e9..49c96ec37 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -917,6 +917,7 @@ void KFileItemModel::resortAllItems() void KFileItemModel::slotCompleted() { + m_maximumUpdateIntervalTimer->stop(); dispatchPendingItemsToInsert(); if (!m_urlsToExpand.isEmpty()) { @@ -1007,7 +1008,7 @@ void KFileItemModel::slotItemsAdded(const QUrl &directoryUrl, const KFileItemLis } } - if (useMaximumUpdateInterval() && !m_maximumUpdateIntervalTimer->isActive()) { + if (!m_maximumUpdateIntervalTimer->isActive()) { // Assure that items get dispatched if no completed() or canceled() signal is // emitted during the maximum update interval. m_maximumUpdateIntervalTimer->start(); @@ -1875,11 +1876,6 @@ int KFileItemModel::stringCompare(const QString& a, const QString& b, const QCol return QString::compare(a, b, Qt::CaseSensitive); } -bool KFileItemModel::useMaximumUpdateInterval() const -{ - return !m_dirLister->url().isLocalFile(); -} - QList > KFileItemModel::nameRoleGroups() const { Q_ASSERT(!m_itemData.isEmpty()); diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 0f7926aae..c2dfd0167 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -382,8 +382,6 @@ private: int stringCompare(const QString& a, const QString& b, const QCollator& collator) const; - bool useMaximumUpdateInterval() const; - QList > nameRoleGroups() const; QList > sizeRoleGroups() const; QList > timeRoleGroups(const std::function &fileTimeCb) const;