From 976b547224ff78d2f15a4df1413f790cba9bc98f Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Wed, 18 Sep 2013 22:32:45 +0200 Subject: [PATCH] HaikuDepot: Implement publisher hyperlink handling. - Clicking the publisher link now actually attempts to open the site in the browser. --- src/apps/haiku-depot/PackageInfoView.cpp | 25 +++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/apps/haiku-depot/PackageInfoView.cpp b/src/apps/haiku-depot/PackageInfoView.cpp index 64bd2fb69f..85c9eaab20 100644 --- a/src/apps/haiku-depot/PackageInfoView.cpp +++ b/src/apps/haiku-depot/PackageInfoView.cpp @@ -24,6 +24,8 @@ #include #include +#include + #include "BitmapButton.h" #include "BitmapView.h" #include "MarkupParser.h" @@ -654,6 +656,27 @@ public: Clear(); } + virtual void AttachedToWindow() + { + fWebsiteLinkView->SetTarget(this); + } + + virtual void MessageReceived(BMessage* message) + { + switch(message->what) { + case MSG_VISIT_PUBLISHER_WEBSITE: + { + BPrivate::Support::BUrl url(fWebsiteLinkView->Text()); + url.OpenWithPreferredApplication(); + break; + } + + default: + BView::MessageReceived(message); + break; + } + } + void SetPackage(const PackageInfo& package) { fDescriptionView->SetText(package.ShortDescription(), @@ -696,7 +719,7 @@ private: SharedBitmap fWebsiteIcon; BitmapView* fWebsiteIconView; - BStringView* fWebsiteLinkView; + LinkView* fWebsiteLinkView; };