Ejemplo n.º 1
0
LONG CMapiImp::InitContext(unsigned long session, MsgMapiListContext **listContext)
{
  nsMAPIConfiguration * pMapiConfig = nsMAPIConfiguration::GetMAPIConfiguration() ;
  if (!pMapiConfig)
    return NS_ERROR_FAILURE ;  // get the singelton obj
  *listContext = (MsgMapiListContext *) pMapiConfig->GetMapiListContext(session);
  // This is the first message
  if (!*listContext)
  {
    nsCOMPtr <nsIMsgFolder> inboxFolder;
    nsresult rv = GetDefaultInbox(getter_AddRefs(inboxFolder));
    if (NS_FAILED(rv))
    {
      NS_ASSERTION(PR_FALSE, "in init context, no inbox");
      return(MAPI_E_NO_MESSAGES);
    }

    *listContext = new MsgMapiListContext;
    if (!*listContext)
      return MAPI_E_INSUFFICIENT_MEMORY;

    rv = (*listContext)->OpenDatabase(inboxFolder);
    if (NS_FAILED(rv))
    {
      pMapiConfig->SetMapiListContext(session, NULL);
      delete *listContext;
      NS_ASSERTION(PR_FALSE, "in init context, unable to open db");
      return MAPI_E_NO_MESSAGES;
    }
    else
      pMapiConfig->SetMapiListContext(session, *listContext);
  }
  return SUCCESS_SUCCESS;
}
void
GPrefsMgr::EditPrefs()
{
	assert(itsDialog == NULL);
	itsDialog =
		new GMailPrefsDialog(JXGetApplication(), ShowingStateInTitle(),
								AutoInsertingQuote(), ShowingSenderString(),
								GetSenderString(), GetDefaultMonoFont(),
								GetDefaultFontSize(), GetMaxQuote()/1024,
								(JXGetSpellChecker())->WillReportNoErrors(),
								GetTabCharWidth(),
								IsBeepingOnNewMail(), (JIndex)GetEncryptionType(),
								GetFilterFile(), GetDefaultInbox(), 
								IsOpeningMailboxWindow());
	assert(itsDialog != NULL);
	ListenTo(itsDialog);
	itsDialog->BeginDialog();
}