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.7 by maloninc, Fri Dec 30 00:54:06 2005 UTC revision 1.10 by maloninc, Tue Jan 24 09:31:13 2006 UTC
# Line 307  void mnNotePanelController::handleOpenDo Line 307  void mnNotePanelController::handleOpenDo
307          docDir = *wikiDataDir + wxT(DOCS_DIR);          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 323  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 343  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            tempFile = tempFile + wxT(".vbs");
350            fp = fopen((const char*)tempFile.mb_str(), "w");
351            if(fp == NULL) {
352                    wxLogMessage(wxT("Cant't create temp file"));
353                    return;
354            }
355            fprintf(fp, "Set obj = CreateObject(\"Shell.Application\")\n");
356            fprintf(fp, "obj.Open \"%s\"", (const char*)doc.mb_str());
357            fclose(fp);
358            cmd.sprintf(wxT("cscript \"%s\""), tempFile.c_str());
359  #endif  #endif
360    
361  #ifdef __WXMAC__  #ifdef __WXMAC__
362          cmd.sprintf(wxT("open %s"), doc.c_str());          cmd.sprintf(wxT("open \'%s\'"), doc.c_str());
363  #endif  #endif
364    
365  #ifdef __WXCOCOA__  #ifdef __WXCOCOA__
366          cmd.sprintf(wxT("open %s"), doc.c_str());          cmd.sprintf(wxT("open \'%s\'"), doc.c_str());
367  #endif  #endif
368    
369  #ifdef __WXGTK__  #ifdef __WXGTK__
370          cmd.sprintf(wxT("gnome-open %s"), doc.c_str());          cmd.sprintf(wxT("gnome-open \'%s\'"), doc.c_str());
371    #endif
372    
373            wxExecute(cmd, wxEXEC_ASYNC);
374    }
375    
376    void mnNotePanelController::openDir(wxString& dir)
377    {
378            wxString cmd;
379    
380    #ifdef __WXMSW__
381            cmd.sprintf(wxT("explorer \"%s\""), dir.c_str());
382    #endif
383    
384    #ifdef __WXMAC__
385            cmd.sprintf(wxT("open \'%s\'"), dir.c_str());
386    #endif
387    
388    #ifdef __WXCOCOA__
389            cmd.sprintf(wxT("open \'%s\'"), dir.c_str());
390    #endif
391    
392    #ifdef __WXGTK__
393            cmd.sprintf(wxT("gnome-open \'%s\'"), dir.c_str());
394  #endif  #endif
395    
396          wxExecute(cmd);          wxExecute(cmd);
397  }  }
398    
399    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.10

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