btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / apps / aboutsystem / HyperTextActions.cpp
blob5c8770ca26a1d2a730aaa428879fa3eb7f0631e2
1 /*
2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT license.
4 */
6 #include "HyperTextActions.h"
8 #include <Entry.h>
9 #include <Message.h>
10 #include <Roster.h>
13 // #pragma mark - URLAction
16 URLAction::URLAction(const BString& url)
18 fURL(url)
23 URLAction::~URLAction()
28 void
29 URLAction::Clicked(HyperTextView* view, BPoint where, BMessage* message)
31 // be lazy and let /bin/open open the URL
32 entry_ref ref;
33 if (get_ref_for_path("/bin/open", &ref))
34 return;
36 const char* args[] = { "/bin/open", fURL.String(), NULL };
37 be_roster->Launch(&ref, 2, args);
42 // #pragma mark - OpenFileAction
45 OpenFileAction::OpenFileAction(const BString& file)
47 fFile(file)
52 OpenFileAction::~OpenFileAction()
57 void
58 OpenFileAction::Clicked(HyperTextView* view, BPoint where, BMessage* message)
60 // get the entry ref and let Tracker open the file
61 entry_ref ref;
62 if (get_ref_for_path(fFile.String(), &ref) != B_OK
63 || !BEntry(&ref).Exists()) {
64 return;
67 BMessenger tracker("application/x-vnd.Be-TRAK");
68 if (tracker.IsValid()) {
69 BMessage message(B_REFS_RECEIVED);
70 message.AddRef("refs", &ref);
71 tracker.SendMessage(&message);
72 } else
73 be_roster->Launch(&ref);