From f200563ee408f24178a35a0621efd181deeb9347 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Fri, 26 Apr 2024 19:30:39 +0300 Subject: [PATCH] UI: Programs: Improve name of wildcard paths --- src/ui/conf/confappmanager.cpp | 10 ++-------- src/ui/form/prog/programeditdialog.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/ui/conf/confappmanager.cpp b/src/ui/conf/confappmanager.cpp index 4ad41d0f..9f09c789 100644 --- a/src/ui/conf/confappmanager.cpp +++ b/src/ui/conf/confappmanager.cpp @@ -196,19 +196,13 @@ void ConfAppManager::updateAppEndTimer() bool ConfAppManager::addAppPathBlocked(App &app) { - // app.blocked - // app.alerted - // app.groupIndex - // app.appOriginPath - // app.scheduleAction - app.appId = appIdByPath(app.appOriginPath, app.appPath); if (app.appId > 0) - return false; // already added by user + return false; // already exists app.isWildcard = ConfUtil::matchWildcard(app.appPath).hasMatch(); - app.appName = IoC()->appName(app.appPath); + app.appName = app.isWildcard ? app.appOriginPath : IoC()->appName(app.appPath); const bool ok = addOrUpdateApp(app); if (ok) { diff --git a/src/ui/form/prog/programeditdialog.cpp b/src/ui/form/prog/programeditdialog.cpp index 2e866e85..ba830e85 100644 --- a/src/ui/form/prog/programeditdialog.cpp +++ b/src/ui/form/prog/programeditdialog.cpp @@ -708,16 +708,16 @@ QLayout *ProgramEditDialog::setupButtonsLayout() void ProgramEditDialog::fillEditName() { - auto appPath = getEditText(); + const QString appPath = getEditText(); if (appPath.isEmpty()) return; QString appName; if (isWildcard()) { - appName = appPath.left(64).replace('\n', ' '); + appName = StringUtil::firstLine(appPath); } else { - appPath = FileUtil::normalizePath(appPath); - appName = IoC()->appName(appPath); + const QString normPath = FileUtil::normalizePath(appPath); + appName = IoC()->appName(normPath); } m_editName->setStartText(appName);