Browse CVS Repository
Diff of /malonnote/mnController.cpp
Parent Directory
| Revision Log
| Revision Graph
| Patch
| 4 |
#include "mnDef.h" |
#include "mnDef.h" |
| 5 |
#include "mnController.h" |
#include "mnController.h" |
| 6 |
#include <wx/config.h> |
#include <wx/config.h> |
| 7 |
|
#include <wx/tokenzr.h> |
| 8 |
|
#include <wx/utils.h> |
| 9 |
|
|
| 10 |
BEGIN_EVENT_TABLE(mnController, wxEvtHandler) |
BEGIN_EVENT_TABLE(mnController, wxEvtHandler) |
| 11 |
EVT_TEXT_ENTER(ID_SearchTextCtrl, mnController::handleSearch) |
EVT_TEXT_ENTER(ID_SearchTextCtrl, mnController::handleSearch) |
| 233 |
|
|
| 234 |
void mnController::handleLinkClick(wxCommandEvent &event) |
void mnController::handleLinkClick(wxCommandEvent &event) |
| 235 |
{ |
{ |
| 236 |
wxLogMessage(event.GetString()); |
wxString href = event.GetString(); |
| 237 |
|
wxString tag; |
| 238 |
|
wxString url; |
| 239 |
|
wxStringTokenizer tkz(href, wxT(":")); |
| 240 |
|
|
| 241 |
|
tag = tkz.GetNextToken(); |
| 242 |
|
url = tkz.GetNextToken(); |
| 243 |
|
|
| 244 |
|
if(tag.Cmp(wxT("mnlink")) == 0) { |
| 245 |
|
event.SetString(url); |
| 246 |
|
handleSearch(event); |
| 247 |
|
} |
| 248 |
|
else { |
| 249 |
|
openUrl(href); |
| 250 |
|
} |
| 251 |
} |
} |
| 252 |
|
|
| 253 |
|
void mnController::openUrl(wxString& url) |
| 254 |
|
{ |
| 255 |
|
wxChar* argv[5]; |
| 256 |
|
wxString cmd; |
| 257 |
|
|
| 258 |
|
#ifdef __WXMSW__ |
| 259 |
|
argv[0] = wxT("explorer"); |
| 260 |
|
argv[1] = (wxChar*)url.c_str(); |
| 261 |
|
argv[2] = NULL; |
| 262 |
|
cmd.sprintf(wxT("explorer %s"), url.c_str()); |
| 263 |
|
#endif |
| 264 |
|
|
| 265 |
|
#ifdef __WXMAC__ |
| 266 |
|
cmd.sprintf(wxT("open %s"), url.c_str()); |
| 267 |
|
#endif |
| 268 |
|
|
| 269 |
|
#ifdef __WXCOCOA__ |
| 270 |
|
cmd.sprintf(wxT("open %s"), url.c_str()); |
| 271 |
|
#endif |
| 272 |
|
|
| 273 |
|
#ifdef __WXGTK__ |
| 274 |
|
wxLogMessage(wxT("Ooops!, I don't know how to launch %s"), url.c_str()); |
| 275 |
|
return; |
| 276 |
|
#endif |
| 277 |
|
|
| 278 |
|
//wxExecute(argv); |
| 279 |
|
wxExecute(cmd); |
| 280 |
|
} |
|
|
Legend:
| Removed from v.1.7 |
|
| changed lines |
| |
Added in v.1.8 |
|
|
| |