View | Details | Raw Unified | Return to bug 21511
Collapse All | Expand All

(-)uriloader/exthandler/nsMIMEInfoImpl.cpp (-1 / +1 lines)
Lines 408-420 nsMIMEInfoBase::LaunchWithURI(nsIURI* aU Link Here
408
}
408
}
409
409
410
void
410
void
411
nsMIMEInfoBase::CopyBasicDataTo(nsMIMEInfoBase* aOther)
411
nsMIMEInfoBase::CopyBasicDataTo(nsMIMEInfoBase* aOther)
412
{
412
{
413
  aOther->mType = mType;
413
  aOther->mType = mType;
414
  aOther->mDefaultAppDescription = mDefaultAppDescription;
414
  //aOther->mDefaultAppDescription = mDefaultAppDescription;
415
  aOther->mExtensions = mExtensions;
415
  aOther->mExtensions = mExtensions;
416
416
417
  aOther->mMacType = mMacType;
417
  aOther->mMacType = mMacType;
418
  aOther->mMacCreator = mMacCreator;
418
  aOther->mMacCreator = mMacCreator;
419
}
419
}
420
420
(-)uriloader/exthandler/unix/nsOSHelperAppService.cpp (+4 lines)
Lines 1621-1632 nsOSHelperAppService::GetMIMEInfoFromOS( Link Here
1621
      
1621
      
1622
      return retval;
1622
      return retval;
1623
    }
1623
    }
1624
1624
1625
    // Copy the attributes of retval onto miByExt, to return it
1625
    // Copy the attributes of retval onto miByExt, to return it
1626
    retval->CopyBasicDataTo(miByExt);
1626
    retval->CopyBasicDataTo(miByExt);
1627
    // But set the extensions primary since CopyBasicDataTo overwrites the
1628
    // list
1629
    if (!aFileExt.IsEmpty())
1630
      retval->SetPrimaryExtension(aFileExt);
1627
1631
1628
    miByExt.swap(retval);
1632
    miByExt.swap(retval);
1629
  }
1633
  }
1630
  return retval;
1634
  return retval;
1631
}
1635
}
1632
1636
(-)uriloader/exthandler/unix/nsMIMEInfoUnix.cpp.orig (-5 / +19 lines)
Lines 46-57 Link Here
46
#include "nsMIMEInfoUnix.h"
46
#include "nsMIMEInfoUnix.h"
47
#include "nsGNOMERegistry.h"
47
#include "nsGNOMERegistry.h"
48
#include "nsIGnomeVFSService.h"
48
#include "nsIGnomeVFSService.h"
49
#ifdef MOZ_ENABLE_DBUS
49
#ifdef MOZ_ENABLE_DBUS
50
#include "nsDBusHandlerApp.h"
50
#include "nsDBusHandlerApp.h"
51
#endif
51
#endif
52
#include "nsAutoPtr.h"
52
53
53
54
54
nsresult
55
nsresult
55
nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
56
nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
56
{ 
57
{ 
57
  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
58
  nsresult rv = nsGNOMERegistry::LoadURL(aURI);
Lines 71-89 nsMIMEInfoUnix::LoadUriInternal(nsIURI * Link Here
71
}
72
}
72
73
73
NS_IMETHODIMP
74
NS_IMETHODIMP
74
nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
75
nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
75
{
76
{
76
  *_retval = PR_FALSE;
77
  *_retval = PR_FALSE;
77
  nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
78
  nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromType(mType);
78
  if (vfs) {
79
  if (!mimeInfo) {
79
    nsCOMPtr<nsIGnomeVFSMimeApp> app;
80
     nsCAutoString ext;
80
    if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app)
81
     GetPrimaryExtension(ext);
81
      *_retval = PR_TRUE;
82
     mimeInfo = nsGNOMERegistry::GetFromExtension(ext);
82
  }
83
  }
83
84
85
  if (mimeInfo)
86
    *_retval = PR_TRUE;
87
84
  if (*_retval)
88
  if (*_retval)
85
    return NS_OK;
89
    return NS_OK;
86
90
87
#ifdef MOZ_PLATFORM_HILDON
91
#ifdef MOZ_PLATFORM_HILDON
88
  HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
92
  HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
89
  if (action) {
93
  if (action) {
Lines 106-117 nsMIMEInfoUnix::LaunchDefaultWithFile(ns Link Here
106
  nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
110
  nsCOMPtr<nsIGnomeVFSService> vfs = do_GetService(NS_GNOMEVFSSERVICE_CONTRACTID);
107
111
108
  if (vfs) {
112
  if (vfs) {
109
    nsCOMPtr<nsIGnomeVFSMimeApp> app;
113
    nsCOMPtr<nsIGnomeVFSMimeApp> app;
110
    if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app)
114
    if (NS_SUCCEEDED(vfs->GetAppForMimeType(mType, getter_AddRefs(app))) && app)
111
      return app->Launch(nativePath);
115
      return app->Launch(nativePath);
116
117
    // If we haven't got an app we try to get a valid one by searching for the
118
    // extension mapped type
119
    nsRefPtr<nsMIMEInfoBase> mimeInfo = nsGNOMERegistry::GetFromExtension(nativePath);
120
    if (mimeInfo) {
121
      nsCAutoString type;
122
      mimeInfo->GetType(type);
123
      if (NS_SUCCEEDED(vfs->GetAppForMimeType(type, getter_AddRefs(app))) && app)
124
        return app->Launch(nativePath);
125
    }
112
  }
126
  }
113
127
114
  if (!mDefaultApplication)
128
  if (!mDefaultApplication)
115
    return NS_ERROR_FILE_NOT_FOUND;
129
    return NS_ERROR_FILE_NOT_FOUND;
116
130
117
  return LaunchWithIProcess(mDefaultApplication, nativePath);
131
  return LaunchWithIProcess(mDefaultApplication, nativePath);

Return to bug 21511