当前位置: 首页>>代码示例>>C++>>正文


C++ AccountHandler类代码示例

本文整理汇总了C++中AccountHandler的典型用法代码示例。如果您正苦于以下问题:C++ AccountHandler类的具体用法?C++ AccountHandler怎么用?C++ AccountHandler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AccountHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: gtk_list_store_new

void AP_UnixDialog_CollaborationAddBuddy::_populateWindowData()
{
	// populate the account combobox
	GtkListStore* store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
	GtkTreeIter iter;
	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();

	for (UT_uint32 i = 0; i < pManager->getAccounts().size(); i++)
	{
		AccountHandler* pHandler = pManager->getAccounts()[i];
		if (pHandler && pHandler->allowsManualBuddies())
		{
			gtk_list_store_append (store, &iter);
			gtk_list_store_set (store, &iter,
						DESC_COLUMN, pHandler->getDescription().utf8_str(),
						HANDLER_COLUMN, pHandler,
						-1);
		}
	}
	m_model = GTK_TREE_MODEL (store);
	gtk_combo_box_set_model(GTK_COMBO_BOX(m_wAccount), m_model);

	// if we have at least one account, then make sure the first one is selected
	if (pManager->getAccounts().size() > 0)
	{
		gtk_combo_box_set_active(GTK_COMBO_BOX(m_wAccount), 0);
	}
	else
	{
		// nope, we don't have any account :'-(
		gtk_combo_box_set_active(GTK_COMBO_BOX(m_wAccount), -1);
	}
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:33,代码来源:ap_UnixDialog_CollaborationAddBuddy.cpp

示例2: UT_DEBUGMSG

void AP_UnixDialog_CollaborationAccounts::eventSelectAccount()
{
	UT_DEBUGMSG(("AP_UnixDialog_CollaborationAccounts::eventSelectAccount()\n"));
	AccountHandler* pHandler = _getSelectedAccountHandler();
	gtk_widget_set_sensitive(m_wProperties, pHandler != NULL && pHandler->canEditProperties());
	gtk_widget_set_sensitive(m_wDelete, pHandler != NULL && pHandler->canDelete());
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:7,代码来源:ap_UnixDialog_CollaborationAccounts.cpp

示例3: UT_return_val_if_fail

bool AbiCollabSessionManager::_canInitiateSessionTakeover(AbiCollab* pSession)
{
	UT_return_val_if_fail(pSession, false);
	UT_return_val_if_fail(pSession->isLocallyControlled(), false);

	const std::map<BuddyPtr, std::string> collaborators = pSession->getCollaborators();

	if (collaborators.size() == 0)
		return false;

	/*
	NOTE: for now, we only allow session takeover, if:

	1. All buddies use the same account handler type
	2. The account handler actually supports session takeover
	3. All buddies are actually owned by the same account handler instance
	
	Condition 1 and 2 are ok, but 3 needs fixing soon.
	*/

	AccountHandler* pHandler = (*collaborators.begin()).first->getHandler();
	if (!pHandler->allowsSessionTakeover())
		return false;

	for (std::map<BuddyPtr, std::string>::const_iterator cit = ++collaborators.begin(); cit != collaborators.end(); cit++)
		if (((*cit).first)->getHandler() != pHandler)
			return false;

	return true;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:30,代码来源:AbiCollabSessionManager.cpp

示例4: UT_DEBUGMSG

void AbiCollab::addCollaborator(BuddyPtr pCollaborator)
{
    UT_DEBUGMSG(("AbiCollab::addCollaborator()\n"));
    UT_return_if_fail(pCollaborator)

    // check if this buddy is in the access control list if we are hosting
    // this session
    if (isLocallyControlled())
    {
        AccountHandler* pAccount = pCollaborator->getHandler();
        UT_return_if_fail(pAccount);
        if (!pAccount->hasAccess(m_vAcl, pCollaborator))
        {
            UT_ASSERT(UT_NOT_IMPLEMENTED);
            return;
        }
    }

    // check for duplicates (as long as we assume a collaborator can only be part of a collaboration session once)
    std::map<BuddyPtr, std::string>::iterator it = m_vCollaborators.find(pCollaborator);
    if (it != m_vCollaborators.end())
    {
        UT_DEBUGMSG(("Attempting to add buddy '%s' twice to a collaboration session!", pCollaborator->getDescription().utf8_str()));
        UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
        return;
    }

    m_vCollaborators[pCollaborator] = ""; // will fill the remote document UUID later once we receive a packet from this buddy
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:29,代码来源:AbiCollab.cpp

示例5: UT_return_if_fail

// should we move this to AbiCollab.cpp ?
void AbiCollabSessionManager::updateAcl(AbiCollab* pSession, AccountHandler* pAccount, const std::vector<std::string> vAcl)
{
	UT_return_if_fail(pSession);
	UT_return_if_fail(pAccount);

	// check if all current collaborators are still allowed to collaborate; if not,
	// then remove them from the session
	const std::map<BuddyPtr, std::string> collaborators = pSession->getCollaborators();
	for (std::map<BuddyPtr, std::string>::const_iterator cit = collaborators.begin(); cit != collaborators.end(); cit++)
	{
		BuddyPtr pBuddy = (*cit).first;
		UT_continue_if_fail(pBuddy);
		AccountHandler* pBuddyAccount = pBuddy->getHandler();
		UT_continue_if_fail(pBuddyAccount);
		UT_continue_if_fail(pBuddyAccount == pAccount);
		if (!pBuddyAccount->hasAccess(vAcl, pBuddy))
		{
			// this current collaborator has been banned from the session, so
			// disconnect him
			UT_ASSERT_HARMLESS(UT_NOT_IMPLEMENTED);
		}
	}

	// set the new ACL on the account handler
	pAccount->setAcl(pSession, vAcl);

	// set the new access control list on the session
	pSession->setAcl(vAcl);
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:30,代码来源:AbiCollabSessionManager.cpp

示例6: main

int main()
{
	AccountHandler KookminAccountHandler;
	while (KookminAccountHandler.ISBooting()) {
		KookminAccountHandler.MainMenu();
	}
	return 0;
}
开发者ID:Sayaten,项目名称:OneDayOneStudy,代码行数:8,代码来源:09-OOPProject07.cpp

示例7: UT_DEBUGMSG

void AP_Dialog_CollaborationShare::eventAccountChanged()
{
	UT_DEBUGMSG(("AP_Dialog_CollaborationShare::eventAccountChanged()\n"));
	AccountHandler* pHandler = _getActiveAccountHandler();
	UT_return_if_fail(pHandler);
	
	UT_DEBUGMSG(("Changed account handler to type: %s\n", pHandler->getDisplayType().utf8_str()));
	PD_Document *pDoc = static_cast<PD_Document*>(XAP_App::getApp()->getLastFocussedFrame()->getCurrentDoc());
	UT_return_if_fail(pDoc);
	_setAccountHint(pHandler->getShareHint(pDoc));	
	_populateBuddyModel(true);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:12,代码来源:ap_Dialog_CollaborationShare.cpp

示例8: UT_DEBUGMSG

void AP_UnixDialog_CollaborationShare::_populateBuddyModel(bool refresh)
{
	UT_DEBUGMSG(("AP_UnixDialog_CollaborationShare::_populateBuddyModel()\n"));
	
	UT_return_if_fail(m_pBuddyModel);
	
	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	UT_return_if_fail(pManager);
	
	AccountHandler* pHandler = _getActiveAccountHandler();
	UT_return_if_fail(pHandler);
	
	if (refresh)
	{
		// signal the account to refresh its buddy list ...
		pHandler->getBuddiesAsync(); // this function is really sync() atm; we need to rework this dialog to make it proper async

		// fetch the current ACL
		m_vAcl = _getSessionACL();
	}

	// clear out the old contents, if any
	_freeBuddyList();

	GtkTreeIter iter;
	for (UT_uint32 i = 0; i < pHandler->getBuddies().size(); i++)
	{
		BuddyPtr pBuddy = pHandler->getBuddies()[i];
		UT_continue_if_fail(pBuddy);
		
		if (!pBuddy->getHandler()->canShare(pBuddy))
		{
			UT_DEBUGMSG(("Not allowed to share with buddy: %s\n", pBuddy->getDescription().utf8_str()));
			continue;
		}

		// crap, we can't store shared pointers in the list store; use a 
		// hack to do it (which kinda defies the whole shared pointer thingy, 
		// but alas...)
		BuddyPtrWrapper* pWrapper = new BuddyPtrWrapper(pBuddy);
		gtk_list_store_append (m_pBuddyModel, &iter);
		gtk_list_store_set (m_pBuddyModel, &iter, 
				SHARE_COLUMN, _populateShareState(pBuddy),
				DESC_COLUMN, pBuddy->getDescription().utf8_str(), 
				BUDDY_COLUMN, pWrapper, 
				-1);
	}
	
	gtk_widget_show_all(m_wBuddyTree);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:50,代码来源:ap_UnixDialog_CollaborationShare.cpp

示例9: _getActiveSession

std::vector<std::string> AP_Dialog_CollaborationShare::_getSessionACL()
{
	AbiCollab* pSession = _getActiveSession();
	if (!pSession)
		return std::vector<std::string>();

	AccountHandler* pAclAccount = pSession->getAclAccount();
	UT_return_val_if_fail(pAclAccount, std::vector<std::string>());

	std::vector<std::string> vAcl = pSession->getAcl();
	if (!pAclAccount->getAcl(pSession, vAcl))
	{
		UT_return_val_if_fail(false, vAcl); // TODO; this return is probably not correct
	}
	return vAcl;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:16,代码来源:ap_Dialog_CollaborationShare.cpp

示例10: UT_DEBUGMSG

BuddyPtr AbiCollabSessionManager::constructBuddy(const std::string& identifier, BuddyPtr pBuddy)
{
	UT_DEBUGMSG(("AbiCollabSessionManager::constructBuddy() - identifier: %s\n", identifier.c_str()));

	// find an account hander to handle this identifier
	for (UT_uint32 i = 0; i < m_vecAccounts.size(); i++)
	{
		AccountHandler* pHandler = m_vecAccounts[i];
		UT_continue_if_fail(pHandler);

		if (pHandler->recognizeBuddyIdentifier(identifier))
			return pHandler->constructBuddy(identifier, pBuddy);
	}

	UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN);
	return BuddyPtr();
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:17,代码来源:AbiCollabSessionManager.cpp

示例11: UT_return_val_if_fail

bool AP_Dialog_CollaborationShare::_populateShareState(BuddyPtr pBuddy)
{
	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	UT_return_val_if_fail(pManager, false);

	PD_Document *pDoc = static_cast<PD_Document*>(XAP_App::getApp()->getLastFocussedFrame()->getCurrentDoc());
	UT_return_val_if_fail(pDoc, false);

	if (!pManager->isInSession(pDoc))
	{
		AccountHandler* pHandler = pBuddy->getHandler();
		UT_return_val_if_fail(pHandler, false);
	
		return pHandler->defaultShareState(pBuddy);
	}

	return _inAcl(m_vAcl, pBuddy);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:18,代码来源:ap_Dialog_CollaborationShare.cpp

示例12: s_any_accounts_online

/*!
 * returns true if at least one account is online
 */
static bool s_any_accounts_online(bool bIncludeNonManualShareAccounts = true)
{
	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	UT_return_val_if_fail(pManager, false);
	
	const std::vector<AccountHandler *>& vecAccounts = pManager->getAccounts();
	
	for (UT_uint32 i = 0; i < vecAccounts.size(); i++)
	{
		AccountHandler* pHandler = vecAccounts[i];
		if (pHandler && pHandler->isOnline())
		{
			if (bIncludeNonManualShareAccounts)
				return true;
			if (pHandler->canManuallyStartSession())
				return true;
		}
	}
	return false;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:23,代码来源:AbiCollab_Plugin.cpp

示例13: gtk_list_store_new

GtkListStore* AP_UnixDialog_CollaborationAccounts::_constructModel()
{
	GtkTreeIter iter;
	GtkListStore* model = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);

	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	for (UT_uint32 i = 0; i < pManager->getAccounts().size(); i++)
	{
		AccountHandler* pHandler = pManager->getAccounts()[i];
		if (pHandler)
		{
			UT_DEBUGMSG(("Got account: %s of type %s\n", 
					pHandler->getDescription().utf8_str(), 
					pHandler->getDisplayType().utf8_str()
				));
			
			gtk_list_store_append (model, &iter);	
			gtk_list_store_set (model, &iter, 
					ONLINE_COLUMN, pHandler->isOnline(),
					DESC_COLUMN, pHandler->getDescription().utf8_str(), 
					TYPE_COLUMN, pHandler->getDisplayType().utf8_str(), 
					HANDLER_COLUMN, pHandler,
					-1);
		}
	}
	
	return model;
}
开发者ID:tchx84,项目名称:debian-abiword-packages,代码行数:28,代码来源:ap_UnixDialog_CollaborationAccounts.cpp

示例14: UT_return_if_fail

void AP_Win32Dialog_CollaborationAccounts::_populateWindowData()
{
	AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
	UT_return_if_fail(pManager);

	m_bPopulating = true;

	// clear out the old contents, if any
	ListView_DeleteAllItems(m_hAccountList);

	for (UT_uint32 i = 0; i < pManager->getAccounts().size(); i++)
	{
		AccountHandler* pAccount = pManager->getAccounts()[i];
		UT_continue_if_fail(pAccount);

		UT_Win32LocaleString sAccountText = AP_Win32App::s_fromUTF8ToWinLocale(pAccount->getDescription().utf8_str());
		UT_Win32LocaleString sAccountTypeText = AP_Win32App::s_fromUTF8ToWinLocale(pAccount->getDisplayType().utf8_str());

		// insert a new account record
		LVITEMW lviAccount;
		lviAccount.mask = LVIF_STATE | LVIF_IMAGE | LVIF_PARAM;
		lviAccount.state = 1;
		lviAccount.iItem = i;
		lviAccount.iSubItem = 0;
		lviAccount.lParam = (LPARAM)pAccount;
		SendMessageW(m_hAccountList, LVM_INSERTITEMW, 0, (LPARAM) &lviAccount);
		ListView_SetCheckState(m_hAccountList, i, pAccount->isOnline());
		lviAccount.iSubItem=1;
		lviAccount.pszText= const_cast<LPWSTR>(sAccountText.c_str());
		SendMessageW(m_hAccountList, LVM_SETITEMTEXTW, i, (LPARAM) &lviAccount);
		lviAccount.iSubItem=2;
		lviAccount.pszText= const_cast<LPWSTR>(sAccountTypeText.c_str());
		SendMessageW(m_hAccountList, LVM_SETITEMTEXTW, i, (LPARAM) &lviAccount);
	}

	_updateSelection();

	m_bPopulating = false;
}
开发者ID:hfiguiere,项目名称:abiword,代码行数:39,代码来源:ap_Win32Dialog_CollaborationAccounts.cpp

示例15: UT_return_val_if_fail

bool AbiCollab::push(SessionPacket* pPacket, BuddyPtr collaborator)
{
    UT_return_val_if_fail(pPacket, false);
    UT_return_val_if_fail(collaborator, false);
    AccountHandler* pHandler = collaborator->getHandler();
    UT_return_val_if_fail(pHandler, false);

    // record
    if (m_pRecorder)
        m_pRecorder->storeOutgoing(const_cast<const SessionPacket*>( pPacket ), collaborator);

    // overwrite remote revision for this collaborator
    _fillRemoteRev(pPacket, collaborator);

    // send!
    bool res = pHandler->send(pPacket, collaborator);
    if (!res)
    {
        UT_DEBUGMSG(("Error sending a packet to collaborator %s!\n", collaborator->getDescription().utf8_str()));
    }

    return res;
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:23,代码来源:AbiCollab.cpp


注:本文中的AccountHandler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。