Пример #1
0
	void FUA::hookUserAgentForUrlRequested (LeechCraft::IHookProxy_ptr proxy,
			const QUrl& url, const QWebPage*)
	{
		QString host = url.host ();
		for (int i = 0; i < Model_->rowCount (); ++i)
		{
			QStandardItem *item = Model_->item (i);
			QRegExp re (item->text (), Qt::CaseSensitive, QRegExp::Wildcard);
			if (re.exactMatch (host))
			{
				proxy->CancelDefault ();
				proxy->SetReturnValue (Model_->item (i, 2)->text ());
				return;
			}
		}
	}
Пример #2
0
	void Plugin::hookEntryActionsRequested (LeechCraft::IHookProxy_ptr proxy,
			QObject *entry)
	{
		if (!qobject_cast<MRIMBuddy*> (entry))
			return;

		if (!EntryServices_.contains (entry))
		{
			auto list = VaderUtil::GetBuddyServices (this,
					SLOT (entryServiceRequested ()));
			Q_FOREACH (QAction *act, list)
				act->setProperty ("Azoth/Vader/Entry", QVariant::fromValue<QObject*> (entry));
			EntryServices_ [entry] = list;
		}

		QList<QVariant> list = proxy->GetReturnValue ().toList ();
		Q_FOREACH (QAction *act, EntryServices_ [entry])
			list += QVariant::fromValue<QObject*> (act);
		proxy->SetReturnValue (list);
	}