зеркало из https://github.com/mozilla/pjs.git
make the subscribe i18n friendly when drilling down to find imap folders.
I need to use the folder path, not the folder name. r=mscott
This commit is contained in:
Родитель
c4571529dd
Коммит
04d4bab13c
|
@ -37,7 +37,7 @@ interface nsISubscribableServer : nsISupports {
|
|||
void setIncomingServer(in nsIMsgIncomingServer server);
|
||||
void setDelimiter(in char delimiter);
|
||||
void populateSubscribeDatasource(in nsIMsgWindow aMsgWindow, in boolean forceToServer);
|
||||
void populateSubscribeDatasourceWithName(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string name);
|
||||
void populateSubscribeDatasourceWithPath(in nsIMsgWindow aMsgWindow, in boolean forceToServer, in string path);
|
||||
attribute nsISubscribeListener subscribeListener;
|
||||
void startPopulatingSubscribeDS();
|
||||
void stopPopulatingSubscribeDS();
|
||||
|
|
|
@ -328,13 +328,23 @@ function SubscribeOnClick(event)
|
|||
var treeitem = event.target.parentNode.parentNode.parentNode;
|
||||
var open = treeitem.getAttribute('open');
|
||||
if(open == "true") {
|
||||
var name = treeitem.getAttribute("name");
|
||||
dump("do twisty for " + name +"\n");
|
||||
var uri = treeitem.getAttribute("id");
|
||||
|
||||
// we need the path here, so if the uri is:
|
||||
// imap://sspitzer@nsmail-1/foo/bar
|
||||
// we want foo/bar
|
||||
//
|
||||
// why not use the "name" attribute?
|
||||
// for i18n, we need the folder path, which is not the same
|
||||
// the folder path (of the uri) will have UTF7
|
||||
// the name has UTF8
|
||||
var path = uri.substring(gServerURI.length + 1,uri.length);
|
||||
dump("do twisty for " + path + "\n");
|
||||
|
||||
// Turn progress meter on.
|
||||
gStatusBar.setAttribute("mode","undetermined");
|
||||
|
||||
gSubscribableServer.populateSubscribeDatasourceWithName(null /* eventually, a nsIMsgWindow */, true /* force to server */, name);
|
||||
gSubscribableServer.populateSubscribeDatasourceWithPath(null /* eventually, a nsIMsgWindow */, true /* force to server */, path);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -452,7 +452,7 @@ nsSubscribableServer::SubscribeCleanup()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSubscribableServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *name)
|
||||
nsSubscribableServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *path)
|
||||
{
|
||||
NS_ASSERTION(PR_FALSE,"override this.");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -140,13 +140,13 @@ interface nsIImapService : nsISupports
|
|||
void discoverChildren(in nsIEventQueue aClientEventQueue,
|
||||
in nsIMsgFolder aImapMailFolder,
|
||||
in nsIUrlListener aUrlListener,
|
||||
in string name,
|
||||
in string folderPath,
|
||||
out nsIURI aURL);
|
||||
|
||||
void discoverLevelChildren(in nsIEventQueue aClientEventQueue,
|
||||
in nsIMsgFolder aImapMailFolder,
|
||||
in nsIUrlListener aUrlListener,
|
||||
in string name,
|
||||
in string folderPath,
|
||||
in long aLevel,
|
||||
out nsIURI aURL);
|
||||
|
||||
|
@ -205,5 +205,5 @@ interface nsIImapService : nsISupports
|
|||
in nsIUrlListener aUrlListener);
|
||||
|
||||
void buildSubscribeDatasource(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow);
|
||||
void buildSubscribeDatasourceWithName(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow, in string name);
|
||||
void buildSubscribeDatasourceWithPath(in nsIImapIncomingServer aServer, in nsIMsgWindow aMsgWindow, in string folderPath);
|
||||
};
|
||||
|
|
|
@ -1839,11 +1839,11 @@ NS_IMETHODIMP nsImapIncomingServer::OnLogonRedirectionReply(const PRUnichar *pHo
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *name)
|
||||
nsImapIncomingServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer /*ignored*/, const char *path)
|
||||
{
|
||||
nsresult rv;
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("in PopulateSubscribeDatasourceWithName(%s)\n",name);
|
||||
printf("in PopulateSubscribeDatasourceWithPath(%s)\n",path);
|
||||
#endif
|
||||
mDoingSubscribeDialog = PR_TRUE;
|
||||
|
||||
|
@ -1855,7 +1855,7 @@ nsImapIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWind
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
if (!imapService) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = imapService->BuildSubscribeDatasourceWithName(this, aMsgWindow, name);
|
||||
rv = imapService->BuildSubscribeDatasourceWithPath(this, aMsgWindow, path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -1503,7 +1503,7 @@ NS_IMETHODIMP
|
|||
nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
|
||||
nsIMsgFolder* aImapMailFolder,
|
||||
nsIUrlListener* aUrlListener,
|
||||
const char *folderName,
|
||||
const char *folderPath,
|
||||
nsIURI** aURL)
|
||||
{
|
||||
NS_ASSERTION (aImapMailFolder && aClientEventQueue,
|
||||
|
@ -1524,13 +1524,13 @@ nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
|
|||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (folderName && (nsCRT::strlen(folderName) > 0))
|
||||
if (folderPath && (nsCRT::strlen(folderPath) > 0))
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
||||
|
||||
urlSpec.Append("/discoverchildren>");
|
||||
urlSpec.AppendWithConversion(hierarchySeparator);
|
||||
urlSpec.Append(folderName);
|
||||
urlSpec.Append(folderPath);
|
||||
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
|
||||
// compiler that is preventing in string parameters from showing up as
|
||||
// const char *. hopefully they will fix it soon.
|
||||
|
@ -1553,7 +1553,7 @@ NS_IMETHODIMP
|
|||
nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
|
||||
nsIMsgFolder* aImapMailFolder,
|
||||
nsIUrlListener* aUrlListener,
|
||||
const char *folderName,
|
||||
const char *folderPath,
|
||||
PRInt32 level,
|
||||
nsIURI** aURL)
|
||||
{
|
||||
|
@ -1574,13 +1574,13 @@ nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
|
|||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
if (folderName && (nsCRT::strlen(folderName) > 0))
|
||||
if (folderPath && (nsCRT::strlen(folderPath) > 0))
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(aImapUrl);
|
||||
urlSpec.Append("/discoverlevelchildren>");
|
||||
urlSpec.AppendInt(level);
|
||||
urlSpec.AppendWithConversion(hierarchySeparator); // hierarchySeparator "/"
|
||||
urlSpec.Append(folderName);
|
||||
urlSpec.Append(folderPath);
|
||||
|
||||
rv = uri->SetSpec((char *) urlSpec.GetBuffer());
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -2758,12 +2758,12 @@ nsImapService::GetDefaultCopiesAndFoldersPrefsToServer(PRBool *aDefaultCopiesAnd
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapService::BuildSubscribeDatasourceWithName(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow, const char *folderName)
|
||||
nsImapService::BuildSubscribeDatasourceWithPath(nsIImapIncomingServer *aServer, nsIMsgWindow *aMsgWindow, const char *folderPath)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("BuildSubscribeDatasourceWithName(%s)\n",folderName);
|
||||
printf("BuildSubscribeDatasourceWithPath(%s)\n",folderPath);
|
||||
#endif
|
||||
nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aServer);
|
||||
if (!server) return NS_ERROR_FAILURE;
|
||||
|
@ -2788,7 +2788,7 @@ nsImapService::BuildSubscribeDatasourceWithName(nsIImapIncomingServer *aServer,
|
|||
rv = pEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(queue));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = DiscoverChildren(queue, rootMsgFolder, listener, folderName, nsnull);
|
||||
rv = DiscoverChildren(queue, rootMsgFolder, listener, folderPath, nsnull);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -815,12 +815,12 @@ nsNntpIncomingServer::PopulateSubscribeDatasourceFromHostInfo(nsIMsgWindow *aMsg
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpIncomingServer::PopulateSubscribeDatasourceWithName(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *name)
|
||||
nsNntpIncomingServer::PopulateSubscribeDatasourceWithPath(nsIMsgWindow *aMsgWindow, PRBool aForceToServer, const char *path)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef DEBUG_sspitzer
|
||||
printf("PopulateSubscribeDatasourceWithName(%s)\n",name);
|
||||
printf("PopulateSubscribeDatasourceWithPath(%s)\n",path);
|
||||
#endif
|
||||
|
||||
rv = StopPopulatingSubscribeDS();
|
||||
|
|
Загрузка…
Ссылка в новой задаче