Optimize code.

This commit is contained in:
zhangjiaping 2021-01-08 10:35:26 +08:00
parent 443c434019
commit 731311931d
2 changed files with 5 additions and 5 deletions

View File

@ -253,7 +253,7 @@ QString ContentWidget::getTitleName(const int& type) {
} }
/** /**
* @brief ContentWidget::clearLayout * @brief ContentWidget::clearLayout
* @param layout * @param layout
*/ */
void ContentWidget::clearLayout(QLayout * layout) { void ContentWidget::clearLayout(QLayout * layout) {

View File

@ -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) { void SearchDetailView::execActions(const int& type, const int& option, const QString& path) {
switch (option) { switch (option) {
case OptionView::Options::Open: { case OptionView::Options::Open: {
openAction(type, path); if (openAction(type, path)) {
writeConfigFile(path);
}
break; break;
} }
case OptionView::Options::Shortcut: { 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()); GDesktopAppInfo * desktopAppInfo = g_desktop_app_info_new_from_filename(path.toLocal8Bit().data());
g_app_info_launch(G_APP_INFO(desktopAppInfo),nullptr, nullptr, nullptr); g_app_info_launch(G_APP_INFO(desktopAppInfo),nullptr, nullptr, nullptr);
g_object_unref(desktopAppInfo); g_object_unref(desktopAppInfo);
writeConfigFile(path);
return true; return true;
break; 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, [ = ]() { connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater(); process->deleteLater();
}); });
writeConfigFile(path);
return true; return true;
break; 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, [ = ]() { connect(process, static_cast<void(QProcess::*)(int,QProcess::ExitStatus)>(&QProcess::finished), this, [ = ]() {
process->deleteLater(); process->deleteLater();
}); });
writeConfigFile(path);
return true; return true;
break; break;
} }
default: default:
return false;
break; break;
} }
} }