Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes
nsMailGNOMEIntegration Class Reference

#include <nsMailGNOMEIntegration.h>

Inheritance diagram for nsMailGNOMEIntegration:
Inheritance graph
[legend]
Collaboration diagram for nsMailGNOMEIntegration:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE 
NS_HIDDEN_ (nsresult) Init()
 nsMailGNOMEIntegration ()
boolean isDefaultClient (in boolean aStartupCheck, in unsigned short aApps)
 Determines whether or not Thunderbird is the "Default Client" for the passed in app type.
void setDefaultClient (in boolean aForAllUsers, in unsigned short aApps)
 Registers Thunderbird as the "Default Mail Client" for the passed in app type.

Public Attributes

const unsigned short MAIL = 0x0001
 app types we can be registered to handle
const unsigned short NEWS = 0x0002
const unsigned short RSS = 0x0004
attribute boolean shouldCheckDefaultClient
 Used to determine whether or not to show a "Set Default Client" query dialog.

Private Member Functions

virtual ~nsMailGNOMEIntegration ()
 NS_HIDDEN_ (PRBool) KeyMatchesAppName(const char *aKeyValue) const
PRBool checkDefault (const char *const *aProtocols, unsigned int aLength)
 NS_HIDDEN_ (nsresult) MakeDefault(const char *const *aProtocols

Private Attributes

unsigned int aLength
PRPackedBool mUseLocaleFilenames
PRPackedBool mCheckedThisSession
nsCString mAppPath

Detailed Description

Definition at line 49 of file nsMailGNOMEIntegration.h.


Constructor & Destructor Documentation

Definition at line 72 of file nsMailGNOMEIntegration.cpp.

virtual nsMailGNOMEIntegration::~nsMailGNOMEIntegration ( ) [inline, private, virtual]

Definition at line 59 of file nsMailGNOMEIntegration.h.

{};

Member Function Documentation

PRBool nsMailGNOMEIntegration::checkDefault ( const char *const aProtocols,
unsigned int  aLength 
) [private]

Definition at line 185 of file nsMailGNOMEIntegration.cpp.

{
  nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);

  PRBool enabled;
  nsCAutoString handler;

  for (unsigned int i = 0; i < aLength; ++i) {
    handler.Truncate();
    nsresult rv = gconf->GetAppForProtocol(nsDependentCString(aProtocols[i]),
                                           &enabled, handler);
    if (NS_SUCCEEDED(rv))
    {
    // The string will be something of the form: [/path/to/]app "%s"
    // We want to remove all of the parameters and get just the binary name.

    gint argc;
    gchar **argv;

    if (g_shell_parse_argv(handler.get(), &argc, &argv, NULL) && argc > 0) {
      handler.Assign(argv[0]);
      g_strfreev(argv);
      } else 
        return PR_FALSE;

    if (!KeyMatchesAppName(handler.get()) || !enabled)
        return PR_FALSE; // the handler is disabled or set to another app
    }
  }

  return PR_TRUE;
}

Here is the call graph for this function:

boolean nsIShellService::isDefaultClient ( in boolean  aStartupCheck,
in unsigned short  aApps 
) [inherited]

Determines whether or not Thunderbird is the "Default Client" for the passed in app type.

This is simply whether or not Thunderbid is registered to handle the url scheme associatd with the app.

Parameters:
aStartupChecktrue if this is the check being performed by the first mail window at startup, false otherwise.
aAppsthe application types being tested (Mail, News, RSS, etc.)
void nsIShellService::setDefaultClient ( in boolean  aForAllUsers,
in unsigned short  aApps 
) [inherited]

Registers Thunderbird as the "Default Mail Client" for the passed in app type.

Parameters:
aForAllUsersWhether or not Thunderbird should attempt to become the default client for all users on a multi-user system.
aAppsthe application types being tested (Mail, News, RSS, etc.)

Member Data Documentation

Definition at line 64 of file nsMailGNOMEIntegration.h.

const unsigned short nsIShellService::MAIL = 0x0001 [inherited]

app types we can be registered to handle

Definition at line 47 of file nsIShellService.idl.

Definition at line 68 of file nsMailGNOMEIntegration.h.

Definition at line 67 of file nsMailGNOMEIntegration.h.

Definition at line 66 of file nsMailGNOMEIntegration.h.

const unsigned short nsIShellService::NEWS = 0x0002 [inherited]

Definition at line 48 of file nsIShellService.idl.

const unsigned short nsIShellService::RSS = 0x0004 [inherited]

Definition at line 49 of file nsIShellService.idl.

Used to determine whether or not to show a "Set Default Client" query dialog.

This attribute is true if the application is starting up and "mail.shell.checkDefaultClient" is true, otherwise it is false.

Definition at line 82 of file nsIShellService.idl.


The documentation for this class was generated from the following files: