Пример #1
0
PrivacyListItem PrivacyRuleDlg::rule() const
{
	PrivacyListItem item;

	// Type & value
	PrivacyListItem::Type t = (PrivacyListItem::Type)ui_.cb_type->itemData(ui_.cb_type->currentIndex()).toInt();
	if(t == PrivacyListItem::SubscriptionType) {
		item.setType(t);
		item.setValue(ui_.cb_value->itemData(ui_.cb_value->currentIndex()).toString());
	}
	else {
		item.setType(t);
		item.setValue(ui_.cb_value->currentText());
	}

	// Action
	item.setAction((PrivacyListItem::Action)ui_.cb_action->itemData(ui_.cb_action->currentIndex()).toInt());

	// Selection
	item.setMessage(ui_.ck_messages->isChecked());
	item.setIQ(ui_.ck_queries->isChecked());
	item.setPresenceIn(ui_.ck_presenceIn->isChecked());
	item.setPresenceOut(ui_.ck_presenceOut->isChecked());

	return item;
}
Пример #2
0
PrivacyListItem MockPrivacyManager::createItem(PrivacyListItem::Type type, const QString& value, PrivacyListItem::Action action, bool message, bool presence_in, bool presence_out, bool iq)
{
	PrivacyListItem item;
	item.setType(type);
	item.setValue(value);
	item.setAction(action);
	item.setMessage(message);
	item.setPresenceIn(presence_in);
	item.setPresenceOut(presence_out);
	item.setIQ(iq);
	return item;
}
PrivacyListItem PrivacyRuleDlg::rule() const
{
	PrivacyListItem item;

	// Type & value
	if(ui_.cb_type->currentText() == tr("Subscription")) {
		item.setType(PrivacyListItem::SubscriptionType);
		if (ui_.cb_value->currentText() == tr("To")) 
			item.setValue("to");
		else if (ui_.cb_value->currentText() == tr("From")) 
			item.setValue("from");
		else if (ui_.cb_value->currentText() == tr("Both")) 
			item.setValue("both");
		else if (ui_.cb_value->currentText() == tr("None")) 
			item.setValue("none");
	}
	else {
		if (ui_.cb_type->currentText() == tr("JID")) {
			item.setType(PrivacyListItem::JidType);
		}
		else if (ui_.cb_type->currentText() == tr("Group")) {
			item.setType(PrivacyListItem::GroupType);
		}
		else {
			item.setType(PrivacyListItem::FallthroughType);
		}
		item.setValue(ui_.cb_value->currentText());
	}
	
	// Action
	if(ui_.cb_action->currentText() == tr("Deny")) {
		item.setAction(PrivacyListItem::Deny);
	}
	else {
		item.setAction(PrivacyListItem::Allow);
	}
	
	// Selection
	item.setMessage(ui_.ck_messages->isChecked());
	item.setIQ(ui_.ck_queries->isChecked());
	item.setPresenceIn(ui_.ck_presenceIn->isChecked());
	item.setPresenceOut(ui_.ck_presenceOut->isChecked());

	return item;
}