示例#1
0
BuddyContactModel::BuddyContactModel(Buddy buddy, QObject *parent) :
		QAbstractListModel(parent), SourceBuddy(buddy), IncludeIdentityInDisplay(false)
{
	connect(SourceBuddy, SIGNAL(contactAboutToBeAdded(Contact)),
			this, SLOT(contactAboutToBeAdded(Contact)), Qt::DirectConnection);
	connect(SourceBuddy, SIGNAL(contactAdded(Contact)),
			this, SLOT(contactAdded(Contact)), Qt::DirectConnection);
	connect(SourceBuddy, SIGNAL(contactAboutToBeRemoved(Contact)),
			this, SLOT(contactAboutToBeRemoved(Contact)), Qt::DirectConnection);
	connect(SourceBuddy, SIGNAL(contactRemoved(Contact)),
			this, SLOT(contactRemoved(Contact)), Qt::DirectConnection);
}
示例#2
0
void ContactManager::addContact(Contact contact)
{
	if (contact.isNull())
		return;

	ensureLoaded();

	if (Contacts.contains(contact))
	{
		contact.setType(ContactData::TypeNormal);
		return;
	}


	emit contactAboutToBeAdded(contact);
	Contacts.append(contact);
	emit contactAdded(contact);

	connect(contact.data(), SIGNAL(updated()), this, SLOT(contactDataUpdated()));
	connect(contact.data(), SIGNAL(accountDataAboutToBeAdded(Account *)),
			this, SLOT(contactAccountDataAboutToBeAdded(Account *)));
	connect(contact.data(), SIGNAL(accountDataAdded(Account *)),
			this, SLOT(contactAccountDataAdded(Account *)));
	connect(contact.data(), SIGNAL(accountDataAboutToBeRemoved(Account *)),
			this, SLOT(contactAccountDataAboutToBeRemoved(Account *)));
	connect(contact.data(), SIGNAL(accountDataRemoved(Account *)),
			this, SLOT(contactAccountDataRemoved(Account *)));
	connect(contact.data(), SIGNAL(accountDataIdChanged(Account *, const QString &)),
			this, SLOT(contactAccountDataIdChanged(Account *, const QString &)));
}