Пример #1
0
static string toLatin(const QString &str)
{
    QString s = toTranslit(str);
    string res;
    for (int i = 0; i < (int)s.length(); i++){
        if (s[i].unicode() > 0x7F){
            res += "?";
        }else{
            res += s[i].latin1();
        }
    }
    return res;
}
Пример #2
0
void WeatherCfg::search()
{
    if (!isDone()){
        stop();
        btnSearch->setText(i18n("&Search"));
        textChanged(cmbLocation->lineEdit()->text());
        return;
    }
    if (cmbLocation->lineEdit()->text().isEmpty())
        return;
    btnSearch->setText(i18n("&Cancel"));
    string url = "http://xoap.weather.com/search/search?where=";
    url += toTranslit(cmbLocation->lineEdit()->text()).utf8();
    fetch(url.c_str());
}
Пример #3
0
void MsgSMS::textChanged()
{
    if (btnSend == NULL)
        return;
    QString msgText = m_edit->m_edit->text();
    if (btnTranslit->isOn())
        msgText = toTranslit(msgText);
    btnSend->setEnabled(!lineEdit()->text().isEmpty() && !msgText.isEmpty());
    unsigned size = msgText.length();
    unsigned max_size = MAX_SMS_LEN_UNICODE;
    if (isLatin(msgText))
        max_size = MAX_SMS_LEN_LATIN1;
    QString status = i18n("Size: %1 / Max. size: %2")
                     .arg(size) .arg(max_size);
    if (size > max_size){
        status += " ! ";
        status += i18n("Message will be split");
    }
    m_edit->m_userWnd->setStatus(status);
}