Baloo
8 #include "baloosearchmodule.h"
10 #include <QDBusConnection>
14 #include <kpluginfactory.h>
18 inline bool isSearchUrl(
const QUrl& url)
26 using namespace Baloo;
30 , m_dirNotify(nullptr)
35 void SearchModule::init()
39 connect(m_dirNotify, &OrgKdeKDirNotifyInterface::enteredDirectory,
40 this, &SearchModule::registerSearchUrl);
41 connect(m_dirNotify, &OrgKdeKDirNotifyInterface::leftDirectory,
42 this, &SearchModule::unregisterSearchUrl);
47 con.
connect(
QString(), QStringLiteral(
"/files"), QStringLiteral(
"org.kde.baloo"),
48 QStringLiteral(
"updated"),
this, SLOT(slotBalooFileDbChanged()));
49 con.
connect(
QString(), QStringLiteral(
"/files"), QStringLiteral(
"org.kde"),
50 QStringLiteral(
"changed"),
this, SLOT(slotFileMetaDataChanged(
QStringList)));
53 void SearchModule::registerSearchUrl(
const QString& urlString)
56 if (isSearchUrl(url)) {
61 void SearchModule::unregisterSearchUrl(
const QString& urlString)
64 m_searchUrls.removeAll(url);
67 void SearchModule::slotBalooFileDbChanged()
69 for (
const QUrl& dirUrl : std::as_const(m_searchUrls)) {
70 org::kde::KDirNotify::emitFilesAdded(dirUrl);
74 void SearchModule::slotFileMetaDataChanged(
const QStringList& list)
78 for (
const QString& path : list) {
81 org::kde::KDirNotify::emitFilesChanged(localFileUrls);
82 slotBalooFileDbChanged();
87 #include "baloosearchmodule.moc"
88 #include "moc_baloosearchmodule.cpp"
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
QString scheme() const const
KIOFILEWIDGETS_EXPORT QStringList list(const QString &fileClass)
QDBusConnection sessionBus()
Implements storage for docIds without any associated data Instantiated for:
QUrl fromLocalFile(const QString &localFile)
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)
#define K_PLUGIN_CLASS_WITH_JSON(classname, jsonFile)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Dec 11 2023 03:53:56 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.