Develop and Download Open Source Software

Browse CVS Repository

Diff of /malonnote/mnNotePanelController.cpp

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

revision 1.5 by maloninc, Wed Dec 28 01:49:51 2005 UTC revision 1.9 by maloninc, Fri Jan 20 12:49:54 2006 UTC
# Line 220  void mnNotePanelController::handleEdit(w Line 220  void mnNotePanelController::handleEdit(w
220    
221  wxString mnNotePanelController::delPercent(const wxString& str)  wxString mnNotePanelController::delPercent(const wxString& str)
222  {  {
223    #ifdef __WXMAC__
224          wxURI uri;          wxURI uri;
   
225          return uri.Unescape(str);          return uri.Unescape(str);
226    #else
227            return str;
228    #endif
229  }  }
230    
231    
# Line 286  void mnNotePanelController::handleLinkCl Line 289  void mnNotePanelController::handleLinkCl
289                  wxRegEx exp(wxT(MNDOC));                  wxRegEx exp(wxT(MNDOC));
290                  exp.Replace(&href, wxT(""));                  exp.Replace(&href, wxT(""));
291                  wikiDataDir = wiki->getWikiDataDir();                  wikiDataDir = wiki->getWikiDataDir();
292                  wxString doc = *wikiDataDir + wxT("/docs/") + delPercent(href);                  wxString doc = *wikiDataDir + wxT(DOCS_DIR) + delPercent(href);
293                  openDoc(doc);                  openDoc(doc);
294          }          }
295          else {          else {
# Line 301  void mnNotePanelController::handleOpenDo Line 304  void mnNotePanelController::handleOpenDo
304          wxString docDir;          wxString docDir;
305    
306          wikiDataDir = wiki->getWikiDataDir();          wikiDataDir = wiki->getWikiDataDir();
307          docDir = *wikiDataDir + wxT("/docs/");          docDir = *wikiDataDir + wxT(DOCS_DIR);
308    
309          /* create docs directory, anyway */          /* create docs directory, anyway */
310          cmd.sprintf(wxT("mkdir %s"), docDir.c_str());          cmd.sprintf(wxT(MKDIR), docDir.c_str());
311          wxExecute(cmd);          wxExecute(cmd);
312    
313          /* open docs directory */          /* open docs directory */
314          openDoc(docDir);          openDir(docDir);
315  }  }
316    
317  void mnNotePanelController::openUrl(wxString& url)  void mnNotePanelController::openUrl(wxString& url)
# Line 320  void mnNotePanelController::openUrl(wxSt Line 323  void mnNotePanelController::openUrl(wxSt
323  #endif  #endif
324    
325  #ifdef __WXMAC__  #ifdef __WXMAC__
326          cmd.sprintf(wxT("open %s"), url.c_str());          cmd.sprintf(wxT("open \'%s\'"), url.c_str());
327  #endif  #endif
328    
329  #ifdef __WXCOCOA__  #ifdef __WXCOCOA__
330          cmd.sprintf(wxT("open %s"), url.c_str());          cmd.sprintf(wxT("open \'%s\'"), url.c_str());
331  #endif  #endif
332    
333  #ifdef __WXGTK__  #ifdef __WXGTK__
334          cmd.sprintf(wxT("gnome-open %s"), url.c_str());          cmd.sprintf(wxT("gnome-open \'%s\'"), url.c_str());
335  #endif  #endif
336    
337          //wxExecute(argv);          //wxExecute(argv);
# Line 340  void mnNotePanelController::openDoc(wxSt Line 343  void mnNotePanelController::openDoc(wxSt
343          wxString cmd;          wxString cmd;
344    
345  #ifdef __WXMSW__  #ifdef __WXMSW__
346          cmd.sprintf(wxT("cmd /c \"start %s\""), doc.c_str());          wxString tempFile = wxFileName::CreateTempFileName(wxT("malonnote-temp"));
347            FILE* fp;
348    
349    wxLogMessage(wxT("temp:[%s]"), tempFile.c_str());
350    return;
351            fp = fopen(tempFile.mb_str(), "w");
352            fprintf(fp, "Set obj = CreateObject(\"Shell.Application\")\n");
353            fprintf(fp, "obj.Open \"%s\"", doc.mb_str());
354            fclose(fp);
355            ///cmd.sprintf(wxT("cscript \"%s\""), tempFile.c_str());
356  #endif  #endif
357    
358  #ifdef __WXMAC__  #ifdef __WXMAC__
359          cmd.sprintf(wxT("open %s"), doc.c_str());          cmd.sprintf(wxT("open \'%s\'"), doc.c_str());
360  #endif  #endif
361    
362  #ifdef __WXCOCOA__  #ifdef __WXCOCOA__
363          cmd.sprintf(wxT("open %s"), doc.c_str());          cmd.sprintf(wxT("open \'%s\'"), doc.c_str());
364  #endif  #endif
365    
366  #ifdef __WXGTK__  #ifdef __WXGTK__
367          cmd.sprintf(wxT("gnome-open %s"), doc.c_str());          cmd.sprintf(wxT("gnome-open \'%s\'"), doc.c_str());
368    #endif
369    
370            wxExecute(cmd, wxEXEC_ASYNC);
371    }
372    
373    void mnNotePanelController::openDir(wxString& dir)
374    {
375            wxString cmd;
376    
377    #ifdef __WXMSW__
378            cmd.sprintf(wxT("explorer \"%s\""), dir.c_str());
379    #endif
380    
381    #ifdef __WXMAC__
382            cmd.sprintf(wxT("open \'%s\'"), dir.c_str());
383    #endif
384    
385    #ifdef __WXCOCOA__
386            cmd.sprintf(wxT("open \'%s\'"), dir.c_str());
387    #endif
388    
389    #ifdef __WXGTK__
390            cmd.sprintf(wxT("gnome-open \'%s\'"), dir.c_str());
391  #endif  #endif
392    
393          wxExecute(cmd);          wxExecute(cmd);
394  }  }
395    
396    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.9

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