mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
[dialer] Also move the MissedCall notification into CallManager
This commit is contained in:
parent
862172fccb
commit
75124ecc74
3 changed files with 23 additions and 36 deletions
|
|
@ -152,6 +152,29 @@ void CallManager::onCallStateChanged(Tp::CallState state)
|
|||
if (d->ringingNotification) {
|
||||
d->ringingNotification->close();
|
||||
}
|
||||
//FIXME this is defined in the spec, but try to find a proper enum value for it
|
||||
if (d->callChannel->callStateReason().reason == 5) {
|
||||
qDebug() << "Adding notification";
|
||||
d->missedCalls++;
|
||||
if (!d->callsNotification) {
|
||||
d->callsNotification = new KNotification("callMissed", KNotification::Persistent, 0);
|
||||
}
|
||||
d->callsNotification->setComponentName("plasma_dialer");
|
||||
d->callsNotification->setIconName("call-start");
|
||||
if (d->missedCalls == 1) {
|
||||
d->callsNotification->setTitle(i18n("Missed call from %1", d->callChannel->targetContact()->alias()));
|
||||
d->callsNotification->setText(QTime::currentTime().toString("HH:mm"));
|
||||
} else {
|
||||
d->callsNotification->setTitle(i18n("%1 calls missed", d->missedCalls));
|
||||
d->callsNotification->setText(i18n("Last call: %1", QTime::currentTime().toString("HH:mm")));
|
||||
}
|
||||
|
||||
if (d->missedCalls == 1) {
|
||||
d->callsNotification->sendEvent();
|
||||
} else {
|
||||
d->callsNotification->update();
|
||||
}
|
||||
}
|
||||
//if we requested the call, make sure we have a window to show the error (if any)
|
||||
// if (d->callChannel->isRequested()) {
|
||||
// ensureCallWindow();
|
||||
|
|
|
|||
|
|
@ -82,41 +82,6 @@ void DialerUtils::setCallState(const QString &state)
|
|||
}
|
||||
}
|
||||
|
||||
void DialerUtils::notifyMissedCall(const QString &caller, const QString &description)
|
||||
{
|
||||
qWarning() << "Missed Call.";
|
||||
|
||||
++m_missedCalls;
|
||||
if (!m_callsNotification) {
|
||||
m_callsNotification = new KNotification("callMissed", KNotification::Persistent, 0);
|
||||
}
|
||||
m_callsNotification->setComponentName("plasma_dialer");
|
||||
m_callsNotification->setIconName("call-start");
|
||||
if (m_missedCalls == 1) {
|
||||
m_callsNotification->setTitle(i18n("Missed call from %1", caller));
|
||||
m_callsNotification->setText(description);
|
||||
} else {
|
||||
m_callsNotification->setTitle(i18n("%1 calls missed", m_missedCalls));
|
||||
m_callsNotification->setText(i18n("Last call: %1", description));
|
||||
}
|
||||
|
||||
QStringList actions;
|
||||
actions.append(i18n("View"));
|
||||
m_callsNotification->setActions(actions);
|
||||
QObject::connect(m_callsNotification.data(), &KNotification::action1Activated,
|
||||
[=]() {
|
||||
qWarning()<<"View action activated";
|
||||
emit missedCallsActionTriggered();
|
||||
resetMissedCalls();
|
||||
});
|
||||
|
||||
if (m_missedCalls == 1) {
|
||||
m_callsNotification->sendEvent();
|
||||
} else {
|
||||
m_callsNotification->update();
|
||||
}
|
||||
}
|
||||
|
||||
void DialerUtils::resetMissedCalls()
|
||||
{
|
||||
m_missedCalls = 0;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ public:
|
|||
QString callState() const;
|
||||
void setCallState(const QString &state);
|
||||
|
||||
Q_INVOKABLE void notifyMissedCall(const QString &caller, const QString &description);
|
||||
Q_INVOKABLE void resetMissedCalls();
|
||||
Q_INVOKABLE void dial(const QString &number);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue