Exemplo n.º 1
0
bool WContact::event(QEvent *ev)
{
	if (ev->type() == ToolTipEvent::eventType()) {
		ToolTipEvent *event = static_cast< ToolTipEvent * >(ev);
		event->addField(QT_TRANSLATE_NOOP("Weather", "Weather"), m_status.text());
	}

	return Contact::event(ev);
}
Exemplo n.º 2
0
void ToolTip::showText(const QPoint &pos, QObject *obj, QWidget *w)
{
    if (!obj)
        return;
    ToolTipEvent event;
    qApp->sendEvent(obj, &event);
    QString text = event.html();
    if (text.isEmpty())
        QToolTip::hideText();
    else
        QToolTip::showText(pos, text, w);
}
Exemplo n.º 3
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);
		}
Exemplo n.º 4
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);
}
Exemplo n.º 5
0
bool VContact::event(QEvent *ev)
{
	Q_D(VContact);
	if (ev->type() == ToolTipEvent::eventType()) {
		ToolTipEvent *event = static_cast<ToolTipEvent*>(ev);
		QString mobile = property("mobilePhone").toString();
		if (!mobile.isEmpty())
			event->addField(QT_TRANSLATE_NOOP("ContactInfo", "Mobile phone"),
							mobile,
							ExtensionIcon("phone"));
		if (!d->activity.isEmpty())
			event->addField(QT_TRANSLATE_NOOP("ContactInfo","Activity"),
							d->activity);
	}
	return Contact::event(ev);
}
Exemplo n.º 6
0
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()) {
Exemplo n.º 7
0
bool JMUCUser::event(QEvent *ev)
{
	if (ev->type() == ToolTipEvent::eventType()) {
		Q_D(JMUCUser);
		ToolTipEvent *event = static_cast<ToolTipEvent*>(ev);
		if (!d->presence.status().isEmpty())
			event->addField(d->presence.status(), QString());
		if (!d->realJid.isEmpty())
			event->addField(QT_TRANSLATE_NOOP("Conference", "Real JID"), d->realJid);
		QString client = property("client").toString();
		QString affiliation;
		switch (d->affiliation) {
		case MUCRoom::AffiliationOwner:
			affiliation = tr("Owner");
			break;
		case MUCRoom::AffiliationAdmin:
			affiliation = tr("Administrator");
			break;
		case MUCRoom::AffiliationMember:
			affiliation = tr("Registered member");
			break;
		default:
			affiliation = QString();
		}
		if (!affiliation.isEmpty())
			event->addField(QT_TRANSLATE_NOOP("Conference", "Affiliation"), affiliation, 30);
		QString role;
		switch (d->role) {
		case MUCRoom::RoleModerator:
			role = tr("Moderator");
			break;
		case MUCRoom::RoleParticipant:
			role = tr("Participant");
			break;
		case MUCRoom::RoleVisitor:
			role = tr("Visitor");
			break;
		default:
			role = QString();
		}
		if (!role.isEmpty())
			event->addField(QT_TRANSLATE_NOOP("Conference", "Role"), role, 30);
		if (!client.isEmpty()) {
			event->addField(QT_TRANSLATE_NOOP("Conference", "Possible client"),
							client,
							property("clientIcon").toString(),
							ToolTipEvent::IconBeforeDescription,
							25);
			QString os = property("os").toString();
			if (!os.isEmpty())
				event->addField(QT_TRANSLATE_NOOP("Conference", "OS"), os, 25);
		}
		Buddy::event(ev);
		return true;
	}
	return JContactResource::event(ev);
}
Exemplo n.º 8
0
bool WContact::event( QEvent *ev )
{
	if ( ev->type() == ToolTipEvent::eventType() )
	{
		ToolTipEvent *event = static_cast< ToolTipEvent * >( ev );
		if ( !m_wmanager->getUnit( "ut" ).isEmpty() )
			event->addField( "Weather", QString::fromUtf8( "%1 °%2" ).arg( m_wmanager->getCC( "tmp" ) ).arg( m_wmanager->getUnit( "ut" ) ) );

		return true;
	}
//	else if ( ev->type() == 67 )
//	{
//		foreach ( QWidget *widget, QApplication::allWidgets() )
//			if ( qobject_cast< QMenu * >( widget ) && widget->isVisible() )
//			{
//				widget->hide();
//				m_menu->popup( QCursor::pos() );
//			}
//	}

	return Contact::event( ev );
}
Exemplo n.º 9
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);
}