┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2019-08-27 13:26:26 +0200
committerKai Uwe Broulik <[email protected]>2019-08-27 13:26:26 +0200
commitf4a1d1b0222eeec4391d307820e8f56bc2d30038 (patch)
treef858fc4e23d1c5c19b803702318c0d54f02b97e7 /src
parent0c4f58328f1c72aee100a568b4315c1d5c91fdf0 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/kitemviews/kfileitemmodel.cpp8
-rw-r--r--src/kitemviews/kfileitemmodel.h2
2 files changed, 2 insertions, 8 deletions
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<QPair<int, QVariant> > 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<QPair<int, QVariant> > nameRoleGroups() const;
QList<QPair<int, QVariant> > sizeRoleGroups() const;
QList<QPair<int, QVariant> > timeRoleGroups(const std::function<QDateTime(const ItemData *)> &fileTimeCb) const;