void SelectGroupParticipantsWindow::addParticipant()
{
    if (!roster->size())
    {
        QMaemo5InformationBox::information(this,"Contacts haven't been synchronized yet.",
                                           QMaemo5InformationBox::NoTimeout);
    }
    else if (participants.size() == 50)
    {
        QMaemo5InformationBox::information(this,"The maximum number of participants have been reached.",
                                           QMaemo5InformationBox::NoTimeout);
    }
    else
    {
        SelectContactDialog selectContactDialog(roster->getContactList(),this,false);

        //connect(&selectContactDialog,SIGNAL(showContactInfo(Contact*)),
        //        this,SLOT(viewContact(Contact*)));

        if (selectContactDialog.exec() == QDialog::Accepted)
        {
            Contact& contact = selectContactDialog.getSelectedContact();

            // Add it only if it hasn't been added before
            if (!participants.contains(contact.jid))
            {
                GroupParticipantItem *item = new GroupParticipantItem(&contact);
                model->appendRow(item);
                participants.insert(contact.jid,item);
            }
        }
    }
}
Beispiel #2
0
void MainWindow::createChatWindow()
{
    if (!roster->size())
    {
        QMaemo5InformationBox::information(this,"Contacts haven't been synchronized yet.",
                                           QMaemo5InformationBox::NoTimeout);
    }
    else
    {
        SelectContactDialog selectContactDialog(roster,this);

        connect(&selectContactDialog,SIGNAL(showContactInfo(Contact*)),
                this,SLOT(viewContact(Contact*)));

        if (selectContactDialog.exec() == QDialog::Accepted)
        {
            Contact& contact = selectContactDialog.getSelectedContact();

            createChatWindow(contact, true);
        }
    }
}