fix meeting time edition

This commit is contained in:
Gaelle Braud 2025-01-06 11:47:56 +01:00
parent 06d00de59b
commit 1d114ab468
11 changed files with 44 additions and 50 deletions

View file

@ -570,6 +570,7 @@ void ConferenceInfoCore::save() {
mConferenceInfoModel->updateConferenceInfo(); mConferenceInfoModel->updateConferenceInfo();
mConfInfoModelConnection->invokeToCore([this] { mConfInfoModelConnection->invokeToCore([this] {
undo(); // Reset new values because some values can be invalid and not changed. undo(); // Reset new values because some values can be invalid and not changed.
emit dataChanged();
}); });
}); });
} else { } else {

View file

@ -153,6 +153,8 @@ signals:
void timeZoneModelChanged(); void timeZoneModelChanged();
void saveFailed(); void saveFailed();
void dataChanged();
void invitationsSent(); void invitationsSent();
void removed(ConferenceInfoCore *confInfo); void removed(ConferenceInfoCore *confInfo);

View file

@ -223,19 +223,12 @@ void ConferenceInfoList::connectItem(QSharedPointer<ConferenceInfoCore> confInfo
remove(confInfo); remove(confInfo);
updateHaveCurrentDate(); updateHaveCurrentDate();
}); });
connect(confInfoCore.get(), &ConferenceInfoCore::dateTimeChanged, 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 dataChanged(modelIndex, modelIndex);
}
});
connect(confInfoCore.get(), &ConferenceInfoCore::endDateTimeChanged, this, [this, confInfoCore]() {
int i = -1; int i = -1;
get(confInfoCore.get(), &i); get(confInfoCore.get(), &i);
if (i != -1) { if (i != -1) {
auto modelIndex = index(i); auto modelIndex = index(i);
emit confInfoUpdated(confInfoCore);
emit dataChanged(modelIndex, modelIndex); emit dataChanged(modelIndex, modelIndex);
} }
}); });

View file

@ -65,6 +65,7 @@ signals:
void haveCurrentDateChanged(); void haveCurrentDateChanged();
void currentDateIndexChanged(int index); void currentDateIndexChanged(int index);
void confInfoInserted(QSharedPointer<ConferenceInfoCore> data); void confInfoInserted(QSharedPointer<ConferenceInfoCore> data);
void confInfoUpdated(QSharedPointer<ConferenceInfoCore> data);
private: private:
QSharedPointer<SafeConnection<ConferenceInfoList, CoreModel>> mCoreModelConnection; QSharedPointer<SafeConnection<ConferenceInfoList, CoreModel>> mCoreModelConnection;

View file

@ -45,6 +45,12 @@ ConferenceInfoProxy::ConferenceInfoProxy(QObject *parent) : LimitProxy(parent) {
emit conferenceInfoCreated(new ConferenceInfoGui(data)); emit conferenceInfoCreated(new ConferenceInfoGui(data));
}, },
Qt::QueuedConnection); 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<ConferenceInfoCore> data) { emit conferenceInfoUpdated(new ConferenceInfoGui(data)); },
Qt::QueuedConnection);
connect(mList.get(), &ConferenceInfoList::initialized, this, &ConferenceInfoProxy::initialized); connect(mList.get(), &ConferenceInfoList::initialized, this, &ConferenceInfoProxy::initialized);
} }

View file

@ -51,6 +51,7 @@ signals:
void initialized(); void initialized();
void haveCurrentDateChanged(); void haveCurrentDateChanged();
void conferenceInfoCreated(ConferenceInfoGui *confInfo); void conferenceInfoCreated(ConferenceInfoGui *confInfo);
void conferenceInfoUpdated(ConferenceInfoGui *confInfo);
private: private:
QSharedPointer<ConferenceInfoList> mList; QSharedPointer<ConferenceInfoList> mList;

View file

@ -111,6 +111,9 @@ ListView {
onConferenceInfoCreated: (confInfoGui) => { onConferenceInfoCreated: (confInfoGui) => {
selectData(confInfoGui) selectData(confInfoGui)
} }
onConferenceInfoUpdated: (confInfoGui) => {
selectData(confInfoGui)
}
onInitialized: { onInitialized: {
// Move to currentDate // Move to currentDate
selectData(null) selectData(null)

View file

@ -16,7 +16,7 @@ Popup {
underlineColor: DefaultStyle.main1_500_main underlineColor: DefaultStyle.main1_500_main
radius: title.length === 0 ? 16 * DefaultStyle.dp : 0 radius: title.length === 0 ? 16 * DefaultStyle.dp : 0
property string title property string title
property var titleColor: DefaultStyle.main2_600 property var titleColor: DefaultStyle.main1_500_main
property string text property string text
property string details property string details
property string firstButtonText: firstButtonAccept ? qsTr("Oui") : qsTr("Annuler") property string firstButtonText: firstButtonAccept ? qsTr("Oui") : qsTr("Annuler")

View file

@ -18,14 +18,6 @@ FocusScope {
id: formLayout id: formLayout
spacing: 16 * DefaultStyle.dp spacing: 16 * DefaultStyle.dp
anchors.fill: parent anchors.fill: parent
Connections {
target: mainItem.conferenceInfoGui.core
function onSchedulerStateChanged() {
if (mainItem.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Ready) {
mainItem.saveSucceed(isCreation)
}
}
}
Component.onCompleted: { Component.onCompleted: {
endHour.selectedDateTime = mainItem.conferenceInfoGui.core.endDateTime endHour.selectedDateTime = mainItem.conferenceInfoGui.core.endDateTime
@ -153,7 +145,7 @@ FocusScope {
RowLayout { RowLayout {
TimeComboBox { TimeComboBox {
id: startHour id: startHour
indicator.visible: mainItem.isCreation // indicator.visible: mainItem.isCreation
Layout.preferredWidth: 94 * DefaultStyle.dp Layout.preferredWidth: 94 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp Layout.preferredHeight: 30 * DefaultStyle.dp
background.visible: mainItem.isCreation background.visible: mainItem.isCreation
@ -173,7 +165,7 @@ FocusScope {
} }
TimeComboBox { TimeComboBox {
id: endHour id: endHour
indicator.visible: mainItem.isCreation // indicator.visible: mainItem.isCreation
Layout.preferredWidth: 94 * DefaultStyle.dp Layout.preferredWidth: 94 * DefaultStyle.dp
Layout.preferredHeight: 30 * DefaultStyle.dp Layout.preferredHeight: 30 * DefaultStyle.dp
background.visible: mainItem.isCreation background.visible: mainItem.isCreation

View file

@ -46,6 +46,8 @@ AbstractMainPage {
} }
onSelectedConferenceChanged: { 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() overridenRightPanelStackView.clear()
if (selectedConference && selectedConference.core && selectedConference.core.haveModel) { if (selectedConference && selectedConference.core && selectedConference.core.haveModel) {
if (!overridenRightPanelStackView.currentItem || overridenRightPanelStackView.currentItem != meetingDetail) overridenRightPanelStackView.replace(meetingDetail, Control.StackView.Immediate) if (!overridenRightPanelStackView.currentItem || overridenRightPanelStackView.currentItem != meetingDetail) overridenRightPanelStackView.replace(meetingDetail, Control.StackView.Immediate)
@ -133,6 +135,7 @@ AbstractMainPage {
Control.StackView.onActivated: { Control.StackView.onActivated: {
mainItem.selectedConference = conferenceList.selectedConference mainItem.selectedConference = conferenceList.selectedConference
} }
enabled: !overridenRightPanelStackView.currentItem || overridenRightPanelStackView.currentItem.objectName !== "editConf"
ColumnLayout { ColumnLayout {
anchors.fill: parent anchors.fill: parent
@ -334,6 +337,7 @@ AbstractMainPage {
id: editConf id: editConf
FocusScope{ FocusScope{
id: editFocusScope id: editFocusScope
objectName: "editConf"
property bool isCreation property bool isCreation
property ConferenceInfoGui conferenceInfoGui property ConferenceInfoGui conferenceInfoGui
width: overridenRightPanelStackView.width width: overridenRightPanelStackView.width
@ -429,30 +433,7 @@ AbstractMainPage {
conferenceInfoGui: editFocusScope.conferenceInfoGui conferenceInfoGui: editFocusScope.conferenceInfoGui
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: 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: { onAddParticipantsRequested: {
overridenRightPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": overridenRightPanelStackView}) overridenRightPanelStackView.push(addParticipants, {"conferenceInfoGui": conferenceInfoGui, "container": overridenRightPanelStackView})
} }
@ -464,11 +445,24 @@ AbstractMainPage {
} }
} }
Connections { Connections {
target: conferenceEdit.conferenceInfoGui ? conferenceEdit.conferenceInfoGui.core : null target: conferenceEdit.conferenceInfoGui.core
function onConferenceSchedulerStateChanged() { ignoreUnknownSignals: true
var mainWin = UtilsCpp.getMainWindow() function onSaveFailed() {
if (conferenceEdit.conferenceInfoGui.core.schedulerState == LinphoneEnums.ConferenceSchedulerState.Error) { UtilsCpp.getMainWindow().closeLoadingPopup()
UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("L'édition de la conférence a échoué"), false) }
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()
} }
} }
} }

View file

@ -222,11 +222,12 @@ ApplicationWindow {
popup.closePopup.connect(removeFromPopupLayout) 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") console.log("Showing confirmation lambda popup")
var popup = confirmPopupComp.createObject(popupLayout, {"title": title, "text": text, "details":details,"callback":callback}) var popup = confirmPopupComp.createObject(popupLayout, {"title": title, "text": text, "details":details,"callback":callback})
if (firstButtonText != undefined) popup.firstButtonText = firstButtonText if (firstButtonText != undefined) popup.firstButtonText = firstButtonText
if (secondButtonText != undefined) popup.secondButtonText = secondButtonText if (secondButtonText != undefined) popup.secondButtonText = secondButtonText
if (customContent != undefined) popup.content = customContent
popup.titleColor = DefaultStyle.main1_500_main popup.titleColor = DefaultStyle.main1_500_main
popup.open() popup.open()
popup.closePopup.connect(removeFromPopupLayout) popup.closePopup.connect(removeFromPopupLayout)