Bug 415736 - "delete/detach attachments in background without question for user" [p=lukas.durfina@gmail.com (Lukas Durfina) r+sr=bienvenu]
git-svn-id: svn://10.0.0.236/trunk@246641 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -50,7 +50,7 @@ interface nsIMsgMessageService;
|
||||
interface nsIFile;
|
||||
interface nsIUrlListener;
|
||||
|
||||
[scriptable, uuid(BE8C45B1-F810-4B7E-BB44-790B53631D52)]
|
||||
[scriptable, uuid(1B44C6EB-2C14-470F-AA5C-BDDCE89A4ECC)]
|
||||
interface nsIMessenger : nsISupports {
|
||||
|
||||
const long eUnknown = 0;
|
||||
@@ -113,10 +113,10 @@ interface nsIMessenger : nsISupports {
|
||||
void saveAttachmentToFile(in nsIFile aFile, in ACString aUrl, in ACString aMessageUri,
|
||||
in ACString aContentType, in nsIUrlListener aListener);
|
||||
|
||||
void detachAttachment(in string contentTpe, in string url, in string displayName, in string messageUri, in boolean saveFirst);
|
||||
void detachAttachment(in string contentTpe, in string url, in string displayName, in string messageUri, in boolean saveFirst, [optional] in boolean withoutWarning);
|
||||
void detachAllAttachments(in unsigned long count, [array, size_is(count)] in string contentTypeArray,
|
||||
[array, size_is(count)] in string urlArray, [array, size_is(count)] in string displayNameArray,
|
||||
[array, size_is(count)] in string messageUriArray, in boolean saveFirst);
|
||||
[array, size_is(count)] in string messageUriArray, in boolean saveFirst, [optional] in boolean withoutWarning);
|
||||
// saveAttachmentToFolder is used by the drag and drop code to drop an attachment to a destination folder
|
||||
// we need to return the actual file path (including the filename).
|
||||
nsILocalFile saveAttachmentToFolder(in ACString contentType, in ACString url, in ACString displayName, in ACString messageUri, in nsILocalFile aDestFolder);
|
||||
|
||||
@@ -3006,7 +3006,7 @@ nsDelAttachListener::StartProcessing(nsMessenger * aMessenger, nsIMsgWindow * aM
|
||||
NS_IMETHODIMP
|
||||
nsMessenger::DetachAttachment(const char * aContentType, const char * aUrl,
|
||||
const char * aDisplayName, const char * aMessageUri,
|
||||
PRBool aSaveFirst)
|
||||
PRBool aSaveFirst, PRBool withoutWarning = PR_FALSE)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aContentType);
|
||||
NS_ENSURE_ARG_POINTER(aUrl);
|
||||
@@ -3014,7 +3014,7 @@ nsMessenger::DetachAttachment(const char * aContentType, const char * aUrl,
|
||||
NS_ENSURE_ARG_POINTER(aMessageUri);
|
||||
|
||||
// convenience function for JS, processing handled by DetachAllAttachments()
|
||||
return DetachAllAttachments(1, &aContentType, &aUrl, &aDisplayName, &aMessageUri, aSaveFirst);
|
||||
return DetachAllAttachments(1, &aContentType, &aUrl, &aDisplayName, &aMessageUri, aSaveFirst, withoutWarning);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@@ -3023,7 +3023,8 @@ nsMessenger::DetachAllAttachments(PRUint32 aCount,
|
||||
const char ** aUrlArray,
|
||||
const char ** aDisplayNameArray,
|
||||
const char ** aMessageUriArray,
|
||||
PRBool aSaveFirst)
|
||||
PRBool aSaveFirst,
|
||||
PRBool withoutWarning = PR_FALSE)
|
||||
{
|
||||
NS_ENSURE_ARG_MIN(aCount, 1);
|
||||
NS_ENSURE_ARG_POINTER(aContentTypeArray);
|
||||
@@ -3034,7 +3035,7 @@ nsMessenger::DetachAllAttachments(PRUint32 aCount,
|
||||
if (aSaveFirst)
|
||||
return SaveAllAttachments(aCount, aContentTypeArray, aUrlArray, aDisplayNameArray, aMessageUriArray, PR_TRUE);
|
||||
else
|
||||
return DetachAttachments(aCount, aContentTypeArray, aUrlArray, aDisplayNameArray, aMessageUriArray, nsnull);
|
||||
return DetachAttachments(aCount, aContentTypeArray, aUrlArray, aDisplayNameArray, aMessageUriArray, nsnull, withoutWarning);
|
||||
}
|
||||
|
||||
nsresult
|
||||
@@ -3043,13 +3044,15 @@ nsMessenger::DetachAttachments(PRUint32 aCount,
|
||||
const char ** aUrlArray,
|
||||
const char ** aDisplayNameArray,
|
||||
const char ** aMessageUriArray,
|
||||
nsCStringArray *saveFileUris)
|
||||
nsCStringArray *saveFileUris,
|
||||
PRBool withoutWarning)
|
||||
{
|
||||
if (NS_FAILED(PromptIfDeleteAttachments(saveFileUris != nsnull, aCount, aDisplayNameArray)))
|
||||
return NS_OK;
|
||||
// if withoutWarning no dialog for user
|
||||
if (!withoutWarning && NS_FAILED(PromptIfDeleteAttachments(saveFileUris != nsnull, aCount, aDisplayNameArray)))
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
||||
// ensure that our arguments are valid
|
||||
// char * partId;
|
||||
for (PRUint32 u = 0; u < aCount; ++u)
|
||||
|
||||
@@ -74,7 +74,8 @@ public:
|
||||
const char ** aUrlArray,
|
||||
const char ** aDisplayNameArray,
|
||||
const char ** aMessageUriArray,
|
||||
nsCStringArray *saveFileUris);
|
||||
nsCStringArray *saveFileUris,
|
||||
PRBool withoutWarning = PR_FALSE);
|
||||
nsresult SaveAllAttachments(PRUint32 count,
|
||||
const char **contentTypeArray,
|
||||
const char **urlArray,
|
||||
|
||||
Reference in New Issue
Block a user