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
*/
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) {
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;
}
}