do not display non secured message in chatroom if server does not allow encrypted chats

This commit is contained in:
Gaelle Braud 2026-02-05 16:24:05 +01:00
parent de7b3e1f56
commit e053fcf63e
5 changed files with 29 additions and 14 deletions

View file

@ -711,6 +711,8 @@ void App::initCore() {
mAccountList->setInitialized(false);
mAccountList->lUpdate(true);
}
connect(mAccountList.get(), &AccountList::defaultAccountChanged, this,
&App::currentAccountChanged);
// Update global unread Notifications when an account updates his unread Notifications
connect(mAccountList.get(), &AccountList::unreadNotificationsChanged, this, [this]() {
lDebug() << "unreadNotificationsChanged of AccountList";
@ -1724,6 +1726,10 @@ void App::setCurrentChat(ChatGui *chat) {
}
}
AccountGui *App::getCurrentAccount() const {
return mAccountList ? mAccountList->getDefaultAccount() : nullptr;
}
float App::getScreenRatio() const {
return mScreenRatio;
}

View file

@ -47,6 +47,7 @@ class App : public SingleApplication, public AbstractObject {
Q_OBJECT
Q_PROPERTY(bool coreStarted READ getCoreStarted WRITE setCoreStarted NOTIFY coreStartedChanged)
Q_PROPERTY(AccountList *accounts READ getAccounts NOTIFY accountsChanged)
Q_PROPERTY(AccountGui *currentAccount READ getCurrentAccount NOTIFY currentAccountChanged)
Q_PROPERTY(CallList *calls READ getCalls NOTIFY callsChanged)
Q_PROPERTY(ChatList *chats READ getChats NOTIFY chatsChanged)
Q_PROPERTY(QString shortApplicationVersion READ getShortApplicationVersion CONSTANT)
@ -175,6 +176,10 @@ public:
QSharedPointer<ChatList> getChatList() const;
ChatList *getChats() const;
void setChatList(QSharedPointer<ChatList> data);
ChatGui *getCurrentChat() const;
void setCurrentChat(ChatGui *chat);
AccountGui *getCurrentAccount() const;
QSharedPointer<CallList> getCallList() const;
void setCallList(QSharedPointer<CallList> data);
@ -192,8 +197,6 @@ public:
QString getQtVersion() const;
Q_INVOKABLE void checkForUpdate(bool requestedByUser = false);
ChatGui *getCurrentChat() const;
void setCurrentChat(ChatGui *chat);
float getScreenRatio() const;
Q_INVOKABLE void setScreenRatio(float ratio);
@ -227,6 +230,7 @@ signals:
void localeChanged();
void lForceOidcTimeout();
void remainingTimeBeforeOidcTimeoutChanged();
void currentAccountChanged();
// void executeCommand(QString command);
private:

View file

@ -297,7 +297,7 @@ ListView {
imageSource: AppIcons.clockCountDown
}
EffectImage {
visible: modelData != undefined && modelData?.core.isBasic
visible: modelData != undefined && !modelData.core.isEncrypted && AppCpp.currentAccount && AppCpp.currentAccount.core.limeServerUrl !== "" && AppCpp.currentAccount.core.conferenceFactoryAddress !== ""
Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0
Layout.preferredHeight: Utils.getSizeWithScreenRatio(14)
colorizationColor: DefaultStyle.warning_700

View file

@ -18,6 +18,7 @@ ListView {
property real busyIndicatorSize: Utils.getSizeWithScreenRatio(60)
property bool loading: false
property bool isEncrypted: chat && chat.core.isEncrypted
property bool showEncryptedInfo: AppCpp.currentAccount !== null && AppCpp.currentAccount.core.limeServerUrl !== "" && AppCpp.currentAccount.core.conferenceFactoryAddress !== ""
highlightFollowsCurrentItem: true
verticalLayoutDirection: ListView.BottomToTop
@ -134,6 +135,7 @@ ListView {
anchors.horizontalCenter: parent.horizontalCenter
Control.Control {
id: headerMessage
visible: mainItem.showEncryptedInfo
property int topMargin: Utils.getSizeWithScreenRatio(mainItem.contentHeight > mainItem.height ? 30 : 50)
property int bottomMargin: Utils.getSizeWithScreenRatio(30)
anchors.topMargin: topMargin

View file

@ -22,6 +22,8 @@ FocusScope {
property alias callHeaderContent: splitPanel.header.contentItem
property bool replyingToMessage: false
property string lastChar
property AccountGui currentAccount: AppCpp.currentAccount
property bool showEncryptedInfo: currentAccount && currentAccount.core.limeServerUrl !== "" && currentAccount.core.conferenceFactoryAddress !== ""
enum PanelType { MessageReactions, SharedFiles, Medias, ImdnStatus, ForwardToList, ManageParticipants, EphemeralSettings, None}
signal oneOneCall(bool video)
@ -127,7 +129,7 @@ FocusScope {
}
}
RowLayout {
visible: mainItem.chat != undefined && mainItem.chat.core.isBasic
visible: mainItem.showEncryptedInfo && mainItem.chat != undefined && !mainItem.chat.core.isEncrypted
spacing: Utils.getSizeWithScreenRatio(8)
EffectImage {
Layout.preferredWidth: visible ? Utils.getSizeWithScreenRatio(14) : 0
@ -135,17 +137,18 @@ FocusScope {
colorizationColor: DefaultStyle.warning_700
imageSource: AppIcons.lockSimpleOpen
}
Text {
// hiding text if in call cause te view
// has smaller width
visible: !mainItem.call
Layout.fillWidth: true
color: DefaultStyle.warning_700
//: This conversation is not encrypted !
text: qsTr("unencrypted_conversation_warning")
font: Typography.p2
}
// Text {
// // hiding text if in call cause te view
// // has smaller width
// visible: !mainItem.call
// Layout.fillWidth: true
// color: DefaultStyle.warning_700
// //: This conversation is not encrypted !
// text: qsTr("unencrypted_conversation_warning")
// font: Typography.p2
// }
}
EffectImage {
visible: mainItem.chat?.core.muted || false
Layout.preferredWidth: Utils.getSizeWithScreenRatio(20)