зеркало из https://github.com/mozilla/pjs.git
Bug 437950 - Support for mailto: r=cbiesinger
This commit is contained in:
Родитель
52ec4b0f9d
Коммит
fbbe44d33d
|
@ -619,6 +619,11 @@ MOZ_DISTRIBUTION_ID = @MOZ_DISTRIBUTION_ID@
|
|||
NS_OSSO = @NS_OSSO@
|
||||
MOZ_PLATFORM_HILDON = @MOZ_PLATFORM_HILDON@
|
||||
|
||||
LIBHILDONMIME_CFLAGS = @LIBHILDONMIME_CFLAGS@
|
||||
LIBHILDONMIME_LIBS = @LIBHILDONMIME_LIBS@
|
||||
LIBOSSO_CFLAGS = @LIBOSSO_CFLAGS@
|
||||
LIBOSSO_LIBS = @LIBOSSO_LIBS@
|
||||
|
||||
MACOS_SDK_DIR = @MACOS_SDK_DIR@
|
||||
NEXT_ROOT = @NEXT_ROOT@
|
||||
GCC_VERSION = @GCC_VERSION@
|
||||
|
|
|
@ -6082,6 +6082,8 @@ PKG_CHECK_MODULES(LIBHILDONMIME,libhildonmime,
|
|||
if test $MOZ_PLATFORM_HILDON; then
|
||||
AC_DEFINE(MOZ_PLATFORM_HILDON)
|
||||
fi
|
||||
AC_SUBST(LIBHILDONMIME_CFLAGS)
|
||||
AC_SUBST(LIBHILDONMIME_LIBS)
|
||||
|
||||
PKG_CHECK_MODULES(LIBOSSO,libosso,
|
||||
NS_OSSO=1,
|
||||
|
@ -6093,6 +6095,8 @@ if test $NS_OSSO; then
|
|||
fi
|
||||
AC_DEFINE(NS_OSSO)
|
||||
fi
|
||||
AC_SUBST(LIBOSSO_CFLAGS)
|
||||
AC_SUBST(LIBOSSO_LIBS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl =
|
||||
|
|
|
@ -215,6 +215,14 @@ EXTRA_DSO_LDOPTS += \
|
|||
endif
|
||||
endif
|
||||
|
||||
ifdef MOZ_PLATFORM_HILDON
|
||||
EXTRA_DSO_LDOPTS += $(LIBHILDONMIME_LIBS)
|
||||
endif
|
||||
|
||||
ifdef NS_OSSO
|
||||
EXTRA_DSO_LDOPTS += $(LIBOSSO_LIBS)
|
||||
endif
|
||||
|
||||
ifdef MOZ_ENABLE_DBUS
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_DBUS_GLIB_LIBS)
|
||||
endif
|
||||
|
|
|
@ -37,14 +37,37 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
#include <glib.h>
|
||||
#include <hildon-uri.h>
|
||||
#endif
|
||||
|
||||
|
||||
#include "nsMIMEInfoUnix.h"
|
||||
#include "nsGNOMERegistry.h"
|
||||
#include "nsIGnomeVFSService.h"
|
||||
#ifdef MOZ_ENABLE_DBUS
|
||||
#include "nsDBusHandlerApp.h"
|
||||
#endif
|
||||
|
||||
|
||||
nsresult
|
||||
nsMIMEInfoUnix::LoadUriInternal(nsIURI * aURI)
|
||||
{
|
||||
return nsGNOMERegistry::LoadURL(aURI);
|
||||
{
|
||||
nsresult rv = nsGNOMERegistry::LoadURL(aURI);
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
if (NS_FAILED(rv)){
|
||||
HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
|
||||
if (action) {
|
||||
nsCAutoString spec;
|
||||
aURI->GetAsciiSpec(spec);
|
||||
if (hildon_uri_open(spec.get(), action, nsnull))
|
||||
rv = NS_OK;
|
||||
hildon_uri_action_unref(action);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -61,6 +84,15 @@ nsMIMEInfoUnix::GetHasDefaultHandler(PRBool *_retval)
|
|||
if (*_retval)
|
||||
return NS_OK;
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
HildonURIAction *action = hildon_uri_get_default_action(mType.get(), nsnull);
|
||||
if (action) {
|
||||
*_retval = PR_TRUE;
|
||||
hildon_uri_action_unref(action);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
// If we didn't find a VFS handler, fallback.
|
||||
return nsMIMEInfoImpl::GetHasDefaultHandler(_retval);
|
||||
}
|
||||
|
@ -84,3 +116,56 @@ nsMIMEInfoUnix::LaunchDefaultWithFile(nsIFile *aFile)
|
|||
|
||||
return LaunchWithIProcess(mDefaultApplication, nativePath);
|
||||
}
|
||||
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMIMEInfoUnix::GetPossibleApplicationHandlers(nsIMutableArray ** aPossibleAppHandlers)
|
||||
{
|
||||
if (!mPossibleApplications) {
|
||||
mPossibleApplications = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
|
||||
if (!mPossibleApplications)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
GSList *actions = hildon_uri_get_actions(mType.get(), nsnull);
|
||||
GSList *actionsPtr = actions;
|
||||
while (actionsPtr) {
|
||||
HildonURIAction *action = (HildonURIAction*)actionsPtr->data;
|
||||
actionsPtr = actionsPtr->next;
|
||||
nsDBusHandlerApp* app = new nsDBusHandlerApp();
|
||||
if (!app){
|
||||
hildon_uri_free_actions(actions);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
nsDependentCString method(hildon_uri_action_get_method(action));
|
||||
nsDependentCString key(hildon_uri_action_get_service(action));
|
||||
nsCString service, objpath, interface;
|
||||
app->SetMethod(method);
|
||||
app->SetName(NS_ConvertUTF8toUTF16(key));
|
||||
|
||||
if (key.FindChar('.', 0) > 0) {
|
||||
service.Assign(key);
|
||||
objpath.Assign(NS_LITERAL_CSTRING("/")+ key);
|
||||
objpath.ReplaceChar('.', '/');
|
||||
interface.Assign(key);
|
||||
} else {
|
||||
service.Assign(NS_LITERAL_CSTRING("com.nokia.")+ key);
|
||||
objpath.Assign(NS_LITERAL_CSTRING("/com/nokia/")+ key);
|
||||
interface.Assign(NS_LITERAL_CSTRING("com.nokia.")+ key);
|
||||
}
|
||||
|
||||
app->SetService(service);
|
||||
app->SetObjectPath(objpath);
|
||||
app->SetDBusInterface(interface);
|
||||
|
||||
mPossibleApplications->AppendElement(app, PR_FALSE);
|
||||
}
|
||||
hildon_uri_free_actions(actions);
|
||||
}
|
||||
|
||||
*aPossibleAppHandlers = mPossibleApplications;
|
||||
NS_ADDREF(*aPossibleAppHandlers);
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,6 +56,9 @@ protected:
|
|||
virtual NS_HIDDEN_(nsresult) LoadUriInternal(nsIURI *aURI);
|
||||
|
||||
virtual NS_HIDDEN_(nsresult) LaunchDefaultWithFile(nsIFile *aFile);
|
||||
#ifdef MOZ_PLATFORM_HILDON
|
||||
NS_IMETHOD GetPossibleApplicationHandlers(nsIMutableArray * *aPossibleAppHandlers);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // nsMIMEInfoUnix_h_
|
||||
|
|
Загрузка…
Ссылка в новой задаче