예제 #1
0
bool MetaContactImpl::event(QEvent* ev)
{
	if (ev->type() == ToolTipEvent::eventType()) {
		ToolTipEvent *event = static_cast<ToolTipEvent*>(ev);
		if (event->generateLayout())
			Contact::event(ev);
		foreach (ChatUnit *contact, m_contacts) {
			ToolTipEvent contactEvent(false);
			qApp->sendEvent(contact, &contactEvent);
			QString text = contactEvent.html();
			if (!text.isEmpty())
				event->addHtml(QStringLiteral("<br/><br/>") + text);
		}
예제 #2
0
bool JContactResource::event(QEvent *ev)
{
	if (ev->type() == ChatStateEvent::eventType()) {
		ChatStateEvent *chatEvent = static_cast<ChatStateEvent *>(ev);
		Jreen::ChatState::State state = static_cast<Jreen::ChatState::State>(chatEvent->chatState());

		Jreen::Message msg(Jreen::Message::Chat,
						   d_func()->id);
		msg.addExtension(new Jreen::ChatState(state));
		JAccount *account = qobject_cast<JAccount*>(d_func()->contact);
		if (!account)
			account = static_cast<JAccount*>(static_cast<ChatUnit*>(d_func()->contact)->account());
		account->messageSessionManager()->send(msg);
		return true;
	} else if (ev->type() == ToolTipEvent::eventType()) {
		ToolTipEvent *event = static_cast<ToolTipEvent*>(ev);
		event->addField(QT_TRANSLATE_NOOP("ContactResource", "Resource"),
						QString("%1 (%2)").arg(id()).arg(priority()), 75);
		if (!text().isEmpty())
			event->addField(text(), QString());
		event->addHtml("<font size=-1>", 50);
		QString client = property("client").toString();
		if (!client.isEmpty()) {
			event->addField(QT_TRANSLATE_NOOP("ContactResource", "Possible client"),
							client,
							property("clientIcon").toString(),
							ToolTipEvent::IconBeforeDescription,
							25);
			QString os = property("os").toString();
			if (!os.isEmpty())
				event->addField(QT_TRANSLATE_NOOP("ContactResource", "OS"), os, 25);
		}
		event->addHtml("</font>", 10);
		return true;
	}
	return Buddy::event(ev);
}
예제 #3
0
bool Conference::event(QEvent *ev)
{
	if (ev->type() == ToolTipEvent::eventType()) {
		ToolTipEvent *event = static_cast<ToolTipEvent*>(ev);
        QString text = QStringLiteral("<p><strong>")
                % title().toHtmlEscaped()
                % QStringLiteral("</strong> &lt;")
                % id().toHtmlEscaped()
                % QStringLiteral("&gt;</p>")
                % QStringLiteral("<p>")
                % topic().toHtmlEscaped()
                % QStringLiteral("</p>");
		event->addHtml(text, 90);
	}
	return ChatUnit::event(ev);
}
예제 #4
0
파일: jcontact.cpp 프로젝트: rnz/qutim
bool JContact::event(QEvent *ev)
{
    Q_D(JContact);
    if (ev->type() == ChatStateEvent::eventType()) {
        ChatStateEvent *chatEvent = static_cast<ChatStateEvent *>(ev);
        Jreen::ChatState::State state = static_cast<Jreen::ChatState::State>(chatEvent->chatState());

        Jreen::Message msg(Jreen::Message::Chat,
                           d->jid);
        msg.addExtension(new Jreen::ChatState(state));
        d->account->messageSessionManager()->send(msg);
        return true;
    } else if (ev->type() == ToolTipEvent::eventType()) {
        Q_D(JContact);
        ToolTipEvent *event = static_cast<ToolTipEvent*>(ev);

        //TODO move to public method
        LocalizedString subscriptionStr;
        switch(d->subscription) {
        case Jreen::RosterItem::None:
            subscriptionStr = QT_TRANSLATE_NOOP("Jabber","None");
            break;
        case Jreen::RosterItem::From:
            subscriptionStr = QT_TRANSLATE_NOOP("Jabber","From");
            break;
        case Jreen::RosterItem::To:
            subscriptionStr = QT_TRANSLATE_NOOP("Jabber","To");
            break;
        case Jreen::RosterItem::Both:
            subscriptionStr = QT_TRANSLATE_NOOP("Jabber","Both");
            break;
        case Jreen::RosterItem::Remove:
            subscriptionStr = QT_TRANSLATE_NOOP("Jabber","Remove");
            break;
        default:
            break;
        }
        event->addField(QT_TRANSLATE_NOOP("Jabber","Subscription"),
                        subscriptionStr
                       );
        foreach (const QString &id, d->resources.keys()) {
            JContactResource *resource = d->resources.value(id);
            ToolTipEvent resourceEvent(false);
            qApp->sendEvent(resource, &resourceEvent);
            event->addHtml("<hr>" + resourceEvent.html(), 9);
        }
    } else if(ev->type() == Authorization::Request::eventType()) {