diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index 93326a9695..225406781a 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -566,20 +566,28 @@ AboutView::AddCopyrightEntry(const char *name, const char *text, if (i > 0) fCreditsView->Insert(", "); + BString licenseName; + BString licenseURL; + parse_named_url(license, licenseName, licenseURL); + BPath licensePath; - if (_GetLicensePath(license, licensePath) == B_OK) { - fCreditsView->InsertHyperText(license, + if (_GetLicensePath(licenseURL, licensePath) == B_OK) { + fCreditsView->InsertHyperText(licenseName, new OpenFileAction(licensePath.Path())); } else - fCreditsView->Insert(license); + fCreditsView->Insert(licenseName); } fCreditsView->Insert("\n"); } if (url) { + BString urlName; + BString urlAddress; + parse_named_url(url, urlName, urlAddress); + fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kLinkBlue); - fCreditsView->InsertHyperText(url, new URLAction(url)); + fCreditsView->InsertHyperText(urlName, new URLAction(urlAddress)); fCreditsView->Insert("\n"); } fCreditsView->Insert("\n"); diff --git a/src/apps/aboutsystem/Utilities.cpp b/src/apps/aboutsystem/Utilities.cpp index f5cc123b02..8ca61ab7e6 100644 --- a/src/apps/aboutsystem/Utilities.cpp +++ b/src/apps/aboutsystem/Utilities.cpp @@ -45,6 +45,26 @@ trim_string(const char* string, size_t len) } +void +parse_named_url(const BString& namedURL, BString& name, BString& url) +{ + int32 urlStart = namedURL.FindFirst('<'); + int32 urlEnd = namedURL.FindLast('>'); + if (urlStart < 0 || urlEnd < 0 || urlStart + 1 >= urlEnd) { + name = namedURL; + url = namedURL; + return; + } + + url.SetTo(namedURL.String() + urlStart + 1, urlEnd - urlStart - 1); + + if (urlStart > 0) + name = trim_string(namedURL, urlStart); + else + name = url; +} + + // #pragma mark - StringVector diff --git a/src/apps/aboutsystem/Utilities.h b/src/apps/aboutsystem/Utilities.h index ef9d9a5563..730af51db3 100644 --- a/src/apps/aboutsystem/Utilities.h +++ b/src/apps/aboutsystem/Utilities.h @@ -21,6 +21,8 @@ BString trim_string(const char* string, size_t len); // Removes leading and trailing white space and replaces all sequences // of white space by a single space. +void parse_named_url(const BString& namedURL, BString& name, BString& url); + class StringVector { public: