Commit 262e265e authored by Matthieu Gallien's avatar Matthieu Gallien

ignore baloo indexer when some paths are not indexed

parent 09598593
...@@ -106,5 +106,10 @@ AbstractFileListing *AbstractFileListener::fileListing() const ...@@ -106,5 +106,10 @@ AbstractFileListing *AbstractFileListener::fileListing() const
return d->mFileListing; return d->mFileListing;
} }
bool AbstractFileListener::canHandleRootPaths() const
{
return d->mFileListing->canHandleRootPaths();
}
#include "moc_abstractfilelistener.cpp" #include "moc_abstractfilelistener.cpp"
...@@ -49,6 +49,8 @@ public: ...@@ -49,6 +49,8 @@ public:
AbstractFileListing* fileListing() const; AbstractFileListing* fileListing() const;
bool canHandleRootPaths() const;
Q_SIGNALS: Q_SIGNALS:
void databaseInterfaceChanged(); void databaseInterfaceChanged();
......
...@@ -81,6 +81,7 @@ AbstractFileListing::~AbstractFileListing() ...@@ -81,6 +81,7 @@ AbstractFileListing::~AbstractFileListing()
void AbstractFileListing::init() void AbstractFileListing::init()
{ {
qCDebug(orgKdeElisaIndexer()) << "AbstractFileListing::init";
Q_EMIT askRestoredTracks(); Q_EMIT askRestoredTracks();
} }
...@@ -128,6 +129,11 @@ const QStringList &AbstractFileListing::allRootPaths() const ...@@ -128,6 +129,11 @@ const QStringList &AbstractFileListing::allRootPaths() const
return d->mAllRootPaths; return d->mAllRootPaths;
} }
bool AbstractFileListing::canHandleRootPaths() const
{
return true;
}
void AbstractFileListing::scanDirectory(DataTypes::ListTrackDataType &newFiles, const QUrl &path) void AbstractFileListing::scanDirectory(DataTypes::ListTrackDataType &newFiles, const QUrl &path)
{ {
if (d->mStopRequest == 1) { if (d->mStopRequest == 1) {
......
...@@ -49,6 +49,8 @@ public: ...@@ -49,6 +49,8 @@ public:
const QStringList& allRootPaths() const; const QStringList& allRootPaths() const;
virtual bool canHandleRootPaths() const;
Q_SIGNALS: Q_SIGNALS:
void tracksList(const DataTypes::ListTrackDataType &tracks, const QHash<QString, QUrl> &covers); void tracksList(const DataTypes::ListTrackDataType &tracks, const QHash<QString, QUrl> &covers);
......
...@@ -121,6 +121,11 @@ void LocalBalooFileListing::applicationAboutToQuit() ...@@ -121,6 +121,11 @@ void LocalBalooFileListing::applicationAboutToQuit()
d->mStopRequest = 1; d->mStopRequest = 1;
} }
bool LocalBalooFileListing::canHandleRootPaths() const
{
return false;
}
void LocalBalooFileListing::newBalooFile(const QString &fileName) void LocalBalooFileListing::newBalooFile(const QString &fileName)
{ {
qCDebug(orgKdeElisaBaloo()) << "LocalBalooFileListing::newBalooFile" << fileName; qCDebug(orgKdeElisaBaloo()) << "LocalBalooFileListing::newBalooFile" << fileName;
...@@ -297,6 +302,11 @@ void LocalBalooFileListing::serviceUnregistered(const QString &serviceName) ...@@ -297,6 +302,11 @@ void LocalBalooFileListing::serviceUnregistered(const QString &serviceName)
} }
} }
void LocalBalooFileListing::stop()
{
qCInfo(orgKdeElisaBaloo()) << "LocalBalooFileListing::stop";
}
void LocalBalooFileListing::executeInit(QHash<QUrl, QDateTime> allFiles) void LocalBalooFileListing::executeInit(QHash<QUrl, QDateTime> allFiles)
{ {
AbstractFileListing::executeInit(std::move(allFiles)); AbstractFileListing::executeInit(std::move(allFiles));
......
...@@ -44,6 +44,8 @@ public: ...@@ -44,6 +44,8 @@ public:
void applicationAboutToQuit() override; void applicationAboutToQuit() override;
bool canHandleRootPaths() const override;
Q_SIGNALS: Q_SIGNALS:
public Q_SLOTS: public Q_SLOTS:
...@@ -56,6 +58,8 @@ public Q_SLOTS: ...@@ -56,6 +58,8 @@ public Q_SLOTS:
void serviceUnregistered(const QString &serviceName); void serviceUnregistered(const QString &serviceName);
void stop();
private Q_SLOTS: private Q_SLOTS:
void newBalooFile(const QString &fileName); void newBalooFile(const QString &fileName);
......
...@@ -361,11 +361,17 @@ void MusicListenersManager::configChanged() ...@@ -361,11 +361,17 @@ void MusicListenersManager::configChanged()
if (!d->mBalooIndexerActive && !d->mFileSystemIndexerActive) { if (!d->mBalooIndexerActive && !d->mFileSystemIndexerActive) {
testBalooIndexerAvailability(); testBalooIndexerAvailability();
} }
if (d->mBalooIndexerActive) { if (d->mBalooIndexerActive && d->mBalooListener.canHandleRootPaths()) {
qCInfo(orgKdeElisaIndexersManager()) << "trigger init of baloo file indexer";
#if defined KF5Baloo_FOUND && KF5Baloo_FOUND #if defined KF5Baloo_FOUND && KF5Baloo_FOUND
QMetaObject::invokeMethod(d->mBalooListener.fileListing(), "init", Qt::QueuedConnection); QMetaObject::invokeMethod(d->mBalooListener.fileListing(), "init", Qt::QueuedConnection);
#endif #endif
} else if (d->mFileSystemIndexerActive) { } 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); QMetaObject::invokeMethod(d->mFileListener.fileListing(), "init", Qt::QueuedConnection);
} }
......
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