~ubuntu-branches/ubuntu/gutsy/audacity/gutsy-backports

« back to all changes in this revision

Viewing changes to src/widgets/LinkingHtmlWindow.cpp

  • Committer: Bazaar Package Importer
  • Author(s): John Dong
  • Date: 2008-02-18 21:58:19 UTC
  • mfrom: (13.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080218215819-tmbcf1rx238r8gdv
Tags: 1.3.4-1.1ubuntu1~gutsy1
Automated backport upload; no source changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
#include "LinkingHtmlWindow.h"
17
17
#include <wx/mimetype.h>
 
18
#include "../HelpText.h"
18
19
 
19
20
void OpenInDefaultBrowser(const wxHtmlLinkInfo& link)
20
21
{
22
23
      wxString openCmd = wxT("open ") + link.GetHref();
23
24
      ::wxExecute(openCmd);
24
25
   #else
25
 
      wxFileType* pFileType = wxTheMimeTypesManager->GetFileTypeFromExtension(wxT(".htm"));
26
 
      if (pFileType == NULL) 
27
 
         return;
28
 
      wxString openCmd = pFileType->GetOpenCommand(link.GetHref());
29
 
      if (openCmd.Contains(wxT("iexplore.exe")))
30
 
         // GetOpenCommand is not quite right for Internet Explorer.
31
 
         openCmd.Replace(wxT("WWW_OpenURL#\"file://"), wxT("WWW_OpenURL#\""));
32
 
      ::wxExecute(openCmd);
33
 
      delete pFileType;
 
26
      #ifdef __WXMSW__
 
27
         wxFileType* pFileType = wxTheMimeTypesManager->GetFileTypeFromExtension(wxT(".htm"));
 
28
         if (pFileType == NULL) 
 
29
            return;
 
30
         wxString openCmd = pFileType->GetOpenCommand(link.GetHref());
 
31
         if (openCmd.Contains(wxT("iexplore.exe")))
 
32
            // GetOpenCommand is not quite right for Internet Explorer.
 
33
            openCmd.Replace(wxT("WWW_OpenURL#\"file://"), wxT("WWW_OpenURL#\""));
 
34
         ::wxExecute(openCmd);
 
35
         delete pFileType;
 
36
      #else
 
37
         wxLaunchDefaultBrowser(link.GetHref());
 
38
      #endif
34
39
   #endif
35
40
};
36
41
 
44
49
 
45
50
void LinkingHtmlWindow::OnLinkClicked(const wxHtmlLinkInfo& link)
46
51
{
 
52
   wxString href = link.GetHref();
 
53
   if( href.StartsWith(wxT("innerlink:")) )
 
54
   {
 
55
      this->SetPage( HelpText( href.Mid( 10 )));
 
56
      this->GetParent()->SetLabel( TitleText( href.Mid( 10 )));
 
57
      return;
 
58
   }
47
59
   OpenInDefaultBrowser(link);
48
60
}