bool MsgEdit::canSend() { if (msg){ if (bMultiply){ UserBox *box = static_cast<UserBox*>(topLevelWidget()); if (box->users == NULL) return false; UserView *users = box->users; if (!users->hasChecked()) return false; } switch (msg->Type()){ case ICQ_MSGxMSG: return (edit->length()); case ICQ_MSGxURL: return (urlEdit->text().length()); case ICQ_MSGxFILE: return (fileEdit->text().length()); case ICQ_MSGxSMS: return (edit->length() && phoneEdit->lineEdit()->text().length()); case ICQ_MSGxCONTACTxLIST: return (!users->isEmpty()); case ICQ_MSGxCHAT: case ICQ_MSGxAUTHxREFUSED: case ICQ_MSGxAUTHxGRANTED: case ICQ_MSGxAUTHxREQUEST: return true; } } return false; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); UserView w; w.show(); return a.exec(); }
void AdminWindow::onUserViewed(UserRegiData *userData) { UserView *userView = new UserView(); userView->setName(userData->getName()); userView->setMobile(userData->getMobile()); userView->setType(userData->getType()); userView->setAddress(userData->getAddress()); userView->setPhoto(userData->getPhoto()); userView->setWindowModality(Qt::ApplicationModal); userView->show(); }
void MsgEdit::makeMessage() { if (msg == NULL) return; switch (msg->Type()){ case ICQ_MSGxMSG:{ ICQMsg *m = static_cast<ICQMsg*>(msg); m->Message = edit->text().local8Bit(); if (edit->colorChanged()){ m->BackColor = (edit->background().rgb() & 0xFFFFFF); m->ForeColor = (edit->foreground().rgb() & 0xFFFFFF); pMain->MessageBgColor = m->BackColor(); pMain->MessageFgColor = m->ForeColor(); } break; } case ICQ_MSGxURL:{ ICQUrl *m = static_cast<ICQUrl*>(msg); m->Message = edit->text().local8Bit(); m->URL = urlEdit->text().local8Bit(); break; } case ICQ_MSGxFILE:{ ICQFile *m = static_cast<ICQFile*>(msg); m->Description = edit->text().local8Bit(); m->Name = fileEdit->text().local8Bit(); break; } case ICQ_MSGxCHAT:{ ICQChat *m = static_cast<ICQChat*>(msg); m->Reason = edit->text().local8Bit(); break; } case ICQ_MSGxSMS:{ ICQSMS *m = static_cast<ICQSMS*>(msg); string s; s = edit->text().local8Bit(); s = pClient->clearHTML(s.c_str()); msgTail = trim(QString::fromLocal8Bit(s.c_str())); m->Message = smsChunk(); m->Phone = phoneEdit->lineEdit()->text().local8Bit(); break; } case ICQ_MSGxCONTACTxLIST:{ ICQContacts *m = static_cast<ICQContacts*>(msg); users->fillList(m->Contacts); break; } case ICQ_MSGxAUTHxREQUEST:{ ICQAuthRequest *m = static_cast<ICQAuthRequest*>(msg); m->Message = edit->text().local8Bit(); break; } case ICQ_MSGxAUTHxREFUSED:{ ICQAuthRefused *m = static_cast<ICQAuthRefused*>(msg); m->Message = edit->text().local8Bit(); break; } case ICQ_MSGxAUTHxGRANTED: break; default: log(L_WARN, "Bad message type %u", msg->Type()); return; } if (bMultiply){ msg->Uin.clear(); UserBox *box = static_cast<UserBox*>(topLevelWidget()); if (box->users){ UserView *users = box->users; if (users) users->fillChecked(msg); } } realSend(); }