void PhoneDetails::getNumber() { QString res; bool bOK = true; if (cmbCountry->currentItem() > 0){ res = "+"; res += QString::number(getComboValue(cmbCountry, getCountries())); res += " "; }else{ bOK = false; } if (edtAreaCode->text().length() > 0){ res += "("; res += edtAreaCode->text(); res += ") "; }else{ bOK = false; } if (edtNumber->text().length() > 0){ res += edtNumber->text(); }else{ bOK = false; } if (m_bExt && (edtExtension->text().length() > 0)){ res += " - "; res += edtExtension->text(); } emit numberChanged(res, bOK); }
void HomeInfo::fill() { ICQUserData *data = m_data; if (data == NULL) data = &m_client->data.owner; edtAddress->setText(m_client->toUnicode(data->Address, data)); edtCity->setText(m_client->toUnicode(data->City, data)); edtState->setText(m_client->toUnicode(data->State, data)); edtZip->setText(m_client->toUnicode(data->Zip, data)); initCombo(cmbCountry, data->Country, getCountries()); initTZCombo(cmbZone, data->TimeZone); }
void HomeInfo::apply(Client *client, void *_data) { if (client != m_client) return; ICQUserData *data = (ICQUserData*)_data; set_str(&data->Address, m_client->fromUnicode(edtAddress->text(), NULL).c_str()); set_str(&data->City, m_client->fromUnicode(edtCity->text(), NULL).c_str()); set_str(&data->State, m_client->fromUnicode(edtState->text(), NULL).c_str()); set_str(&data->Zip, m_client->fromUnicode(edtZip->text(), NULL).c_str()); data->Country = getComboValue(cmbCountry, getCountries()); }
void HomeInfo::fill() { ICQUserData *data = m_data; if (data == NULL) data = &m_client->data.owner; Contact *contact = getContacts()->contact(m_contact); edtAddress->setText(getContacts()->toUnicode(contact ,data->Address.ptr)); edtCity->setText(getContacts()->toUnicode(contact ,data->City.ptr)); edtState->setText(getContacts()->toUnicode(contact ,data->State.ptr)); edtZip->setText(getContacts()->toUnicode(contact ,data->Zip.ptr)); initCombo(cmbCountry, (unsigned short)(data->Country.value), getCountries()); initTZCombo(cmbZone, (char)(data->TimeZone.value)); }
void HomeInfo::apply(Client *client, void *_data) { if (client != m_client) return; ICQUserData *data = (ICQUserData*)_data; Contact *contact = getContacts()->contact(m_contact); set_str(&data->Address.ptr, getContacts()->fromUnicode(contact, edtAddress->text()).c_str()); set_str(&data->City.ptr, getContacts()->fromUnicode(contact, edtCity->text()).c_str()); set_str(&data->State.ptr, getContacts()->fromUnicode(contact, edtState->text()).c_str()); set_str(&data->Zip.ptr, getContacts()->fromUnicode(contact, edtZip->text()).c_str()); data->Country.value = getComboValue(cmbCountry, getCountries()); }
MSNSearch::MSNSearch(MSNClient *client, QWidget *parent) : MSNSearchBase(parent) { m_client = client; connect(this, SIGNAL(setAdd(bool)), topLevelWidget(), SLOT(setAdd(bool))); edtMail->setValidator(new EMailValidator(edtMail)); initCombo(cmbCountry, 0, getCountries(), true, getCountryCodes()); m_btnMail = new GroupRadioButton(i18n("&E-Mail address"), grpMail); m_btnInfo = new GroupRadioButton(i18n("&Hotmail directory"), grpHotmail); connect(m_btnInfo, SIGNAL(toggled(bool)), this, SLOT(radioToggled(bool))); connect(m_btnMail, SIGNAL(toggled(bool)), this, SLOT(radioToggled(bool))); }
PhoneDetails::PhoneDetails(QWidget *p, const QString &oldNumber) : PhoneDetailsBase(p) { QString number = oldNumber; QString areaCode; QString extension; int countryCode = 0; if (number.find('(') >= 0){ QCString country = trim(getToken(number, '(')).latin1(); const char *p; for (p = country; *p; p++){ if ((*p >= '0') && (*p <= '9')) break; } countryCode = atol(p); areaCode = trim(getToken(number, ')')); } if (number.find(" - ") >= 0){ int pos = number.find(" - "); extension = trim(number.mid(pos + 3)); number = number.mid(0, pos); } number = trim(number); initCombo(cmbCountry, (unsigned short)countryCode, getCountries()); QFontMetrics fm(font()); unsigned wChar = fm.width("0"); QSize s(wChar*10, 0); edtNumber->setMinimumSize(s); s = edtAreaCode->size(); s.setWidth(wChar*5); QSize sLabel = lblAreaCode->sizeHint(); sLabel.setHeight(0); s = s.expandedTo(sLabel); edtAreaCode->setMaximumSize(s); s.setWidth(wChar*5); sLabel = lblExtension->sizeHint(); sLabel.setHeight(0); s = s.expandedTo(sLabel); edtExtension->setMaximumSize(s); connect(cmbCountry, SIGNAL(activated(int)), this, SLOT(countryChanged(int))); connect(edtAreaCode, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtNumber, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtExtension, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); edtAreaCode->setValidator(new QIntValidator(edtAreaCode)); edtNumber->setValidator(new QIntValidator(edtNumber)); edtExtension->setValidator(new QIntValidator(edtExtension)); edtAreaCode->setText(areaCode); edtNumber->setText(number); edtExtension->setText(extension); m_bExt = false; }
ICQSearch::ICQSearch(ICQClient *client) { m_client = client; m_result = NULL; m_wizard = NULL; m_bRandomSearch = false; m_randomUin = 0; initCombo(cmbGender, 0, p_genders); initCombo(cmbAge, 0, ages); initCombo(cmbCountry, 0, getCountries()); initCombo(cmbLang, 0, p_languages); connect(tabSearch, SIGNAL(currentChanged(QWidget*)), this, SLOT(currentChanged(QWidget*))); connect(edtEmail, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbAge, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbGender, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbCountry, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(cmbLang, SIGNAL(activated(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtCity, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtState, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtCompany, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtDepartment, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtInterests, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtFirst, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtLast, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtNick, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtUin, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtScreen, SIGNAL(textChanged(const QString&)), this, SLOT(textChanged(const QString&))); connect(edtEmail, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtFirst, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtLast, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtNick, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtUin, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtCity, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtState, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtCompany, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtDepartment, SIGNAL(returnPressed()), this, SLOT(search())); connect(edtInterests, SIGNAL(returnPressed()), this, SLOT(search())); edtUin->setValidator(new QIntValidator(10000, 0x7FFFFFFF, edtUin)); initCombo(cmbGroup, m_client->getRandomChatGroup(), p_chat_groups, false); connect(btnFind, SIGNAL(clicked()), this, SLOT(randomFind())); setFindText(); edtStatus->setReadOnly(true); edtInfo->setReadOnly(true); edtInfo->setTextFormat(QTextEdit::RichText); btnAdd->setEnabled(false); btnMsg->setEnabled(false); connect(btnAdd, SIGNAL(clicked()), this, SLOT(addContact())); connect(btnMsg, SIGNAL(clicked()), this, SLOT(sendMessage())); edtScreen->setValidator(new AIMValidator(edtScreen)); fillGroup(); }
void WorkInfo::apply(Client *client, void *_data) { if (client != m_client) return; ICQUserData *data = (ICQUserData*)_data; set_str(&data->WorkAddress.ptr, getContacts()->fromUnicode(NULL, edtAddress->text()).c_str()); set_str(&data->WorkCity.ptr, getContacts()->fromUnicode(NULL, edtCity->text()).c_str()); set_str(&data->WorkState.ptr, getContacts()->fromUnicode(NULL, edtState->text()).c_str()); set_str(&data->WorkZip.ptr, getContacts()->fromUnicode(NULL, edtZip->text()).c_str()); data->WorkCountry.value = getComboValue(cmbCountry, getCountries()); data->Occupation.value = getComboValue(cmbOccupation, occupations); set_str(&data->WorkName.ptr, getContacts()->fromUnicode(NULL, edtName->text()).c_str()); set_str(&data->WorkDepartment.ptr, getContacts()->fromUnicode(NULL, edtDept->text()).c_str()); set_str(&data->WorkPosition.ptr, getContacts()->fromUnicode(NULL, edtPosition->text()).c_str()); set_str(&data->WorkHomepage.ptr, getContacts()->fromUnicode(NULL, edtSite->text()).c_str()); }
void WorkInfo::fill() { ICQUserData *data = m_data; if (data == NULL) data = &m_client->data.owner; edtAddress->setText(m_client->toUnicode(data->WorkAddress.ptr, data)); edtCity->setText(m_client->toUnicode(data->WorkCity.ptr, data)); edtState->setText(m_client->toUnicode(data->WorkState.ptr, data)); edtZip->setText(m_client->toUnicode(data->WorkZip.ptr, data)); initCombo(cmbCountry, (unsigned short)(data->WorkCountry.value), getCountries()); initCombo(cmbOccupation, (unsigned short)(data->Occupation.value), occupations); edtName->setText(m_client->toUnicode(data->WorkName.ptr, data)); edtDept->setText(m_client->toUnicode(data->WorkDepartment.ptr, data)); edtPosition->setText(m_client->toUnicode(data->WorkPosition.ptr, data)); edtSite->setText(m_client->toUnicode(data->WorkHomepage.ptr, data)); urlChanged(edtSite->text()); }
void *ICQSearch::processEvent(Event *e) { if (e->type() == EventRandomChat){ m_randomUin = (unsigned)(e->param()); if (m_randomUin == 0){ edtStatus->setText(i18n("Search fail")); }else{ edtStatus->setText(i18n("Request user info")); btnMsg->setEnabled(true); btnAdd->setEnabled(true); edtInfo->setText(i18n("<p>UIN: <b><a href=\"icq://%1\"><u>%2</u></a></b></p>") .arg(QString::number(m_randomUin)) .arg(QString::number(m_randomUin))); edtInfo->sync(); m_client->randomChatInfo(m_randomUin); } return this; } if (e->type() == EventRandomChatInfo){ ICQUserData *data = (ICQUserData*)(e->param()); if (data->Uin.value != m_randomUin) return NULL; edtStatus->setText(""); m_name = QString::fromUtf8(data->Alias.ptr); QString name = quoteString(m_name); QString topic = quoteString(QString::fromUtf8(data->About.ptr)); QString page = QString::fromUtf8(data->Homepage.ptr); QString pageLink = page; if (pageLink.left(5) != "http:"){ pageLink = "http://"; pageLink += page; } page = quoteString(page); const ext_info *e; QString text = i18n("<p><b>%1</b></p>") .arg(name); if (!topic.isEmpty()) text += i18n("%1<br>") .arg(topic); text += i18n("<p>Age: <b>%1</b></p>") .arg(data->Age.value); QString gender; for (e = p_genders; e->nCode; e++){ if (e->nCode == data->Gender.value){ gender = i18n(e->szName); break; } } if (!gender.isEmpty()) text += i18n("<p>Gender: <b>%1</b></p>") .arg(gender); QString country; for (e = getCountries(); e->nCode; e++){ if (e->nCode == data->Country.value){ country = i18n(e->szName); break; } } if (!country.isEmpty()) text += i18n("<p>Country: <b>%1</b></p>") .arg(country); QString lang; for (e = p_languages; e->nCode; e++){ if (e->nCode == data->Language.value){ lang = i18n(e->szName); break; } } if (!lang.isEmpty()) text += i18n("<p>Language: <b>%1</b></p>") .arg(lang); if (!page.isEmpty()) text += i18n("<p>Homepage: <a href=\"%1\"><u>%2</u></a></p>") .arg(pageLink) .arg(page); edtInfo->append(text); edtInfo->sync(); } switch (e->type()){ case EventGroupCreated: case EventGroupDeleted: case EventGroupChanged: fillGroup(); } return NULL; }
void ICQSearch::startSearch() { m_result->clear(); unsigned short id1 = SEARCH_DONE; unsigned short id2 = SEARCH_DONE; unsigned long uin; switch (tabSearch->currentPageIndex()){ case 0:{ string mail = getString(edtEmail); char age = (char)getComboValue(cmbAge, ages); char gender = (char)getComboValue(cmbGender, p_genders); char language = (char)getComboValue(cmbLang, p_languages); string city = getString(edtCity); string state = getString(edtState); unsigned short country = getComboValue(cmbCountry, getCountries()); string company = getString(edtCompany); string department = getString(edtDepartment); string interests = getString(edtInterests); if (mail.length() || age || gender || language || city.c_str() || state.c_str() || country || company.c_str() || department.c_str() || interests.c_str()) id1 = m_client->findWP("", "", "", mail.c_str(), age, gender, language, city.c_str(), state.c_str(), country, company.c_str(), department.c_str(), "", 0, 0, "", 0, interests.c_str(), 0, "", 0, "", chkOnline->isChecked()); if (!mail.empty() && (age == 0) && (gender == 0) && (language == 0) && city.empty() && state.empty() && (country == 0) && company.empty() && department.empty() && interests.empty()) id2 = m_client->aimEMailSearch(mail.c_str()); break; } case 1:{ string first = getString(edtFirst); string last = getString(edtLast); string nick = getString(edtNick); if (first.length() || last.length() || nick.length()) id1 = m_client->findWP(first.c_str(), last.c_str(), nick.c_str(), "", 0, 0, 0, "", "", 0, "", "", "", 0, 0, "", 0, "", 0, "", 0, "", chkOnline->isChecked()); if (first.length() || last.length()) id2 = m_client->aimInfoSearch(first.c_str(), last.c_str(), NULL, NULL, NULL, NULL, NULL, nick.c_str(), NULL, NULL); break; } case 2: uin = atol(edtUin->text().latin1()); if (uin) id2 = m_client->findByUin(uin); break; case 3: return; case 4:{ QString screen = edtScreen->text(); if (screen.isEmpty()) return; Contact *contact; ICQUserData *data = m_client->findContact(screen.latin1(), NULL, false, contact); if (data){ m_result->setText(i18n("%1 already in contact list") .arg(screen)); return; } data = m_client->findContact(screen.latin1(), NULL, true, contact); int nGrp = cmbGrp->currentItem(); ContactList::GroupIterator it; Group *grp; while ((grp = ++it) != NULL){ if (grp->id() == 0) continue; if (nGrp-- == 0){ contact->setGroup(grp->id()); Event e(EventContactChanged, contact); e.process(); break; } } m_result->setText(i18n("%1 added to contact list") .arg(screen)); return; } } m_result->setRequestId(id1, id2); }
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); }