mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-28 23:34:46 +00:00
[dialer] Move the ringing notification into CallManager
This commit is contained in:
parent
297c6500bd
commit
862172fccb
3 changed files with 17 additions and 18 deletions
|
|
@ -16,6 +16,9 @@
|
||||||
*/
|
*/
|
||||||
#include "call-manager.h"
|
#include "call-manager.h"
|
||||||
#include "dialerutils.h"
|
#include "dialerutils.h"
|
||||||
|
|
||||||
|
#include <KNotification>
|
||||||
|
#include <KLocalizedString>
|
||||||
// #include "call-window.h"
|
// #include "call-window.h"
|
||||||
// #include "approver.h"
|
// #include "approver.h"
|
||||||
// #include "../libktpcall/call-channel-handler.h"
|
// #include "../libktpcall/call-channel-handler.h"
|
||||||
|
|
@ -30,6 +33,9 @@ struct CallManager::Private
|
||||||
// QPointer<CallWindow> callWindow;
|
// QPointer<CallWindow> callWindow;
|
||||||
// QPointer<Approver> approver;
|
// QPointer<Approver> approver;
|
||||||
DialerUtils *dialerUtils;
|
DialerUtils *dialerUtils;
|
||||||
|
KNotification *ringingNotification;
|
||||||
|
KNotification *callsNotification;
|
||||||
|
uint missedCalls;
|
||||||
};
|
};
|
||||||
|
|
||||||
CallManager::CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dialerUtils, QObject *parent)
|
CallManager::CallManager(const Tp::CallChannelPtr &callChannel, DialerUtils *dialerUtils, QObject *parent)
|
||||||
|
|
@ -107,6 +113,11 @@ void CallManager::onCallStateChanged(Tp::CallState state)
|
||||||
|
|
||||||
//show approver;
|
//show approver;
|
||||||
(void) d->callChannel->setRinging();
|
(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;
|
break;
|
||||||
case Tp::CallStateAccepted:
|
case Tp::CallStateAccepted:
|
||||||
|
|
@ -117,6 +128,9 @@ void CallManager::onCallStateChanged(Tp::CallState state)
|
||||||
// d->callWindow.data()->setStatus(CallWindow::StatusRemoteAccepted);
|
// d->callWindow.data()->setStatus(CallWindow::StatusRemoteAccepted);
|
||||||
} else {
|
} else {
|
||||||
//hide approver & show call window
|
//hide approver & show call window
|
||||||
|
if (d->ringingNotification) {
|
||||||
|
d->ringingNotification->close();
|
||||||
|
}
|
||||||
// delete d->approver.data();
|
// delete d->approver.data();
|
||||||
// ensureCallWindow();
|
// ensureCallWindow();
|
||||||
// d->callWindow.data()->setStatus(CallWindow::StatusConnecting);
|
// d->callWindow.data()->setStatus(CallWindow::StatusConnecting);
|
||||||
|
|
@ -135,6 +149,9 @@ void CallManager::onCallStateChanged(Tp::CallState state)
|
||||||
break;
|
break;
|
||||||
case Tp::CallStateEnded:
|
case Tp::CallStateEnded:
|
||||||
d->dialerUtils->setCallState("ended");
|
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 we requested the call, make sure we have a window to show the error (if any)
|
||||||
// if (d->callChannel->isRequested()) {
|
// if (d->callChannel->isRequested()) {
|
||||||
// ensureCallWindow();
|
// ensureCallWindow();
|
||||||
|
|
|
||||||
|
|
@ -126,20 +126,4 @@ void DialerUtils::resetMissedCalls()
|
||||||
m_callsNotification.clear();
|
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"
|
#include "moc_dialerutils.cpp"
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void notifyMissedCall(const QString &caller, const QString &description);
|
Q_INVOKABLE void notifyMissedCall(const QString &caller, const QString &description);
|
||||||
Q_INVOKABLE void resetMissedCalls();
|
Q_INVOKABLE void resetMissedCalls();
|
||||||
Q_INVOKABLE void notifyRinging();
|
|
||||||
Q_INVOKABLE void stopRinging();
|
|
||||||
Q_INVOKABLE void dial(const QString &number);
|
Q_INVOKABLE void dial(const QString &number);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue