https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4b0398184677dcd19a7e9…
commit 4b0398184677dcd19a7e9609f9d4eb8c42e00672
Author: Whindmar Saksit <whindsaks(a)proton.me>
AuthorDate: Sat Nov 4 22:08:10 2023 +0100
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Nov 4 22:08:10 2023 +0100
[RAPPS] Improve LicenseType handling (#5809)
Tries now to map the "License" text set to "Freeware" to the
LICENSE_FREEWARE "LicenseType" so it is translated correctly (LoadString).
Fixes the following:
- If only the "License" field is set in the DB, nothing will change
(this applies to 99% of the current entries in the DB).
- If both "LicenseType" and "License" are set, both will be used
(no observable change in behavior): "Open Source (GPL v2)" etc.
- If only "LicenseType" is set, it will now display just the type
"Freeware" instead of "Freeware ()".
This is done only for "Freeware", because the others (the open source
ones)
have many variations. "OpenSource", "Open Source", "Open
Source (GPL)" etc.
---
base/applications/rapps/appinfo.cpp | 11 +++++++++--
base/applications/rapps/include/appinfo.h | 10 +++++-----
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/base/applications/rapps/appinfo.cpp b/base/applications/rapps/appinfo.cpp
index 765f02016bb..7e00c4224e8 100644
--- a/base/applications/rapps/appinfo.cpp
+++ b/base/applications/rapps/appinfo.cpp
@@ -159,13 +159,18 @@ CAvailableApplicationInfo::LicenseString()
m_Parser->GetString(L"License", szLicenseString);
LicenseType licenseType;
- if (IsLicenseType(IntBuffer))
+ if (IsKnownLicenseType(IntBuffer))
{
licenseType = static_cast<LicenseType>(IntBuffer);
}
else
{
licenseType = LICENSE_NONE;
+ if (szLicenseString.CompareNoCase(L"Freeware") == 0)
+ {
+ licenseType = LICENSE_FREEWARE;
+ szLicenseString = L"";
+ }
}
CStringW szLicense;
@@ -184,7 +189,9 @@ CAvailableApplicationInfo::LicenseString()
return szLicenseString;
}
- return szLicense + L" (" + szLicenseString + L")";
+ if (!szLicenseString.IsEmpty())
+ szLicense += L" (" + szLicenseString + L")";
+ return szLicense;
}
VOID
diff --git a/base/applications/rapps/include/appinfo.h
b/base/applications/rapps/include/appinfo.h
index 7ea0c65e537..639d3fc8182 100644
--- a/base/applications/rapps/include/appinfo.h
+++ b/base/applications/rapps/include/appinfo.h
@@ -8,17 +8,17 @@
enum LicenseType
{
LICENSE_NONE,
- LICENSE_OPENSOURCE,
- LICENSE_FREEWARE,
- LICENSE_TRIAL,
+ LICENSE_OPENSOURCE = 1,
+ LICENSE_FREEWARE = 2,
+ LICENSE_TRIAL = 3,
LICENSE_MIN = LICENSE_NONE,
LICENSE_MAX = LICENSE_TRIAL
};
inline BOOL
-IsLicenseType(INT x)
+IsKnownLicenseType(INT x)
{
- return (x >= LICENSE_MIN && x <= LICENSE_MAX);
+ return (x > LICENSE_NONE && x <= LICENSE_MAX);
}
enum AppsCategories