40 return (
int)(intptr_t)ShellExecute(
nullptr,
"open", link.text(),
nullptr,
nullptr, SW_SHOWNORMAL) > 32 ? 1 : 0;
42 FXString ext = FXPath::extension(link);
44 if (comparecase(link.section(
':', 0),
"http") == 0 ||
45 comparecase(link.section(
':', 0),
"https") == 0 ||
46 comparecase(link.section(
':', 0),
"ftp") == 0 ||
47 comparecase(ext,
"htm") == 0 || comparecase(ext,
"html") == 0 ||
48 comparecase(ext,
"php") == 0 || comparecase(ext,
"asp") == 0) {
49 list =
"firefox\tchromium\tkonqueror\tdillo\tlynx\topen";
50 }
else if (comparecase(ext,
"pdf") == 0) {
51 list =
"acroread\tkghostview\tgpdf\txpdf";
57 FXString path = FXSystem::getExecPath();
59 software = list.section(
"\t", index);
60 while (!software.empty()) {
61 software = FXPath::search(path, software);
62 if (software.length())
63 return system(FXString().format(
"%s \"%s\" >/dev/null 2>&1 & ",
64 software.text(), link.text()).text()) > 0 ? 0 : 1;
66 software = list.section(
"\t", index);
68 }
else if (FXStat::isExecutable(link)) {
69 return system((link +
" >/dev/null 2>&1 & ").text()) > 0 ? 0 : 1;
81 FXIMPLEMENT(
MFXLinkLabel, FXLabel, MFXLinkLabelMap, ARRAYNUMBER(MFXLinkLabelMap))
84 MFXLinkLabel::
MFXLinkLabel(FXComposite* p, const FXString& text, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h, FXint pl, FXint pr, FXint pt, FXint pb) : FXLabel(p, text, ic, opts, x, y, w, h, pl, pr, pt, pb) {
85 setDefaultCursor(getApp()->getDefaultCursor(DEF_HAND_CURSOR));
86 setTextColor(FXRGB(0, 0, 255));
90 getApp()->removeTimeout(
this,
ID_TIMER);
94 FXString link = getTipText();
96 getApp()->beginWaitCursor();
98 getApp()->addTimeout(
this,
ID_TIMER, 2000);
100 getApp()->endWaitCursor();
108 getApp()->endWaitCursor();
FXDEFMAP(MFXLinkLabel) MFXLinkLabelMap[]
long onTimer(FXObject *, FXSelector, void *)
long onLeftBtnPress(FXObject *, FXSelector, void *)
static FXint fxexecute(FXString link)
virtual ~MFXLinkLabel()
Destructor.