зеркало из https://github.com/mozilla/pjs.git
Fix to add feedback for send operation - Bug 25500 - r: ducarroz
This commit is contained in:
Родитель
b06091c60e
Коммит
877171c87e
|
@ -123,4 +123,14 @@
|
|||
## @name NS_MSG_NO_SUBJECT_WAS_SPECIFIED
|
||||
12533=No subject was specified.
|
||||
|
||||
## @name NS_MSG_ASSEMBLING_MESSAGE
|
||||
12534=Assembling mail information...
|
||||
|
||||
## @name NS_MSG_GATHERING_ATTACHMENT
|
||||
12535=Attaching %s...
|
||||
|
||||
## @name NS_MSG_CREATING_MESSAGE
|
||||
12536=Creating mail message...
|
||||
|
||||
|
||||
noIdentities=You don't have any email identities yet. Create one with the Account Wizard.
|
||||
|
|
|
@ -34,35 +34,29 @@
|
|||
#include "nsIMsgMessageService.h"
|
||||
#include "nsMsgUtils.h"
|
||||
|
||||
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// RICHIE_MAC - for the Mac, when can we get rid of this stuff?
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AT SOME POINT, WE NEED TO FIGURE OUT A SOLUTION FOR THIS MAC ONLY STUFF
|
||||
// Mac Specific Attachment Handling for AppleDouble Encoded Files
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#ifdef XP_MAC
|
||||
#include "xp.h" // mac only
|
||||
#include "errors.h"
|
||||
#include "m_cvstrm.h"
|
||||
//
|
||||
// Need a routine for the Mac to see if this is a Mac file?
|
||||
//
|
||||
static PRBool
|
||||
nsMsgIsMacFile(char *filename)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
//
|
||||
// Need a routine for the Mac to get type information
|
||||
//
|
||||
void
|
||||
MacGetFileType(nsFileSpec *fs, PRBool *useDefault, char **type, char **encoding)
|
||||
{
|
||||
*useDefault = PR_TRUE;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// GET RID OF THIS STUFF!!!!
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
PRBool nsMsgIsMacFile(char *filename) { return PR_FALSE; }
|
||||
void MacGetFileType(nsFileSpec *fs, PRBool *useDefault, char **type, char **encoding) { *useDefault = PR_TRUE;}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**********
|
||||
extern PRBool nsMsgIsMacFile(char *filename);
|
||||
extern void MacGetFileType(nsFileSpec *fs, PRBool *useDefault, char **type, char **encoding);
|
||||
**********/
|
||||
|
||||
#endif /* XP_MAC */
|
||||
|
||||
//
|
||||
|
@ -428,6 +422,7 @@ FetcherURLDoneCallback(nsIURI* aURL, nsresult aStatus,
|
|||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgAttachmentHandler::SnarfMsgAttachment(nsMsgCompFields *compFields)
|
||||
{
|
||||
|
@ -872,3 +867,4 @@ nsMsgAttachmentHandler::UseUUEncode_p(void)
|
|||
else
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsURLFetcher.h"
|
||||
#include "nsIMimeConverter.h"
|
||||
#include "nsMsgCompFields.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
|
||||
// Forward declarations...
|
||||
class nsMsgComposeAndSend;
|
||||
|
|
|
@ -66,6 +66,11 @@
|
|||
#define NS_MSG_FAILED_COPY_OPERATION NS_MSG_GENERATE_FAILURE(12532)
|
||||
#define NS_MSG_NO_SUBJECT_WAS_SPECIFIED NS_MSG_GENERATE_SUCCESS(12533)
|
||||
|
||||
// For message sending operations...
|
||||
#define NS_MSG_ASSEMBLING_MESSAGE NS_MSG_GENERATE_SUCCESS(12534)
|
||||
#define NS_MSG_GATHERING_ATTACHMENT NS_MSG_GENERATE_SUCCESS(12535)
|
||||
#define NS_MSG_CREATING_MESSAGE NS_MSG_GENERATE_SUCCESS(12536)
|
||||
|
||||
NS_BEGIN_EXTERN_C
|
||||
|
||||
PRUnichar *ComposeGetStringByID(PRInt32 stringID);
|
||||
|
|
|
@ -61,11 +61,14 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIDNSService.h"
|
||||
#include "mozITXTToHTMLConv.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
|
||||
// use these macros to define a class IID for our component. Our object currently
|
||||
// supports two interfaces (nsISupports and nsIMsgCompose) so we want to define constants
|
||||
// for these two interfaces
|
||||
//
|
||||
|
||||
static NS_DEFINE_CID(kMsgMailSessionCID, NS_MSGMAILSESSION_CID);
|
||||
static NS_DEFINE_CID(kSmtpServiceCID, NS_SMTPSERVICE_CID);
|
||||
static NS_DEFINE_CID(kNntpServiceCID, NS_NNTPSERVICE_CID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
|
@ -189,6 +192,20 @@ nsMsgComposeAndSend::nsMsgComposeAndSend() :
|
|||
mCompFieldLocalAttachments = 0;
|
||||
mCompFieldRemoteAttachments = 0;
|
||||
|
||||
|
||||
// note: it is okay to return a null status feedback and not return an error
|
||||
// it's possible the url really doesn't have status feedback
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kMsgMailSessionCID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgWindow> msgWindow;
|
||||
|
||||
mailSession->GetTemporaryMsgWindow(getter_AddRefs(msgWindow));
|
||||
if (msgWindow)
|
||||
msgWindow->GetStatusFeedback(getter_AddRefs(mFeedback));
|
||||
}
|
||||
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
|
@ -350,6 +367,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
|||
PRBool shouldDeleteDeliveryState = PR_TRUE;
|
||||
PRInt32 status;
|
||||
PRUint32 i;
|
||||
PRUnichar *msg;
|
||||
char *headers = 0;
|
||||
PRFileDesc *in_file = 0;
|
||||
PRBool multipart_p = PR_FALSE;
|
||||
|
@ -932,6 +950,11 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
|||
|
||||
}
|
||||
|
||||
// Tell the user we are creating the message...
|
||||
msg = ComposeGetStringByID(NS_MSG_CREATING_MESSAGE);
|
||||
SetStatusMessage( msg );
|
||||
PR_FREEIF(msg);
|
||||
|
||||
// OK, now actually write the structure we've carefully built up.
|
||||
status = toppart->Write();
|
||||
if (status < 0)
|
||||
|
@ -2109,6 +2132,29 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
|||
// This only returns a failure code if NET_GetURL was not called
|
||||
// (and thus no exit routine was or will be called.)
|
||||
//
|
||||
|
||||
// Display some feedback to user...
|
||||
char *printfString = nsnull;
|
||||
PRUnichar *progressMsg = nsnull;
|
||||
PRUnichar *msg = nsnull;
|
||||
|
||||
msg = ComposeGetStringByID(NS_MSG_GATHERING_ATTACHMENT);
|
||||
nsCAutoString cProgressString(msg);
|
||||
if (m_attachments[i].m_real_name)
|
||||
printfString = PR_smprintf(cProgressString, m_attachments[i].m_real_name);
|
||||
else
|
||||
printfString = PR_smprintf(cProgressString, "");
|
||||
|
||||
if (printfString)
|
||||
{
|
||||
nsString formattedString(printfString);
|
||||
progressMsg = nsCRT::strdup(formattedString.GetUnicode());
|
||||
PR_smprintf_free(printfString);
|
||||
}
|
||||
|
||||
PR_FREEIF(msg);
|
||||
SetStatusMessage(progressMsg);
|
||||
|
||||
int status = m_attachments[i].SnarfAttachment(mCompFields);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
@ -2345,6 +2391,12 @@ nsMsgComposeAndSend::Init(
|
|||
const nsMsgAttachedFile *preloaded_attachments)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
PRUnichar *msg;
|
||||
|
||||
// Tell the user we are assembling the message...
|
||||
msg = ComposeGetStringByID(NS_MSG_ASSEMBLING_MESSAGE);
|
||||
SetStatusMessage( msg );
|
||||
PR_FREEIF(msg);
|
||||
|
||||
//
|
||||
// The Init() method should initialize a send operation for full
|
||||
|
@ -3760,3 +3812,21 @@ nsMsgComposeAndSend::StartMessageCopyOperation(nsIFileSpec *aFileSpec,
|
|||
this, uri, mMsgToReplace);
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgComposeAndSend::SetStatusMessage(PRUnichar *aMsgString)
|
||||
{
|
||||
PRUnichar *progressMsg;
|
||||
|
||||
if ( (!mFeedback) || (!aMsgString) )
|
||||
return NS_OK;
|
||||
|
||||
nsString formattedString(aMsgString);
|
||||
|
||||
// lossy, but what can we do?
|
||||
nsCAutoString cProgressString(aMsgString);
|
||||
progressMsg = nsCRT::strdup(formattedString.GetUnicode());
|
||||
mFeedback->ShowStatusString(progressMsg);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsIEditorShell.h"
|
||||
#include "nsIUrlListener.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
#if 0
|
||||
#include "nsMsgCopy.h"
|
||||
#endif
|
||||
|
@ -324,6 +325,8 @@ public:
|
|||
nsMsgDeliverMode mode,
|
||||
nsIMsgSendListener **aListenerArray);
|
||||
|
||||
nsresult SetStatusMessage(PRUnichar *aMsgString); // Status message method
|
||||
|
||||
//
|
||||
// All vars necessary for this implementation
|
||||
//
|
||||
|
@ -395,6 +398,8 @@ public:
|
|||
PRUint32 mCompFieldLocalAttachments; // the number of file:// attachments in the comp fields
|
||||
PRUint32 mCompFieldRemoteAttachments; // the number of remote attachments in the comp fields
|
||||
|
||||
nsCOMPtr <nsIMsgStatusFeedback> mFeedback; // Tell the user something why don't ya'
|
||||
|
||||
//
|
||||
// attachment states and other info...
|
||||
//
|
||||
|
|
|
@ -647,7 +647,7 @@ nsMsgSendPart::Write()
|
|||
}
|
||||
else if (m_filespec)
|
||||
{
|
||||
nsIOFileStream myStream(*m_filespec);
|
||||
nsInputFileStream myStream(*m_filespec);
|
||||
|
||||
if (!myStream.is_open())
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче