From 028ddba8b2685f464c93821dadb9c77a8ab80e64 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 2 Jul 2020 10:49:13 +0200 Subject: [PATCH] Bugfix : show all popup in a StackView + crash on authentification - Show all Linphone popup - Add a way to merge popup that have almost the same data - Remove test on authentification requested --- .../src/components/core/CoreHandlers.cpp | 13 +- .../settings/AccountSettingsModel.cpp | 8 +- .../modules/Common/Window/VirtualWindow.qml | 127 ++++++++++-------- .../ui/modules/Common/Window/Window.js | 12 +- linphone-app/ui/views/App/Main/MainWindow.js | 3 +- 5 files changed, 87 insertions(+), 76 deletions(-) diff --git a/linphone-app/src/components/core/CoreHandlers.cpp b/linphone-app/src/components/core/CoreHandlers.cpp index 34fc475a9..309fa074e 100644 --- a/linphone-app/src/components/core/CoreHandlers.cpp +++ b/linphone-app/src/components/core/CoreHandlers.cpp @@ -83,17 +83,12 @@ void CoreHandlers::notifyCoreStarted () { void CoreHandlers::onAuthenticationRequested ( const shared_ptr & core, const shared_ptr &authInfo, - linphone::AuthMethod + linphone::AuthMethod method ) { + Q_UNUSED(core) + Q_UNUSED(method) if( authInfo ) { - auto configList = core->getProxyConfigList(); - auto config = configList.begin() ; - std::string username = authInfo->getUsername(); - std::string domain = authInfo->getDomain(); - while(config != configList.end() && ((*config)->getContact()->getUsername() != username || (*config)->getContact()->getDomain() != domain)) - ++config; - if( config != configList.end() ) - emit authenticationRequested(authInfo);// Send authentification request only if a proxy still exists + emit authenticationRequested(authInfo); } } diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index ecfc14128..c807ab87a 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -290,7 +290,7 @@ bool AccountSettingsModel::addOrUpdateProxyConfig ( turnUser, Utils::appStringToCoreString(data["turnPassword"].toString()), "", - "", + stunServer, "" )); if( newPublishPresence) @@ -427,8 +427,10 @@ QVariantList AccountSettingsModel::getAccounts () const { // ----------------------------------------------------------------------------- void AccountSettingsModel::handleRegistrationStateChanged ( - const shared_ptr &, - linphone::RegistrationState + const shared_ptr & proxy, + linphone::RegistrationState core ) { + Q_UNUSED(proxy) + Q_UNUSED(core) emit accountSettingsUpdated(); } diff --git a/linphone-app/ui/modules/Common/Window/VirtualWindow.qml b/linphone-app/ui/modules/Common/Window/VirtualWindow.qml index 3952383ad..feb031029 100644 --- a/linphone-app/ui/modules/Common/Window/VirtualWindow.qml +++ b/linphone-app/ui/modules/Common/Window/VirtualWindow.qml @@ -1,67 +1,86 @@ import QtQuick 2.7 +import QtQuick.Controls 2.5 import Common.Styles 1.0 import 'Window.js' as Logic // ============================================================================= - -Loader { - id:mainLoader - active:false - property var sourceUrl - property var sourceProperties - property var exitStatusHandler - property bool setData : false // USe this flag to update source data +StackView{ + id:stackView anchors.fill: parent - - function setContent (url, properties, exitStatusHandler) { - mainLoader.sourceUrl=url; - mainLoader.sourceProperties=properties; - mainLoader.exitStatusHandler=exitStatusHandler; - setData=true; - active=true; - } - - function unsetContent () { - active=false - setData=false; - } - - // --------------------------------------------------------------------------- - sourceComponent:Component{ - id:mainComponent - - Item{ - id:rootContent - property alias contentLoader:content.contentLoader - anchors.fill: parent - MouseArea { - anchors.fill: parent - hoverEnabled: true - onWheel: wheel.accepted = true + property var active : !stackView.empty + visible:!stackView.empty + + function setContent(url, properties, exitStatusHandler){ + var isEmpty = stackView.empty; + if(properties && properties.virtualWindowHash){ + var haveItem = stackView.find(function(item, index) { + return item.sourceProperties && item.sourceProperties.virtualWindowHash && item.sourceProperties.virtualWindowHash == properties.virtualWindowHash; + }); + if( haveItem == null ){//Push new + push(page, {"sourceUrl":url, "sourceProperties":properties, "exitStatusHandler":exitStatusHandler, "setData":true, "active":true}); + }else{//Update fields + haveItem.sourceProperties = properties; + haveItem.exitStatusHandler = exitStatusHandler; } + }else{ + push(page, {"sourceUrl":url, "sourceProperties":properties, "exitStatusHandler":exitStatusHandler, "setData":true, "active":true}); + } + return isEmpty; + } + function unsetContent () { + if(stackView.depth == 1) + clear(); + else + pop(); + return stackView.empty; + } + Component{ + id:page + Loader { + id:mainLoader + active:false + property var sourceUrl + property var sourceProperties + property var exitStatusHandler + property bool setData : false // USe this flag to update source data - Rectangle { - id: content - property alias contentLoader:contentLoader + // --------------------------------------------------------------------------- + sourceComponent:Component{ + id:mainComponent - anchors.fill: parent - color: WindowStyle.transientWindow.color - Loader{ - id:contentLoader - anchors.centerIn: parent - property var setSourceData : setData - onSetSourceDataChanged: if( setData) {// SetData is true : assign source with properties using QML functions - if(sourceProperties) - setSource(sourceUrl, sourceProperties); - else - setSource(sourceUrl); - }else{source=undefined}// SetData is false : clean memory - active:mainLoader.active - onLoaded:{// When loaded, attache handlers to content - item.exitStatus.connect(Logic.detachVirtualWindow) - if (exitStatusHandler) { - item.exitStatus.connect(exitStatusHandler) + Item{ + id:rootContent + property alias contentLoader:content.contentLoader + anchors.fill: parent + MouseArea { + anchors.fill: parent + hoverEnabled: true + onWheel: wheel.accepted = true + } + Rectangle { + id: content + property alias contentLoader:contentLoader + + anchors.fill: parent + color: WindowStyle.transientWindow.color + Loader{ + id:contentLoader + anchors.centerIn: parent + property var setSourceData : setData + onSetSourceDataChanged: if( setData) {// SetData is true : assign source with properties using QML functions + if(sourceProperties) + setSource(sourceUrl, sourceProperties); + else + setSource(sourceUrl); + }else{source=undefined}// SetData is false : clean memory + active:mainLoader.active + onLoaded:{// When loaded, attach handlers to content + item.exitStatus.connect(Logic.detachVirtualWindow) + if (exitStatusHandler) { + item.exitStatus.connect(exitStatusHandler) + } + } } } } diff --git a/linphone-app/ui/modules/Common/Window/Window.js b/linphone-app/ui/modules/Common/Window/Window.js index c59ab4d04..e2ded1b35 100644 --- a/linphone-app/ui/modules/Common/Window/Window.js +++ b/linphone-app/ui/modules/Common/Window/Window.js @@ -31,16 +31,10 @@ // // The exit status handler is optional. function attachVirtualWindow (component, properties, exitStatusHandler) { - if (virtualWindow.active){//already loaded - return - } - virtualWindow.setContent(component, properties, exitStatusHandler) - window.attachedVirtualWindow() + virtualWindow.setContent(component, properties, exitStatusHandler); } function detachVirtualWindow () { - if( virtualWindow.active){ - virtualWindow.unsetContent() - window.detachedVirtualWindow() - } + if( virtualWindow.active) + virtualWindow.unsetContent(); } diff --git a/linphone-app/ui/views/App/Main/MainWindow.js b/linphone-app/ui/views/App/Main/MainWindow.js index 4761633e2..ec9ee9f7b 100644 --- a/linphone-app/ui/views/App/Main/MainWindow.js +++ b/linphone-app/ui/views/App/Main/MainWindow.js @@ -133,6 +133,7 @@ function handleAuthenticationRequested (authInfo, realm, sipAddress, userId) { authInfo: authInfo, realm: realm, sipAddress: sipAddress, - userId: userId + userId: userId, + virtualWindowHash:Qt.md5('Dialogs/AuthenticationRequest.qml'+realm+sipAddress+userId) }) }