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();
mConfInfoModelConnection->invokeToCore([this] {
undo(); // Reset new values because some values can be invalid and not changed.
emit dataChanged();
});
});
} else {

View file

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

View file

@ -223,19 +223,12 @@ void ConferenceInfoList::connectItem(QSharedPointer<ConferenceInfoCore> 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);
}
});

View file

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

View file

@ -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<ConferenceInfoCore> data) { emit conferenceInfoUpdated(new ConferenceInfoGui(data)); },
Qt::QueuedConnection);
connect(mList.get(), &ConferenceInfoList::initialized, this, &ConferenceInfoProxy::initialized);
}

View file

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

View file

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

View file

@ -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")

View file

@ -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

View file

@ -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()
}
}
}

View file

@ -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)