Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsMsgPrompts.cpp File Reference
#include "nsMsgPrompts.h"
#include "nsMsgCopy.h"
#include "nsIMsgStringService.h"
#include "nsIPrompt.h"
#include "nsIWindowWatcher.h"
#include "nsMsgComposeStringBundle.h"
#include "nsXPIDLString.h"
#include "nsMsgCompCID.h"

Go to the source code of this file.

Functions

nsresult nsMsgBuildErrorMessageByID (PRInt32 msgID, nsString &retval, nsString *param0, nsString *param1)
nsresult nsMsgDisplayMessageByID (nsIPrompt *aPrompt, PRInt32 msgID, const PRUnichar *windowTitle)
nsresult nsMsgDisplayMessageByString (nsIPrompt *aPrompt, const PRUnichar *msg, const PRUnichar *windowTitle)
nsresult nsMsgAskBooleanQuestionByID (nsIPrompt *aPrompt, PRInt32 msgID, PRBool *answer, const PRUnichar *windowTitle)
nsresult nsMsgAskBooleanQuestionByString (nsIPrompt *aPrompt, const PRUnichar *msg, PRBool *answer, const PRUnichar *windowTitle)
PRInt32 nsMsgAskAboutUncoveredCharacters (nsIPrompt *aPrompt)

Function Documentation

Definition at line 158 of file nsMsgPrompts.cpp.

{
  PRInt32 result;
  nsCOMPtr<nsIPrompt> dialog = aPrompt;

  if (!dialog)
  {
    nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
    if (wwatch)
      wwatch->GetNewPrompter(0, getter_AddRefs(dialog));
  }

  NS_ENSURE_TRUE(dialog, 0);

  nsCOMPtr<nsIStringBundleService> bundleService =
    do_GetService(NS_STRINGBUNDLE_CONTRACTID);
  NS_ENSURE_TRUE(bundleService, 0);

  nsCOMPtr<nsIStringBundle> composeBundle;
  bundleService->CreateBundle("chrome://messenger/locale/messengercompose/"
                              "composeMsgs.properties",
                               getter_AddRefs(composeBundle));
  NS_ENSURE_TRUE(composeBundle, 0);

  nsXPIDLString title;
  nsXPIDLString msg;
  nsXPIDLString sendInUTF8;
  nsXPIDLString sendAnyway;

  composeBundle->
    GetStringFromName(NS_LITERAL_STRING("initErrorDlogTitle").get(),
                      getter_Copies(title));
  composeBundle->
    GetStringFromID(NS_ERROR_GET_CODE(NS_ERROR_MSG_MULTILINGUAL_SEND),
                    getter_Copies(msg));
  composeBundle->
    GetStringFromName(NS_LITERAL_STRING("sendInUTF8").get(),
                      getter_Copies(sendInUTF8));
  composeBundle->
    GetStringFromName(NS_LITERAL_STRING("sendAnyway").get(),
                      getter_Copies(sendAnyway));

  nsresult rv = dialog->
    ConfirmEx(title, msg, 
              nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_0 +
              nsIPrompt::BUTTON_TITLE_CANCEL * nsIPrompt::BUTTON_POS_1 +
              nsIPrompt::BUTTON_TITLE_IS_STRING * nsIPrompt::BUTTON_POS_2 +
              nsIPrompt::BUTTON_POS_0_DEFAULT,
              sendInUTF8, nsnull, sendAnyway, nsnull, 0, &result);

  NS_ENSURE_SUCCESS(rv, 0);
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgAskBooleanQuestionByID ( nsIPrompt aPrompt,
PRInt32  msgID,
PRBool answer,
const PRUnichar windowTitle 
)

Definition at line 113 of file nsMsgPrompts.cpp.

{
  nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID));
  nsXPIDLString msg;

  if (composebundle)
  {
    composebundle->GetStringByID(msgID, getter_Copies(msg));
    nsMsgAskBooleanQuestionByString(aPrompt, msg, answer, windowTitle);
  }

  return NS_OK;
}     

Here is the call graph for this function:

nsresult nsMsgAskBooleanQuestionByString ( nsIPrompt aPrompt,
const PRUnichar msg,
PRBool answer,
const PRUnichar windowTitle 
)

Definition at line 128 of file nsMsgPrompts.cpp.

{
  nsresult rv;
  PRInt32 result;
  nsCOMPtr<nsIPrompt> dialog = aPrompt;

  if ((!msg) || (!*msg))
    return NS_ERROR_INVALID_ARG;
  
  if (!dialog)
  {
    nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
    if (wwatch)
      wwatch->GetNewPrompter(0, getter_AddRefs(dialog));
  }

  if (dialog) 
  {
    rv = dialog->Confirm(windowTitle, msg, &result);
    if (result == 1) 
      *answer = PR_TRUE;
    else 
      *answer = PR_FALSE;
  }

  return NS_OK;
}     

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgBuildErrorMessageByID ( PRInt32  msgID,
nsString retval,
nsString param0,
nsString param1 
)

Definition at line 48 of file nsMsgPrompts.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
  nsXPIDLString msg;

  if (composebundle)
  {
    composebundle->GetStringByID(msgID, getter_Copies(msg));
    retval = msg;

    nsString target;
    if (param0)
    {
      target.AssignLiteral("%P0%");
      retval.ReplaceSubstring(target, *param0);
    }
    if (param1)
    {
      target.AssignLiteral("%P1%");
      retval.ReplaceSubstring(target, *param1);
    }
  }
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgDisplayMessageByID ( nsIPrompt aPrompt,
PRInt32  msgID,
const PRUnichar windowTitle 
)

Definition at line 76 of file nsMsgPrompts.cpp.

{
  nsresult rv;

  nsCOMPtr<nsIMsgStringService> composebundle (do_GetService(NS_MSG_COMPOSESTRINGSERVICE_CONTRACTID, &rv));
  nsXPIDLString msg;

  if (composebundle)
  {
    composebundle->GetStringByID(msgID, getter_Copies(msg));
    rv = nsMsgDisplayMessageByString(aPrompt, msg, windowTitle);
  }
  return rv;
}

Here is the call graph for this function:

nsresult nsMsgDisplayMessageByString ( nsIPrompt aPrompt,
const PRUnichar msg,
const PRUnichar windowTitle 
)

Definition at line 92 of file nsMsgPrompts.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIPrompt> prompt = aPrompt;

  if ((!msg) || (!*msg))
    return NS_ERROR_INVALID_ARG;
  
  if (!prompt)
  {
    nsCOMPtr<nsIWindowWatcher> wwatch(do_GetService(NS_WINDOWWATCHER_CONTRACTID));
    if (wwatch)
      wwatch->GetNewPrompter(0, getter_AddRefs(prompt));
  }
  
  if (prompt)
    rv = prompt->Alert(windowTitle, msg);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function: