diff options
| author | Nikolai Krasheninnikov <[email protected]> | 2020-01-26 17:06:40 +0100 |
|---|---|---|
| committer | Elvis Angelaccio <[email protected]> | 2020-01-26 17:09:18 +0100 |
| commit | 305085b58143c431d9abb7bd8dcb2f0954df725a (patch) | |
| tree | 4e7dc4d9b7aa7b4cc6e24b4556d699ec10cf8660 /src | |
| parent | 17e1a48c68000f92033196b6d19d876143a13608 (diff) | |
Fixes multiple VCS plugin calls on single directory update.
Summary:
Fixes multiple VCS plugin beginRetrival()/endRetrival()/itemVersion() calls on single directory update.
When VCS pluging finished gathering directory information VersionControlObserver::slotThreadFinished() calls KFileItemModel::setData() on each entry with appropriate item VCS information.
This in turn emits KFileItemModel::itemsChanged() which is connected with VersionControlObserver::delayedDirectoryVerification() which is starting to gather VCS directory information again.
This commits breaks the vicious circle.
BUG: 415698
FIXED-IN: 20.04.0
Reviewers: #dolphin, meven, ngraham, elvisangelaccio
Subscribers: kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D26721
Diffstat (limited to 'src')
| -rw-r--r-- | src/views/versioncontrol/versioncontrolobserver.cpp | 16 | ||||
| -rw-r--r-- | src/views/versioncontrol/versioncontrolobserver.h | 7 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/views/versioncontrol/versioncontrolobserver.cpp b/src/views/versioncontrol/versioncontrolobserver.cpp index fc74390a9..65c13ef7d 100644 --- a/src/views/versioncontrol/versioncontrolobserver.cpp +++ b/src/views/versioncontrol/versioncontrolobserver.cpp @@ -69,7 +69,7 @@ void VersionControlObserver::setModel(KFileItemModel* model) disconnect(m_model, &KFileItemModel::itemsInserted, this, &VersionControlObserver::delayedDirectoryVerification); disconnect(m_model, &KFileItemModel::itemsChanged, - this, &VersionControlObserver::delayedDirectoryVerification); + this, &VersionControlObserver::slotItemsChanged); } m_model = model; @@ -78,7 +78,7 @@ void VersionControlObserver::setModel(KFileItemModel* model) connect(m_model, &KFileItemModel::itemsInserted, this, &VersionControlObserver::delayedDirectoryVerification); connect(m_model, &KFileItemModel::itemsChanged, - this, &VersionControlObserver::delayedDirectoryVerification); + this, &VersionControlObserver::slotItemsChanged); } } @@ -137,6 +137,18 @@ void VersionControlObserver::silentDirectoryVerification() m_dirVerificationTimer->start(); } +void VersionControlObserver::slotItemsChanged(const KItemRangeList& itemRanges, const QSet<QByteArray>& roles) +{ + Q_UNUSED(itemRanges) + + // Because "version" role is emitted by VCS plugin (ourselfs) we don't need to + // analyze it and update directory item states information. So lets check if + // there is only "version". + if ( !(roles.count() == 1 && roles.contains("version")) ) { + delayedDirectoryVerification(); + } +} + void VersionControlObserver::verifyDirectory() { if (!m_model) { diff --git a/src/views/versioncontrol/versioncontrolobserver.h b/src/views/versioncontrol/versioncontrolobserver.h index 08279dc86..7b269abec 100644 --- a/src/views/versioncontrol/versioncontrolobserver.h +++ b/src/views/versioncontrol/versioncontrolobserver.h @@ -33,6 +33,7 @@ class KFileItemList; class KFileItemModel; +class KItemRangeList; class QAction; class QTimer; class UpdateItemStatesThread; @@ -97,6 +98,12 @@ private slots: */ void silentDirectoryVerification(); + /** + * Invokes delayedDirectoryVerification() only if the itemsChanged() signal has not + * been triggered by the VCS plugin itself. + */ + void slotItemsChanged(const KItemRangeList& itemRanges, const QSet<QByteArray>& roles); + void verifyDirectory(); /** |
