From b9b206cb3a446925a00974d5dfb08d5c0bb98db6 Mon Sep 17 00:00:00 2001 From: jixiaoxu Date: Fri, 24 Sep 2021 15:35:47 +0800 Subject: [PATCH] Add web search selection with no result; App search fix bug; --- frontend/control/stack-pages/search-page-section.cpp | 12 +++++------- libsearch/appsearch/app-match.cpp | 1 + 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/control/stack-pages/search-page-section.cpp b/frontend/control/stack-pages/search-page-section.cpp index 43218f3..c0d9581 100644 --- a/frontend/control/stack-pages/search-page-section.cpp +++ b/frontend/control/stack-pages/search-page-section.cpp @@ -78,10 +78,8 @@ void ResultArea::pressEnter() { if (false == m_is_selected) {//未选中时默认选取bestlist第一项 int resultNum = m_bestListWidget->getResultNum(); - if (0 == resultNum) {//搜索结果为空则选中网页搜索项 - QModelIndex index = m_webSearchWidget->getModlIndex(0, 0); - m_webSearchWidget->setResultSelection(index); - m_selectedPluginID = m_webSearchWidget->getWidgetName(); + if (0 == resultNum) {//无搜索结果时默认选中websearch + m_webSearchWidget->LaunchBrowser();//默认已选中websearch m_is_selected = true; } else {//选取bestlist第一项 QModelIndex index = m_bestListWidget->getModlIndex(0, 0); @@ -386,13 +384,13 @@ void ResultArea::initConnections() connect(this, &ResultArea::startSearch, this, [=] () { m_detail_open_state = false; m_is_selected = false; - if (m_selectedPluginID == m_webSearchWidget->getWidgetName()) { - m_webSearchWidget->clearResultSelection(); - } + QModelIndex index = m_webSearchWidget->getModlIndex(0, 0);//每次启动搜索则选中web搜索,待bestlist收到结果后清空选中 + m_webSearchWidget->setResultSelection(index); }); connect(m_bestListWidget, &BestListWidget::sizeChanged, this, &ResultArea::onWidgetSizeChanged); connect(m_bestListWidget, &BestListWidget::sizeChanged, this, [=] () { if (!m_is_selected) { + m_webSearchWidget->clearResultSelection();//每次启动搜索则选中web搜索,待bestlist收到结果后清空选中 QModelIndex index = m_bestListWidget->getModlIndex(0, 0); m_bestListWidget->setResultSelection(index); m_selectedPluginID = m_bestListWidget->getWidgetName(); diff --git a/libsearch/appsearch/app-match.cpp b/libsearch/appsearch/app-match.cpp index de84008..dc8e47e 100644 --- a/libsearch/appsearch/app-match.cpp +++ b/libsearch/appsearch/app-match.cpp @@ -98,6 +98,7 @@ void AppMatch::getAllDesktopFilePath(QString path) { if(isDir) { getAllDesktopFilePath(fileInfo.filePath()); qDebug() << fileInfo.filePath(); + ++i; } else { QString filePathStr = fileInfo.filePath(); if(m_ExcludedDesktopfiles.contains(filePathStr)) {