Esempio n. 1
0
void QtVoxOxCallBarFrame::fillComboBox() {
	QStringList tobeinserted = QStringList();
	clearComboBox();

	//CUserProfile * cUserProfile =
	//	_qtWengoPhone->getCWengoPhone().getCUserProfileHandler().getCUserProfile();
	if (!_cUserProfile) {
		return;
	}

	//completion of history
	//if _qtHistoryWidget is set it means that History has been created
	
	bool isWengoAccountConnected = _cUserProfile->getUserProfile().hasWengoAccount();
	
	CHistory* chistory = _cUserProfile->getCHistory();
	if (chistory) {
		HistoryMementoCollection * mementos = chistory->getMementos(HistoryMemento::OutgoingCall, 10);
		Config & config = ConfigManager::getInstance().getCurrentConfig();
		QString wengoSuffix = "@" + QString::fromStdString( config.getWengoRealm() );
		for (HistoryMap::iterator it = mementos->begin(); it != mementos->end(); it++) {
			HistoryMemento * memento = (*it).second;
			SipAddress sipAddress(memento->getPeer());
			
			QString username(sipAddress.getSipAddress().c_str());
			if (isWengoAccountConnected) {
				username.remove(wengoSuffix);
			}
			username.remove("sip:");	

			if( !username.isEmpty() && (memento->getState()==HistoryMemento::OutgoingCall) && !tobeinserted.contains(username) ) {
				tobeinserted << username;
			}
		}
		OWSAFE_DELETE(mementos);
	}
	////

	tobeinserted.sort();

	QStringList::const_iterator constIterator;
	for (constIterator = tobeinserted.constBegin(); constIterator != tobeinserted.constEnd();++constIterator){		
		
		addComboBoxItem(*constIterator);

	}

	if(tobeinserted.count() > 0){
		if(_ui->callBarComboBox->findText(CLEAR_RECENT_CALLS_MESSAGE) == -1){
			_ui->callBarComboBox->insertItem (_ui->callBarComboBox->count(), CLEAR_RECENT_CALLS_MESSAGE );
		}
	}

	clearComboBoxEditText();
}
Esempio n. 2
0
QString QtHistory::formatName(const std::string& name, bool isWengo) const {
	// do not display realm whith wengo account
	SipAddress sipAddress(name);
	QString formattedName = QString::fromStdString(sipAddress.getSipAddress());
	
	Config & config = ConfigManager::getInstance().getCurrentConfig();
	QString wengoSuffix = "@" + QString::fromStdString( config.getWengoRealm() );
	if (isWengo) {
		formattedName.remove(wengoSuffix);
	}
	formattedName.remove("sip:");

	Contact * contact = _cHistory.getCWengoPhone().getCUserProfileHandler().getUserProfileHandler().getCurrentUserProfile()->getContactList().getContactByNumber(formattedName.toStdString()); //VOXOX CHANGE by Rolando - 2009.10.06 
	QString displayName;//VOXOX CHANGE by Rolando - 2009.10.06 

	if(contact)//VOXOX CHANGE by Rolando - 2009.10.06 
	{
		QString newName = QString::fromStdString(contact->getDisplayName()) + " (" + formattedName + ")";//VOXOX CHANGE by Rolando - 2009.10.06 
		formattedName = newName;//VOXOX CHANGE by Rolando - 2009.10.06 
	}	

	return formattedName;
}