コード例 #1
0
void QtHistory::replayItem(int id) {
	if (id != 0){
	HistoryMementoCollection * collection = _cHistory.getHistory().getHistoryMementoCollection();
	HistoryMemento* memento = collection->getMemento(id);
	QString data = QString::fromStdString(memento->getData());

	QtWengoPhone * qtWengoPhone = (QtWengoPhone *) _cHistory.getCWengoPhone().getPresentation();
	//VOXOX - CJC - 2009.06.10 
	QtVoxMessageBox box(_historyWidget->getWidget());
	box.setWindowTitle("VoxOx - Call History");
	box.setText(tr("Do you want to call %1?").arg(formatName(memento->getPeer(), _isWengoAccountConnected)));
	box.setStandardButtons(QMessageBox::Yes | QMessageBox::No );


	/*QMessageBox mb(tr("@product@ - Call History"),
		tr("Do you want to call %1?").arg(formatName(memento->getPeer(), _isWengoAccountConnected)),
		QMessageBox::Question,
		QMessageBox::Yes | QMessageBox::Default,
		QMessageBox::No | QMessageBox::Escape,
		QMessageBox::NoButton, _historyWidget->getWidget());*/

	switch (memento->getState()) {
	case HistoryMemento::OutgoingSmsOk:
	case HistoryMemento::OutgoingSmsNok: {
		//Retrieve info & configure the Sms widget
		std::string data = _cHistory.getMementoData(id);
		QString text = QString::fromUtf8(data.c_str(), data.size());
		QString phoneNumber = QString::fromStdString(_cHistory.getMementoPeer(id));

		//Test existance of Sms (available only if a WengoAccount has been created)
		QtSms * sms = qtWengoPhone->getQtSms();
		if (sms) {
			sms->setText(text);
			sms->setPhoneNumber(phoneNumber);
			sms->getWidget()->show();
		}
		break;
	}

	case HistoryMemento::OutgoingCall:
	case HistoryMemento::IncomingCall:
	case HistoryMemento::MissedCall:
	case HistoryMemento::RejectedCall:
		if (box.exec() == QMessageBox::Yes) {
			_cHistory.replay(id);
		}
		break;

	case HistoryMemento::ChatSession:
		_chatLogViewer = new QtChatLogViewer(NULL, *qtWengoPhone, data );
		_chatLogViewer->restartChat();
		break;

	default:
		break;
		}
	}
}
コード例 #2
0
void QtHistory::showChatLog(int id) {
	if (id != 0){
		HistoryMementoCollection * collection = _cHistory.getHistory().getHistoryMementoCollection();
		HistoryMemento* memento = collection->getMemento(id);

		QtWengoPhone * qtWengoPhone = (QtWengoPhone *) _cHistory.getCWengoPhone().getPresentation();

		if(memento->getState() == HistoryMemento::ChatSession){
			_chatLogViewer = new QtChatLogViewer(NULL, *qtWengoPhone, QString::fromStdString(memento->getData()));
			_chatLogViewer->show();
		}
	}
}