mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
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
This commit is contained in:
parent
17e1a48c68
commit
305085b581
|
@ -69,7 +69,7 @@ void VersionControlObserver::setModel(KFileItemModel* model)
|
||||||
disconnect(m_model, &KFileItemModel::itemsInserted,
|
disconnect(m_model, &KFileItemModel::itemsInserted,
|
||||||
this, &VersionControlObserver::delayedDirectoryVerification);
|
this, &VersionControlObserver::delayedDirectoryVerification);
|
||||||
disconnect(m_model, &KFileItemModel::itemsChanged,
|
disconnect(m_model, &KFileItemModel::itemsChanged,
|
||||||
this, &VersionControlObserver::delayedDirectoryVerification);
|
this, &VersionControlObserver::slotItemsChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_model = model;
|
m_model = model;
|
||||||
|
@ -78,7 +78,7 @@ void VersionControlObserver::setModel(KFileItemModel* model)
|
||||||
connect(m_model, &KFileItemModel::itemsInserted,
|
connect(m_model, &KFileItemModel::itemsInserted,
|
||||||
this, &VersionControlObserver::delayedDirectoryVerification);
|
this, &VersionControlObserver::delayedDirectoryVerification);
|
||||||
connect(m_model, &KFileItemModel::itemsChanged,
|
connect(m_model, &KFileItemModel::itemsChanged,
|
||||||
this, &VersionControlObserver::delayedDirectoryVerification);
|
this, &VersionControlObserver::slotItemsChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +137,18 @@ void VersionControlObserver::silentDirectoryVerification()
|
||||||
m_dirVerificationTimer->start();
|
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()
|
void VersionControlObserver::verifyDirectory()
|
||||||
{
|
{
|
||||||
if (!m_model) {
|
if (!m_model) {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
class KFileItemList;
|
class KFileItemList;
|
||||||
class KFileItemModel;
|
class KFileItemModel;
|
||||||
|
class KItemRangeList;
|
||||||
class QAction;
|
class QAction;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class UpdateItemStatesThread;
|
class UpdateItemStatesThread;
|
||||||
|
@ -97,6 +98,12 @@ private slots:
|
||||||
*/
|
*/
|
||||||
void silentDirectoryVerification();
|
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();
|
void verifyDirectory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue