void PrivacyRuleDlg::setRule(const PrivacyListItem& item) { // Type if (item.type() == PrivacyListItem::SubscriptionType) { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("Subscription"))); if (item.value() == "both") { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("Both"))); } else if (item.value() == "none") { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("None"))); } else if (item.value() == "from") { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("From"))); } else if (item.value() == "to") { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("To"))); } } else { if (item.type() == PrivacyListItem::JidType) { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("JID"))); } else if (item.type() == PrivacyListItem::GroupType) { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("Group"))); } else { ui_.cb_type->setCurrentIndex(ui_.cb_type->findText(tr("*"))); } ui_.cb_value->setCurrentText(item.value()); } // Action if (item.action() == PrivacyListItem::Allow) { ui_.cb_action->setCurrentIndex(ui_.cb_action->findText(tr("Allow"))); } else { ui_.cb_action->setCurrentIndex(ui_.cb_action->findText(tr("Deny"))); } // Selection ui_.ck_messages->setChecked(item.message()); ui_.ck_queries->setChecked(item.iq()); ui_.ck_presenceIn->setChecked(item.presenceIn()); ui_.ck_presenceOut->setChecked(item.presenceOut()); }
void PrivacyRuleDlg::setRule(const PrivacyListItem& item) { // Type if (item.type() == PrivacyListItem::SubscriptionType) { ui_.cb_type->setCurrentIndex(ui_.cb_type->findData(item.type())); ui_.cb_value->setCurrentIndex(ui_.cb_value->findData(item.value())); } else { ui_.cb_type->setCurrentIndex(ui_.cb_type->findData(item.type())); // clears combo as well ui_.cb_value->insertItem(0, item.value()); } // Action ui_.cb_action->setCurrentIndex(ui_.cb_action->findData(item.action())); // Selection ui_.ck_messages->setChecked(item.message()); ui_.ck_queries->setChecked(item.iq()); ui_.ck_presenceIn->setChecked(item.presenceIn()); ui_.ck_presenceOut->setChecked(item.presenceOut()); }