void DClusterSetManagerPage::handleDevClusterAuthorizedInfo(InputPacket& inpack) { quint8 ansCode = inpack.getAnswerCode(); if(clusterAddManagerPage != NULL){ clusterAddManagerPage->fetchData(inpack); if(ansCode == Mi::Success){//添加管理员成功 quint64 managerID = clusterAddManagerPage->getManagerID(); QHash<quint64, DClusterUserInfo*> infoList = userInfoList->fetchList(); QHashIterator<quint64, DClusterUserInfo*> iter(infoList); while(iter.hasNext()) { iter.next(); DClusterUserInfo* userInfo = dynamic_cast<DClusterUserInfo*>(iter.value()); if(managerID == userInfo->getUserID()){ userInfo->setUserRole(Mi::SeniorManager); this->appendManagerToList(userInfo); return; } } } return; } QString strText; if(ansCode == Mi::Success){ strText = tr("取消管理员成功"); QHashIterator<quint64, CheckButton*> iter(btnCheckList); while(iter.hasNext()) { iter.next(); CheckButton* btn = iter.value(); if(btn->getUserID() == curCancelManagerID){ managerLayout->removeWidget(btn); SAFE_DELETE(btn); } } } else if(ansCode == Mi::Failure) strText = tr("取消管理员失败, 请重试"); this->handleHintInfo(strText); }
void DClusterSetManagerPage::on_btnCancelManager_clicked() { CheckButton* btn = dynamic_cast<CheckButton*>(sender()); btn->setReviewText(tr("取消管理员")); quint8 role = Mi::Operator; curCancelManagerID = btn->getUserID(); AssemblyData assemblyData; assemblyData.append(curClusterID); assemblyData.append(role); assemblyData.append(curCancelManagerID); char* data = assemblyData.getAssemblyData(); quint16 dataLen = assemblyData.getAssemblyDataLen(); emit readyRead(CommandCode::DCLUSTER_SETTING_USER_AUTHORIZE, data, dataLen); //页面加载窗口 if(loadingPage == NULL){ loadingPage = new LoadingPage(this); loadingPage->show(); } }