diff --git a/src/app/constant/JamiStrings.qml b/src/app/constant/JamiStrings.qml index 6a469b55..aafdd91e 100644 --- a/src/app/constant/JamiStrings.qml +++ b/src/app/constant/JamiStrings.qml @@ -305,6 +305,8 @@ Item { property string showPlugins: qsTr("Show available plugins") property string addToConversations: qsTr("Add to conversations") property string backendError: qsTr("This is the error from the backend: %0") + property string disabledAccount: qsTr("The account is disabled") + property string noNetworkConnectivity: qsTr("No network connectivity") // Chatview footer property string jumpToLatest: qsTr("Jump to latest") diff --git a/src/app/mainview/components/ChatView.qml b/src/app/mainview/components/ChatView.qml index d8d946fe..d6b694d9 100644 --- a/src/app/mainview/components/ChatView.qml +++ b/src/app/mainview/components/ChatView.qml @@ -136,6 +136,25 @@ Rectangle { } } + Connections { + target: CurrentConversation + enabled: LRCInstance.debugMode() + + function onErrorsChanged() { + if (CurrentConversation.errors.length > 0) { + errorRect.errorLabel.text = CurrentConversation.errors[0] + errorRect.backendErrorToolTip.text = JamiStrings.backendError.arg(CurrentConversation.backendErrors[0]) + } + errorRect.visible = CurrentConversation.errors.length > 0 + } + } + + GenericErrorsRow { + id: genericError + Layout.fillWidth: true + Layout.preferredHeight: JamiTheme.chatViewHeaderPreferredHeight + } + ConversationErrorsRow { id: errorRect Layout.fillWidth: true diff --git a/src/app/mainview/components/GenericErrorsRow.qml b/src/app/mainview/components/GenericErrorsRow.qml new file mode 100644 index 00000000..b6b043f0 --- /dev/null +++ b/src/app/mainview/components/GenericErrorsRow.qml @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2022 Savoir-faire Linux Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import Qt5Compat.GraphicalEffects + +import net.jami.Models 1.1 +import net.jami.Adapters 1.1 +import net.jami.Constants 1.1 + +import "../../commoncomponents" + +Rectangle { + id: root + + opacity: visible + + property alias text: errorLabel.text + + color: JamiTheme.filterBadgeColor + visible: CurrentAccount.status === Account.Status.UNREGISTERED + + RowLayout { + anchors.fill: parent + anchors.margins: JamiTheme.preferredMarginSize + + Text { + id: errorLabel + Layout.alignment: Qt.AlignVCenter + text: CurrentAccount.enabled? JamiStrings.noNetworkConnectivity : JamiStrings.disabledAccount + color: JamiTheme.filterBadgeTextColor + font.pixelSize: JamiTheme.headerFontSize + elide: Text.ElideRight + } + } + + Behavior on opacity { + NumberAnimation { + from: 0 + duration: JamiTheme.shortFadeDuration + } + } +} \ No newline at end of file diff --git a/src/libclient/callmodel.cpp b/src/libclient/callmodel.cpp index 354d6723..64e4471b 100644 --- a/src/libclient/callmodel.cpp +++ b/src/libclient/callmodel.cpp @@ -1649,7 +1649,7 @@ CallModelPimpl::slotConferenceCreated(const QString& accountId, const QString& c void CallModelPimpl::slotConferenceChanged(const QString& accountId, const QString& confId, - const QString& state) + const QString&) { if (accountId != linked.owner.id) return;