UI: AppInfoCache: Get by normalized path

This commit is contained in:
Nodir Temirkhodjaev 2024-02-11 12:04:11 +03:00
parent 1dff5f7345
commit 22e50a03b8
3 changed files with 9 additions and 4 deletions

View File

@ -15,7 +15,7 @@ namespace {
const QLoggingCategory LC("appInfo");
constexpr int DATABASE_USER_VERSION = 5;
constexpr int DATABASE_USER_VERSION = 6;
constexpr int APP_CACHE_MAX_COUNT = 2000;

View File

@ -263,7 +263,7 @@ void ConfAppManager::logBlockedApp(const LogEntryBlocked &logEntry)
if (appIdByPath(appPath) > 0)
return; // already added by user
const QString appName = IoC<AppInfoCache>()->appName(appOriginPath);
const QString appName = IoC<AppInfoCache>()->appName(appPath);
App app;
app.blocked = logEntry.blocked();

View File

@ -646,8 +646,13 @@ void ProgramEditDialog::fillEditName()
if (appPath.isEmpty())
return;
const QString appName =
isWildcard() ? appPath.replace('\n', ' ') : IoC<AppInfoCache>()->appName(appPath);
QString appName;
if (isWildcard()) {
appName = appPath.left(64).replace('\n', ' ');
} else {
appPath = FileUtil::normalizePath(appPath);
appName = IoC<AppInfoCache>()->appName(appPath);
}
m_editName->setText(appName);
}