DiscoveryJob: Fix progress display.

This fixes #2909
This commit is contained in:
Klaas Freitag 2015-03-03 16:00:45 +01:00
parent ccbeb86140
commit f913cd97ee

View file

@ -74,8 +74,12 @@ void DiscoveryJob::update_job_update_callback (bool local,
updateJob->_lastUpdateProgressCallbackCall.restart(); updateJob->_lastUpdateProgressCallbackCall.restart();
} }
QString path(QUrl::fromPercentEncoding(QByteArray(dirUrl)).section('/', -1)); QByteArray pPath(dirUrl);
emit updateJob->folderDiscovered(local, path); int indx = pPath.lastIndexOf('/');
if(indx>-1) {
const QString path = QUrl::fromPercentEncoding( pPath.mid(indx+1));
emit updateJob->folderDiscovered(local, path);
}
} }
} }
@ -332,8 +336,9 @@ void DiscoveryMainThread::doOpendirSlot(QString subPath, DiscoveryDirectoryResul
while (fullPath.endsWith('/')) { while (fullPath.endsWith('/')) {
fullPath.chop(1); fullPath.chop(1);
} }
qDebug() << Q_FUNC_INFO << _pathPrefix << subPath << fullPath;
// emit _discoveryJob->folderDiscovered(false, subPath);
_discoveryJob->update_job_update_callback (false, subPath.toUtf8(), _discoveryJob);
// Result gets written in there // Result gets written in there
_currentDiscoveryDirectoryResult = r; _currentDiscoveryDirectoryResult = r;
@ -428,7 +433,7 @@ csync_vio_handle_t* DiscoveryJob::remote_vio_opendir_hook (const char *url,
directoryResult->code = EIO; directoryResult->code = EIO;
discoveryJob->_vioMutex.lock(); discoveryJob->_vioMutex.lock();
QString qurl = QString::fromUtf8(url); const QString qurl = QString::fromUtf8(url);
emit discoveryJob->doOpendirSignal(qurl, directoryResult); emit discoveryJob->doOpendirSignal(qurl, directoryResult);
discoveryJob->_vioWaitCondition.wait(&discoveryJob->_vioMutex, ULONG_MAX); // FIXME timeout? discoveryJob->_vioWaitCondition.wait(&discoveryJob->_vioMutex, ULONG_MAX); // FIXME timeout?
discoveryJob->_vioMutex.unlock(); discoveryJob->_vioMutex.unlock();