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 需要清空的布局
|
* @param layout 需要清空的布局
|
||||||
*/
|
*/
|
||||||
void ContentWidget::clearLayout(QLayout * 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) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue