Esempio n. 1
0
    Contact::Contact(Tp::ContactPtr tp_contact): tp_contact_(tp_contact)
    {
        if (tp_contact.isNull())
            return;
        id_ = tp_contact->id();
        name_ = tp_contact->alias();
        QString avatar = tp_contact->avatarToken();  // todo: use this information

        connect(tp_contact_.data(),
                SIGNAL( simplePresenceChanged(const QString &, uint, const QString &) ),
                SLOT( OnSimplePresenceChanged(const QString &, uint, const QString &) ));
        connect(tp_contact_.data(),
                SIGNAL( subscriptionStateChanged(Tp::Contact::PresenceState) ),
                SLOT( OnContactChanged() ));
        connect(tp_contact_.data(),
                SIGNAL( publishStateChanged(Tp::Contact::PresenceState) ),
                SLOT( OnContactChanged() ));
        connect(tp_contact_.data(),
                SIGNAL( blockStatusChanged(bool) ),
                SLOT( OnContactChanged()) );
    }
void InviteContactDialog::onOkClicked()
{
    // don't do anytghing if no contact has been selected
    if (!m_contactGridWidget->hasSelection()) {
        return;
    }

    Tp::ContactPtr contact = m_contactGridWidget->selectedContact();

    if (contact.isNull() || m_channel.isNull() || m_account.isNull()) {
        return;
    }

    //if can invite do so, otherwise make a new channel with the new contacts
    if (m_channel->canInviteContacts()) {
        m_channel->inviteContacts(QList<Tp::ContactPtr>() << contact);
    }
    else {
        QList<Tp::ContactPtr> contacts;
        contacts << contact;
        m_account->createConferenceTextChat(QList<Tp::ChannelPtr>() << m_channel, contacts);
    }
}