1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:47:44 +00:00

LibDesktop: Add menu_name() to AppFile

This really just takes the [App].Name config value and removes the
ampersands `&` from the name. These ampersands are hotkeys for the
system menu. Instead of typing them twice - error prone  - use the
fact that name is just menu_name without the ampersand. Remove the
ampersand to use as the name and use it as is as the menu_name.
This commit is contained in:
Hugh Davenport 2024-01-04 08:19:34 +13:00 committed by Andrew Kaster
parent f5dec55fd6
commit 6ab315ae69
3 changed files with 11 additions and 2 deletions

View file

@ -69,6 +69,13 @@ bool AppFile::validate() const
}
ByteString AppFile::name() const
{
auto name = m_config->read_entry("App", "Name").trim_whitespace().replace("&"sv, ""sv);
VERIFY(!name.is_empty());
return name;
}
ByteString AppFile::menu_name() const
{
auto name = m_config->read_entry("App", "Name").trim_whitespace();
VERIFY(!name.is_empty());