Merge branch '0621-dev' into 'dev-unity'
[Fix] Tray icon click won't work after Win+D; Close inotify fd after closed file index service. See merge request kylin-desktop/ukui-search!42
This commit is contained in:
commit
91c13ca43d
|
@ -483,8 +483,10 @@ void FileUtils::getDocxTextContent(QString &path, QString &textcontent) {
|
|||
if(!file.open(QuaZip::mdUnzip))
|
||||
return;
|
||||
|
||||
if(!file.setCurrentFile("word/document.xml", QuaZip::csSensitive))
|
||||
if(!file.setCurrentFile("word/document.xml", QuaZip::csSensitive)) {
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
QuaZipFile fileR(&file);
|
||||
|
||||
fileR.open(QIODevice::ReadOnly); //读取方式打开
|
||||
|
@ -545,8 +547,10 @@ void FileUtils::getPptxTextContent(QString &path, QString &textcontent) {
|
|||
if(i.startsWith(prefix))
|
||||
fileList << i;
|
||||
}
|
||||
if(fileList.isEmpty())
|
||||
if(fileList.isEmpty()) {
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < fileList.size(); ++i){
|
||||
QString name = prefix + QString::number(i + 1) + ".xml";
|
||||
|
@ -650,8 +654,10 @@ void FileUtils::getXlsxTextContent(QString &path, QString &textcontent) {
|
|||
if(!file.open(QuaZip::mdUnzip))
|
||||
return;
|
||||
|
||||
if(!file.setCurrentFile("xl/sharedStrings.xml", QuaZip::csSensitive))
|
||||
if(!file.setCurrentFile("xl/sharedStrings.xml", QuaZip::csSensitive)) {
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
QuaZipFile fileR(&file);
|
||||
|
||||
fileR.open(QIODevice::ReadOnly);
|
||||
|
@ -706,8 +712,10 @@ void FileUtils::getXlsxTextContent(QString &path, QString &textcontent) {
|
|||
|
||||
void FileUtils::getPdfTextContent(QString &path, QString &textcontent) {
|
||||
Poppler::Document *doc = Poppler::Document::load(path);
|
||||
if(doc->isLocked())
|
||||
if(doc->isLocked()) {
|
||||
delete doc;
|
||||
return;
|
||||
}
|
||||
const QRectF qf;
|
||||
int pageNum = doc->numPages();
|
||||
for(int i = 0; i < pageNum; ++i) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "inotify-watch.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <malloc.h>
|
||||
#include <errno.h>
|
||||
using namespace Zeeker;
|
||||
static InotifyWatch* global_instance_InotifyWatch = nullptr;
|
||||
|
||||
|
@ -65,7 +66,7 @@ bool InotifyWatch::removeWatch(const QString &path, bool removeFromDatabase)
|
|||
// qDebug() << i.value();
|
||||
if(i.value().length() > path.length()) {
|
||||
if(i.value().startsWith(path)) {
|
||||
qDebug() << "remove path: " << i.value();
|
||||
// qDebug() << "remove path: " << i.value();
|
||||
inotify_rm_watch(m_inotifyFd, currentPath.key(path));
|
||||
currentPath.erase(i++);
|
||||
} else {
|
||||
|
@ -132,6 +133,8 @@ void InotifyWatch::run()
|
|||
if (m_inotifyFd > 0) {
|
||||
qDebug()<<"Inotify init success!";
|
||||
} else {
|
||||
printf("errno=%d\n",errno);
|
||||
printf("Mesg:%s\n",strerror(errno));
|
||||
Q_ASSERT_X(0, "InotifyWatch", "Failed to initialize inotify");
|
||||
}
|
||||
|
||||
|
@ -205,10 +208,12 @@ void InotifyWatch::run()
|
|||
assert(false);
|
||||
}
|
||||
}
|
||||
qDebug() << "Leave watch loop";
|
||||
if(FileUtils::SearchMethod::DIRECTSEARCH == FileUtils::searchMethod) {
|
||||
IndexStatusRecorder::getInstance()->setStatus(INOTIFY_NORMAL_EXIT, "3");
|
||||
removeWatch(QStandardPaths::writableLocation(QStandardPaths::HomeLocation), false);
|
||||
}
|
||||
close(m_inotifyFd);
|
||||
// fcntl(m_inotifyFd, F_SETFD, FD_CLOEXEC);
|
||||
// m_notifier = new QSocketNotifier(m_inotifyFd, QSocketNotifier::Read);
|
||||
// connect(m_notifier, &QSocketNotifier::activated, this, &InotifyWatch::slotEvent, Qt::DirectConnection);
|
||||
|
|
|
@ -129,6 +129,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||
this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入
|
||||
this->raise();
|
||||
this->activateWindow();
|
||||
} else if(this->isVisible()&&!this->isActiveWindow()) {
|
||||
this->activateWindow();
|
||||
} else {
|
||||
tryHideMainwindow();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue