fix(frontend): Process crushed when openning apps.
Description: 修复打开应用时全局搜索崩溃的问题 Log: 修复打开应用时全局搜索崩溃的问题 Bug: http://172.17.66.192/biz/bug-view-33144.html
This commit is contained in:
parent
b044ca189f
commit
4e0ee32008
|
@ -158,6 +158,15 @@ int ContentWidget::currentPage() {
|
|||
*/
|
||||
void ContentWidget::refreshSearchList(const QVector<int>& types, const QVector<QStringList>& 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;
|
||||
|
|
|
@ -58,7 +58,6 @@ bool ConfigFile::writeRecently(QString message){
|
|||
recently.insert(0,message);
|
||||
|
||||
m_qSettings->beginGroup("Recently");
|
||||
qWarning()<<m_qSettings->value("Recently").toStringList().length();
|
||||
if (m_qSettings->value("Recently").toStringList().length() >= 20) {
|
||||
m_qSettings->setValue("Recently",QStringList(recently.mid(0, 20)));
|
||||
} else {
|
||||
|
|
|
@ -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<void(QProcess::*)(int,QProcess::ExitStatus)>(&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<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
||||
process->deleteLater();
|
||||
});
|
||||
QProcess process;
|
||||
process.start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -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<void(QProcess::*)(int,QProcess::ExitStatus)>(&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<void(QProcess::*)(int,QProcess::ExitStatus)>(&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<void(QProcess::*)(int,QProcess::ExitStatus)>(&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<void(QProcess::*)(int,QProcess::ExitStatus)>(&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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue