mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-24 15:18:07 +00:00
feat(ui/views/App/Calls/CallsWindow): handle correctly close
This commit is contained in:
parent
e4076f8eb8
commit
3de094165f
7 changed files with 61 additions and 0 deletions
|
|
@ -219,6 +219,10 @@
|
|||
<source>callsTitle</source>
|
||||
<translation>Calls</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>acceptClosingDescription</source>
|
||||
<translation>Are you sure you want to terminate all calls?</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Chat</name>
|
||||
|
|
|
|||
|
|
@ -219,6 +219,10 @@
|
|||
<source>callsTitle</source>
|
||||
<translation>Appels</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>acceptClosingDescription</source>
|
||||
<translation>Voulez-vous vraiment quitter tous vos appels en cours ?</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>Chat</name>
|
||||
|
|
|
|||
|
|
@ -311,6 +311,7 @@
|
|||
<file>ui/scripts/Utils/uri-tools.js</file>
|
||||
<file>ui/scripts/Utils/utils.js</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/IncallFullscreenWindow.qml</file>
|
||||
<file>ui/views/App/Calls/Incall.js</file>
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
return removeRows(row, 1, parent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ public:
|
|||
Q_INVOKABLE void launchAudioCall (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:
|
||||
void callRunning (int index, CallModel *call);
|
||||
|
||||
|
|
|
|||
30
linphone-desktop/ui/views/App/Calls/CallsWindow.js
Normal file
30
linphone-desktop/ui/views/App/Calls/CallsWindow.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// =============================================================================
|
||||
// `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
|
|||
|
||||
import App.Styles 1.0
|
||||
|
||||
import 'CallsWindow.js' as Logic
|
||||
|
||||
// =============================================================================
|
||||
|
||||
Window {
|
||||
|
|
@ -36,6 +38,12 @@ Window {
|
|||
minimumWidth: CallsWindowStyle.minimumWidth
|
||||
title: qsTr('callsTitle')
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
onClosing: Logic.handleClosing(close)
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Paned {
|
||||
anchors.fill: parent
|
||||
defaultChildAWidth: CallsWindowStyle.callsList.defaultWidth
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue