From 1d114ab4682a1a3f3195500baf95b883c6f5dbff Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Mon, 6 Jan 2025 11:47:56 +0100 Subject: [PATCH] fix meeting time edition --- .../core/conference/ConferenceInfoCore.cpp | 1 + .../core/conference/ConferenceInfoCore.hpp | 2 + .../core/conference/ConferenceInfoList.cpp | 11 +--- .../core/conference/ConferenceInfoList.hpp | 1 + .../core/conference/ConferenceInfoProxy.cpp | 6 +++ .../core/conference/ConferenceInfoProxy.hpp | 1 + .../Display/Meeting/MeetingListView.qml | 3 ++ Linphone/view/Control/Popup/Dialog/Dialog.qml | 2 +- .../view/Page/Form/Meeting/MeetingForm.qml | 12 +---- .../view/Page/Main/Meeting/MeetingPage.qml | 52 ++++++++----------- Linphone/view/Page/Window/AbstractWindow.qml | 3 +- 11 files changed, 44 insertions(+), 50 deletions(-) diff --git a/Linphone/core/conference/ConferenceInfoCore.cpp b/Linphone/core/conference/ConferenceInfoCore.cpp index 89b23e64..32546238 100644 --- a/Linphone/core/conference/ConferenceInfoCore.cpp +++ b/Linphone/core/conference/ConferenceInfoCore.cpp @@ -570,6 +570,7 @@ void ConferenceInfoCore::save() { mConferenceInfoModel->updateConferenceInfo(); mConfInfoModelConnection->invokeToCore([this] { undo(); // Reset new values because some values can be invalid and not changed. + emit dataChanged(); }); }); } else { diff --git a/Linphone/core/conference/ConferenceInfoCore.hpp b/Linphone/core/conference/ConferenceInfoCore.hpp index fa5234b2..dce0136d 100644 --- a/Linphone/core/conference/ConferenceInfoCore.hpp +++ b/Linphone/core/conference/ConferenceInfoCore.hpp @@ -153,6 +153,8 @@ signals: void timeZoneModelChanged(); void saveFailed(); + void dataChanged(); + void invitationsSent(); void removed(ConferenceInfoCore *confInfo); diff --git a/Linphone/core/conference/ConferenceInfoList.cpp b/Linphone/core/conference/ConferenceInfoList.cpp index b3535e16..2349bd9b 100644 --- a/Linphone/core/conference/ConferenceInfoList.cpp +++ b/Linphone/core/conference/ConferenceInfoList.cpp @@ -223,19 +223,12 @@ void ConferenceInfoList::connectItem(QSharedPointer confInfo remove(confInfo); updateHaveCurrentDate(); }); - connect(confInfoCore.get(), &ConferenceInfoCore::dateTimeChanged, this, [this, confInfoCore]() { - int i = -1; - get(confInfoCore.get(), &i); - if (i != -1) { - auto modelIndex = index(i); - emit dataChanged(modelIndex, modelIndex); - } - }); - connect(confInfoCore.get(), &ConferenceInfoCore::endDateTimeChanged, this, [this, confInfoCore]() { + connect(confInfoCore.get(), &ConferenceInfoCore::dataChanged, this, [this, confInfoCore]() { int i = -1; get(confInfoCore.get(), &i); if (i != -1) { auto modelIndex = index(i); + emit confInfoUpdated(confInfoCore); emit dataChanged(modelIndex, modelIndex); } }); diff --git a/Linphone/core/conference/ConferenceInfoList.hpp b/Linphone/core/conference/ConferenceInfoList.hpp index d231951b..a2c4d6c3 100644 --- a/Linphone/core/conference/ConferenceInfoList.hpp +++ b/Linphone/core/conference/ConferenceInfoList.hpp @@ -65,6 +65,7 @@ signals: void haveCurrentDateChanged(); void currentDateIndexChanged(int index); void confInfoInserted(QSharedPointer data); + void confInfoUpdated(QSharedPointer data); private: QSharedPointer> mCoreModelConnection; diff --git a/Linphone/core/conference/ConferenceInfoProxy.cpp b/Linphone/core/conference/ConferenceInfoProxy.cpp index 25427ef2..bde27c18 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.cpp +++ b/Linphone/core/conference/ConferenceInfoProxy.cpp @@ -45,6 +45,12 @@ ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : LimitProxy(parent) { emit conferenceInfoCreated(new ConferenceInfoGui(data)); }, Qt::QueuedConnection); + // When the date of a conference is being modified, it can be moved at another index, + // so we need to find this new index to select the right coference info + connect( + mList.get(), &ConferenceInfoList::confInfoUpdated, this, + [this](QSharedPointer data) { emit conferenceInfoUpdated(new ConferenceInfoGui(data)); }, + Qt::QueuedConnection); connect(mList.get(), &ConferenceInfoList::initialized, this, &ConferenceInfoProxy::initialized); } diff --git a/Linphone/core/conference/ConferenceInfoProxy.hpp b/Linphone/core/conference/ConferenceInfoProxy.hpp index 6ef3f451..38523be2 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.hpp +++ b/Linphone/core/conference/ConferenceInfoProxy.hpp @@ -51,6 +51,7 @@ signals: void initialized(); void haveCurrentDateChanged(); void conferenceInfoCreated(ConferenceInfoGui *confInfo); + void conferenceInfoUpdated(ConferenceInfoGui *confInfo); private: QSharedPointer mList; diff --git a/Linphone/view/Control/Display/Meeting/MeetingListView.qml b/Linphone/view/Control/Display/Meeting/MeetingListView.qml index d739d5ed..94fdf34f 100644 --- a/Linphone/view/Control/Display/Meeting/MeetingListView.qml +++ b/Linphone/view/Control/Display/Meeting/MeetingListView.qml @@ -111,6 +111,9 @@ ListView { onConferenceInfoCreated: (confInfoGui) => { selectData(confInfoGui) } + onConferenceInfoUpdated: (confInfoGui) => { + selectData(confInfoGui) + } onInitialized: { // Move to currentDate selectData(null) diff --git a/Linphone/view/Control/Popup/Dialog/Dialog.qml b/Linphone/view/Control/Popup/Dialog/Dialog.qml index 31cc5fe6..723b92ad 100644 --- a/Linphone/view/Control/Popup/Dialog/Dialog.qml +++ b/Linphone/view/Control/Popup/Dialog/Dialog.qml @@ -16,7 +16,7 @@ Popup { underlineColor: DefaultStyle.main1_500_main radius: title.length === 0 ? 16 * DefaultStyle.dp : 0 property string title - property var titleColor: DefaultStyle.main2_600 + property var titleColor: DefaultStyle.main1_500_main property string text property string details property string firstButtonText: firstButtonAccept ? qsTr("Oui") : qsTr("Annuler") diff --git a/Linphone/view/Page/Form/Meeting/MeetingForm.qml b/Linphone/view/Page/Form/Meeting/MeetingForm.qml index 02179ac1..1c0a1b97 100644 --- a/Linphone/view/Page/Form/Meeting/MeetingForm.qml +++ b/Linphone/view/Page/Form/Meeting/MeetingForm.qml @@ -18,14 +18,6 @@ FocusScope { id: formLayout spacing: 16 * DefaultStyle.dp anchors.fill: parent - Connections { - target: mainItem.conferenceInfoGui.core - function onSchedulerStateChanged() { - if (mainItem.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) { - mainItem.saveSucceed(isCreation) - } - } - } Component.onCompleted: { endHour.selectedDateTime = mainItem.conferenceInfoGui.core.endDateTime @@ -153,7 +145,7 @@ FocusScope { RowLayout { TimeComboBox { id: startHour - indicator.visible: mainItem.isCreation + // indicator.visible: mainItem.isCreation Layout.preferredWidth: 94 * DefaultStyle.dp Layout.preferredHeight: 30 * DefaultStyle.dp background.visible: mainItem.isCreation @@ -173,7 +165,7 @@ FocusScope { } TimeComboBox { id: endHour - indicator.visible: mainItem.isCreation + // indicator.visible: mainItem.isCreation Layout.preferredWidth: 94 * DefaultStyle.dp Layout.preferredHeight: 30 * DefaultStyle.dp background.visible: mainItem.isCreation diff --git a/Linphone/view/Page/Main/Meeting/MeetingPage.qml b/Linphone/view/Page/Main/Meeting/MeetingPage.qml index 7bb9febb..64cbedac 100644 --- a/Linphone/view/Page/Main/Meeting/MeetingPage.qml +++ b/Linphone/view/Page/Main/Meeting/MeetingPage.qml @@ -46,6 +46,8 @@ AbstractMainPage { } onSelectedConferenceChanged: { + // While a conference is being edited, we need to stay on the edit page + if (overridenRightPanelStackView.currentItem && overridenRightPanelStackView.currentItem.objectName === "editConf") return overridenRightPanelStackView.clear() if (selectedConference && selectedConference.core && selectedConference.core.haveModel) { if (!overridenRightPanelStackView.currentItem || overridenRightPanelStackView.currentItem != meetingDetail) overridenRightPanelStackView.replace(meetingDetail, Control.StackView.Immediate) @@ -133,6 +135,7 @@ AbstractMainPage { Control.StackView.onActivated: { mainItem.selectedConference = conferenceList.selectedConference } + enabled: !overridenRightPanelStackView.currentItem || overridenRightPanelStackView.currentItem.objectName !== "editConf" ColumnLayout { anchors.fill: parent @@ -334,6 +337,7 @@ AbstractMainPage { id: editConf FocusScope{ id: editFocusScope + objectName: "editConf" property bool isCreation property ConferenceInfoGui conferenceInfoGui width: overridenRightPanelStackView.width @@ -429,30 +433,7 @@ AbstractMainPage { conferenceInfoGui: editFocusScope.conferenceInfoGui Layout.fillWidth: true Layout.fillHeight: true - Connections { - target: conferenceEdit.conferenceInfoGui ? conferenceEdit.conferenceInfoGui.core : null - function onConferenceSchedulerStateChanged() { - var mainWin = UtilsCpp.getMainWindow() - if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending - || conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) { - mainWin.showLoadingPopup(qsTr("Modification de la réunion en cours...")) - } else { - if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) { - UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La modification de la conférence a échoué"), false) - } - mainWin.closeLoadingPopup() - } - editFocusScope.enabled = conferenceEdit.conferenceInfoGui.core.schedulerState != LinphoneEnums.ConferenceSchedulerState.AllocationPending - } - function onSaveFailed() { - var mainWin = UtilsCpp.getMainWindow() - mainWin.closeLoadingPopup() - } - } - onSaveSucceed: { - overridenRightPanelStackView.pop() - UtilsCpp.showInformationPopup(qsTr("Enregistré"), qsTr("Réunion modifiée avec succès"), true) - } + onAddParticipantsRequested: { overridenRightPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": overridenRightPanelStackView}) } @@ -464,11 +445,24 @@ AbstractMainPage { } } Connections { - target: conferenceEdit.conferenceInfoGui ? conferenceEdit.conferenceInfoGui.core : null - function onConferenceSchedulerStateChanged() { - var mainWin = UtilsCpp.getMainWindow() - if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) { - UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'édition de la conférence a échoué"), false) + target: conferenceEdit.conferenceInfoGui.core + ignoreUnknownSignals: true + function onSaveFailed() { + UtilsCpp.getMainWindow().closeLoadingPopup() + } + function onSchedulerStateChanged() { + editFocusScope.enabled = conferenceInfoGui.core.schedulerState != LinphoneEnums.ConferenceSchedulerState.AllocationPending + if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) { + overridenRightPanelStackView.pop() + UtilsCpp.getMainWindow().closeLoadingPopup() + UtilsCpp.showInformationPopup(qsTr("Enregistré"), qsTr("Réunion modifiée avec succès"), true) + } + else if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.AllocationPending + || conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Updating) { + UtilsCpp.getMainWindow().showLoadingPopup(qsTr("Modification de la réunion en cours...")) + } else if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) { + UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("La modification de la conférence a échoué"), false) + UtilsCpp.getMainWindow().closeLoadingPopup() } } } diff --git a/Linphone/view/Page/Window/AbstractWindow.qml b/Linphone/view/Page/Window/AbstractWindow.qml index aa3a0d80..11388d42 100644 --- a/Linphone/view/Page/Window/AbstractWindow.qml +++ b/Linphone/view/Page/Window/AbstractWindow.qml @@ -222,11 +222,12 @@ ApplicationWindow { popup.closePopup.connect(removeFromPopupLayout) } - function showConfirmationLambdaPopup(title,text, details,callback, firstButtonText, secondButtonText){ + function showConfirmationLambdaPopup(title,text, details, callback, firstButtonText, secondButtonText, customContent){ console.log("Showing confirmation lambda popup") var popup = confirmPopupComp.createObject(popupLayout, {"title": title, "text": text, "details":details,"callback":callback}) if (firstButtonText != undefined) popup.firstButtonText = firstButtonText if (secondButtonText != undefined) popup.secondButtonText = secondButtonText + if (customContent != undefined) popup.content = customContent popup.titleColor = DefaultStyle.main1_500_main popup.open() popup.closePopup.connect(removeFromPopupLayout)