Add DB_DIR placeholder for autoopen urls

This commit is contained in:
stingray21 2020-05-20 22:44:38 -04:00 committed by Jonathan White
parent bcb64a231f
commit d863496f62
3 changed files with 13 additions and 6 deletions

View file

@ -903,6 +903,10 @@ QString Entry::resolvePlaceholderRecursive(const QString& placeholder, int maxDe
return url();
}
return resolveMultiplePlaceholdersRecursive(url(), maxDepth - 1);
case PlaceholderType::DbDir: {
QFileInfo fileInfo(database()->filePath());
return fileInfo.absoluteDir().absolutePath();
}
case PlaceholderType::UrlWithoutScheme:
case PlaceholderType::UrlScheme:
case PlaceholderType::UrlHost:
@ -1237,7 +1241,8 @@ Entry::PlaceholderType Entry::placeholderType(const QString& placeholder) const
{QStringLiteral("{DT_UTC_DAY}"), PlaceholderType::DateTimeUtcDay},
{QStringLiteral("{DT_UTC_HOUR}"), PlaceholderType::DateTimeUtcHour},
{QStringLiteral("{DT_UTC_MINUTE}"), PlaceholderType::DateTimeUtcMinute},
{QStringLiteral("{DT_UTC_SECOND}"), PlaceholderType::DateTimeUtcSecond}};
{QStringLiteral("{DT_UTC_SECOND}"), PlaceholderType::DateTimeUtcSecond},
{QStringLiteral("{DB_DIR}"), PlaceholderType::DbDir}};
return placeholders.value(placeholder.toUpper(), PlaceholderType::Unknown);
}