diff --git a/src/content-widget.cpp b/src/content-widget.cpp index 5a6093d..80bccf2 100644 --- a/src/content-widget.cpp +++ b/src/content-widget.cpp @@ -158,6 +158,15 @@ int ContentWidget::currentPage() { */ void ContentWidget::refreshSearchList(const QVector& types, const QVector& lists, const QString& keyword) { if (!m_listLyt->isEmpty()) { + if (m_fileListView) { + m_fileListView->clear(); + } + if (m_dirListView) { + m_dirListView->clear(); + } + if (m_contentListView) { + m_contentListView->clear(); + } clearLayout(m_listLyt); m_resultList->setFixedHeight(0); } @@ -396,15 +405,6 @@ QString ContentWidget::getTitleName(const int& type) { * @param layout 需要清空的布局 */ void ContentWidget::clearLayout(QLayout * layout) { - if (m_fileListView) { - m_fileListView->clear(); - } - if (m_dirListView) { - m_dirListView->clear(); - } - if (m_contentListView) { - m_contentListView->clear(); - } m_contentList.clear(); if (! layout) return; QLayoutItem * child; diff --git a/src/control/config-file.cpp b/src/control/config-file.cpp index 43bfe2d..67b87e3 100644 --- a/src/control/config-file.cpp +++ b/src/control/config-file.cpp @@ -58,7 +58,6 @@ bool ConfigFile::writeRecently(QString message){ recently.insert(0,message); m_qSettings->beginGroup("Recently"); - qWarning()<value("Recently").toStringList().length(); if (m_qSettings->value("Recently").toStringList().length() >= 20) { m_qSettings->setValue("Recently",QStringList(recently.mid(0, 20))); } else { diff --git a/src/control/home-page-item.cpp b/src/control/home-page-item.cpp index db87111..973e910 100644 --- a/src/control/home-page-item.cpp +++ b/src/control/home-page-item.cpp @@ -34,20 +34,14 @@ void HomePageItem::setupUi(const int& type, const QString& path) { case SearchListView::ResType::Content: case SearchListView::ResType::Dir: case SearchListView::ResType::File: { - QProcess * process = new QProcess; - process->start(QString("xdg-open %1").arg(path)); - connect(process, static_cast(&QProcess::finished), this, [ = ]() { - process->deleteLater(); - }); + QProcess process; + process.start(QString("xdg-open %1").arg(path)); break; } case SearchListView::ResType::Setting: { //打开控制面板对应页面 - QProcess * process = new QProcess; - process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower())); - connect(process, static_cast(&QProcess::finished), this, [ = ]() { - process->deleteLater(); - }); + QProcess process; + process.start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower())); break; } default: diff --git a/src/control/search-detail-view.cpp b/src/control/search-detail-view.cpp index be7df2c..f47c7ad 100644 --- a/src/control/search-detail-view.cpp +++ b/src/control/search-detail-view.cpp @@ -251,21 +251,15 @@ bool SearchDetailView::openAction(const int& type, const QString& path) { case SearchListView::ResType::Content: case SearchListView::ResType::Dir: case SearchListView::ResType::File: { - QProcess * process = new QProcess; - process->start(QString("xdg-open %1").arg(path)); - connect(process, static_cast(&QProcess::finished), this, [ = ]() { - process->deleteLater(); - }); + QProcess process; + process.start(QString("xdg-open %1").arg(path)); return true; break; } case SearchListView::ResType::Setting: { //打开控制面板对应页面 - QProcess * process = new QProcess; - process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower())); - connect(process, static_cast(&QProcess::finished), this, [ = ]() { - process->deleteLater(); - }); + QProcess process; + process.start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower())); return true; break; } @@ -283,7 +277,9 @@ bool SearchDetailView::openAction(const int& type, const QString& path) { bool SearchDetailView::writeConfigFile(const QString& path) { if (ConfigFile::writeConfig(path)) { Q_EMIT this->configFileChanged(); + return true; } + return false; } /** @@ -299,11 +295,8 @@ bool SearchDetailView::addDesktopShortcut(const QString& path) { bool ret = file.copy(QString(dirpath+"/"+desktopfn)); if(ret) { - QProcess * process = new QProcess; - process->start(QString("chmod a+x %1").arg(newName)); - connect(process, static_cast(&QProcess::finished), this, [ = ]() { - process->deleteLater(); - }); + QProcess process; + process.start(QString("chmod a+x %1").arg(newName)); return true; } return false; @@ -328,6 +321,7 @@ bool SearchDetailView::addPanelShortcut(const QString& path) { qDebug()<<"qDebug: Add shortcut to panel successed!"; return true; } + return false; } /** @@ -335,11 +329,8 @@ bool SearchDetailView::addPanelShortcut(const QString& path) { * @return */ bool SearchDetailView::openPathAction(const QString& path) { - QProcess * process = new QProcess; - process->start(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/")))); - connect(process, static_cast(&QProcess::finished), this, [ = ]() { - process->deleteLater(); - }); + QProcess process; + process.start(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/")))); return true; } @@ -350,4 +341,5 @@ bool SearchDetailView::openPathAction(const QString& path) { bool SearchDetailView::copyPathAction(const QString& path) { QClipboard * clipboard = QApplication::clipboard(); //获取系统剪贴板指针 clipboard->setText(path); + return true; }