Beispiel #1
0
AccountManager::~AccountManager()
{
	Account* account = (Account*)(m_accountlist.First());
	Account* next_account;
	while (account)
	{
		next_account = (Account*)(account->Suc());
		account->Out();
		if (!m_m2_init_failed) //Only store accounts.ini if we know we didn't fail reading it!
		{
			account->SaveSettings(FALSE); // don't commit, it will happen below
		}
		OP_DELETE(account);
		account = next_account;
	}

	if (!m_m2_init_failed && m_headerdisplay)
	{
		m_headerdisplay->SaveSettings();
	}
	OP_DELETE(m_headerdisplay);

	if (!m_m2_init_failed) //Only store accounts.ini if we know we didn't fail reading it!
	{
		// write prefs file
		OpStatus::Ignore(CommitPrefsFile(TRUE)); //We need to get this on disk (not much we can do if Commit fails)
	}

    if (m_prefs_file)
		MessageEngine::GetInstance()->GetGlueFactory()->DeletePrefsFile(m_prefs_file); //If m_m2_init_failed, this will assert, even though everything is ok
}
Beispiel #2
0
UINT32 SignatureEditor::OnOk()
{
	// store the HTML source
	BOOL isHTML = m_rich_text_editor->IsHTML();
	OpString signature_content;
	if (isHTML)
		m_rich_text_editor->GetHTMLSource(signature_content,TRUE);
	else
	{
		// the text equivalent returns LF instead of CRLF, we need to convert it
		OpString temp_sig;		
		m_rich_text_editor->GetTextEquivalent(temp_sig);
		UINT32 needed_length = StringConvert::ConvertLineFeedsToLineBreaks(temp_sig.CStr(),temp_sig.Length(),NULL,0);
		uni_char* buf = OP_NEWA(uni_char,needed_length);
		StringConvert::ConvertLineFeedsToLineBreaks(temp_sig.CStr(),temp_sig.Length(),buf,needed_length);
		signature_content.Set(buf,needed_length);
		OP_DELETEA(buf);
	}
	

	// check if we should apply the signature for all accounts or not
	if (GetWidgetValue("apply_for_all_accounts"))
	{
		Account* account = g_m2_engine->GetAccountManager()->GetFirstAccount();

		while (account)
		{
			account->SetSignature(signature_content,isHTML);
			account = (Account*)(account->Suc());
		}

	}
	else
	{
		Account* account = g_m2_engine->GetAccountById(m_account_id);
		if (account)
			account->SetSignature(signature_content, isHTML);
	}
	return 0;
}