make the defaultLocalPath attribute of the nsIMsgProtocolInfo interface NOT read only. when we do pref migration, I have to call the setter (which will set the pref for me)

This commit is contained in:
sspitzer%netscape.com 1999-09-14 03:16:02 +00:00
parent c123f33f8a
commit b6a9d0a97f
4 changed files with 43 additions and 4 deletions

View File

@ -30,6 +30,6 @@
[scriptable, uuid(53d0214a-689c-11d3-80f5-00a0c900d445)]
interface nsIMsgProtocolInfo : nsISupports
{
readonly attribute nsIFileSpec defaultLocalPath;
attribute nsIFileSpec defaultLocalPath;
};

View File

@ -40,6 +40,8 @@
#include "nsIPref.h"
#include "nsIProfile.h"
#define PREF_MAIL_ROOT_IMAP "mail.root.imap"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
@ -2170,6 +2172,17 @@ NS_IMETHODIMP nsImapService::NewChannel(const char *verb, nsIURI *aURI, nsILoadG
return rv;
}
NS_IMETHODIMP
nsImapService::SetDefaultLocalPath(nsIFileSpec *aPath)
{
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->SetFilePref(PREF_MAIL_ROOT_IMAP, aPath, PR_FALSE /* set default */);
return rv;
}
NS_IMETHODIMP
nsImapService::GetDefaultLocalPath(nsIFileSpec ** aResult)
{
@ -2177,7 +2190,7 @@ nsImapService::GetDefaultLocalPath(nsIFileSpec ** aResult)
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->GetFilePref("mail.root.imap", aResult);
rv = prefs->GetFilePref(PREF_MAIL_ROOT_IMAP, aResult);
if (NS_SUCCEEDED(rv)) return rv;
NS_WITH_SERVICE(nsIProfile, profile, NS_PROFILE_PROGID, &rv);

View File

@ -36,6 +36,8 @@
#define POP3_PORT 110 // The IANA port for Pop3
#define PREF_MAIL_ROOT_POP3 "mail.root.pop3"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
static NS_DEFINE_CID(kProfileCID, NS_PROFILE_CID);
static NS_DEFINE_CID(kPop3UrlCID, NS_POP3URL_CID);
@ -269,6 +271,18 @@ NS_IMETHODIMP nsPop3Service::NewChannel(const char *verb, nsIURI *aURI, nsILoadG
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPop3Service::SetDefaultLocalPath(nsIFileSpec *aPath)
{
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->SetFilePref(PREF_MAIL_ROOT_POP3, aPath, PR_FALSE /* set default */);
return rv;
}
NS_IMETHODIMP
nsPop3Service::GetDefaultLocalPath(nsIFileSpec ** aResult)
{
@ -276,7 +290,7 @@ nsPop3Service::GetDefaultLocalPath(nsIFileSpec ** aResult)
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->GetFilePref("mail.root.pop3", aResult);
rv = prefs->GetFilePref(PREF_MAIL_ROOT_POP3, aResult);
if (NS_SUCCEEDED(rv)) return rv;
NS_WITH_SERVICE(nsIProfile, profile, kProfileCID, &rv);

View File

@ -46,6 +46,7 @@
#undef SetPort // XXX Windows!
#define PREF_NETWORK_HOSTS_NNTP_SERVER "network.hosts.nntp_server"
#define PREF_MAIL_ROOT_NNTP "mail.root.nntp"
static NS_DEFINE_CID(kCNntpUrlCID, NS_NNTPURL_CID);
static NS_DEFINE_CID(kCNewsDB, NS_NEWSDB_CID);
@ -967,6 +968,17 @@ NS_IMETHODIMP nsNntpService::NewChannel(const char *verb, nsIURI *aURI, nsILoadG
return rv;
}
NS_IMETHODIMP
nsNntpService::SetDefaultLocalPath(nsIFileSpec *aPath)
{
nsresult rv;
NS_WITH_SERVICE(nsIPref, prefs, kCPrefServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->SetFilePref(PREF_MAIL_ROOT_NNTP, aPath, PR_FALSE /* set default */);
return rv;
}
NS_IMETHODIMP
nsNntpService::GetDefaultLocalPath(nsIFileSpec ** aResult)
{
@ -974,7 +986,7 @@ nsNntpService::GetDefaultLocalPath(nsIFileSpec ** aResult)
NS_WITH_SERVICE(nsIPref, prefs, kCPrefServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->GetFilePref("mail.root.nntp", aResult);
rv = prefs->GetFilePref(PREF_MAIL_ROOT_NNTP, aResult);
if (NS_SUCCEEDED(rv)) return rv;
NS_WITH_SERVICE(nsIProfile, profile, NS_PROFILE_PROGID, &rv);