From c20a54df48ba0973be4188014d4e4a0232f5bef2 Mon Sep 17 00:00:00 2001 From: gaelle Date: Wed, 5 Mar 2025 07:49:09 +0100 Subject: [PATCH] fix request error ui get account devices --- Linphone/core/account/AccountDeviceList.cpp | 11 +++++++---- Linphone/core/account/AccountDeviceList.hpp | 1 + Linphone/core/account/AccountDeviceProxy.cpp | 1 + Linphone/core/account/AccountDeviceProxy.hpp | 1 + .../Layout/Settings/AccountSettingsGeneralLayout.qml | 4 ++++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Linphone/core/account/AccountDeviceList.cpp b/Linphone/core/account/AccountDeviceList.cpp index ad42c20a7..2d35a8ec0 100644 --- a/Linphone/core/account/AccountDeviceList.cpp +++ b/Linphone/core/account/AccountDeviceList.cpp @@ -150,10 +150,13 @@ void AccountDeviceList::setSelf(QSharedPointer me) { &AccountManagerServicesModel::requestError, [this](const std::shared_ptr &request, int statusCode, const std::string &errorMessage, - const std::shared_ptr ¶meterErrors) { - lDebug() << "REQUEST ERROR" << errorMessage; - if (request->getType() == linphone::AccountManagerServicesRequest::Type::GetDevicesList) { - } + const std::shared_ptr ¶meterErrors) { + lDebug() << "REQUEST ERROR" << errorMessage << "/" << int(request->getType()); + QString message = QString::fromStdString(errorMessage); + if (request->getType() == linphone::AccountManagerServicesRequest::Type::GetDevicesList) { + message = tr("Erreur lors de la récupération des appareils"); + } + emit requestError(message); }); mAccountManagerServicesModelConnection->makeConnectToModel( &AccountManagerServicesModel::devicesListFetched, diff --git a/Linphone/core/account/AccountDeviceList.hpp b/Linphone/core/account/AccountDeviceList.hpp index 246d2debf..1f5fdf450 100644 --- a/Linphone/core/account/AccountDeviceList.hpp +++ b/Linphone/core/account/AccountDeviceList.hpp @@ -56,6 +56,7 @@ public: signals: void componentReady(); void devicesSet(); + void requestError(QString errorMessage = QString()); private: QSharedPointer mAccountCore; diff --git a/Linphone/core/account/AccountDeviceProxy.cpp b/Linphone/core/account/AccountDeviceProxy.cpp index 276ccaa8c..fa5715fbc 100644 --- a/Linphone/core/account/AccountDeviceProxy.cpp +++ b/Linphone/core/account/AccountDeviceProxy.cpp @@ -36,6 +36,7 @@ AccountDeviceProxy::AccountDeviceProxy(QObject *parent) : LimitProxy(parent) { auto model = getListModel(); if (model) { connect(model, &AccountDeviceList::devicesSet, this, &AccountDeviceProxy::devicesSet); + connect(model, &AccountDeviceList::requestError, this, &AccountDeviceProxy::requestError); } }); setSourceModels(new SortFilterList(mAccountDeviceList.get(), Qt::DescendingOrder)); diff --git a/Linphone/core/account/AccountDeviceProxy.hpp b/Linphone/core/account/AccountDeviceProxy.hpp index 87c81c01d..8afce5ddf 100644 --- a/Linphone/core/account/AccountDeviceProxy.hpp +++ b/Linphone/core/account/AccountDeviceProxy.hpp @@ -49,6 +49,7 @@ signals: void lUpdate(); void accountChanged(); void devicesSet(); + void requestError(QString message = QString()); private: QString mSearchText; diff --git a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml index 54a34215a..617fbd626 100644 --- a/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml +++ b/Linphone/view/Page/Layout/Settings/AccountSettingsGeneralLayout.qml @@ -245,6 +245,10 @@ AbstractSettingsLayout { id: accountDeviceProxy account: model onDevicesSet: devices.loading = false; + onRequestError: (errorMessage) => { + devices.loading = false; + mainWindow.showInformationPopup(qsTr("Erreur"), errorMessage, false) + } } Control.Control { Layout.fillWidth: true