void AIMInfo::fill() { ICQUserData *data = m_data; if (data == NULL) data = &m_client->data.owner; setText(edtScreen, data->Screen.ptr); setText(edtFirst, data->FirstName.ptr); setText(edtLast, data->LastName.ptr); setText(edtMiddle, data->MiddleName.ptr); setText(edtMaiden, data->Maiden.ptr); setText(edtNick, data->Nick.ptr); setText(edtStreet, data->Address.ptr); setText(edtCity, data->City.ptr); setText(edtState, data->State.ptr); setText(edtZip, data->Zip.ptr); initCombo(cmbCountry, (unsigned short)(data->Country.value), getCountries(), true, getCountryCodes()); if (m_data == NULL){ if (edtFirst->text().isEmpty()) edtFirst->setText(getContacts()->owner()->getFirstName()); if (edtLast->text().isEmpty()) edtLast->setText(getContacts()->owner()->getLastName()); } cmbStatus->clear(); unsigned status = STATUS_ONLINE; if (m_data){ unsigned s = m_data->Status.value; if (s == ICQ_STATUS_OFFLINE){ status = STATUS_OFFLINE; }else if (s & ICQ_STATUS_AWAY){ status = STATUS_AWAY; } }else{ status = m_client->getStatus(); } if ((status != STATUS_ONLINE) && (status != STATUS_OFFLINE) && m_data){ edtAutoReply->setText(m_client->toUnicode(m_data->AutoReply.ptr, m_data)); }else{ edtAutoReply->hide(); } int current = 0; const char *text = NULL; for (const CommandDef *cmd = m_client->protocol()->statusList(); cmd->id; cmd++){ if (cmd->flags & COMMAND_CHECK_STATE) continue; if (status == cmd->id){ current = cmbStatus->count(); text = cmd->text; } cmbStatus->insertItem(Pict(cmd->icon), i18n(cmd->text)); } cmbStatus->setCurrentItem(current); disableWidget(cmbStatus); if (status == STATUS_OFFLINE){ lblOnline->setText(i18n("Last online") + ":"); edtOnline->setText(formatDateTime(data->StatusTime.value)); lblNA->hide(); edtNA->hide(); }else{ if (data->OnlineTime.value){ edtOnline->setText(formatDateTime(data->OnlineTime.value)); }else{ lblOnline->hide(); edtOnline->hide(); } if ((status == STATUS_ONLINE) || (text == NULL)){ lblNA->hide(); edtNA->hide(); }else{ lblNA->setText(i18n(text)); edtNA->setText(formatDateTime(data->StatusTime.value)); } } if (data->IP.ptr){ edtExtIP->setText(formatAddr(data->IP, data->Port.value)); }else{ lblExtIP->hide(); edtExtIP->hide(); } if (data->RealIP.ptr && ((data->IP.ptr == NULL) || (get_ip(data->IP) != get_ip(data->RealIP)))){ edtIntIP->setText(formatAddr(data->RealIP, data->Port.value)); }else{ lblIntIP->hide(); edtIntIP->hide(); } if (m_data){ string client_name = m_client->clientName(data); if (client_name.length()){ edtClient->setText(client_name.c_str()); }else{ lblClient->hide(); edtClient->hide(); } }else{ string name = PACKAGE; name += " "; name += VERSION; #ifdef WIN32 name += "/win32"; #endif edtClient->setText(name.c_str()); } if (m_bInit) return; m_bInit = true; m_client->fillEncoding(cmbEncoding, data); }
void ICQInfo::fill() { ICQUserData *data = m_data; if (data == NULL) data = &m_client->data.owner; edtUin->setText(QString::number(data->Uin.value)); Contact *contact = getContacts()->contact(m_contact); edtFirst->setText(getContacts()->toUnicode(contact, data->FirstName.ptr)); edtLast->setText(getContacts()->toUnicode(contact, data->LastName.ptr)); edtNick->setText(getContacts()->toUnicode(contact, data->Nick.ptr)); if (m_data == NULL){ if (edtFirst->text().isEmpty()) { QString firstName = getContacts()->owner()->getFirstName(); firstName = getToken(firstName, '/'); edtFirst->setText(firstName); } if (edtLast->text().isEmpty()) { QString lastName = getContacts()->owner()->getLastName(); lastName = getToken(lastName, '/'); edtLast->setText(lastName); } password->setEnabled(m_client->getState() == Client::Connected); } cmbStatus->clear(); unsigned status = STATUS_ONLINE; if (m_data){ unsigned s = m_data->Status.value; if (s == ICQ_STATUS_OFFLINE){ status = STATUS_OFFLINE; }else if (s & ICQ_STATUS_DND){ status = STATUS_DND; }else if (s & ICQ_STATUS_OCCUPIED){ status = STATUS_OCCUPIED; }else if (s & ICQ_STATUS_NA){ status = STATUS_NA; }else if (s & ICQ_STATUS_AWAY){ status = STATUS_AWAY; }else if (s & ICQ_STATUS_FFC){ status = STATUS_FFC; } }else{ status = m_client->getStatus(); initCombo(cmbRandom, m_client->getRandomChatGroup(), chat_groups); } if ((status != STATUS_ONLINE) && (status != STATUS_OFFLINE) && m_data){ edtAutoReply->setText(getContacts()->toUnicode(getContacts()->contact(m_contact), m_data->AutoReply.ptr)); }else{ edtAutoReply->hide(); } int current = 0; const char *text = NULL; if (m_data && (status == STATUS_OFFLINE) && m_data->bInvisible.bValue){ cmbStatus->insertItem(Pict("ICQ_invisible"), i18n("Possibly invisible")); }else{ for (const CommandDef *cmd = ICQPlugin::m_icq->statusList(); cmd->id; cmd++){ if (cmd->flags & COMMAND_CHECK_STATE) continue; if (status == cmd->id){ current = cmbStatus->count(); text = cmd->text; } cmbStatus->insertItem(Pict(cmd->icon), i18n(cmd->text)); } } cmbStatus->setCurrentItem(current); disableWidget(cmbStatus); if (status == STATUS_OFFLINE){ lblOnline->setText(i18n("Last online") + ":"); edtOnline->setText(formatDateTime(data->StatusTime.value)); lblNA->hide(); edtNA->hide(); }else{ if (data->OnlineTime.value){ edtOnline->setText(formatDateTime(data->OnlineTime.value)); }else{ lblOnline->hide(); edtOnline->hide(); } if ((status == STATUS_ONLINE) || (text == NULL)){ lblNA->hide(); edtNA->hide(); }else{ lblNA->setText(i18n(text)); edtNA->setText(formatDateTime(data->StatusTime.value)); } } if (data->IP.ptr){ edtExtIP->setText(formatAddr(data->IP, data->Port.value)); }else{ lblExtIP->hide(); edtExtIP->hide(); } if ((data->RealIP.ptr) && ((data->IP.ptr == NULL) || (get_ip(data->IP) != get_ip(data->RealIP)))){ edtIntIP->setText(formatAddr(data->RealIP, data->Port.value)); }else{ lblIntIP->hide(); edtIntIP->hide(); } if (m_data){ string client_name = m_client->clientName(data); if (client_name.length()){ edtClient->setText(client_name.c_str()); }else{ lblClient->hide(); edtClient->hide(); } }else{ string name = PACKAGE; name += " "; name += VERSION; #ifdef WIN32 name += "/win32"; #endif edtClient->setText(name.c_str()); } }
void ICQInfo::fill() { ICQUserData *data = m_data; if (data == NULL) data = &m_client->data.owner; edtUin->setText(QString::number(data->Uin)); edtFirst->setText(m_client->toUnicode(data->FirstName, data)); edtLast->setText(m_client->toUnicode(data->LastName, data)); edtNick->setText(m_client->toUnicode(data->Nick, data)); if (m_data == NULL){ if (edtFirst->text().isEmpty()) edtFirst->setText(getContacts()->owner()->getFirstName()); if (edtLast->text().isEmpty()) edtLast->setText(getContacts()->owner()->getLastName()); } cmbStatus->clear(); unsigned status = STATUS_ONLINE; if (m_data){ unsigned s = m_data->Status; if (s == ICQ_STATUS_OFFLINE){ status = STATUS_OFFLINE; }else if (s & ICQ_STATUS_DND){ status = STATUS_DND; }else if (s & ICQ_STATUS_OCCUPIED){ status = STATUS_OCCUPIED; }else if (s & ICQ_STATUS_NA){ status = STATUS_NA; }else if (s & ICQ_STATUS_AWAY){ status = STATUS_AWAY; }else if (s & ICQ_STATUS_FFC){ status = STATUS_FFC; } }else{ status = m_client->getStatus(); initCombo(cmbRandom, m_client->getRandomChatGroup(), chat_groups); } if ((status != STATUS_ONLINE) && (status != STATUS_OFFLINE) && m_data){ edtAutoReply->setText(m_client->toUnicode(m_data->AutoReply, m_data)); }else{ edtAutoReply->hide(); } int current = 0; const char *text = NULL; if (m_data && (status == STATUS_OFFLINE) && m_data->bInvisible){ cmbStatus->insertItem(Pict("ICQ_invisible"), i18n("Possibly invisible")); }else{ for (const CommandDef *cmd = m_client->protocol()->statusList(); cmd->id; cmd++){ if (cmd->flags & COMMAND_CHECK_STATE) continue; if (status == cmd->id){ current = cmbStatus->count(); text = cmd->text; } cmbStatus->insertItem(Pict(cmd->icon), i18n(cmd->text)); } } cmbStatus->setCurrentItem(current); disableWidget(cmbStatus); if (status == STATUS_OFFLINE){ lblOnline->setText(i18n("Last online") + ":"); edtOnline->setText(formatTime(data->StatusTime)); lblNA->hide(); edtNA->hide(); }else{ if (data->OnlineTime){ edtOnline->setText(formatTime(data->OnlineTime)); }else{ lblOnline->hide(); edtOnline->hide(); } if ((status == STATUS_ONLINE) || (text == NULL)){ lblNA->hide(); edtNA->hide(); }else{ lblNA->setText(i18n(text)); edtNA->setText(formatTime(data->StatusTime)); } } if (data->IP){ edtExtIP->setText(formatAddr(data->IP, data->Port)); }else{ lblExtIP->hide(); edtExtIP->hide(); } if ((data->RealIP) && ((data->IP == NULL) || (get_ip(data->IP) != get_ip(data->RealIP)))){ edtIntIP->setText(formatAddr(data->RealIP, data->Port)); }else{ lblIntIP->hide(); edtIntIP->hide(); } if (m_data){ string client_name = m_client->clientName(data); if (client_name.length()){ edtClient->setText(client_name.c_str()); }else{ lblClient->hide(); edtClient->hide(); } }else{ string name = PACKAGE; name += " "; name += VERSION; #ifdef WIN32 name += "/win32"; #endif edtClient->setText(name.c_str()); } if (m_bInit) return; m_bInit = true; current = 0; int n_item = 1; cmbEncoding->clear(); cmbEncoding->insertItem("Default"); QStringList l; const ENCODING *e; QStringList main; QStringList::Iterator it; for (e = encodingTbl; e->language; e++){ if (!e->bMain) continue; main.append(i18n(e->language) + " (" + e->codec + ")"); } main.sort(); for (it = main.begin(); it != main.end(); ++it, n_item++){ QString str = *it; int n = str.find('('); str = str.mid(n + 1); n = str.find(')'); str = str.left(n); if (data->Encoding && !strcmp(data->Encoding, str.latin1())) current = n_item; cmbEncoding->insertItem(*it); } QStringList noMain; for (e = encodingTbl; e->language; e++){ if (e->bMain) continue; noMain.append(i18n(e->language) + " (" + e->codec + ")"); } noMain.sort(); for (it = noMain.begin(); it != noMain.end(); ++it, n_item++){ QString str = *it; int n = str.find('('); str = str.mid(n + 1); n = str.find(')'); str = str.left(n); if (data->Encoding && !strcmp(data->Encoding, str.latin1())) current = n_item; cmbEncoding->insertItem(*it); } cmbEncoding->setCurrentItem(current); }