fix(frontend): Optimize code for frontend.
Description: 优化前端Qprocess相关代码 Log: 优化前端Qprocess相关代码
This commit is contained in:
parent
3efac5701c
commit
db3e947e95
|
@ -35,19 +35,14 @@ void HomePageItem::setupUi(const int& type, const QString& path) {
|
||||||
case SearchListView::ResType::Dir:
|
case SearchListView::ResType::Dir:
|
||||||
case SearchListView::ResType::File: {
|
case SearchListView::ResType::File: {
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.start(QString("xdg-open %1").arg(path));
|
process.startDetached(QString("xdg-open %1").arg(path));
|
||||||
process.waitForFinished();
|
process.waitForFinished();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SearchListView::ResType::Setting: {
|
case SearchListView::ResType::Setting: {
|
||||||
//打开控制面板对应页面
|
//打开控制面板对应页面
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
process.startDetached(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
||||||
if (process) {
|
|
||||||
delete process;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -253,20 +253,14 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
|
||||||
case SearchListView::ResType::Dir:
|
case SearchListView::ResType::Dir:
|
||||||
case SearchListView::ResType::File: {
|
case SearchListView::ResType::File: {
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.start(QString("xdg-open %1").arg(path));
|
process.startDetached(QString("xdg-open %1").arg(path));
|
||||||
process.waitForFinished();
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SearchListView::ResType::Setting: {
|
case SearchListView::ResType::Setting: {
|
||||||
//打开控制面板对应页面
|
//打开控制面板对应页面
|
||||||
QProcess * process = new QProcess;
|
QProcess process;
|
||||||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
process.startDetached(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
||||||
if (process) {
|
|
||||||
delete process;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
process->start(QString("ukui-control-center --%1").arg(path.left(path.indexOf("/")).toLower()));
|
|
||||||
return true;
|
return true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -391,8 +385,7 @@ bool SearchDetailView::addDesktopShortcut(const QString& path) {
|
||||||
if(ret)
|
if(ret)
|
||||||
{
|
{
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.start(QString("chmod a+x %1").arg(newName));
|
process.startDetached(QString("chmod a+x %1").arg(newName));
|
||||||
process.waitForFinished();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -426,8 +419,7 @@ bool SearchDetailView::addPanelShortcut(const QString& path) {
|
||||||
*/
|
*/
|
||||||
bool SearchDetailView::openPathAction(const QString& path) {
|
bool SearchDetailView::openPathAction(const QString& path) {
|
||||||
QProcess process;
|
QProcess process;
|
||||||
process.start(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/"))));
|
process.startDetached(QString("xdg-open %1").arg(path.left(path.lastIndexOf("/"))));
|
||||||
process.waitForFinished();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue