OP_STATUS GroupsModel::Init(UINT16 account_id, BOOL read_only) { m_account_id = account_id; m_read_only = read_only; Account* account = MessageEngine::GetInstance()->GetAccountById(account_id); if (account) { RETURN_IF_ERROR(MessageEngine::GetInstance()->AddAccountListener(this)); switch (account->GetIncomingProtocol()) { case AccountTypes::NEWS: m_folder_type = OpTypedObject::NEWSGROUP_TYPE; break; case AccountTypes::IMAP: m_folder_type = OpTypedObject::IMAPFOLDER_TYPE; break; case AccountTypes::RSS: m_folder_type = OpTypedObject::NEWSFEED_TYPE; break; case AccountTypes::IRC: m_folder_type = OpTypedObject::CHATROOM_TYPE; break; } account->GetAllFolders(); } return OpStatus::OK; }
void GroupsModel::Refresh() { // Clear up internal state. DeleteAll(); m_groups_hash_table.RemoveAll(); m_folder_loading_completed = FALSE; // Tell the account to fetch all folders. Account* account = MessageEngine::GetInstance()->GetAccountById(m_account_id); OP_ASSERT(account != 0); account->GetAllFolders(); }