本文整理汇总了C++中Account::GetIsTemporary方法的典型用法代码示例。如果您正苦于以下问题:C++ Account::GetIsTemporary方法的具体用法?C++ Account::GetIsTemporary怎么用?C++ Account::GetIsTemporary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::GetIsTemporary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
OP_STATUS AccountManager::Init(OpString8& status)
{
if (!m_prefs_file)
return OpStatus::ERR;
const char *accounts_str = "Accounts";
int account_count, accounts_version;
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Count", 0, account_count));
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Version", -1, accounts_version));
// if we have no information, we simply must assume it's the current version
if (accounts_version == -1)
{
m_old_version = CURRENT_M2_ACCOUNT_VERSION;
accounts_version = CURRENT_M2_ACCOUNT_VERSION;
RETURN_IF_ERROR(PrefsUtils::WritePrefsInt(m_prefs_file, accounts_str, "Version", CURRENT_M2_ACCOUNT_VERSION));
}
if (accounts_version > CURRENT_M2_ACCOUNT_VERSION && account_count)
{
status.Append("Not possible to run old Opera version with new Opera mail files.\r\n");
return OpStatus::ERR; // refuse to start
}
if (accounts_version < CURRENT_M2_ACCOUNT_VERSION)
{
m_old_version = accounts_version;
RETURN_IF_ERROR(PrefsUtils::WritePrefsInt(m_prefs_file, accounts_str, "Version", CURRENT_M2_ACCOUNT_VERSION));
}
INT32 default_mail_account;
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Next Available Id" , 1, m_next_available_account_id));
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default Mail Account" , 0, m_last_used_mail_account));
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default Outgoing Mail Account", 0, default_mail_account));
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default News Account" , 0, m_default_news_account));
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, "Default Chat Account" , 0, m_default_chat_account));
m_default_mail_account.Set(default_mail_account);
m_default_mail_account.Subscribe(MAKE_DELEGATE(*this, &AccountManager::CommitDefaultMailAccount));
if (m_active_account!=-1) //Category is only available for active account -1 ('custom category')
m_active_category.Empty();
UINT16 account_id = 0;
OpINTSortedVector valid_account_ids;
char account_key[13];
OP_STATUS ret;
for (UINT16 i=1; i<=account_count; i++)
{
op_sprintf(account_key, "Account%u", i);
// first get the account id
RETURN_IF_ERROR(PrefsUtils::ReadPrefsInt(m_prefs_file, accounts_str, account_key, 0, account_id));
OpString8 account_section;
RETURN_IF_ERROR(account_section.AppendFormat("Account%d", account_id));;
OpString8 protocol;
RETURN_IF_ERROR(PrefsUtils::ReadPrefsString(m_prefs_file, account_section, "Incoming Protocol", protocol));
// check if it's a known type or an old unsupported type
if (Account::GetProtocolFromName(protocol) == AccountTypes::UNDEFINED)
continue;
if (account_id != 0)
{
Account* account = OP_NEW(Account, (m_database));
if (!account)
return OpStatus::ERR_NO_MEMORY;
Account* does_it_exist = NULL;
if (OpStatus::IsError(ret=GetAccountById(account_id, does_it_exist)))
{
OP_DELETE(account);
return ret;
}
if (does_it_exist)
{
OP_DELETE(account);
return OpStatus::ERR; //Already exists in list!
}
account->Into(&m_accountlist);
if (OpStatus::IsError(ret=account->Init(account_id, status)))
{
status.Append("Initializing ");
status.Append(account_key);
status.Append(" failed\n");
return ret;
}
if (account->GetIsTemporary())
{
UINT16* temporary_id = OP_NEW(UINT16, ());
if(!temporary_id)
return OpStatus::ERR_NO_MEMORY;
*temporary_id = account->GetAccountId();
m_temporary_accounts.Add(temporary_id);
}
else
//.........这里部分代码省略.........