Thunderbird default mail/news client support for GNOME (bug 252056). r=mscott.

This commit is contained in:
bryner%brianryner.com 2004-07-24 23:54:29 +00:00
Родитель 7a94f785e6
Коммит 17acba2405
27 изменённых файлов: 758 добавлений и 267 удалений

Просмотреть файл

@ -965,6 +965,8 @@ mail/components/addrbook/skin/Makefile
mail/components/prefwindow/Makefile
mail/components/prefwindow/skin/mac/Makefile
mail/components/prefwindow/skin/Makefile
mail/components/build/Makefile
mail/components/gnome/Makefile
mail/extensions/Makefile
mail/extensions/smime/Makefile
mail/extensions/smime/skin/mac/Makefile

Просмотреть файл

@ -16,7 +16,7 @@
# Reserved.
#
## $Id: mozilla.in,v 1.2 2004-02-20 18:13:45 pkw%us.ibm.com Exp $
## $Id: mozilla.in,v 1.3 2004-07-24 23:54:25 bryner%brianryner.com Exp $
##
## Usage:
##
@ -78,18 +78,19 @@ MRE_HOME=%MREDIR%
# Use run-mozilla.sh in the current dir if it exists
# If not, then start resolving symlinks until we find run-mozilla.sh
found=0
progname=$0
progname="$0"
curdir=`dirname "$progname"`
progbase=`basename "$progname"`
run_moz="$curdir/run-mozilla.sh"
if test -x "$run_moz"; then
dist_bin=$curdir
dist_bin="$curdir"
found=1
else
here=`/bin/pwd`
while [ -h "$progname" ]; do
bn=`basename "$progname"`
cd `dirname "$progname"`
progname=`/bin/ls -l "$bn" |sed -e 's/^.* -> //' `
progname=`/bin/ls -l "$bn" | sed -e 's/^.* -> //' `
if [ ! -x "$progname" ]; then
break
fi
@ -107,7 +108,7 @@ fi
if [ $found = 0 ]; then
# Check default compile-time libdir
if [ -x "$moz_libdir/run-mozilla.sh" ]; then
dist_bin=$moz_libdir
dist_bin="$moz_libdir"
else
echo "Cannot find mozilla runtime directory. Exiting."
exit 1
@ -117,17 +118,95 @@ fi
script_args=""
moreargs=""
debugging=0
MOZILLA_BIN="%MOZILLA-BIN%"
MOZILLA_BIN="${progbase}-bin"
# The following is to check for a currently running instance.
# This is taken almost verbatim from the Mozilla RPM package's launch script.
MOZ_CLIENT_PROGRAM="$dist_bin/mozilla-xremote-client"
check_running() {
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" 'ping()' 2>/dev/null >/dev/null
RETURN_VAL=$?
if [ $RETURN_VAL -eq 0 ]; then
echo 1
return 1
else
echo 0
return 0
fi
}
if [ "$OSTYPE" = "beos" ]; then
mimeset -F $MOZILLA_BIN
mimeset -F "$MOZILLA_BIN"
fi
ALREADY_RUNNING=`check_running`
################################################################ Parse Arguments
# If there's a command line argument but it doesn't begin with a -
# it's probably a url. Try to send it to a running instance.
_USE_EXIST=0
_NEW_WINDOW=
_optOne="$1"
case "${_optOne}" in
-*)
;;
*)
_USE_EXIST=1
;;
esac
_optOthers=
_optLast=
for i in "$@"; do
_optLast="${i}"
done #last arg
for i in "$@"; do
[ $i = ${_optLast} ] && break
_optOthers="${_optOthers} ${i}"
done #others arg
#???: needs check if othersopt begin with -* ?
if [ `expr "${_optLast}" : '.*:/.*'` -eq 0 -a \( -f "${_optLast}" -o -d "${_optLast}" \) ]; then
# Last argument seems to be a local file/directory
# Check, if it is absolutely specified (ie. /home/foo/file vs. ./file)
# If it is just "relatively" (./file) specified, make it absolutely
[ `expr "${_optLast}" : '/.*'` -eq 0 ] && _optLast="file://`pwd`/${_optLast}"
elif [ `expr "${_optLast}" : '.*:/.*'` -gt 0 -o -n "${_optOthers}" ]; then #???? like before...
_NEW_WINDOW=1
fi
################################################################ Parse Arguments
########################################################################### Main
if [ $ALREADY_RUNNING -eq 1 ]; then
# There's an instance already running. Use it.
# Any command line args passed in?
if [ $# -gt 0 ]; then
# There were "some" command line args.
if [ ${_USE_EXIST} -eq 1 ]; then
# We should use an existing instance, as _USE_EXIST=$_USE_EXIST=-1
_open_type="window"
#_open_type="tab"
_remote_cmd="openURL(${_optLast} , new-${_open_type})"
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "${_remote_cmd}"
unset _remote_cmd _open_type
exit $?
fi
else
# No command line args. Open new window/tab
#exec "${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "xfeDoCommand(openBrowser)"
"${run_moz}" "$MOZ_CLIENT_PROGRAM" -a "${progbase}" "xfeDoCommand(openInbox)"
exit $?
fi
fi
# Default action - no running instance or _USE_EXIST (${_USE_EXIST}) ! -eq 1
########################################################################### Main
while [ $# -gt 0 ]
do
case "$1" in
-p | -pure)
MOZILLA_BIN="%MOZILLA-BIN%.pure"
-p | --pure | -pure)
MOZILLA_BIN="${MOZILLA_BIN}.pure"
shift
;;
-g | --debug)

Просмотреть файл

@ -115,6 +115,13 @@ pref("network.image.imageBehavior", 2);
// End seamonkey suite mailnews.js pref overrides
/////////////////////////////////////////////////////////////////
#ifdef MOZ_WIDGET_GTK2
// whether to check if we're the default mail client on startup (GNOME)
pref("mail.checkDefaultMail", true);
// whether to check if we're the default news client on startup (GNOME)
pref("mail.checkDefaultNews", false);
#endif
/////////////////////////////////////////////////////////////////
// Overrides for generic app behavior from the seamonkey suite's all.js
/////////////////////////////////////////////////////////////////

Просмотреть файл

@ -67,10 +67,8 @@ en-US.jar:
+ locale/en-US/global/brand.properties (locale/brand.properties)
*+ locale/en-US/global/brand.dtd (locale/brand.dtd)
+ locale/en-US/communicator/utilityOverlay.dtd (locale/utilityOverlay.dtd)
+ locale/en-US/messenger-mapi/mapi.properties (locale/mapi.properties)
US.jar:
+ locale/US/messenger-region/region.properties (locale/region.properties)
*+ locale/US/global-region/region.dtd (locale/region.dtd)
en-win.jar:
+ locale/en-US/messenger-mapi/mapi.properties (locale/mapi.properties)

Просмотреть файл

@ -1,4 +0,0 @@
brandShortName=Mozilla Thunderbird
brandFullName=Mozilla Thunderbird
vendorShortName=Mozilla Thunderbird
sidebarName=Sidebar

Просмотреть файл

@ -1,24 +0,0 @@
# Mail Integration Dialog
dialogTitle=%S
dialogText=Do you want to use %S as the default mail application?
checkboxText=Do not display this dialog again
# MAPI Messages
loginText=Please enter your password for %S:
loginTextwithName=Please enter your username and password
loginTitle=%S
PasswordTitle=%S
# MAPI Error Messages
errorMessage=%S could not be set as the default mail application because a registry key could not be updated. Verify with your system administrator that you have write access to your system registry, and then try again.
errorMessageNews=%S could not be set as the default news application because a registry key could not be updated. Verify with your system administrator that you have write access to your system registry, and then try again.
errorMessageTitle=%S
# MAPI Security Messages
mapiBlindSendWarning=Another application is attempting to send mail using your user profile. Are you sure you want to send mail?
mapiBlindSendDontShowAgain=Warn me whenever other applications try to send mail from me
#Default Mail Display String
# localization note, %S is the vendor name
defaultMailDisplayTitle=%S

Просмотреть файл

@ -28,5 +28,11 @@ include $(DEPTH)/config/autoconf.mk
DIRS = compose prefwindow addrbook migration
ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
DIRS += gnome
endif
DIRS += build
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1 @@
Makefile

Просмотреть файл

@ -0,0 +1,87 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Thunderbird.
#
# The Initial Developer of the Original Code is
# IBM Corporation.
# Portions created by the Initial Developer are Copyright (C) 2004
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brian Ryner <bryner@brianryner.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = mailcomps
LIBRARY_NAME = mailcomps
SHORT_LIBNAME = mailcmp
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
MODULE_NAME = nsMailCompsModule
REQUIRES = \
xpcom \
xulapp \
mailprofilemigration \
string \
xpcom \
libreg \
intl \
pref \
msgbase \
$(NULL)
CPPSRCS = nsModule.cpp \
$(NULL)
LOCAL_INCLUDES = \
-I$(srcdir)/../migration/src \
-I$(srcdir)/../gnome \
$(NULL)
SHARED_LIBRARY_LIBS = \
$(DIST)/lib/$(LIB_PREFIX)profilemigration_s.$(LIB_SUFFIX) \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT), gtk2)
SHARED_LIBRARY_LIBS += $(DIST)/lib/$(LIB_PREFIX)mail_gnome_s.$(LIB_SUFFIX)
endif
EXTRA_DSO_LDOPTS += \
$(LIBS_DIR) \
$(EXTRA_DSO_LIBS) \
$(MOZ_XPCOM_OBSOLETE_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -0,0 +1,106 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Thunderbird.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Ryner <bryner@brianryner.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "nsMailMigrationCID.h"
#include "nsProfileMigrator.h"
#include "nsSeamonkeyProfileMigrator.h"
#include "nsDogbertProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileMigrator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSeamonkeyProfileMigrator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDogbertProfileMigrator)
#ifdef XP_WIN32
#include "nsOEProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOEProfileMigrator)
#include "nsOutlookProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOutlookProfileMigrator)
#endif
#if defined(XP_WIN32) || defined(XP_MACOSX)
#include "nsEudoraProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEudoraProfileMigrator)
#endif
#ifdef MOZ_WIDGET_GTK2
#include "nsMailGNOMEIntegration.h"
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsMailGNOMEIntegration, Init)
#endif
static const nsModuleComponentInfo components[] = {
{ "Profile Importer",
NS_THUNDERBIRD_PROFILEIMPORT_CID,
NS_PROFILEMIGRATOR_CONTRACTID,
nsProfileMigratorConstructor },
{ "Seamonkey Profile Migrator",
NS_SEAMONKEYPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey",
nsSeamonkeyProfileMigratorConstructor },
{ "Netscape Communicator 4.x",
NS_DOGBERTPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert",
nsDogbertProfileMigratorConstructor },
#ifdef XP_WIN32
{ "Outlook Express Profile Migrator",
NS_OEXPRESSPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "oexpress",
nsOEProfileMigratorConstructor },
{ "Outlook Profile Migrator",
NS_OUTLOOKPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "outlook",
nsOutlookProfileMigratorConstructor },
#endif
#if defined (XP_WIN32) || defined (XP_MACOSX)
{ "Eudora Profile Migrator",
NS_EUDORAPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "eudora",
nsEudoraProfileMigratorConstructor },
#endif
#ifdef MOZ_WIDGET_GTK2
{ "Mail GNOME Integration",
NS_MAILGNOMEINTEGRATION_CID,
"@mozilla.org/mapiregistry;1",
nsMailGNOMEIntegrationConstructor },
#endif
};
NS_IMPL_NSGETMODULE(nsMailCompsModule, components)

Просмотреть файл

@ -0,0 +1,66 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Mozilla GNOME integration code.
#
# The Initial Developer of the Original Code is
# IBM Corporation.
# Portions created by the Initial Developer are Copyright (C) 2004
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Brian Ryner <bryner@brianryner.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = mail_gnome
LIBRARY_NAME = mail_gnome_s
MODULE_NAME = nsMailGNOMEModule
REQUIRES = \
xpcom \
string \
mozgnome \
msgbase \
appshell \
intl \
windowwatcher \
pref \
$(NULL)
CPPSRCS = nsMailGNOMEIntegration.cpp
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk
CXXFLAGS += $(TK_CFLAGS)

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,345 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Mozilla GNOME integration code.
*
* The Initial Developer of the Original Code is
* IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2004
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Brian Ryner <bryner@brianryner.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsMailGNOMEIntegration.h"
#include "nsIGenericFactory.h"
#include "nsIGConfService.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "prenv.h"
#include "nsICmdLineService.h"
#include "nsIStringBundle.h"
#include "nsIPromptService.h"
#include "nsIPrefService.h"
#include "nsIPrefBranch.h"
#include <glib.h>
#include <limits.h>
#include <stdlib.h>
static const char* const sMailProtocols[] = {
"mailto"
};
static const char* const sNewsProtocols[] = {
"news",
"snews",
"nntp"
};
nsresult
nsMailGNOMEIntegration::Init()
{
// GConf _must_ be available, or we do not allow CreateInstance to succeed.
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
if (!gconf)
return NS_ERROR_NOT_AVAILABLE;
// Check G_BROKEN_FILENAMES. If it's set, then filenames in glib use
// the locale encoding. If it's not set, they use UTF-8.
mUseLocaleFilenames = PR_GetEnv("G_BROKEN_FILENAMES") != nsnull;
// Get the path we were launched from.
nsCOMPtr<nsICmdLineService> cmdService =
do_GetService("@mozilla.org/appshell/commandLineService;1");
if (!cmdService)
return NS_ERROR_NOT_AVAILABLE;
nsXPIDLCString programName;
cmdService->GetProgramName(getter_Copies(programName));
// Make sure we have an absolute pathname.
if (programName[0] != '/') {
// First search PATH if we were just launched as 'thunderbird-bin'.
// If we were launched as './thunderbird-bin', this will just return
// the original string.
gchar *appPath = g_find_program_in_path(programName.get());
// Now resolve it.
char resolvedPath[PATH_MAX] = "";
if (realpath(appPath, resolvedPath)) {
mAppPath.Assign(resolvedPath);
}
g_free(appPath);
} else {
mAppPath.Assign(programName);
}
// strip "-bin" off of the binary name
if (StringEndsWith(mAppPath, NS_LITERAL_CSTRING("-bin")))
mAppPath.SetLength(mAppPath.Length() - 4);
PRBool isDefault;
nsMailGNOMEIntegration::GetIsDefaultMailClient(&isDefault);
mShowMailDialog = !isDefault;
nsMailGNOMEIntegration::GetIsDefaultNewsClient(&isDefault);
mShowNewsDialog = !isDefault;
return NS_OK;
}
NS_IMPL_ISUPPORTS1(nsMailGNOMEIntegration, nsIMapiRegistry)
PRBool
nsMailGNOMEIntegration::KeyMatchesAppName(const char *aKeyValue) const
{
gchar *commandPath;
if (mUseLocaleFilenames) {
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, NULL, NULL, NULL);
if (!nativePath) {
NS_ERROR("Error converting path to filesystem encoding");
return PR_FALSE;
}
commandPath = g_find_program_in_path(nativePath);
g_free(nativePath);
} else {
commandPath = g_find_program_in_path(aKeyValue);
}
if (!commandPath)
return PR_FALSE;
PRBool matches = mAppPath.Equals(commandPath);
g_free(commandPath);
return matches;
}
nsresult
nsMailGNOMEIntegration::CheckDefault(const char* const *aProtocols,
unsigned int aLength, PRBool *aIsDefault)
{
*aIsDefault = PR_FALSE;
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);
NS_ENSURE_SUCCESS(rv, 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 NS_ERROR_FAILURE;
}
if (!KeyMatchesAppName(handler.get()) || !enabled)
return NS_OK; // the handler is disabled or set to another app
}
*aIsDefault = PR_TRUE;
return NS_OK;
}
nsresult
nsMailGNOMEIntegration::MakeDefault(const char* const *aProtocols,
unsigned int aLength)
{
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
nsCAutoString appKeyValue(mAppPath + NS_LITERAL_CSTRING(" \"%s\""));
for (unsigned int i = 0; i < aLength; ++i) {
nsresult rv = gconf->SetAppForProtocol(nsDependentCString(aProtocols[i]),
appKeyValue);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}
NS_IMETHODIMP
nsMailGNOMEIntegration::GetIsDefaultMailClient(PRBool *aIsDefault)
{
return CheckDefault(sMailProtocols, NS_ARRAY_LENGTH(sMailProtocols),
aIsDefault);
}
NS_IMETHODIMP
nsMailGNOMEIntegration::SetIsDefaultMailClient(PRBool aIsDefault)
{
NS_ASSERTION(!aIsDefault, "Should never be called with aIsDefault=false");
return MakeDefault(sMailProtocols, NS_ARRAY_LENGTH(sMailProtocols));
}
NS_IMETHODIMP
nsMailGNOMEIntegration::GetIsDefaultNewsClient(PRBool *aIsDefault)
{
return CheckDefault(sNewsProtocols, NS_ARRAY_LENGTH(sNewsProtocols),
aIsDefault);
}
NS_IMETHODIMP
nsMailGNOMEIntegration::SetIsDefaultNewsClient(PRBool aIsDefault)
{
NS_ASSERTION(!aIsDefault, "Should never be called with aIsDefault=false");
return MakeDefault(sNewsProtocols, NS_ARRAY_LENGTH(sNewsProtocols));
}
NS_IMETHODIMP
nsMailGNOMEIntegration::GetShowDialog(PRBool *aShow)
{
*aShow = (mShowMailDialog || mShowNewsDialog);
return NS_OK;
}
NS_IMETHODIMP
nsMailGNOMEIntegration::ShowMailIntegrationDialog(nsIDOMWindow* aParentWindow)
{
nsCOMPtr<nsIPrefService> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsCOMPtr<nsIPrefBranch> branch;
pref->GetBranch("", getter_AddRefs(branch));
PRBool showMailDialog, showNewsDialog;
branch->GetBoolPref("mail.checkDefaultMail", &showMailDialog);
branch->GetBoolPref("mail.checkDefaultNews", &showNewsDialog);
if (!((mShowMailDialog && showMailDialog) ||
(mShowNewsDialog && showNewsDialog)))
return NS_OK;
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID);
NS_ENSURE_TRUE(bundleService, NS_ERROR_FAILURE);
nsCOMPtr<nsIStringBundle> brandBundle;
bundleService->CreateBundle("chrome://global/locale/brand.properties",
getter_AddRefs(brandBundle));
NS_ENSURE_TRUE(brandBundle, NS_ERROR_FAILURE);
nsXPIDLString brandShortName;
brandBundle->GetStringFromName(NS_LITERAL_STRING("brandShortName").get(),
getter_Copies(brandShortName));
nsCOMPtr<nsIStringBundle> mapiBundle;
bundleService->CreateBundle("chrome://messenger-mapi/locale/mapi.properties",
getter_AddRefs(mapiBundle));
NS_ENSURE_TRUE(mapiBundle, NS_ERROR_FAILURE);
nsXPIDLString dialogTitle;
const PRUnichar *brandStrings[] = { brandShortName.get() };
nsresult rv =
mapiBundle->FormatStringFromName(NS_LITERAL_STRING("dialogTitle").get(),
brandStrings, 1,
getter_Copies(dialogTitle));
NS_ENSURE_SUCCESS(rv, rv);
nsXPIDLString checkboxText;
rv = mapiBundle->GetStringFromName(NS_LITERAL_STRING("checkboxText").get(),
getter_Copies(checkboxText));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPromptService> promptService =
do_GetService("@mozilla.org/embedcomp/prompt-service;1");
NS_ENSURE_TRUE(promptService, NS_ERROR_FAILURE);
if (mShowMailDialog && showMailDialog) {
nsXPIDLString dialogText;
rv = mapiBundle->FormatStringFromName(NS_LITERAL_STRING("dialogText").get(),
brandStrings, 1,
getter_Copies(dialogText));
PRBool checkValue = PR_FALSE;
PRInt32 buttonPressed = 0;
rv = promptService->ConfirmEx(aParentWindow, dialogTitle, dialogText.get(),
(nsIPromptService::BUTTON_TITLE_YES *
nsIPromptService::BUTTON_POS_0) +
(nsIPromptService::BUTTON_TITLE_NO *
nsIPromptService::BUTTON_POS_1),
nsnull, nsnull, nsnull,
checkboxText, &checkValue, &buttonPressed);
NS_ENSURE_SUCCESS(rv, rv);
if (checkValue)
branch->SetBoolPref("mail.checkDefaultMail", PR_FALSE);
mShowMailDialog = PR_FALSE;
if (buttonPressed == 0) {
rv = nsMailGNOMEIntegration::SetIsDefaultMailClient(PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
}
}
if (mShowNewsDialog && showNewsDialog) {
nsXPIDLString dialogText;
rv = mapiBundle->FormatStringFromName(NS_LITERAL_STRING("newsDialogText").get(),
brandStrings, 1,
getter_Copies(dialogText));
PRBool checkValue = PR_FALSE;
PRInt32 buttonPressed = 0;
rv = promptService->ConfirmEx(aParentWindow, dialogTitle, dialogText.get(),
(nsIPromptService::BUTTON_TITLE_YES *
nsIPromptService::BUTTON_POS_0) +
(nsIPromptService::BUTTON_TITLE_NO *
nsIPromptService::BUTTON_POS_1),
nsnull, nsnull, nsnull,
checkboxText, &checkValue, &buttonPressed);
NS_ENSURE_SUCCESS(rv, rv);
if (checkValue)
branch->SetBoolPref("mail.checkDefaultNews", PR_FALSE);
mShowNewsDialog = PR_FALSE;
if (buttonPressed == 0)
rv = nsMailGNOMEIntegration::SetIsDefaultNewsClient(PR_TRUE);
}
return rv;
}
NS_IMETHODIMP
nsMailGNOMEIntegration::RegisterMailAndNewsClient()
{
return NS_OK;
}

Просмотреть файл

Просмотреть файл

@ -6,9 +6,7 @@ VPATH=@srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE=mailprofilemigration
LIBRARY_NAME = profilemigration
EXPORT_LIBRARY = 1
IS_COMPONENT = 1
LIBRARY_NAME = profilemigration_s
MODULE_NAME = nsMailProfileMigratorModule
REQUIRES = \
@ -57,9 +55,6 @@ CPPSRCS += \
$(NULL)
endif
EXTRA_DSO_LDOPTS += \
$(MOZ_XPCOM_OBSOLETE_LIBS) \
$(MOZ_COMPONENT_LIBS) \
$(NULL)
FORCE_STATIC_LIB = 1
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -36,7 +36,6 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsIGenericFactory.h"
#include "nsILocalFile.h"
#include "nsIDOMWindowInternal.h"
#include "nsIProfileMigrator.h"
@ -291,62 +290,3 @@ cleanup:
NR_ShutdownRegistry();
return migrated;
}
// Make this into a component
#include "nsSeamonkeyProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileMigrator)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSeamonkeyProfileMigrator)
#include "nsDogbertProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDogbertProfileMigrator)
#ifdef XP_WIN32
#include "nsOEProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOEProfileMigrator)
#include "nsOutlookProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsOutlookProfileMigrator)
#endif
#if defined (XP_WIN32) || defined (XP_MACOSX)
#include "nsEudoraProfileMigrator.h"
NS_GENERIC_FACTORY_CONSTRUCTOR(nsEudoraProfileMigrator)
#endif
static const nsModuleComponentInfo components[] =
{
{ "Profile Importer",
NS_THUNDERBIRD_PROFILEIMPORT_CID,
NS_PROFILEMIGRATOR_CONTRACTID,
nsProfileMigratorConstructor },
{ "Seamonkey Profile Migrator",
NS_SEAMONKEYPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "seamonkey",
nsSeamonkeyProfileMigratorConstructor },
{ "Netscape Communicator 4.x",
NS_DOGBERTPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "dogbert",
nsDogbertProfileMigratorConstructor },
#ifdef XP_WIN32
{ "Outlook Express Profile Migrator",
NS_OEXPRESSPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "oexpress",
nsOEProfileMigratorConstructor },
{ "Outlook Profile Migrator",
NS_OUTLOOKPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "outlook",
nsOutlookProfileMigratorConstructor },
#endif
#if defined (XP_WIN32) || defined (XP_MACOSX)
{ "Eudora Profile Migrator",
NS_EUDORAPROFILEMIGRATOR_CID,
NS_MAILPROFILEMIGRATOR_CONTRACTID_PREFIX "eudora",
nsEudoraProfileMigratorConstructor },
#endif
};
NS_IMPL_NSGETMODULE(nsMailProfileMigratorModule, components)

Просмотреть файл

@ -1,114 +0,0 @@
function Startup()
{
var startupFunc;
try {
startupFunc = document.getElementById("mailnewsEnableMapi").getAttribute('startupFunc');
}
catch (ex) {
startupFunc = null;
}
if (startupFunc)
eval(startupFunc);
StartPageCheck();
// now do some Notification panel startup work:
PlaySoundCheck();
// if we don't have the alert service, hide the pref UI for using alerts to notify on new mail
// see bug #158711
var newMailNotificationAlertUI = document.getElementById("newMailNotificationAlert");
newMailNotificationAlertUI.hidden = !("@mozilla.org/alerts-service;1" in Components.classes);
}
function setColorWell(menu)
{
// Find the colorWell and colorPicker in the hierarchy.
var colorWell = menu.firstChild.nextSibling;
var colorPicker = menu.firstChild.nextSibling.nextSibling.firstChild;
// Extract color from colorPicker and assign to colorWell.
var color = colorPicker.getAttribute('color');
colorWell.style.backgroundColor = color;
}
function StartPageCheck()
{
var checked = document.getElementById("mailnewsStartPageEnabled").checked;
document.getElementById("mailnewsStartPageUrl").disabled = !checked;
}
function setHomePageToDefaultPage(folderFieldId)
{
var homePageField = document.getElementById(folderFieldId);
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var prefs = prefService.getDefaultBranch(null);
var url = prefs.getComplexValue("mailnews.start_page.url",
Components.interfaces.nsIPrefLocalizedString).data;
homePageField.value = url;
}
function PlaySoundCheck()
{
var playSound = document.getElementById("newMailNotification").checked;
var playSoundType = document.getElementById("newMailNotificationType");
playSoundType.disabled = !playSound;
var disableCustomUI = !(playSound && playSoundType.value == 1);
var mailnewsSoundFileUrl = document.getElementById("mailnewsSoundFileUrl");
mailnewsSoundFileUrl.disabled = disableCustomUI
document.getElementById("preview").disabled = disableCustomUI || (mailnewsSoundFileUrl.value == "");
document.getElementById("browse").disabled = disableCustomUI;
}
function onCustomWavInput()
{
document.getElementById("preview").disabled = (document.getElementById("mailnewsSoundFileUrl").value == "");
}
const nsIFilePicker = Components.interfaces.nsIFilePicker;
function Browse()
{
var fp = Components.classes["@mozilla.org/filepicker;1"]
.createInstance(nsIFilePicker);
// XXX todo, persist the last sound directory and pass it in
// XXX todo filter by .wav
fp.init(window, document.getElementById("browse").getAttribute("filepickertitle"), nsIFilePicker.modeOpen);
fp.appendFilters(nsIFilePicker.filterAll);
var ret = fp.show();
if (ret == nsIFilePicker.returnOK) {
var mailnewsSoundFileUrl = document.getElementById("mailnewsSoundFileUrl");
// convert the nsILocalFile into a nsIFile url
mailnewsSoundFileUrl.value = fp.fileURL.spec;
}
onCustomWavInput();
}
var gSound = null;
function PreviewSound()
{
var soundURL = document.getElementById("mailnewsSoundFileUrl").value;
if (!gSound)
gSound = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
if (soundURL.indexOf("file://") == -1) {
// XXX todo see if we can create a nsIURL from the native file path
// otherwise, play a system sound
gSound.playSystemSound(soundURL);
}
else {
var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
var url = ioService.newURI(soundURL, null, null);
gSound.play(url)
}
}

Просмотреть файл

@ -34,6 +34,9 @@
onload="parent.initPanel('chrome://messenger/content/pref-mailnews.xul');"
headertitle="&pane.title;">
<stringbundle id="mapiBundle" src="chrome://messenger-mapi/locale/mapi.properties"/>
<stringbundle id="brandBundle" src="chrome://global/locale/brand.properties"/>
<script type="application/x-javascript" src="chrome://messenger/content/pref-mailnews.js"/>
<script type="application/x-javascript">
@ -42,6 +45,11 @@
var _elementIDs = ["mailnewsStartPageEnabled", "mailnewsStartPageUrl", "mailPaneConfig", "mailnewsDoubleClick2NewWindow", "mailRememberLastMsg",
"mailnewsSoundFileUrl", "newMailNotification", "newMailNotificationType",
"newMailNotificationAlert"];
#ifdef MOZ_WIDGET_GTK2
_elementIDs.push("checkDefaultMail");
_elementIDs.push("checkDefaultNews");
#endif
]]>
</script>
@ -49,6 +57,34 @@
<caption label="&generalSettings.label;"/>
<hbox id="mapi"/>
#ifdef MOZ_WIDGET_GTK2
<vbox align="left" id="defaultClientBox">
<label value="&whenStartingCheck.label;"/>
<grid flex="1" style="margin-left: 20px;">
<columns>
<column/>
<column flex="1" align="left"/>
</columns>
<rows>
<row>
<checkbox id="checkDefaultMail" prefstring="mail.checkDefaultMail"
label="&mailApplication.label;"
accesskey="&checkDefaultMail.accesskey;"/>
<button label="&checkNow.label;" accesskey="&checkNow.accesskey;"
oncommand="checkDefaultMailNow(false)"/>
</row>
<row>
<checkbox id="checkDefaultNews" prefstring="mail.checkDefaultNews"
label="&newsApplication.label;"
accesskey="&checkDefaultNews.accesskey;"/>
<button label="&checkNow.label;" accesskey="&checkNow.accesskey;"
oncommand="checkDefaultMailNow(true)"/>
</row>
</rows>
</grid>
</vbox>
<separator class="thin"/>
#endif
<checkbox id="mailRememberLastMsg" label="&rememberLastMsg.label;"
prefstring="mailnews.remember_selected_message"

Просмотреть файл

@ -4,7 +4,7 @@ messenger.jar:
content/messenger/messengercompose/pref-sendOptions.xul (content/pref-sendOptions.xul)
+ content/messenger/pref-viewing_messages.xul (content/pref-viewing_messages.xul)
*+ content/messenger/pref-mailnews.xul (content/pref-mailnews.xul)
+ content/messenger/pref-mailnews.js (content/pref-mailnews.js)
*+ content/messenger/pref-mailnews.js (content/pref-mailnews.js)
*+ content/messenger/pref-advanced.xul (content/pref-advanced.xul)
*+ content/messenger/pref-advanced.js (content/pref-advanced.js)

Просмотреть файл

@ -1,37 +0,0 @@
<!ENTITY pane.title "Mail &amp; Newsgroups">
<!ENTITY generalSettings.label "General Settings">
<!ENTITY confirmMove.label "Confirm when moving folders to the Trash">
<!ENTITY confirmMove.accesskey "C">
<!ENTITY useMessenger.label "Use Mail from MAPI-based applications">
<!ENTITY useMessenger.accesskey "U">
<!ENTITY autounzip.label "Automatically expand zip files when saving attachments">
<!ENTITY autounzip.accesskey "A">
<!ENTITY messengerStartPage.label "&brandShortName; Start Page">
<!ENTITY enableStartPage.label "When &brandShortName; launches, show the Start Page in the message area">
<!ENTITY enableStartPage.accesskey "W">
<!ENTITY location.label "Location:">
<!ENTITY location.accesskey "L">
<!ENTITY useDefault.label "Restore Default">
<!ENTITY useDefault.accesskey "R">
<!ENTITY rememberLastMsg.label "Remember the last selected message">
<!ENTITY rememberLastMsg.accesskey "e">
<!ENTITY warnOnSendAccelKey.label "Confirm when using keyboard shortcut to send message">
<!ENTITY warnOnSendAccelKey.accesskey "o">
<!ENTITY windowSettings.label "Window Configuration">
<!ENTITY selectWindowLayout.label "Select the window layout you prefer for Mail.">
<!ENTITY selectWindowLayout.accesskey "S">
<!ENTITY windowBehavior.label "Message Window Behavior">
<!ENTITY reuseExp.label "Open new messages in:">
<!ENTITY reuseExpRadio0.label "A new message window">
<!ENTITY reuseExpRadio0.accesskey "n">
<!ENTITY reuseExpRadio1.label "An existing message window">
<!ENTITY reuseExpRadio1.accesskey "e">
<!ENTITY reuseExpRadio2.label "A tab in an existing message window">
<!ENTITY reuseExpRadio2.accesskey "t">
<!ENTITY setDefaultMailClient.label "Use &vendorShortName; as the default mail application">
<!ENTITY setDefaultMailClient.accesskey "u">
<!ENTITY setDefaultNewsClient.label "Use &vendorShortName; as the default news application">
<!ENTITY setDefaultNewsClient.accesskey "n">

Просмотреть файл

@ -113,7 +113,7 @@ function showMailIntegrationDialog() {
}
catch (ex) {}
try {
if (!prefLocked && !mapiRegistry.isDefaultMailClient)
if (!prefLocked)
mapiRegistry.showMailIntegrationDialog(window /* parent window */);
}
catch (ex) {

Просмотреть файл

@ -95,6 +95,7 @@ XPIDLSRCS = \
nsIMessengerOSIntegration.idl \
nsIMsgMdnGenerator.idl \
nsISpamSettings.idl \
nsIMapiRegistry.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

Просмотреть файл

@ -281,12 +281,10 @@ en-US.jar:
locale/en-US/messenger/vcard.properties (mime/cthandlers/resources/vcard.properties)
locale/en-US/messenger/smime.properties (mime/cthandlers/resources/smime.properties)
locale/en-US/messenger/markByDate.dtd (base/resources/locale/en-US/markByDate.dtd)
locale/en-US/messenger-mapi/pref-mailnewsOverlay.dtd (mapi/resources/locale/en-US/pref-mailnewsOverlay.dtd)
locale/en-US/messenger-mapi/mapi.properties (mapi/resources/locale/en-US/mapi.properties)
* locale/en-US/messenger-mapi/contents.rdf (mapi/resources/locale/en-US/contents.rdf)
US.jar:
* locale/US/messenger-region/contents.rdf (base/resources/locale/en-US/contents-region.rdf)
locale/US/messenger-region/region.properties (base/resources/locale/en-US/region.properties)
en-win.jar:
locale/en-US/messenger-mapi/pref-mailnewsOverlay.dtd (mapi/resources/locale/en-US/pref-mailnewsOverlay.dtd)
locale/en-US/messenger-mapi/mapi.properties (mapi/resources/locale/en-US/mapi.properties)
* locale/en-US/messenger-mapi/contents.rdf (mapi/resources/locale/en-US/contents.rdf)

Просмотреть файл

@ -46,7 +46,6 @@ MODULE = msgMapi
XPIDL_MODULE = mapihook
XPIDLSRCS = \
nsIMapiRegistry.idl \
nsIMapiSupport.idl \
$(NULL)

Просмотреть файл

@ -111,8 +111,12 @@ nsMapiRegistry::SetIsDefaultMailClient(PRBool aIsDefaultMailClient)
*/
NS_IMETHODIMP
nsMapiRegistry::ShowMailIntegrationDialog(nsIDOMWindow *aParentWindow) {
if (!m_ShowDialog || !m_registryUtils.getShowDialog() ||
m_registryUtils.IsDefaultMailClient()) {
return NS_OK;
}
nsresult rv;
if (!m_ShowDialog || !m_registryUtils.getShowDialog()) return NS_OK;
nsCOMPtr<nsIPromptService> promptService(do_GetService(
"@mozilla.org/embedcomp/prompt-service;1", &rv));
if (NS_SUCCEEDED(rv) && promptService)