ukui-search/ukui-search-service-dir-man.../dirwatcher/dir-watcher.h

75 lines
1.9 KiB
C
Raw Normal View History

#ifndef MOUNTDISKLISTENER_H
#define MOUNTDISKLISTENER_H
#include "dir-watcher-adaptor.h"
#include <QObject>
2023-04-08 16:54:01 +08:00
#include <QStringList>
#include <QDBusMessage>
#include <QDBusObjectPath>
#include <QDBusConnection>
#include <QDBusInterface>
#include <QDBusReply>
class DirWatcher : public QObject
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface","org.ukui.search.fileindex")
public:
static DirWatcher *getDirWatcher();
public Q_SLOTS:
void initDbusService();
QStringList currentIndexableDir();
QStringList currentBlackListOfIndex();
QStringList currentSearchableDir();
QStringList searchableDirForSearchApplication();
QStringList blackListOfDir(const QString &dirPath);
/**
* @brief DirWatcher::appendIndexableListItem
* add a item to indexable dirs
* @param path: the path to be added to the index dirs list
* @return int: the result code
2023-04-08 16:54:01 +08:00
* 0: successful
* 1: path or its parent dir has been added
* 2: path is or under blacklist
* 3: path is in repeat mounted devices and another path which is in the same device has been indexed
* 4: another path which is in the same device has been indexed
* 5: path is not exists
*/
Q_SCRIPTABLE int appendIndexableListItem(const QString &path);
Q_SCRIPTABLE bool removeIndexableListItem(const QString &path);
//新接口
2023-04-08 16:54:01 +08:00
Q_SCRIPTABLE int appendSearchDir(const QString &path);
Q_SCRIPTABLE void removeSearchDir(const QString &path);
QStringList currentSearchDirs();
QStringList currentBlackList();
private:
DirWatcher(QObject *parent = nullptr);
~DirWatcher();
static QMutex s_mutex;
DirWatcherAdaptor *m_adaptor = nullptr;
Q_SIGNALS:
void appendIndexItem(const QString&, const QStringList&);
void removeIndexItem(const QString&);
2023-04-08 16:54:01 +08:00
//abondoned
void udiskRemoved();
void indexDirsChanged();
};
#endif // MOUNTDISKLISTENER_H