PrivacyListItem PrivacyListsItemDialog::GetItem () const
	{
		PrivacyListItem result;

		if (Ui_.Type_->currentIndex () == TNSubscription)
			result.SetValue (Ui_.Value_->itemData (Ui_.Value_->currentIndex ()).toString ());
		else
			result.SetValue (Ui_.Value_->currentText ());

		result.SetAction (Ui_.Action_->currentIndex () == ANAllow ?
					PrivacyListItem::AAllow :
					PrivacyListItem::ADeny);

		switch (Ui_.Type_->currentIndex ())
		{
		case TNJID:
			result.SetType (PrivacyListItem::TJid);
			break;
		case TNGroup:
			result.SetType (PrivacyListItem::TGroup);
			break;
		case TNSubscription:
			result.SetType (PrivacyListItem::TSubscription);
			break;
		}

		PrivacyListItem::StanzaTypes stanzas = PrivacyListItem::STNone;
		if (Ui_.StanzaMessage_->checkState () == Qt::Checked)
			stanzas |= PrivacyListItem::STMessage;
		if (Ui_.StanzaInPres_->checkState () == Qt::Checked)
			stanzas |= PrivacyListItem::STPresenceIn;
		if (Ui_.StanzaOutPres_->checkState () == Qt::Checked)
			stanzas |= PrivacyListItem::STPresenceOut;
		if (Ui_.StanzaIQ_->checkState () == Qt::Checked)
			stanzas |= PrivacyListItem::STIq;

		if (stanzas == PrivacyListItem::STNone)
			stanzas = PrivacyListItem::STAll;

		result.SetStanzaTypes (stanzas);

		return result;
	}
	void PrivacyListsConfigDialog::on_DefaultPolicy__currentIndexChanged (int idx)
	{
		const QString& listName = Ui_.ConfigureList_->currentText ();
		if (listName.isEmpty ())
			return;

		const PrivacyListItem::Action action = idx == 0 ?
				PrivacyListItem::AAllow :
				PrivacyListItem::ADeny;

		QList<PrivacyListItem> items = Lists_ [listName].GetItems ();
		if (!items.isEmpty () &&
				items.last ().GetType () == PrivacyListItem::TNone)
			items.removeLast ();
		if (action == PrivacyListItem::ADeny)
		{
			PrivacyListItem item;
			item.SetType (PrivacyListItem::TNone);
			item.SetAction (action);
			items << item;
		}
		Lists_ [listName].SetItems (items);
	}