Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 5e4203cd authored by Michael Heidelbach's avatar Michael Heidelbach

baloo-widgets: Emit metaDataRequestFinished once per request

Summary:
Add signal 'dataAvailable' to allow chunkwise data processing
Emit metaDataRequestFinished when request processing is finished
Adapted execution order to ensure loadingFinished is signalled last

CCBUG: 388583

Test Plan:
Visual inspection
make test

Reviewers: elvisangelaccio, smithjd, vhanda, ngraham, #dolphin, #frameworks

Reviewed By: elvisangelaccio, ngraham, #dolphin

Subscribers: dhaumann

Differential Revision: https://phabricator.kde.org/D10113
parent 11df1823
......@@ -103,7 +103,6 @@ namespace {
return v;
}
}
void FileMetaDataProvider::totalPropertyAndInsert(const QString& prop,
......@@ -318,13 +317,13 @@ void FileMetaDataProvider::setFileItem()
if (!m_config.fileIndexingEnabled() || !m_config.shouldBeIndexed(filePath)) {
m_realTimeIndexing = true;
insertBasicData();
insertEditableData();
emit dataAvailable();
IndexedDataRetriever *ret = new IndexedDataRetriever(filePath, this);
connect(ret, SIGNAL(finished(KJob*)), this, SLOT(slotLoadingFinished(KJob*)));
ret->start();
insertBasicData();
insertEditableData();
emit loadingFinished();
} else {
FileFetchJob* job = new FileFetchJob(QStringList() << filePath, this);
......@@ -350,13 +349,16 @@ void FileMetaDataProvider::setFileItems()
}
if (!urls.isEmpty()) {
insertBasicData();
emit dataAvailable();
FileFetchJob* job = new FileFetchJob(urls, this);
connect(job, SIGNAL(finished(KJob*)), this, SLOT(slotFileFetchFinished(KJob*)));
job->start();
} else {
insertBasicData();
emit loadingFinished();
}
insertBasicData();
emit loadingFinished();
}
void FileMetaDataProvider::setItems(const KFileItemList& items)
......@@ -480,7 +482,6 @@ QVariantMap FileMetaDataProvider::data() const
return m_data;
}
int FileMetaDataProvider::subDirectoriesCount(const QString& path)
{
#ifdef Q_OS_WIN
......
......@@ -105,18 +105,20 @@ public:
Q_SIGNALS:
/**
* Is emitted after the loading triggered by KFileMetaDataProvider::setItems()
* has been finished.
*
* Can be emitted multiple times to indicate data changes
* Emitted once per KFileMetaDataProvider::setItems()
* after data loading is finished.
*/
void loadingFinished();
/**
* Indicates data changes.
* Can be emitted zero or more times
*/
void dataAvailable();
private Q_SLOTS:
void slotLoadingFinished(KJob* job);
void slotFileFetchFinished(KJob* job);
private:
void insertBasicData();
void insertEditableData();
......
......@@ -63,6 +63,7 @@ public:
void deleteRows();
void slotLoadingFinished();
void slotDataAvailable();
void slotLinkActivated(const QString& link);
void slotDataChangeStarted();
void slotDataChangeFinished();
......@@ -94,6 +95,7 @@ FileMetaDataWidget::Private::Private(FileMetaDataWidget* parent)
// TODO: If KFileMetaDataProvider might get a public class in future KDE releases,
// the following code should be moved into KFileMetaDataWidget::setModel():
m_provider = new FileMetaDataProvider(q);
connect(m_provider, SIGNAL(dataAvailable()), q, SLOT(slotDataAvailable()));
connect(m_provider, SIGNAL(loadingFinished()), q, SLOT(slotLoadingFinished()));
}
......@@ -112,6 +114,12 @@ void FileMetaDataWidget::Private::deleteRows()
}
void FileMetaDataWidget::Private::slotLoadingFinished()
{
slotDataAvailable();
emit q->metaDataRequestFinished(m_provider->items());
}
void FileMetaDataWidget::Private::slotDataAvailable()
{
deleteRows();
......@@ -161,7 +169,7 @@ void FileMetaDataWidget::Private::slotLoadingFinished()
}
q->updateGeometry();
emit q->metaDataRequestFinished(m_provider->items());
}
void FileMetaDataWidget::Private::slotLinkActivated(const QString& link)
......
......@@ -80,6 +80,7 @@ private:
Private* d;
Q_PRIVATE_SLOT(d, void slotLoadingFinished())
Q_PRIVATE_SLOT(d, void slotDataAvailable())
Q_PRIVATE_SLOT(d, void slotLinkActivated(QString))
Q_PRIVATE_SLOT(d, void slotDataChangeStarted())
Q_PRIVATE_SLOT(d, void slotDataChangeFinished())
......
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