2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT license.
6 #include "HyperTextActions.h"
13 // #pragma mark - URLAction
16 URLAction::URLAction(const BString
& url
)
23 URLAction::~URLAction()
29 URLAction::Clicked(HyperTextView
* view
, BPoint where
, BMessage
* message
)
31 // be lazy and let /bin/open open the URL
33 if (get_ref_for_path("/bin/open", &ref
))
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
)
52 OpenFileAction::~OpenFileAction()
58 OpenFileAction::Clicked(HyperTextView
* view
, BPoint where
, BMessage
* message
)
60 // get the entry ref and let Tracker open the file
62 if (get_ref_for_path(fFile
.String(), &ref
) != B_OK
63 || !BEntry(&ref
).Exists()) {
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
);
73 be_roster
->Launch(&ref
);