[dialer] Move the ringing notification into CallManager

This commit is contained in:
Martin Klapetek 2015-06-19 17:52:10 +02:00
parent 297c6500bd
commit 862172fccb
3 changed files with 17 additions and 18 deletions

View file

@ -16,6 +16,9 @@
*/
#include "call-manager.h"
#include "dialerutils.h"
#include <KNotification>
#include <KLocalizedString>
// #include "call-window.h"
// #include "approver.h"
// #include "../libktpcall/call-channel-handler.h"
@ -30,6 +33,9 @@ struct CallManager::Private
// QPointer<CallWindow> callWindow;
// QPointer<Approver> approver;
DialerUtils *dialerUtils;
KNotification *ringingNotification;
KNotification *callsNotification;
uint missedCalls;
};
CallManager::CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dialerUtils, QObject *parent)
@ -107,6 +113,11 @@ void CallManager::onCallStateChanged(Tp::CallState state)
//show approver;
(void) d->callChannel->setRinging();
if (!d->ringingNotification) {
d->ringingNotification = new KNotification("ringing", KNotification::Persistent | KNotification::LoopSound, 0);
d->ringingNotification->setComponentName("plasma_dialer");
}
d->ringingNotification->sendEvent();
}
break;
case Tp::CallStateAccepted:
@ -117,6 +128,9 @@ void CallManager::onCallStateChanged(Tp::CallState state)
// d->callWindow.data()->setStatus(CallWindow::StatusRemoteAccepted);
} else {
//hide approver & show call window
if (d->ringingNotification) {
d->ringingNotification->close();
}
// delete d->approver.data();
// ensureCallWindow();
// d->callWindow.data()->setStatus(CallWindow::StatusConnecting);
@ -135,6 +149,9 @@ void CallManager::onCallStateChanged(Tp::CallState state)
break;
case Tp::CallStateEnded:
d->dialerUtils->setCallState("ended");
if (d->ringingNotification) {
d->ringingNotification->close();
}
//if we requested the call, make sure we have a window to show the error (if any)
// if (d->callChannel->isRequested()) {
// ensureCallWindow();

View file

@ -126,20 +126,4 @@ void DialerUtils::resetMissedCalls()
m_callsNotification.clear();
}
void DialerUtils::notifyRinging()
{
if (!m_ringingNotification) {
m_ringingNotification = new KNotification("ringing", KNotification::Persistent, 0);
m_ringingNotification->setComponentName("plasma_dialer");
}
m_ringingNotification->sendEvent();
}
void DialerUtils::stopRinging()
{
if (m_ringingNotification) {
m_ringingNotification->close();
}
}
#include "moc_dialerutils.cpp"

View file

@ -39,8 +39,6 @@ public:
Q_INVOKABLE void notifyMissedCall(const QString &caller, const QString &description);
Q_INVOKABLE void resetMissedCalls();
Q_INVOKABLE void notifyRinging();
Q_INVOKABLE void stopRinging();
Q_INVOKABLE void dial(const QString &number);
Q_SIGNALS: