Exemple #1
0
CookiesExceptionsDialog::CookiesExceptionsDialog(const QStringList &acceptedHosts, const QStringList &rejectedHosts, QWidget *parent) : Dialog(parent),
	m_ui(new Ui::CookiesExceptionsDialog)
{
	m_ui->setupUi(this);

	QStandardItemModel *acceptedHostsModel(new QStandardItemModel(this));

	for (int i = 0; i < acceptedHosts.count(); ++i)
	{
		if (!acceptedHosts.at(i).isEmpty())
		{
			acceptedHostsModel->appendRow(new QStandardItem(acceptedHosts.at(i)));
		}
	}

	m_ui->acceptedHostsItemView->setModel(acceptedHostsModel);

	QStandardItemModel *rejectedHostsModel(new QStandardItemModel(this));

	for (int i = 0; i < rejectedHosts.count(); ++i)
	{
		if (!rejectedHosts.at(i).isEmpty())
		{
			rejectedHostsModel->appendRow(new QStandardItem(rejectedHosts.at(i)));
		}
	}

	m_ui->rejectedHostsItemView->setModel(rejectedHostsModel);

	updateAcceptedHostsActions();
	updateRejectedHostsActions();

	connect(m_ui->acceptedHostsItemView, SIGNAL(needsActionsUpdate()), this, SLOT(updateAcceptedHostsActions()));
	connect(m_ui->addAcceptedHostsButton, SIGNAL(clicked()), this, SLOT(addAcceptedHost()));
	connect(m_ui->editAcceptedHostsButton, SIGNAL(clicked()), this, SLOT(editAcceptedHost()));
	connect(m_ui->removeAcceptedHostsButton, SIGNAL(clicked()), this, SLOT(removeAcceptedHost()));
	connect(m_ui->rejectedHostsItemView, SIGNAL(needsActionsUpdate()), this, SLOT(updateRejectedHostsActions()));
	connect(m_ui->addRejectedHostsButton, SIGNAL(clicked()), this, SLOT(addRejectedHost()));
	connect(m_ui->editRejectedHostsButton, SIGNAL(clicked()), this, SLOT(editRejectedHost()));
	connect(m_ui->removeRejectedHostsButton, SIGNAL(clicked()), this, SLOT(removeRejectedHost()));
}
void CookiesExceptionsDialog::addRejectedHost()
{
	m_ui->rejectedHostsItemView->insertRow();

	editRejectedHost();
}