Пример #1
0
QNetworkProxy SocksStreams::accountNetworkProxy(const Jid &AStreamJid) const
{
	QNetworkProxy proxy(QNetworkProxy::NoProxy);
	IXmppStream *stream = FXmppStreams!=NULL ? FXmppStreams->xmppStream(AStreamJid) : NULL;
	IDefaultConnection *connection = stream!=NULL ? qobject_cast<IDefaultConnection *>(stream->connection()->instance()) : NULL;
	return connection!=NULL ? connection->proxy() : QNetworkProxy(QNetworkProxy::NoProxy);
}
ViewHistoryWindow::ViewHistoryWindow(IRoster *ARoster, IGateways *AGateways, const Jid &AContactJid, QWidget *AParent) : QMainWindow(AParent)
{
	ui.setupUi(this);
	StyleStorage::staticStorage(RSR_STORAGE_STYLESHEETS)->insertAutoStyle(this,STS_RAMBLERHISTORY_VIEWHISTORYWINDOW);

	CustomBorderContainer *border = CustomBorderStorage::staticStorage(RSR_STORAGE_CUSTOMBORDER)->addBorder(this, CBS_WINDOW);
	if (border)
	{
		border->setResizable(true);
		border->setAttribute(Qt::WA_DeleteOnClose,true);
	}
	else
	{
		ui.lblCaption->setVisible(false);
		ui.centralWidget->layout()->setContentsMargins(0, 0, 0, 0);
		setAttribute(Qt::WA_DeleteOnClose,true);
	}

	FProgress = 0;
	FRoster = ARoster;
	FGateways = AGateways;
	FContactJid = AContactJid;

	if (FRoster->xmppStream() && FRoster->xmppStream()->connection())
	{
		IDefaultConnection *defConnection = qobject_cast<IDefaultConnection *>(ARoster->xmppStream()->connection()->instance());
		if (defConnection)
			ui.wbvHistoryView->page()->networkAccessManager()->setProxy(defConnection->proxy());
	}

	connect(ui.wbvHistoryView,SIGNAL(loadProgress(int)),SLOT(onWebLoadProgress(int)));
	connect(ui.wbvHistoryView,SIGNAL(loadFinished(bool)),SLOT(onWebLoadFinished(bool)));
	connect(ui.wbvHistoryView->page(),SIGNAL(linkClicked(const QUrl &)),SLOT(onWebPageLinkClicked(const QUrl &)));

	if (FRoster)
	{
		connect(FRoster->instance(),SIGNAL(itemReceived(const IRosterItem &, const IRosterItem &)),
			SLOT(onRosterItemReceived(const IRosterItem &, const IRosterItem &)));
		connect(FRoster->instance(),SIGNAL(destroyed(QObject *)),SLOT(deleteLater()));
	}

	initViewHtml();
	updateTitle();
	window()->resize(650,500);
}