mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-07-26 06:14:45 +00:00
ring with a loop notification
This commit is contained in:
parent
111223b727
commit
8b8647ab43
5 changed files with 36 additions and 8 deletions
|
|
@ -37,16 +37,16 @@ GridLayout {
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
DialerButton { id: one; text: "1" }
|
DialerButton { id: one; text: "1" }
|
||||||
DialerButton { text: "2" }
|
DialerButton { text: "2"; sub: "ABC" }
|
||||||
DialerButton { text: "3" }
|
DialerButton { text: "3"; sub: "DEF" }
|
||||||
|
|
||||||
DialerButton { text: "4" }
|
DialerButton { text: "4"; sub: "GHI" }
|
||||||
DialerButton { text: "5" }
|
DialerButton { text: "5"; sub: "JKL" }
|
||||||
DialerButton { text: "6" }
|
DialerButton { text: "6"; sub: "MNO" }
|
||||||
|
|
||||||
DialerButton { text: "7" }
|
DialerButton { text: "7"; sub: "PQRS" }
|
||||||
DialerButton { text: "8" }
|
DialerButton { text: "8"; sub: "TUV" }
|
||||||
DialerButton { text: "9" }
|
DialerButton { text: "9"; sub: "WXYZ" }
|
||||||
|
|
||||||
DialerButton { text: "*"; }
|
DialerButton { text: "*"; }
|
||||||
DialerButton { text: "0"; sub: "+"; }
|
DialerButton { text: "0"; sub: "+"; }
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ ApplicationWindow {
|
||||||
} else if (status == 5) {
|
} else if (status == 5) {
|
||||||
wasVisible = root.visible;
|
wasVisible = root.visible;
|
||||||
root.visible = true;
|
root.visible = true;
|
||||||
|
dialerUtils.notifyRinging();
|
||||||
//Was STATUS_INCOMING now is STATUS_DISCONNECTED: Missed call!
|
//Was STATUS_INCOMING now is STATUS_DISCONNECTED: Missed call!
|
||||||
} else if (status == 7 && previousStatus == 5) {
|
} else if (status == 7 && previousStatus == 5) {
|
||||||
var prettyDate = Qt.formatTime(voiceCallmanager.activeVoiceCall.startedAt, Qt.locale().timeFormat(Locale.ShortFormat));
|
var prettyDate = Qt.formatTime(voiceCallmanager.activeVoiceCall.startedAt, Qt.locale().timeFormat(Locale.ShortFormat));
|
||||||
|
|
@ -62,6 +63,8 @@ ApplicationWindow {
|
||||||
insertCallInHistory(voiceCallmanager.activeVoiceCall.lineId, 0, 0);
|
insertCallInHistory(voiceCallmanager.activeVoiceCall.lineId, 0, 0);
|
||||||
} else if (status == 7) {
|
} else if (status == 7) {
|
||||||
insertCallInHistory(voiceCallmanager.activeVoiceCall.lineId, voiceCallmanager.activeVoiceCall.duration, isIncoming ? 1 : 2);
|
insertCallInHistory(voiceCallmanager.activeVoiceCall.lineId, voiceCallmanager.activeVoiceCall.duration, isIncoming ? 1 : 2);
|
||||||
|
} else {
|
||||||
|
dialerUtils.stopRinging();
|
||||||
}
|
}
|
||||||
|
|
||||||
previousStatus = status;
|
previousStatus = status;
|
||||||
|
|
|
||||||
|
|
@ -76,4 +76,20 @@ void DialerUtils::resetMissedCalls()
|
||||||
m_callsNotification.clear();
|
m_callsNotification.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DialerUtils::notifyRinging()
|
||||||
|
{
|
||||||
|
if (!m_ringingNotification) {
|
||||||
|
m_ringingNotification = new KNotification("ringing", KNotification::Persistent|KNotification::LoopSound, 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"
|
||||||
|
|
|
||||||
|
|
@ -33,12 +33,15 @@ 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_SIGNALS:
|
Q_SIGNALS:
|
||||||
void missedCallsActionTriggered();
|
void missedCallsActionTriggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPointer <KNotification> m_callsNotification;
|
QPointer <KNotification> m_callsNotification;
|
||||||
|
QPointer <KNotification> m_ringingNotification;
|
||||||
int m_missedCalls;
|
int m_missedCalls;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,3 +7,9 @@ Name=Missed Call
|
||||||
Comment=A call has been missed
|
Comment=A call has been missed
|
||||||
Action=Popup
|
Action=Popup
|
||||||
|
|
||||||
|
[Event/ringing]
|
||||||
|
Name=Ringing
|
||||||
|
Comment=The phone is ringing
|
||||||
|
Action=Sound
|
||||||
|
Sound=KDE-Sys-Question.ogg
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue