Example #1
0
void InterestsInfo::cmbChanged(int)
{
    QComboBox *cmbs[4] = { cmbBg1, cmbBg2, cmbBg3, cmbBg4 };
    QLineEdit *edts[4] = { edtBg1, edtBg2, edtBg3, edtBg4 };
    unsigned n = 0;
    unsigned i;
    for (i = 0; i < 4; i++){
        unsigned short value = getComboValue(cmbs[i], interests);
        if (value){
            if (i != n){
                cmbs[n]->setEnabled(true);
                edts[n]->setEnabled(true);
                initCombo(cmbs[n], value, interests, true);
                edts[n]->setText(edts[i]->text());
            }
            edts[n]->setEnabled(true);
            n++;
        }
    }
    if (n >= 4)
        return;
    cmbs[n]->setEnabled(true);
    disableWidget(edts[n]);
    cmbs[n]->setCurrentItem(0);
    edts[n]->setText("");
    for (n++; n < 4; n++){
        disableWidget(cmbs[n]);
        disableWidget(edts[n]);
        initCombo(cmbs[n], 0, interests, true);
        edts[n]->setText("");
    }
}
Example #2
0
void PastInfo::cmbAfChanged(int)
{
    QComboBox *cmbs[3] = { cmbAf1, cmbAf2, cmbAf3 };
    QLineEdit *edts[3] = { edtAf1, edtAf2, edtAf3 };
    unsigned n = 0;
    unsigned i;
    for (i = 0; i < 3; i++){
        unsigned short value = getComboValue(cmbs[i], affilations);
        if (value){
            if (i != n){
                cmbs[n]->setEnabled(true);
                edts[n]->setEnabled(true);
                initCombo(cmbs[n], value, affilations, true);
                edts[n]->setText(edts[i]->text());
            }
            edts[n]->setEnabled(true);
            edts[n]->setReadOnly(false);
            n++;
        }
    }
    if (n >= 3)
        return;
    cmbs[n]->setEnabled(true);
    disableWidget(edts[n]);
    cmbs[n]->setCurrentItem(0);
    edts[n]->setText("");
    for (n++; n < 3; n++){
        disableWidget(cmbs[n]);
        disableWidget(edts[n]);
        initCombo(cmbs[n], 0, affilations, true);
        edts[n]->setText("");
    }
}
Example #3
0
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();
}
Example #4
0
void WorkInfo::load(ICQUser *u)
{
    edtAddress->setText(QString::fromLocal8Bit(u->WorkAddress.c_str()));
    edtCity->setText(QString::fromLocal8Bit(u->WorkCity.c_str()));
    edtState->setText(QString::fromLocal8Bit(u->WorkState.c_str()));
    edtZip->setText(QString::fromLocal8Bit(u->WorkZip.c_str()));
    initCombo(cmbCountry, u->WorkCountry, countries);
    initCombo(cmbOccupation, u->Occupation, occupations);
    edtName->setText(QString::fromLocal8Bit(u->WorkName.c_str()));
    edtDept->setText(QString::fromLocal8Bit(u->WorkDepartment.c_str()));
    edtPosition->setText(QString::fromLocal8Bit(u->WorkPosition.c_str()));
    edtSite->setText(QString::fromLocal8Bit(u->WorkHomepage.c_str()));
    btnSite->setEnabled(*(u->WorkHomepage.c_str()));
}
Example #5
0
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());
}
Example #6
0
void HomeInfo::load(ICQUser *u)
{
    edtAddress->setText(QString::fromLocal8Bit(u->Address.c_str()));
    edtCity->setText(QString::fromLocal8Bit(u->City.c_str()));
    edtState->setText(QString::fromLocal8Bit(u->State.c_str()));
    edtZip->setText(QString::fromLocal8Bit(u->Zip.c_str()));
    initCombo(cmbCountry, u->Country, countries);
    initTZCombo(cmbZone, u->TimeZone);
}
Example #7
0
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);
}
Example #8
0
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)));
}
Example #9
0
void MoreInfo::fill()
{
    ICQUserData *data = m_data;
    if (data == NULL) data = &m_client->data.owner;
    edtHomePage->setText(m_client->toUnicode(data->Homepage.ptr, data));
    initCombo(cmbGender, (unsigned short)(data->Gender.value), genders);
    if (spnAge->text() == "0") spnAge->setSpecialValueText("");
    edtDate->setDate(data->BirthDay.value, data->BirthMonth.value, data->BirthYear.value);
    birthDayChanged();
    unsigned l = data->Language.value;
    char l1 = (char)(l & 0xFF);
    l = l >> 8;
    char l2 = (char)(l & 0xFF);
    l = l >> 8;
    char l3 = (char)(l & 0xFF);
    initCombo(cmbLang1, l1, languages);
    initCombo(cmbLang2, l2, languages);
    initCombo(cmbLang3, l3, languages);
    setLang(0);
    urlChanged(edtHomePage->text());
}
Example #10
0
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));
}
Example #11
0
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;
}
Example #12
0
void InterestsInfo::fill()
{
    ICQUserData *data = m_data;
    if (data == NULL) data = &m_client->data.owner;
    unsigned i = 0;
    QString str = m_client->toUnicode(data->Interests, data);
    while (str.length()){
        QString info = getToken(str, ';', false);
        QString n = getToken(info, ',');
        unsigned short category = (unsigned short)atol(n.latin1());
        switch (i){
        case 0:
            edtBg1->setText(info);
            initCombo(cmbBg1, category, interests);
            break;
        case 1:
            edtBg2->setText(info);
            initCombo(cmbBg2, category, interests);
            break;
        case 2:
            edtBg3->setText(info);
            initCombo(cmbBg3, category, interests);
            break;
        case 3:
            edtBg4->setText(info);
            initCombo(cmbBg4, category, interests);
            break;
        }
        i++;
    }
    for (; i < 4; i++){
        switch (i){
        case 0:
            initCombo(cmbBg1, 0, interests);
            break;
        case 1:
            initCombo(cmbBg2, 0, interests);
            break;
        case 2:
            initCombo(cmbBg3, 0, interests);
            break;
        case 3:
            initCombo(cmbBg4, 0, interests);
            break;
        }
    }
    if (m_data == NULL)
        cmbChanged(0);
}
Example #13
0
PhoneDetails::PhoneDetails(QWidget *p, PhoneInfo *info, unsigned userCountry)
        : PhoneDetailsBase(p)
{
    initCombo(cmbCountry, userCountry, countries);
    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));
    chkPublish->setChecked(info->Publish);
    chkSMS->setChecked(info->Type == SMS);
    edtAreaCode->setText(info->AreaCode.c_str());
    edtNumber->setText(info->Number.c_str());
    edtExtension->setText(info->Extension.c_str());
    int i = 1;
    for (const ext_info *c = countries; *c->szName; c++, i++){
        if (info->Country == c->szName){
            cmbCountry->setCurrentItem(i);
            break;
        }
    }
}
Example #14
0
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);
}
Example #15
0
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());
    }
}
Example #16
0
void PastInfo::fill()
{
    ICQUserData *data = m_data;
    if (data == NULL) data = &m_client->data.owner;
    unsigned i = 0;
    Contact *contact = getContacts()->contact(m_contact);
    QString str = getContacts()->toUnicode(contact, data->Backgrounds.ptr);
    while (str.length()){
        QString info = getToken(str, ';', false);
        QString n = getToken(info, ',');
        unsigned short category = (unsigned short)atol(n.latin1());
        switch (i){
        case 0:
            edtBg1->setText(info);
            initCombo(cmbBg1, category, pasts);
            break;
        case 1:
            edtBg2->setText(info);
            initCombo(cmbBg2, category, pasts);
            break;
        case 2:
            edtBg3->setText(info);
            initCombo(cmbBg3, category, pasts);
            break;
        }
        i++;
    }
    for (; i < 4; i++){
        switch (i){
        case 0:
            initCombo(cmbBg1, 0, pasts);
            break;
        case 1:
            initCombo(cmbBg2, 0, pasts);
            break;
        case 2:
            initCombo(cmbBg3, 0, pasts);
            break;
        }
    }
    i = 0;
    str = getContacts()->toUnicode(contact, data->Affilations.ptr);
    while (str.length()){
        QString info = getToken(str, ';', false);
        QString n = getToken(info, ',');
        unsigned short category = (unsigned short)atol(n.latin1());
        switch (i){
        case 0:
            edtAf1->setText(info);
            initCombo(cmbAf1, category, affilations);
            break;
        case 1:
            edtAf2->setText(info);
            initCombo(cmbAf2, category, affilations);
            break;
        case 2:
            edtAf3->setText(info);
            initCombo(cmbAf3, category, affilations);
            break;
        }
        i++;
    }
    for (; i < 4; i++){
        switch (i){
        case 0:
            initCombo(cmbAf1, 0, affilations);
            break;
        case 1:
            initCombo(cmbAf2, 0, affilations);
            break;
        case 2:
            initCombo(cmbAf3, 0, affilations);
            break;
        }
    }
    if (m_data == NULL){
        cmbBgChanged(0);
        cmbAfChanged(0);
    }
}
Example #17
0
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);
}