mirror of
https://github.com/tnodir/fort
synced 2024-11-15 07:15:39 +00:00
UI: Programs: Improve name of wildcard paths
This commit is contained in:
parent
89ee96ba1f
commit
f200563ee4
@ -196,19 +196,13 @@ void ConfAppManager::updateAppEndTimer()
|
|||||||
|
|
||||||
bool ConfAppManager::addAppPathBlocked(App &app)
|
bool ConfAppManager::addAppPathBlocked(App &app)
|
||||||
{
|
{
|
||||||
// app.blocked
|
|
||||||
// app.alerted
|
|
||||||
// app.groupIndex
|
|
||||||
// app.appOriginPath
|
|
||||||
// app.scheduleAction
|
|
||||||
|
|
||||||
app.appId = appIdByPath(app.appOriginPath, app.appPath);
|
app.appId = appIdByPath(app.appOriginPath, app.appPath);
|
||||||
|
|
||||||
if (app.appId > 0)
|
if (app.appId > 0)
|
||||||
return false; // already added by user
|
return false; // already exists
|
||||||
|
|
||||||
app.isWildcard = ConfUtil::matchWildcard(app.appPath).hasMatch();
|
app.isWildcard = ConfUtil::matchWildcard(app.appPath).hasMatch();
|
||||||
app.appName = IoC<AppInfoCache>()->appName(app.appPath);
|
app.appName = app.isWildcard ? app.appOriginPath : IoC<AppInfoCache>()->appName(app.appPath);
|
||||||
|
|
||||||
const bool ok = addOrUpdateApp(app);
|
const bool ok = addOrUpdateApp(app);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
|
@ -708,16 +708,16 @@ QLayout *ProgramEditDialog::setupButtonsLayout()
|
|||||||
|
|
||||||
void ProgramEditDialog::fillEditName()
|
void ProgramEditDialog::fillEditName()
|
||||||
{
|
{
|
||||||
auto appPath = getEditText();
|
const QString appPath = getEditText();
|
||||||
if (appPath.isEmpty())
|
if (appPath.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QString appName;
|
QString appName;
|
||||||
if (isWildcard()) {
|
if (isWildcard()) {
|
||||||
appName = appPath.left(64).replace('\n', ' ');
|
appName = StringUtil::firstLine(appPath);
|
||||||
} else {
|
} else {
|
||||||
appPath = FileUtil::normalizePath(appPath);
|
const QString normPath = FileUtil::normalizePath(appPath);
|
||||||
appName = IoC<AppInfoCache>()->appName(appPath);
|
appName = IoC<AppInfoCache>()->appName(normPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_editName->setStartText(appName);
|
m_editName->setStartText(appName);
|
||||||
|
Loading…
Reference in New Issue
Block a user