Example #1
0
void Window::setUserAgent(const QString &identifier)
{
	WebContentsWidget *webWidget = NULL;

	if (m_contentsWidget && m_contentsWidget->getType() == QLatin1String("web"))
	{
		webWidget = qobject_cast<WebContentsWidget*>(m_contentsWidget);

		if (!webWidget)
		{
			return;
		}
	}

	QString value;

	if (identifier == QLatin1String("custom"))
	{
		value = QInputDialog::getText(this, tr("Select User Agent"), tr("Input User Agent:"), QLineEdit::Normal, webWidget->getUserAgent().second);
	}
	else
	{
		value = NetworkManagerFactory::getUserAgent(identifier).value;
	}

	webWidget->setUserAgent(identifier, value);
}
Example #2
0
void Window::setDefaultTextEncoding(const QString &encoding)
{
	if (m_contentsWidget->getType() == QLatin1String("web"))
	{
		WebContentsWidget *webWidget = qobject_cast<WebContentsWidget*>(m_contentsWidget);

		if (webWidget)
		{
			return webWidget->setDefaultTextEncoding(encoding);
		}
	}
}
Example #3
0
void Window::search(const QString &query, const QString &engine)
{
	WebContentsWidget *widget = qobject_cast<WebContentsWidget*>(m_contentsWidget);

	if (!widget)
	{
		widget = new WebContentsWidget(isPrivate(), NULL, this);

		setContentsWidget(widget);
	}

	widget->search(query, engine);
}
Example #4
0
void Window::search(const QString &query, const QString &engine)
{
	WebContentsWidget *widget = qobject_cast<WebContentsWidget*>(m_contentsWidget);

	if (!widget)
	{
		widget = new WebContentsWidget(isPrivate(), NULL, this);

		setContentsWidget(widget);
	}

	m_ui->addressWidget->clearFocus();

	widget->search(query, engine);

	m_ui->addressWidget->setUrl(getUrl());
}