Ejemplo n.º 1
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;
}
Ejemplo n.º 2
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;
}