Bug #277833 --> Land Aviary mapi changes to allow thunderbird to register as a default
news client. sr=bienvenu git-svn-id: svn://10.0.0.236/trunk@168014 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -45,7 +45,10 @@
|
||||
var _elementIDs = ["mailnewsStartPageEnabled", "mailnewsStartPageUrl", "mailPaneConfig", "mailnewsDoubleClick2NewWindow", "mailRememberLastMsg",
|
||||
"mailnewsSoundFileUrl", "newMailNotification", "newMailNotificationType",
|
||||
"newMailNotificationAlert"];
|
||||
|
||||
#ifdef XP_WIN
|
||||
_elementIDs.push("mailnewsEnableMapi");
|
||||
_elementIDs.push("mailnewsEnableNews");
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
_elementIDs.push("checkDefaultMail");
|
||||
_elementIDs.push("checkDefaultNews");
|
||||
@@ -56,7 +59,17 @@
|
||||
<groupbox align="start">
|
||||
<caption label="&generalSettings.label;"/>
|
||||
|
||||
<hbox id="mapi"/>
|
||||
#ifdef XP_WIN
|
||||
<checkbox id="mailnewsEnableMapi" label="&setDefaultMailClient.label;"
|
||||
accesskey="&setDefaultMailClient.accesskey;"
|
||||
oncommand="onEnableMapi();"
|
||||
startupFunc="registerCallback();"/>
|
||||
|
||||
<checkbox id="mailnewsEnableNews" label="&setDefaultNewsClient.label;"
|
||||
accesskey="&setDefaultNewsClient.accesskey;"
|
||||
oncommand="onEnableNews();"/>
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
<vbox align="left" id="defaultClientBox">
|
||||
<label value="&whenStartingCheck.label;"/>
|
||||
|
||||
@@ -45,7 +45,8 @@ interface nsIDOMWindow;
|
||||
* for the default Mail Client.
|
||||
*
|
||||
*/
|
||||
[scriptable, uuid(c5be14ba-4e0a-4eec-a1b8-04363761d63c)]
|
||||
|
||||
[scriptable, uuid(6183EC68-04F1-45a2-95C6-9E8BE8E59F64)]
|
||||
interface nsIMapiRegistry: nsISupports {
|
||||
|
||||
/** This is set to TRUE if Mozilla is the default mail application
|
||||
@@ -64,7 +65,13 @@ interface nsIMapiRegistry: nsISupports {
|
||||
* Call this only if Mozilla is not the default Mail client
|
||||
*/
|
||||
void showMailIntegrationDialog(in nsIDOMWindow parentWindow);
|
||||
|
||||
/* After being installed, when we first launch, make sure we add the correct
|
||||
OS registry entries to make us show up as regsitered mail and news client
|
||||
in the OS
|
||||
*/
|
||||
|
||||
void registerMailAndNewsClient();
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIAppStartup.h"
|
||||
#include "nsIAppShellService.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsINativeAppSupport.h"
|
||||
@@ -73,7 +73,7 @@
|
||||
#include "nsIMsgComposeParams.h"
|
||||
#include "nsIMsgCompose.h"
|
||||
#include "nsMsgCompCID.h"
|
||||
#include "nsXPFEComponentsCID.h"
|
||||
#include "nsXPFEComponentsCID.h"
|
||||
#include "nsIMsgSend.h"
|
||||
#include "nsIProxyObjectManager.h"
|
||||
#include "nsIMsgComposeService.h"
|
||||
@@ -93,7 +93,6 @@
|
||||
|
||||
extern PRLogModuleInfo *MAPI;
|
||||
|
||||
|
||||
class nsMAPISendListener : public nsIMsgSendListener
|
||||
{
|
||||
public:
|
||||
@@ -162,24 +161,21 @@ PRBool nsMapiHook::isMapiService = PR_FALSE;
|
||||
|
||||
PRBool nsMapiHook::Initialize()
|
||||
{
|
||||
#ifndef MOZ_THUNDERBIRD
|
||||
#ifndef MOZ_THUNDERBIRD
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsINativeAppSupport> native;
|
||||
|
||||
nsCOMPtr<nsICmdLineService> cmdLineArgs (
|
||||
do_GetService(NS_COMMANDLINESERVICE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
nsCOMPtr<nsICmdLineService> cmdLineArgs (do_GetService(NS_COMMANDLINESERVICE_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAppStartup> appStartup (do_GetService(NS_APPSTARTUP_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
rv = appStartup->GetNativeAppSupport(getter_AddRefs(native));
|
||||
rv = appStartup->GetNativeAppSupport(getter_AddRefs(native));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
rv = native->EnsureProfile(cmdLineArgs);
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
#endif
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
@@ -194,7 +190,7 @@ PRBool nsMapiHook::DisplayLoginDialog(PRBool aLogin, PRUnichar **aUsername,
|
||||
{
|
||||
nsresult rv;
|
||||
PRBool btnResult = PR_FALSE;
|
||||
|
||||
|
||||
nsCOMPtr<nsIPromptService> dlgService(do_GetService("@mozilla.org/embedcomp/prompt-service;1", &rv));
|
||||
if (NS_SUCCEEDED(rv) && dlgService)
|
||||
{
|
||||
@@ -506,7 +502,7 @@ nsresult nsMapiHook::PopulateCompFields(lpnsMapiMessage aMessage,
|
||||
nsString Body;
|
||||
Body.AssignWithConversion(aMessage->lpszNoteText);
|
||||
if (Body.Last() != nsCRT::LF)
|
||||
Body.AppendLiteral(CRLF);
|
||||
Body.AppendLiteral(CRLF);
|
||||
rv = aCompFields->SetBody(Body) ;
|
||||
}
|
||||
|
||||
@@ -572,18 +568,17 @@ nsresult nsMapiHook::HandleAttachments (nsIMsgCompFields * aCompFields, PRInt32
|
||||
// a value for lpszFileName, use it. Otherwise stick with leafName
|
||||
if (aFiles[i].lpszFileName)
|
||||
{
|
||||
nsAutoString wholeFileName;
|
||||
nsAutoString wholeFileName;
|
||||
if (aIsUnicode)
|
||||
wholeFileName.Assign(aFiles[i].lpszFileName);
|
||||
else
|
||||
ConvertToUnicode(nsMsgI18NFileSystemCharset(), (char *) aFiles[i].lpszFileName, wholeFileName);
|
||||
|
||||
// need to find the last '\' and find the leafname from that.
|
||||
PRInt32 lastSlash = wholeFileName.RFindChar(PRUnichar('\\'));
|
||||
if (lastSlash != kNotFound)
|
||||
wholeFileName.Right(leafName, wholeFileName.Length() - lastSlash - 1);
|
||||
else
|
||||
leafName.Assign(wholeFileName);
|
||||
// need to find the last '\' and find the leafname from that.
|
||||
PRInt32 lastSlash = wholeFileName.RFindChar(PRUnichar('\\'));
|
||||
if (lastSlash != kNotFound)
|
||||
wholeFileName.Right(leafName, wholeFileName.Length() - lastSlash - 1);
|
||||
else
|
||||
leafName.Assign(wholeFileName);
|
||||
}
|
||||
else
|
||||
pFile->GetLeafName (leafName);
|
||||
@@ -599,7 +594,6 @@ nsresult nsMapiHook::HandleAttachments (nsIMsgCompFields * aCompFields, PRInt32
|
||||
{
|
||||
rv = pTempFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 0777);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
pTempFile->GetLeafName(leafName);
|
||||
pTempFile->Remove(PR_FALSE); // remove so we can copy over it.
|
||||
}
|
||||
// copy the file to its new location and file name
|
||||
@@ -714,7 +708,7 @@ nsresult nsMapiHook::PopulateCompFieldsWithConversion(lpnsMapiMessage aMessage,
|
||||
rv = ConvertToUnicode(platformCharSet.get(), (char *) aMessage->lpszNoteText, Body);
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
if (Body.Last() != nsCRT::LF)
|
||||
Body.AppendLiteral(CRLF);
|
||||
Body.AppendLiteral(CRLF);
|
||||
rv = aCompFields->SetBody(Body) ;
|
||||
}
|
||||
|
||||
@@ -778,21 +772,21 @@ nsresult nsMapiHook::PopulateCompFieldsForSendDocs(nsIMsgCompFields * aCompField
|
||||
PRUnichar * newFilePaths = (PRUnichar *) strFilePaths.get() ;
|
||||
while (offset != kNotFound)
|
||||
{
|
||||
//Temp Directory
|
||||
nsCOMPtr <nsIFile> pTempFileDir;
|
||||
NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(pTempFileDir));
|
||||
//Temp Directory
|
||||
nsCOMPtr <nsIFile> pTempFileDir;
|
||||
NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(pTempFileDir));
|
||||
nsCOMPtr <nsILocalFile> pTempDir = do_QueryInterface(pTempFileDir);
|
||||
|
||||
nsCOMPtr <nsILocalFile> pTempDir = do_QueryInterface(pTempFileDir);
|
||||
// if not already existing, create another temp dir for mapi within Win temp dir
|
||||
// this is windows only so we can do "\\"
|
||||
pTempDir->AppendRelativePath (NS_LITERAL_STRING("moz_mapi"));
|
||||
pTempDir->Exists(&bExist) ;
|
||||
if (!bExist)
|
||||
{
|
||||
rv = pTempDir->Create(nsIFile::DIRECTORY_TYPE, 777) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
}
|
||||
|
||||
// if not already existing, create another temp dir for mapi within Win temp dir
|
||||
// this is windows only so we can do "\\"
|
||||
pTempDir->AppendRelativePath (NS_LITERAL_STRING("moz_mapi"));
|
||||
pTempDir->Exists(&bExist) ;
|
||||
if (!bExist)
|
||||
{
|
||||
rv = pTempDir->Create(nsIFile::DIRECTORY_TYPE, 777) ;
|
||||
if (NS_FAILED(rv)) return rv ;
|
||||
}
|
||||
nsString RemainingPaths ;
|
||||
RemainingPaths.Assign(newFilePaths) ;
|
||||
offset = RemainingPaths.Find (strDelimChars) ;
|
||||
@@ -806,10 +800,10 @@ nsresult nsMapiHook::PopulateCompFieldsForSendDocs(nsIMsgCompFields * aCompField
|
||||
FilePathsLen -= offset + strDelimChars.Length();
|
||||
}
|
||||
|
||||
if (RemainingPaths[1] != ':' && RemainingPaths[1] != '\\')
|
||||
if (RemainingPaths[1] != ':' && RemainingPaths[1] != '\\')
|
||||
{
|
||||
char cwd[MAX_PATH];
|
||||
if (_getdcwd(_getdrive(), cwd, MAX_PATH))
|
||||
char cwd[MAX_PATH];
|
||||
if (_getdcwd(_getdrive(), cwd, MAX_PATH))
|
||||
{
|
||||
nsAutoString cwdStr;
|
||||
CopyASCIItoUTF16(cwd, cwdStr);
|
||||
@@ -817,7 +811,9 @@ nsresult nsMapiHook::PopulateCompFieldsForSendDocs(nsIMsgCompFields * aCompField
|
||||
RemainingPaths.Insert(cwdStr, 0);
|
||||
}
|
||||
}
|
||||
|
||||
pFile->InitWithPath (RemainingPaths) ;
|
||||
|
||||
rv = pFile->Exists(&bExist) ;
|
||||
if (NS_FAILED(rv) || (!bExist) ) return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST ;
|
||||
|
||||
|
||||
@@ -55,9 +55,10 @@ NS_IMPL_ISUPPORTS1(nsMapiRegistry, nsIMapiRegistry)
|
||||
|
||||
nsMapiRegistry::nsMapiRegistry() {
|
||||
m_DefaultMailClient = m_registryUtils.IsDefaultMailClient();
|
||||
m_DefaultNewsClient = m_registryUtils.IsDefaultNewsClient();
|
||||
// m_ShowDialog should be initialized to false
|
||||
// if we are the default mail client.
|
||||
m_ShowDialog = !m_registryUtils.verifyRestrictedAccess() && !m_DefaultMailClient;
|
||||
m_ShowDialog = !m_registryUtils.HasRestrictedRegistryAccess() && !m_DefaultMailClient;
|
||||
}
|
||||
|
||||
nsMapiRegistry::~nsMapiRegistry() {
|
||||
@@ -74,9 +75,11 @@ nsMapiRegistry::GetIsDefaultMailClient(PRBool * retval) {
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiRegistry::GetIsDefaultNewsClient(PRBool * retval) {
|
||||
// XXX this needs merged from aviary branch
|
||||
*retval = PR_FALSE;
|
||||
return NS_OK;
|
||||
// we need to get the value from registry everytime
|
||||
// because the registry settings can be changed from
|
||||
// other mail applications.
|
||||
*retval = m_registryUtils.IsDefaultNewsClient();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -97,7 +100,7 @@ nsMapiRegistry::SetIsDefaultMailClient(PRBool aIsDefaultMailClient)
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_DefaultMailClient = PR_TRUE;
|
||||
else
|
||||
m_registryUtils.ShowMapiErrorDialog();
|
||||
m_registryUtils.ShowMapiErrorDialog(PR_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -105,16 +108,41 @@ nsMapiRegistry::SetIsDefaultMailClient(PRBool aIsDefaultMailClient)
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_DefaultMailClient = PR_FALSE;
|
||||
else
|
||||
m_registryUtils.ShowMapiErrorDialog();
|
||||
m_registryUtils.ShowMapiErrorDialog(PR_TRUE);
|
||||
}
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMapiRegistry::SetIsDefaultNewsClient(PRBool aIsDefaultNewsClient)
|
||||
nsMapiRegistry::SetIsDefaultNewsClient(PRBool aIsDefaultNewsClient)
|
||||
{
|
||||
// XXX this needs merged from aviary branch
|
||||
nsresult rv = NS_OK ;
|
||||
|
||||
if (aIsDefaultNewsClient)
|
||||
{
|
||||
rv = m_registryUtils.setDefaultNewsClient();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_DefaultNewsClient = PR_TRUE;
|
||||
else
|
||||
m_registryUtils.ShowMapiErrorDialog(PR_FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
rv = m_registryUtils.unsetDefaultNewsClient();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
m_DefaultNewsClient = PR_FALSE;
|
||||
else
|
||||
m_registryUtils.ShowMapiErrorDialog(PR_FALSE);
|
||||
}
|
||||
|
||||
return rv ;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMapiRegistry::RegisterMailAndNewsClient()
|
||||
{
|
||||
m_registryUtils.registerNewsApp(PR_FALSE);
|
||||
m_registryUtils.registerMailApp(PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -176,7 +204,7 @@ nsMapiRegistry::ShowMailIntegrationDialog(nsIDOMWindow *aParentWindow) {
|
||||
&checkValue,
|
||||
&buttonPressed);
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
rv = m_registryUtils.SetRegistryKey(HKEY_LOCAL_MACHINE, "Software\\Mozilla\\Desktop",
|
||||
rv = m_registryUtils.SetRegistryKey(HKEY_LOCAL_MACHINE, kAppDesktopKey,
|
||||
"showMapiDialog", (checkValue) ? "0" : "1");
|
||||
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
protected:
|
||||
|
||||
PRBool m_DefaultMailClient;
|
||||
PRBool m_DefaultNewsClient;
|
||||
PRBool m_ShowDialog;
|
||||
nsMapiRegistryUtils m_registryUtils ;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -46,17 +46,34 @@
|
||||
#include "nsString.h"
|
||||
#include "nsIStringBundle.h"
|
||||
|
||||
#ifndef MOZ_THUNDERBIRD
|
||||
#define kAppDesktopKey "Software\\Mozilla\\Desktop"
|
||||
#else
|
||||
#define kAppDesktopKey "Software\\Mozilla Thunderbird\\Desktop"
|
||||
#endif
|
||||
|
||||
class nsMapiRegistryUtils
|
||||
{
|
||||
private :
|
||||
nsCAutoString m_thisApp ;
|
||||
nsAutoString m_brand ;
|
||||
nsAutoString m_vendor ;
|
||||
nsAutoString m_versionNo ;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> m_mapiStringBundle ;
|
||||
|
||||
// sets result to the value of varName (as defined in brand.properties)
|
||||
void getVarValue(const PRUnichar * varName, nsAutoString & result);
|
||||
|
||||
// verifyRestrictedAccess - Returns PR_TRUE if this user only has restricted access
|
||||
// to the registry keys we need to modify. Consumers should call the public method
|
||||
PRBool verifyRestrictedAccess() ;
|
||||
|
||||
PRBool mRestrictedRegAccess; // cannot write to HKLM in the registry
|
||||
|
||||
nsresult RegCopyKey(HKEY SrcKey, HKEY TrgKey, const char* TrgSubKeyName); // copies a key and all sub keys to TrgKey.
|
||||
nsresult recursiveDeleteKey(HKEY hKeyParent, const char* lpszKeyChild);
|
||||
|
||||
public :
|
||||
nsMapiRegistryUtils() ;
|
||||
|
||||
@@ -65,45 +82,45 @@ public :
|
||||
// returns TRUE if the Mapi32.dll is a Mozilla dll.
|
||||
PRBool isMozDll();
|
||||
|
||||
PRBool HasRestrictedRegistryAccess() { return mRestrictedRegAccess; }
|
||||
|
||||
// Returns the (fully-qualified) name of this executable.
|
||||
const char * thisApplication() ;
|
||||
// This returns the brand name for this application
|
||||
const PRUnichar * brandName() ;
|
||||
// This returns the vendor name of this application
|
||||
const nsString& vendorName();
|
||||
// verifyRestrictedAccess - Returns PR_TRUE if this user only has restricted access
|
||||
// to the registry keys we need to modify.
|
||||
PRBool verifyRestrictedAccess() ;
|
||||
|
||||
// set the Windows registry key
|
||||
nsresult SetRegistryKey(HKEY baseKey, const char * keyName,
|
||||
nsresult SetRegistryKey(HKEY baseKey, const char * keyName,
|
||||
const char * valueName, char * value);
|
||||
// delete a registry key
|
||||
nsresult DeleteRegistryValue(HKEY baseKey, const char * keyName,
|
||||
const char * valueName);
|
||||
nsresult DeleteRegistryValue(HKEY baseKey, const char * keyName, const char * valueName);
|
||||
|
||||
// get a Windows registry key
|
||||
void GetRegistryKey(HKEY baseKey, const char * keyName,
|
||||
const char * valueName, nsCAutoString & value) ;
|
||||
void GetRegistryKey(HKEY baseKey, const char * keyName, const char * valueName, nsCAutoString & value);
|
||||
|
||||
// Returns TRUE if the current application is default mail client.
|
||||
PRBool IsDefaultMailClient();
|
||||
// Sets Mozilla as default Mail Client
|
||||
nsresult setDefaultMailClient() ;
|
||||
// Removes Mozilla as the default Mail client and restores the previous setting
|
||||
nsresult unsetDefaultMailClient() ;
|
||||
PRBool IsDefaultMailClient();
|
||||
nsresult setDefaultMailClient(); // Sets Mozilla as default Mail Client
|
||||
nsresult unsetDefaultMailClient(); // Removes Mozilla as the default Mail client and restores the previous setting
|
||||
nsresult saveDefaultMailClient(); // Save default mail client settings in HKEY_LOCAL_MACHINE\\Software\\Mozilla\\Desktop
|
||||
nsresult saveUserDefaultMailClient(); // save default
|
||||
|
||||
PRBool IsDefaultNewsClient(); // Returns TRUE if the current application is default news client.
|
||||
nsresult setDefaultNewsClient(); // Sets Mozilla as the default News Client
|
||||
nsresult unsetDefaultNewsClient(); // Removes Mozilla as the default Mail client and restores the previous setting
|
||||
nsresult saveDefaultNewsClient(); // Saves the current setting of the default News Client in HKEY_LOCAL_MACHINE\\Software\\Mozilla\\Desktop
|
||||
nsresult saveUserDefaultNewsClient();
|
||||
|
||||
// Saves the current setting of the default Mail Client in
|
||||
// HKEY_LOCAL_MACHINE\\Software\\Mozilla\\Desktop
|
||||
nsresult saveDefaultMailClient();
|
||||
// Saves the current user setting of the default Mail Client in
|
||||
// HKEY_LOCAL_MACHINE\\Software\\Mozilla\\Desktop
|
||||
nsresult saveUserDefaultMailClient();
|
||||
nsresult setupDefaultProtocolKey(const char * aDefaultAppRegKey, const char * aProtocol, const char * aProtocolEntryValue, const char * aCmdLineParam);
|
||||
nsresult setProtocolHandler(const char * aDefaultAppRegKey, const char * protocolName); // installs protocol handler on Software\Classes\<protocolName>
|
||||
|
||||
nsresult setMailtoProtocolHandler();
|
||||
nsresult setNewsProtocolHandler();
|
||||
nsresult registerNewsApp(PRBool aForceRegistration); // aForceRegistration set to TRUE if we want to force the keys to be set again
|
||||
nsresult registerMailApp(PRBool aForceRegistration);
|
||||
|
||||
nsresult CopyMozMapiToWinSysDir();
|
||||
nsresult RestoreBackedUpMapiDll();
|
||||
nsresult CopyMozMapiToWinSysDir();
|
||||
nsresult RestoreBackedUpMapiDll();
|
||||
|
||||
// Returns FALSE if showMapiDialog is set to 0.
|
||||
PRBool getShowDialog() ;
|
||||
@@ -111,7 +128,7 @@ nsresult RestoreBackedUpMapiDll();
|
||||
// create a string bundle for MAPI messages
|
||||
nsresult MakeMapiStringBundle(nsIStringBundle ** aMapiStringBundle) ;
|
||||
// display an error dialog for MAPI messages
|
||||
nsresult ShowMapiErrorDialog() ;
|
||||
nsresult ShowMapiErrorDialog(PRBool aForMail); // set to false if showing a news error
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,40 +1,25 @@
|
||||
/* ***** 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 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 mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
* Rajiv Dayal <rdayal@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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 ***** */
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 2001 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Srilatha Moturi <srilatha@netscape.com>
|
||||
* Rajiv Dayal <rdayal@netscape.com>
|
||||
*/
|
||||
|
||||
function mailnewsOverlayStartup() {
|
||||
mailnewsOverlayInit();
|
||||
@@ -42,15 +27,29 @@ function mailnewsOverlayStartup() {
|
||||
parent.mapiPref = new Object;
|
||||
parent.mapiPref.isDefaultMailClient =
|
||||
document.getElementById("mailnewsEnableMapi").checked;
|
||||
|
||||
var mailnewsEnableNews = document.getElementById("mailnewsEnableNews");
|
||||
if (mailnewsEnableNews)
|
||||
parent.mapiPref.isDefaultNewsClient = mailnewsEnableNews.checked;
|
||||
}
|
||||
else {
|
||||
// when we switch between different panes
|
||||
// set the checkbox based on the saved state
|
||||
var mailnewsEnableMapi = document.getElementById("mailnewsEnableMapi");
|
||||
var mailnewsEnableNews = document.getElementById("mailnewsEnableNews");
|
||||
|
||||
if (parent.mapiPref.isDefaultMailClient)
|
||||
mailnewsEnableMapi.setAttribute("checked", "true");
|
||||
else
|
||||
mailnewsEnableMapi.setAttribute("checked", "false");
|
||||
|
||||
if (mailnewsEnableNews)
|
||||
{
|
||||
if (parent.mapiPref.isDefaultNewsClient)
|
||||
mailnewsEnableNews.setAttribute("checked", "true");
|
||||
else
|
||||
mailnewsEnableNews.setAttribute("checked", "false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +73,8 @@ function mailnewsOverlayInit() {
|
||||
|
||||
const prefbase = "system.windows.lock_ui.";
|
||||
var mailnewsEnableMapi = document.getElementById("mailnewsEnableMapi");
|
||||
var mailnewsEnableNews = document.getElementById("mailnewsEnableNews");
|
||||
|
||||
if (mapiRegistry) {
|
||||
// initialise preference component.
|
||||
// While the data is coming from the system registry, we use a set
|
||||
@@ -89,13 +90,17 @@ function mailnewsOverlayInit() {
|
||||
}
|
||||
}
|
||||
catch(ex) {}
|
||||
if (mapiRegistry.isDefaultMailClient)
|
||||
mailnewsEnableMapi.setAttribute("checked", "true");
|
||||
else
|
||||
mailnewsEnableMapi.setAttribute("checked", "false");
|
||||
|
||||
mailnewsEnableMapi.setAttribute("checked", mapiRegistry.isDefaultMailClient ? "true" : "false");
|
||||
if (mailnewsEnableNews)
|
||||
mailnewsEnableNews.setAttribute("checked", mapiRegistry.isDefaultNewsClient ? "true" : "false");
|
||||
}
|
||||
else
|
||||
{
|
||||
mailnewsEnableMapi.setAttribute("disabled", "true");
|
||||
if (mailnewsEnableNews)
|
||||
mailnewsEnableNews.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
|
||||
function onEnableMapi() {
|
||||
@@ -105,19 +110,30 @@ function onEnableMapi() {
|
||||
document.getElementById("mailnewsEnableMapi").checked;
|
||||
}
|
||||
|
||||
function onEnableNews() {
|
||||
// save the state of the checkbox
|
||||
if ("mapiPref" in parent)
|
||||
parent.mapiPref.isDefaultNewsClient = document.getElementById("mailnewsEnableNews").checked;
|
||||
}
|
||||
|
||||
function onOK()
|
||||
{
|
||||
try {
|
||||
var mapiRegistry = Components.classes[ "@mozilla.org/mapiregistry;1" ].
|
||||
getService( Components.interfaces.nsIMapiRegistry );
|
||||
var mapiRegistry = Components.classes[ "@mozilla.org/mapiregistry;1" ].getService( Components.interfaces.nsIMapiRegistry );
|
||||
}
|
||||
catch(ex){
|
||||
mapiRegistry = null;
|
||||
}
|
||||
if (mapiRegistry &&
|
||||
("mapiPref" in parent) &&
|
||||
(mapiRegistry.isDefaultMailClient != parent.mapiPref.isDefaultMailClient)) {
|
||||
|
||||
if (mapiRegistry && ("mapiPref" in parent)) {
|
||||
if (mapiRegistry.isDefaultMailClient != parent.mapiPref.isDefaultMailClient)
|
||||
mapiRegistry.isDefaultMailClient = parent.mapiPref.isDefaultMailClient ;
|
||||
|
||||
if ("isDefaultNewsClient" in parent.mapiPref)
|
||||
{
|
||||
if (mapiRegistry.isDefaultNewsClient != parent.mapiPref.isDefaultNewsClient)
|
||||
mapiRegistry.isDefaultNewsClient = parent.mapiPref.isDefaultNewsClient;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user