Commit 305085b5 authored by Nikolai Krasheninnikov's avatar Nikolai Krasheninnikov Committed by Elvis Angelaccio
Browse files

Fixes multiple VCS plugin calls on single directory update.

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:
parent 17e1a48c
......@@ -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()
void VersionControlObserver::slotItemsChanged(const KItemRangeList& itemRanges, const QSet<QByteArray>& roles)
// 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")) ) {
void VersionControlObserver::verifyDirectory()
if (!m_model) {
......@@ -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();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment