//VOXOX CHANGE by Rolando - 2009.06.28 void QtVoxOxCallBarFrame::setFullPhoneNumber(QString fullPhoneNumber){ fullPhoneNumber = getPhoneNumberOnlyDigits(fullPhoneNumber);//VOXOX CHANGE by Rolando - 2009.06.28 QString phoneNumber; QString codeAreaFound; bool error; bool removePrefix = false; QString prefix = QString("011"); if(fullPhoneNumber.startsWith(QString("+"))){//VOXOX CHANGE by Rolando - 2009.06.28 fullPhoneNumber = fullPhoneNumber.replace(0,1,prefix); } if(fullPhoneNumber.startsWith(prefix)){//VOXOX CHANGE by Rolando - 2009.06.28 removePrefix = true; } QtFlag flag = getFlagByPhoneNumber(_qtFlagsManager, FLAGS_NAME_LANGUAGE, fullPhoneNumber, prefix, &error, &codeAreaFound);//VOXOX CHANGE by Rolando - 2009.06.28 if(!error){//VOXOX CHANGE by Rolando - 2009.06.28 setFlagButtonPixmap(flag.getDefaultCountryName()); setCountryCodeText(flag.getDefaultCountryName()); _qtFlagsListWidget->setDefaultFlagByCountryName(flag.getDefaultCountryName()); if(removePrefix){ codeAreaFound = prefix + codeAreaFound; } if(codeAreaFound == CODE_AREA_USA){ phoneNumber = fullPhoneNumber; } else{ phoneNumber = fullPhoneNumber.remove(0,codeAreaFound.length()); } _voxOxToolTipLineEdit->setText(phoneNumber);//VOXOX CHANGE by Rolando - 2009.08.05 } else{ setFlagButtonPixmap(QString(""));//VOXOX CHANGE by Rolando - 2009.06.28 setCountryCodeText(QString("")); _qtFlagsListWidget->setDefaultFlagByCountryName(QString("")); _voxOxToolTipLineEdit->setText(fullPhoneNumber);//VOXOX CHANGE by Rolando - 2009.08.05 } }
/* * setFlagButtonPixmap: displays a flag image according countryName parameter * parameters: QString countryName * returns void */ void QtVoxOxCallBarFrame::setFlagButtonPixmap(QString countryName){ QtFlag qtFlag = _qtFlagsManager->getFlagByCountryName(countryName, FLAGS_NAME_LANGUAGE); _ui->flagLabel->setPixmap(qtFlag.getPixmap()); if(!qtFlag.isNullCountryName()){ if(qtFlag.getDefaultCountryName() != ""){//if countryName is valid _ui->flagLabel->setToolTip(QString("Current country selected: ") + qtFlag.getDefaultCountryName()); } else{ _ui->flagLabel->setToolTip(QString("Select the country where you want to call")); } } else{ _ui->flagLabel->setToolTip(QString("Select the country where you want to call")); } }
void QtVoxOxCallBarFrame::itemActivatedComboBoxSlot(int index){ QString newText = _ui->callBarComboBox->itemText(index); if(newText == CLEAR_RECENT_CALLS_MESSAGE){ clearOutgoingCalls(); clearComboBoxEditText(); } else{ if(_ui->callBarComboBox->currentText() != newText){ QString codeAreaFound; bool error; QString prefix = QString("011"); QPixmap flagPixmap; QtFlag flag = getFlagByPhoneNumber(_qtFlagsManager, FLAGS_NAME_LANGUAGE, newText, prefix, &error, &codeAreaFound); if(!error){ setFlagButtonPixmap(flag.getDefaultCountryName()); setCountryCodeText(flag.getDefaultCountryName()); _qtFlagsListWidget->setDefaultFlagByCountryName(flag.getDefaultCountryName()); } else{ setFlagButtonPixmap(QString("")); setCountryCodeText(QString("")); _qtFlagsListWidget->setDefaultFlagByCountryName(QString("")); } if(_ui->callBarComboBox->findText(newText) != -1){ newText = newText.remove(QString("+") + codeAreaFound); _voxOxToolTipLineEdit->setText(newText);//VOXOX CHANGE by Rolando - 2009.08.05 } comboBoxTextChanged(newText); } } }