Commit 3de09416 authored by Ronan Abhamon's avatar Ronan Abhamon

feat(ui/views/App/Calls/CallsWindow): handle correctly close

parent e4076f8e
...@@ -219,6 +219,10 @@ ...@@ -219,6 +219,10 @@
<source>callsTitle</source> <source>callsTitle</source>
<translation>Calls</translation> <translation>Calls</translation>
</message> </message>
<message>
<source>acceptClosingDescription</source>
<translation>Are you sure you want to terminate all calls?</translation>
</message>
</context> </context>
<context> <context>
<name>Chat</name> <name>Chat</name>
......
...@@ -219,6 +219,10 @@ ...@@ -219,6 +219,10 @@
<source>callsTitle</source> <source>callsTitle</source>
<translation>Appels</translation> <translation>Appels</translation>
</message> </message>
<message>
<source>acceptClosingDescription</source>
<translation>Voulez-vous vraiment quitter tous vos appels en cours ?</translation>
</message>
</context> </context>
<context> <context>
<name>Chat</name> <name>Chat</name>
......
...@@ -311,6 +311,7 @@ ...@@ -311,6 +311,7 @@
<file>ui/scripts/Utils/uri-tools.js</file> <file>ui/scripts/Utils/uri-tools.js</file>
<file>ui/scripts/Utils/utils.js</file> <file>ui/scripts/Utils/utils.js</file>
<file>ui/views/App/Calls/AbstractStartingCall.qml</file> <file>ui/views/App/Calls/AbstractStartingCall.qml</file>
<file>ui/views/App/Calls/CallsWindow.js</file>
<file>ui/views/App/Calls/CallsWindow.qml</file> <file>ui/views/App/Calls/CallsWindow.qml</file>
<file>ui/views/App/Calls/IncallFullscreenWindow.qml</file> <file>ui/views/App/Calls/IncallFullscreenWindow.qml</file>
<file>ui/views/App/Calls/Incall.js</file> <file>ui/views/App/Calls/Incall.js</file>
......
...@@ -138,6 +138,16 @@ void CallsListModel::launchVideoCall (const QString &sip_uri) const { ...@@ -138,6 +138,16 @@ void CallsListModel::launchVideoCall (const QString &sip_uri) const {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
int CallsListModel::getRunningCallsNumber () const {
return CoreManager::getInstance()->getCore()->getCallsNb();
}
void CallsListModel::terminateAllCalls () const {
CoreManager::getInstance()->getCore()->terminateAllCalls();
}
// -----------------------------------------------------------------------------
bool CallsListModel::removeRow (int row, const QModelIndex &parent) { bool CallsListModel::removeRow (int row, const QModelIndex &parent) {
return removeRows(row, 1, parent); return removeRows(row, 1, parent);
} }
......
...@@ -48,6 +48,10 @@ public: ...@@ -48,6 +48,10 @@ public:
Q_INVOKABLE void launchAudioCall (const QString &sip_uri) const; Q_INVOKABLE void launchAudioCall (const QString &sip_uri) const;
Q_INVOKABLE void launchVideoCall (const QString &sip_uri) const; Q_INVOKABLE void launchVideoCall (const QString &sip_uri) const;
Q_INVOKABLE int getRunningCallsNumber () const;
Q_INVOKABLE void terminateAllCalls () const;
signals: signals:
void callRunning (int index, CallModel *call); void callRunning (int index, CallModel *call);
......
// =============================================================================
// `CallsWindow.qml` Logic.
// =============================================================================
.import Linphone 1.0 as Linphone
.import 'qrc:/ui/scripts/Utils/utils.js' as Utils
// =============================================================================
var forceClose = false
function handleClosing (close) {
var callsList = Linphone.CallsListModel
if (forceClose || callsList.getRunningCallsNumber() === 0) {
callsList.terminateAllCalls()
return
}
window.attachVirtualWindow(Utils.buildDialogUri('ConfirmDialog'), {
descriptionText: qsTr('acceptClosingDescription'),
}, function (status) {
if (status) {
forceClose = true
window.close()
}
})
close.accepted = false
}
...@@ -8,6 +8,8 @@ import Linphone 1.0 ...@@ -8,6 +8,8 @@ import Linphone 1.0
import App.Styles 1.0 import App.Styles 1.0
import 'CallsWindow.js' as Logic
// ============================================================================= // =============================================================================
Window { Window {
...@@ -36,6 +38,12 @@ Window { ...@@ -36,6 +38,12 @@ Window {
minimumWidth: CallsWindowStyle.minimumWidth minimumWidth: CallsWindowStyle.minimumWidth
title: qsTr('callsTitle') title: qsTr('callsTitle')
// ---------------------------------------------------------------------------
onClosing: Logic.handleClosing(close)
// ---------------------------------------------------------------------------
Paned { Paned {
anchors.fill: parent anchors.fill: parent
defaultChildAWidth: CallsWindowStyle.callsList.defaultWidth defaultChildAWidth: CallsWindowStyle.callsList.defaultWidth
......
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