mirror of
https://invent.kde.org/system/dolphin
synced 2024-08-22 01:40:02 +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,
|
||||
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) {
|
||||
|
|
|
@ -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();
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue