Moved the scan time to populated and get it from settings

This commit is contained in:
Alessandro Pasotti 2017-09-10 10:54:00 +02:00
parent 1d4c6061a8
commit 9349ae8606

View File

@ -765,7 +765,6 @@ QVector<QgsDataItem *> QgsDirectoryItem::createChildren()
}
}
mLastScan = QDateTime::currentDateTime();
return children;
}
@ -781,6 +780,7 @@ void QgsDirectoryItem::setState( State state )
mFileSystemWatcher->addPath( mDirPath );
connect( mFileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &QgsDirectoryItem::directoryChanged );
}
mLastScan = QDateTime::currentDateTime();
}
else if ( state == NotPopulated )
{
@ -795,7 +795,7 @@ void QgsDirectoryItem::setState( State state )
void QgsDirectoryItem::directoryChanged()
{
// If the last scan was less than 10 seconds ago, skip this
if ( mLastScan.msecsTo( QDateTime::currentDateTime() ) < 10000 )
if ( mLastScan.msecsTo( QDateTime::currentDateTime() ) < QgsSettings().value( QStringLiteral( "browser/minscaninterval" ), 10000 ).toInt() )
{
return;
}