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
This commit is contained in:
Julien Wadel 2020-07-02 10:49:13 +02:00
parent 2a0e480fc5
commit 028ddba8b2
5 changed files with 87 additions and 76 deletions

View file

@ -83,17 +83,12 @@ void CoreHandlers::notifyCoreStarted () {
void CoreHandlers::onAuthenticationRequested (
const shared_ptr<linphone::Core> & core,
const shared_ptr<linphone::AuthInfo> &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);
}
}

View file

@ -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::ProxyConfig> &,
linphone::RegistrationState
const shared_ptr<linphone::ProxyConfig> & proxy,
linphone::RegistrationState core
) {
Q_UNUSED(proxy)
Q_UNUSED(core)
emit accountSettingsUpdated();
}

View file

@ -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)
}
}
}
}
}

View file

@ -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();
}

View file

@ -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)
})
}