Optimize code.
This commit is contained in:
parent
443c434019
commit
731311931d
|
@ -253,7 +253,7 @@ QString ContentWidget::getTitleName(const int& type) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief ContentWidget::clearLayout 清空搜索结果列表
|
||||
* @brief ContentWidget::clearLayout 清空某个布局
|
||||
* @param layout 需要清空的布局
|
||||
*/
|
||||
void ContentWidget::clearLayout(QLayout * layout) {
|
||||
|
|
|
@ -209,7 +209,9 @@ void SearchDetailView::setupWidget(const int& type, const QString& path) {
|
|||
void SearchDetailView::execActions(const int& type, const int& option, const QString& path) {
|
||||
switch (option) {
|
||||
case OptionView::Options::Open: {
|
||||
openAction(type, path);
|
||||
if (openAction(type, path)) {
|
||||
writeConfigFile(path);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OptionView::Options::Shortcut: {
|
||||
|
@ -243,7 +245,6 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
|
|||
GDesktopAppInfo * desktopAppInfo = g_desktop_app_info_new_from_filename(path.toLocal8Bit().data());
|
||||
g_app_info_launch(G_APP_INFO(desktopAppInfo),nullptr, nullptr, nullptr);
|
||||
g_object_unref(desktopAppInfo);
|
||||
writeConfigFile(path);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
@ -255,7 +256,6 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
|
|||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
||||
process->deleteLater();
|
||||
});
|
||||
writeConfigFile(path);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
@ -266,11 +266,11 @@ bool SearchDetailView::openAction(const int& type, const QString& path) {
|
|||
connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
|
||||
process->deleteLater();
|
||||
});
|
||||
writeConfigFile(path);
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue