1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-23 00:45:29 +02:00
jami-client-qt/src/app/mainview/ConversationView.qml
Andreas Traczyk 762cbbff38 mainview: prevent details panel from opening maximized
also-misc: Removes SplitPanel state-saving

Gitlab: #1370
Change-Id: I71f5c209922ad69fb701e935a03078fb8e5ad2de
2023-11-27 14:19:00 -05:00

126 lines
3.8 KiB
QML

/*
* Copyright (C) 2023 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 <https://www.gnu.org/licenses/>.
*/
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"
import "components"
ListSelectionView {
id: viewNode
objectName: "ConversationView"
managed: false
splitViewStateKey: "Main"
hasValidSelection: CurrentConversation.id !== ''
visible: false
onPresented: visible = true
Connections {
target: CurrentConversation
function onReloadInteractions() {
UtilsAdapter.clearInteractionsCache(CurrentAccount.id, CurrentConversation.id);
MessagesAdapter.loadMoreMessages();
}
}
onDismissed: {
callStackView.needToCloseInCallConversationAndPotentialWindow();
LRCInstance.deselectConversation();
}
property string currentAccountId: CurrentAccount.id
onCurrentAccountIdChanged: dismiss()
onVisibleChanged: {
if (visible)
return;
UtilsAdapter.clearInteractionsCache(CurrentAccount.id, CurrentConversation.id);
}
color: JamiTheme.transparentColor
leftPaneItem: viewCoordinator.getView("SidePanel")
rightPaneItem: StackLayout {
currentIndex: !CurrentConversation.hasCall ? 0 : 1
onCurrentIndexChanged: chatView.parent = currentIndex === 1 ? callStackView.chatViewContainer : chatViewContainer
anchors.fill: parent
Item {
id: chatViewContainer
Layout.fillWidth: true
Layout.fillHeight: true
ChatView {
id: chatView
anchors.fill: parent
inCallView: parent == callStackView.chatViewContainer
readonly property string currentConvId: CurrentConversation.id
onCurrentConvIdChanged: {
if (!CurrentConversation.hasCall) {
Qt.callLater(focusChatView);
} else {
dismiss();
callStackView.contentView.forceActiveFocus();
}
}
onDismiss: {
if (!inCallView) {
viewNode.dismiss();
} else {
callStackView.chatViewContainer.visible = false;
callStackView.contentView.forceActiveFocus();
}
}
// Handle visibility change for the in-call chat only.
onVisibleChanged: {
if (inCallView) {
if (visible) {
focusChatView();
} else {
callStackView.contentView.forceActiveFocus();
}
}
}
}
}
CallStackView {
id: callStackView
Layout.fillWidth: true
Layout.fillHeight: true
onVisibleChanged: {
if (visible)
contentView.forceActiveFocus();
else
chatView.focusChatView();
}
}
}
}