Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnController.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.7 by maloninc, Mon Aug 1 10:46:20 2005 UTC revision 1.8 by maloninc, Tue Aug 2 07:21:38 2005 UTC
# Line 4  Line 4 
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)
# Line 231  void mnController::handleEditButton(wxCo Line 233  void mnController::handleEditButton(wxCo
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

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26