Exemple #1
0
void CFrmUserList::slotSendMessage()
{
    if(!GetCurrentRoster().isEmpty())
    {
        //是用户结点,打开消息对话框  
        MANAGE_MESSAGE_DIALOG->ShowDialog(GetCurrentRoster()); 
    }
}
Exemple #2
0
void CFrmUserList::slotRenameRoster()
{
    QString szName;
    if(GLOBAL_USER->GetUserInfoRoster(GetCurrentRoster()).isNull())
        return;
    szName = GLOBAL_USER->GetUserInfoRoster(GetCurrentRoster())->GetInfo()->GetShowName();
    bool ok;
    QString text = QInputDialog::getText(this, tr("Roster[%1] rename").arg(szName),
                                         tr("Roster[%1] rename:").arg(szName), QLineEdit::Normal,
                                         szName, &ok);
    if (ok && !text.isEmpty())
        GET_CLIENT->RosterRename(GetCurrentRoster(), text);
}
Exemple #3
0
void CFrmUserList::slotRemoveRoster()
{
    QString szId = GetCurrentRoster();
    if(szId.isEmpty())
        return;
    GET_CLIENT->RosterRemove(szId);
}
Exemple #4
0
void CFrmUserList::slotUpdateMenu()
{
    m_Menu.setTitle(tr("Operator roster(&O)"));
    m_Menu.setEnabled(true);
    EnableAllActioins(false);
    if(this->isHidden())
        return;

    //如果是组上,显示增加好友  
    EnableAction(ui->actionAddRoster_A);

    //判断是在组上还是在好友上  
    CRoster* p = GetCurrentRoster();
    if(p)
    {
        //增加订阅  
        if(QXmppRosterIq::Item::None == p->GetSubScriptionType()
             || QXmppRosterIq::Item::From == p->GetSubScriptionType())
            EnableAction(ui->actionAgreeAddRoster);

        //如果是好友上,显示删除好友  
        EnableAction(ui->actionRemoveRoster_R);

        //查看好友信息  
        EnableAction(ui->actionInformation_I);
        //TODO: 移动到组  

    }
    else
    {
        //TODO:新建组  
    }
    return;
}
Exemple #5
0
void CFrmUserList::slotCallAudio()
{
    QString szId = GetCurrentRoster();
    if(szId.isEmpty())
        return;
    GETMANAGER->GetCall()->Call(szId);
    //弹出消息对话框  
    MANAGE_MESSAGE_DIALOG->ShowDialog(szId); 
}
Exemple #6
0
void CFrmUserList::slotMonitor()
{
    QString szId = GetCurrentRoster();
    if(szId.isEmpty())
        return;
    QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId);
    if(roster.isNull())
        return;
    roster->GetInfo()->SetMonitor(!roster->GetInfo()->GetIsMonitor());
}
Exemple #7
0
void CFrmUserList::slotAddRoster()
{
    CDlgAddRoster dlgAddRoster;
    QSet<QString> groups;
    groups = GetGroupsName();
    QString szId = GetCurrentRoster();
    if(!szId.isEmpty() && CUserInfo::None == GLOBAL_USER->GetUserInfoRoster(szId)->GetInfo()->GetSubScriptionType())
        dlgAddRoster.Init(groups, szId);
    else
        dlgAddRoster.Init(groups);
    dlgAddRoster.exec();
}
Exemple #8
0
void CFrmUserList::slotSendFile()
{
    QString szId = GetCurrentRoster();
    if(szId.isEmpty())
        return;

    QString szFile = CTool::FileDialog(this, QString(), QString(), tr("Open File"));
    if(szFile.isEmpty())
        return;
    QSharedPointer<CManageFileTransfer> file = CGlobal::Instance()->GetManager()->GetFileTransfer();
    file->SendFile(szId, szFile);
    //弹出消息对话框  
    MANAGE_MESSAGE_DIALOG->ShowDialog(szId); 
}
Exemple #9
0
void CFrmUserList::slotMoveRoster()
{
    QString szName;
    QSharedPointer<CUser> user = GLOBAL_USER->GetUserInfoRoster(GetCurrentRoster());
    if(user.isNull())
        return;
    szName = user->GetInfo()->GetShowName();
    QStringList items;
    int nIndex = 0, i = 0;
    QMap<QString, QStandardItem*>::iterator it;
    for(it = m_Groups.begin(); it != m_Groups.end(); it++)
    {
        items << it.key();
        if(user->GetInfo()->GetGroups().contains(it.key()))
            nIndex = i;
        i++;
    }

    bool ok;
    QString item = QInputDialog::getItem(this,
                                         tr("Move roster").arg(szName),
                                         tr("Move roster %1 to group:").arg(szName),
                                         items,
                                         nIndex,
                                         true,
                                         &ok);
    if (ok && !item.isEmpty())
    {
        QSet<QString> groups;
        groups << item;
        GET_CLIENT->RosterRemove(user->GetInfo()->GetId());
        GET_CLIENT->RosterAdd(user->GetInfo()->GetId(),
                              CClient::SUBSCRIBE_ACCEPT,
                              user->GetInfo()->GetNick(),
                              groups);
    }
}
Exemple #10
0
void CFrmUserList::slotInformationRoster()
{
    QString bareJid = GetCurrentRoster();
    CDlgUservCard pvCard(GLOBAL_USER->GetUserInfoRoster(bareJid)->GetInfo());
    pvCard.exec();
}
Exemple #11
0
void CFrmUserList::slotAgreeAddRoster()
{
    GET_CLIENT->RosterAdd(GetCurrentRoster(), CClient::SUBSCRIBE_REQUEST);
}
Exemple #12
0
void CFrmUserList::slotUpdateMenu()
{
    m_Menu.setTitle(tr("Operator roster(&O)"));
    m_Menu.setEnabled(true);
    EnableAllActioins(false);
    if(this->isHidden())
        return;

    //如果是组上,显示增加好友  
    EnableAction(ui->actionAddRoster_A);

    //判断是在组上还是在好友上  
    QString bareJid = GetCurrentRoster();
    if(bareJid.isEmpty())
    {
        //TODO:新建组  

        //判断子节点是否为空  
        QModelIndex index = m_UserList.currentIndex();
        if(!m_pModel->hasChildren(index))
            EnableAction(ui->actionRemove_Group);
    }
    else
    {
        QSharedPointer<CUser> user = GLOBAL_USER->GetUserInfoRoster(bareJid);
        if(user.isNull())
        {
            LOG_MODEL_ERROR("FrmUserList", "Don't roster:%s", bareJid.toStdString().c_str());
            return;
        }
        
        QSharedPointer<CUserInfo> info = user->GetInfo();
        if(info.isNull())
        {
            LOG_MODEL_ERROR("FrmUserList", "Don't roster:%s", bareJid.toStdString().c_str());
            return;
        }

        //增加订阅  
        if(CUserInfo::Both != info->GetSubScriptionType())
            EnableAction(ui->actionAgreeAddRoster);
        
        //显示重命名菜单  
        EnableAction(ui->actionRename);
        //如果是好友上,显示删除好友  
        EnableAction(ui->actionRemoveRoster_R);

        //查看好友信息  
        EnableAction(ui->actionInformation_I);
        //移动到组  
        EnableAction(ui->actionMove_roster);
        EnableAction(ui->actionSendMessage);
        EnableAction(ui->actionSendFile);
        EnableAction(ui->actionVideo);
        EnableAction(ui->actionAudio);
        if(CGlobal::Instance()->GetIsMonitor())
        {
            ui->actionAllowMonitor->setChecked(info->GetIsMonitor());
            EnableAction(ui->actionAllowMonitor);
        }
         //TODO:3新增菜单  
    }
    return;
}
Exemple #13
0
void CFrmUserList::slotInformationRoster()
{
    CRoster* p = GetCurrentRoster();
    CFrmUservCard* pvCard = new CFrmUservCard(p);
    pvCard->show();
}
Exemple #14
0
void CFrmUserList::slotRemoveRoster()
{
    CRoster* p = GetCurrentRoster();
    if(p)
        CGlobal::Instance()->GetXmppClient()->rosterManager().removeItem(p->BareJid());
}
Exemple #15
0
void CFrmUserList::slotAgreeAddRoster()
{
    CRoster* p = GetCurrentRoster();
    if(p)
       CGlobal::Instance()->GetXmppClient()->rosterManager().subscribe(p->BareJid());
}