Commit 1be57bd5 authored by Ming Rui Zhang's avatar Ming Rui Zhang

newcallmodel: add voicemail notification related signals

Change-Id: I86c0be35cc56b03b39279d239fe77bb83fe5240c
parent bc5b6841
......@@ -251,6 +251,15 @@ Q_SIGNALS:
*/
void callAddedToConference(const std::string& callId, const std::string& confId) const;
/**
* Emitted when a voice mail notice arrives
* @param accountId
* @param newCount
* @param oldCount
* @param urgentCount
*/
void voiceMailNotify(const std::string& accountId, int newCount, int oldCount, int urgentCount) const;
private:
std::unique_ptr<NewCallModelPimpl> pimpl_;
};
......
......@@ -145,6 +145,12 @@ CallbacksHandler::CallbacksHandler(const Lrc& parent)
&CallbacksHandler::slotIncomingMessage,
Qt::QueuedConnection);
connect(&CallManager::instance(),
&CallManagerInterface::voiceMailNotify,
this,
&CallbacksHandler::slotVoiceMailNotify,
Qt::QueuedConnection);
connect(&ConfigurationManager::instance(),
&ConfigurationManagerInterface::dataTransferEvent,
this,
......@@ -264,6 +270,12 @@ CallbacksHandler::slotNearbyPeerSubscription(const QString& accountId,
emit newPeerSubscription(accountId.toStdString(), contactUri.toStdString(), state, displayname.toStdString());
}
void
CallbacksHandler::slotVoiceMailNotify(const QString& accountId, int newCount, int oldCount, int urgentCount)
{
emit voiceMailNotify(accountId.toStdString(), newCount, oldCount, urgentCount);
}
void
CallbacksHandler::slotContactAdded(const QString& accountId,
const QString& contactUri,
......
......@@ -268,6 +268,15 @@ Q_SIGNALS:
*/
void audioMeter(const std::string& id, float level);
/**
* Emitted when an audio level is received
* @param accountId
* @param newCount
* @param oldCount
* @param urgentCount
*/
void voiceMailNotify(const std::string& accountId, int newCount, int oldCount, int urgentCount);
private Q_SLOTS:
/**
* Emit newAccountMessage
......@@ -488,6 +497,18 @@ private Q_SLOTS:
int state,
const QString& displayname);
/**
* Emit voiceMailNotify
* @param accountId
* @param new VM
* @param old VM
* @param new Urgent VM
*/
void slotVoiceMailNotify(const QString& accountId,
int newCount,
int oldCount,
int urgentCount);
private:
const api::Lrc& parent;
};
......
......@@ -166,6 +166,14 @@ public Q_SLOTS:
* @param callId
*/
void slotConferenceCreated(const std::string& callId);
/**
* Listen from CallbacksHandler when a voice mail notice is incoming
* @param accountId
* @param newCount
* @param oldCount
* @param urgentCount
*/
void slotVoiceMailNotify(const std::string& accountId, int newCount, int oldCount, int urgentCount);
};
NewCallModel::NewCallModel(const account::Info& owner, const CallbacksHandler& callbacksHandler)
......@@ -423,6 +431,7 @@ NewCallModelPimpl::NewCallModelPimpl(const NewCallModel& linked, const Callbacks
connect(&callbacksHandler, &CallbacksHandler::callStateChanged, this, &NewCallModelPimpl::slotCallStateChanged);
connect(&callbacksHandler, &CallbacksHandler::incomingVCardChunk, this, &NewCallModelPimpl::slotincomingVCardChunk);
connect(&callbacksHandler, &CallbacksHandler::conferenceCreated, this , &NewCallModelPimpl::slotConferenceCreated);
connect(&callbacksHandler, &CallbacksHandler::voiceMailNotify, this, &NewCallModelPimpl::slotVoiceMailNotify);
#ifndef ENABLE_LIBWRAP
// Only necessary with dbus since the daemon runs separately
......@@ -630,6 +639,12 @@ NewCallModelPimpl::slotincomingVCardChunk(const std::string& callId,
}
}
void
NewCallModelPimpl::slotVoiceMailNotify(const std::string & accountId, int newCount, int oldCount, int urgentCount)
{
emit linked.voiceMailNotify(accountId, newCount, oldCount, urgentCount);
}
bool
NewCallModel::hasCall(const std::string& callId) const
{
......
......@@ -69,9 +69,9 @@ public:
Q_EMIT recordPlaybackStopped(QString(filepath.c_str()));
}),
exportable_callback<CallSignal::VoiceMailNotify>(
[this] (const std::string &accountID, int count) {
LOG_DRING_SIGNAL2("voiceMailNotify",QString(accountID.c_str()), count);
Q_EMIT voiceMailNotify(QString(accountID.c_str()), count);
[this] (const std::string &accountId, int newCount, int oldCount, int urgentCount) {
LOG_DRING_SIGNAL4("voiceMailNotify",QString(accountId.c_str()), newCount, oldCount, urgentCount);
Q_EMIT voiceMailNotify(QString(accountId.c_str()), newCount, oldCount, urgentCount);
}),
exportable_callback<CallSignal::IncomingMessage>(
[this] (const std::string &callID, const std::string &from, const std::map<std::string,std::string> &message) {
......@@ -373,7 +373,7 @@ Q_SIGNALS: // SIGNALS
void transferFailed();
void transferSucceeded();
void recordPlaybackStopped(const QString &filepath);
void voiceMailNotify(const QString &accountID, int count);
void voiceMailNotify(const QString &accountId, int newCount, int oldCount, int urgentCount);
void incomingMessage(const QString &callID, const QString &from, const MapStringString &message);
void incomingCall(const QString &accountID, const QString &callID, const QString &from);
void recordPlaybackFilepath(const QString &callID, const QString &filepath);
......
......@@ -302,7 +302,7 @@ Q_SIGNALS: // SIGNALS
void transferFailed();
void transferSucceeded();
void recordPlaybackStopped(const QString &filepath);
void voiceMailNotify(const QString &accountID, int count);
void voiceMailNotify(const QString &accountId, int newCount, int oldCount, int urgentCount);
void incomingMessage(const QString &callID, const QString &from, const MapStringString &message);
void incomingCall(const QString &accountID, const QString &callID, const QString &from);
void recordPlaybackFilepath(const QString &callID, const QString &filepath);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment