Skip to content
Snippets Groups Projects
Commit 262e265e authored by Matthieu Gallien's avatar Matthieu Gallien :musical_note:
Browse files

ignore baloo indexer when some paths are not indexed

parent 09598593
No related branches found
No related tags found
No related merge requests found
......@@ -106,5 +106,10 @@ AbstractFileListing *AbstractFileListener::fileListing() const
return d->mFileListing;
}
bool AbstractFileListener::canHandleRootPaths() const
{
return d->mFileListing->canHandleRootPaths();
}
#include "moc_abstractfilelistener.cpp"
......@@ -49,6 +49,8 @@ public:
AbstractFileListing* fileListing() const;
bool canHandleRootPaths() const;
Q_SIGNALS:
void databaseInterfaceChanged();
......
......@@ -81,6 +81,7 @@ AbstractFileListing::~AbstractFileListing()
void AbstractFileListing::init()
{
qCDebug(orgKdeElisaIndexer()) << "AbstractFileListing::init";
Q_EMIT askRestoredTracks();
}
......@@ -128,6 +129,11 @@ const QStringList &AbstractFileListing::allRootPaths() const
return d->mAllRootPaths;
}
bool AbstractFileListing::canHandleRootPaths() const
{
return true;
}
void AbstractFileListing::scanDirectory(DataTypes::ListTrackDataType &newFiles, const QUrl &path)
{
if (d->mStopRequest == 1) {
......
......@@ -49,6 +49,8 @@ public:
const QStringList& allRootPaths() const;
virtual bool canHandleRootPaths() const;
Q_SIGNALS:
void tracksList(const DataTypes::ListTrackDataType &tracks, const QHash<QString, QUrl> &covers);
......
......@@ -121,6 +121,11 @@ void LocalBalooFileListing::applicationAboutToQuit()
d->mStopRequest = 1;
}
bool LocalBalooFileListing::canHandleRootPaths() const
{
return false;
}
void LocalBalooFileListing::newBalooFile(const QString &fileName)
{
qCDebug(orgKdeElisaBaloo()) << "LocalBalooFileListing::newBalooFile" << fileName;
......@@ -297,6 +302,11 @@ void LocalBalooFileListing::serviceUnregistered(const QString &serviceName)
}
}
void LocalBalooFileListing::stop()
{
qCInfo(orgKdeElisaBaloo()) << "LocalBalooFileListing::stop";
}
void LocalBalooFileListing::executeInit(QHash<QUrl, QDateTime> allFiles)
{
AbstractFileListing::executeInit(std::move(allFiles));
......
......@@ -44,6 +44,8 @@ public:
void applicationAboutToQuit() override;
bool canHandleRootPaths() const override;
Q_SIGNALS:
public Q_SLOTS:
......@@ -56,6 +58,8 @@ public Q_SLOTS:
void serviceUnregistered(const QString &serviceName);
void stop();
private Q_SLOTS:
void newBalooFile(const QString &fileName);
......
......@@ -361,11 +361,17 @@ void MusicListenersManager::configChanged()
if (!d->mBalooIndexerActive && !d->mFileSystemIndexerActive) {
testBalooIndexerAvailability();
}
if (d->mBalooIndexerActive) {
if (d->mBalooIndexerActive && d->mBalooListener.canHandleRootPaths()) {
qCInfo(orgKdeElisaIndexersManager()) << "trigger init of baloo file indexer";
#if defined KF5Baloo_FOUND && KF5Baloo_FOUND
QMetaObject::invokeMethod(d->mBalooListener.fileListing(), "init", Qt::QueuedConnection);
#endif
} else if (d->mFileSystemIndexerActive) {
if (d->mBalooIndexerActive && !d->mBalooListener.canHandleRootPaths()) {
qCInfo(orgKdeElisaIndexersManager()) << "trigger stop of baloo file indexer";
QMetaObject::invokeMethod(d->mBalooListener.fileListing(), "stop", Qt::QueuedConnection);
}
qCInfo(orgKdeElisaIndexersManager()) << "trigger init of local file indexer";
QMetaObject::invokeMethod(d->mFileListener.fileListing(), "init", Qt::QueuedConnection);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment