增加unmount信号监听处理
This commit is contained in:
parent
c0c9c0e2fd
commit
d684692f51
|
@ -340,7 +340,7 @@ void FileSystemWatcher::eventProcess(int socket)
|
|||
// This is present because a unmount event is sent by inotify after unmounting, by
|
||||
// which time the watches have already been removed.
|
||||
if (path != "/") {
|
||||
Q_EMIT unmounted(path);
|
||||
Q_EMIT unmounted(path, event->mask & IN_ISDIR);
|
||||
}
|
||||
}
|
||||
if (event->mask & EventAttributeChange) {
|
||||
|
|
|
@ -151,7 +151,7 @@ Q_SIGNALS:
|
|||
/**
|
||||
* Emitted if a watched path has been unmounted (FileSystemWatcher::EventUnmount)
|
||||
*/
|
||||
void unmounted(const QString& path);
|
||||
void unmounted(const QString& path, bool isDir);
|
||||
|
||||
private Q_SLOTS:
|
||||
void eventProcess(int socket);
|
||||
|
|
|
@ -29,6 +29,9 @@ BasicIndexer::BasicIndexer(const QString& filePath): m_filePath(filePath)
|
|||
bool BasicIndexer::index()
|
||||
{
|
||||
QFileInfo info = QFileInfo(m_filePath);
|
||||
if(!info.exists()) {
|
||||
return false;
|
||||
}
|
||||
//添加数据
|
||||
m_document.setData(m_filePath);
|
||||
//唯一term
|
||||
|
|
|
@ -264,7 +264,7 @@ void BatchIndexer::contentIndex()
|
|||
++batchSize;
|
||||
++finishNum;
|
||||
} else {
|
||||
qDebug() << "Extract fail===" << path;
|
||||
// qDebug() << "Extract fail===" << path;
|
||||
}
|
||||
if(batchSize >= 30) {
|
||||
contentDb.commit();
|
||||
|
@ -295,7 +295,7 @@ void BatchIndexer::contentIndex()
|
|||
++batchSize;
|
||||
++ocrFinishNum;
|
||||
} else {
|
||||
qDebug() << "Extract fail===" << path;
|
||||
// qDebug() << "Extract fail===" << path;
|
||||
}
|
||||
if(batchSize >= 30) {
|
||||
contentDb.commit();
|
||||
|
|
|
@ -31,6 +31,9 @@ bool fileContentIndexer::index()
|
|||
{
|
||||
QString content;
|
||||
QFileInfo info(m_filePath);
|
||||
if(!info.exists()) {
|
||||
return false;
|
||||
}
|
||||
QString suffix = info.suffix();
|
||||
FileReader::getTextContent(m_filePath, content, suffix);
|
||||
if(content.isEmpty()) {
|
||||
|
|
|
@ -29,6 +29,7 @@ FileWatcher::FileWatcher(QObject *parent) : QObject(parent), m_config(FileIndexe
|
|||
connect(m_watcher, &FileSystemWatcher::modified, this, &FileWatcher::onFileModefied);
|
||||
connect(m_watcher, &FileSystemWatcher::deleted, this, &FileWatcher::onFileDeletedOrMoved);
|
||||
connect(m_watcher, &FileSystemWatcher::moved, this, &FileWatcher::onFileDeletedOrMoved);
|
||||
connect(m_watcher, &FileSystemWatcher::unmounted, this, &FileWatcher::onFileDeletedOrMoved);
|
||||
|
||||
connect(m_pendingFileQUeue, &PendingFileQueue::filesUpdate, this, &FileWatcher::filesUpdate);
|
||||
}
|
||||
|
|
|
@ -31,9 +31,10 @@ IndexUpdater::IndexUpdater(const QVector<PendingFile>& files, QAtomicInt &stop)
|
|||
m_stop(&stop)
|
||||
{
|
||||
}
|
||||
|
||||
void IndexUpdater::UpdateIndex()
|
||||
{
|
||||
//fix me: How should I delete metadata of files below a folder
|
||||
//that has been deleted(When a file watcher signal comes which only contains folder info)?
|
||||
if(FileIndexerConfig::getInstance()->isFileIndexEnable()) {
|
||||
WritableDatabase basicDb(DataBaseType::Basic);
|
||||
if(!basicDb.open()) {
|
||||
|
|
|
@ -601,7 +601,7 @@ void DirWatcher::handleDisk()
|
|||
for (auto t = m_currentUDiskDeviceInfo.constBegin(); t != m_currentUDiskDeviceInfo.constEnd(); t++) {
|
||||
for (QString udiskDevice: t.value()) {
|
||||
// if (udiskDevice.startsWith("/data") || udiskDevice.startsWith("/home")) {
|
||||
m_blackListOfIndex.append(udiskDevice);
|
||||
// m_blackListOfIndex.append(udiskDevice);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue