fix #LINQT-1505 edit meeting start/end time

This commit is contained in:
Gaelle Braud 2024-12-26 17:58:52 +01:00
parent d425a3dfe8
commit cae5372e97
5 changed files with 39 additions and 12 deletions

View file

@ -568,6 +568,9 @@ void ConferenceInfoCore::save() {
thisCopy->writeIntoModel(mConferenceInfoModel);
thisCopy->deleteLater();
mConferenceInfoModel->updateConferenceInfo();
mConfInfoModelConnection->invokeToCore([this] {
undo(); // Reset new values because some values can be invalid and not changed.
});
});
} else {
mCoreModelConnection->invokeToModel([this, thisCopy]() {

View file

@ -218,11 +218,28 @@ ConferenceInfoList::build(const std::shared_ptr<linphone::ConferenceInfo> &confe
}
void ConferenceInfoList::connectItem(QSharedPointer<ConferenceInfoCore> confInfoCore) {
if (confInfoCore)
if (confInfoCore) {
connect(confInfoCore.get(), &ConferenceInfoCore::removed, this, [this](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]() {
int i = -1;
get(confInfoCore.get(), &i);
if (i != -1) {
auto modelIndex = index(i);
emit dataChanged(modelIndex, modelIndex);
}
});
}
}
QHash<int, QByteArray> ConferenceInfoList::roleNames() const {

View file

@ -31,13 +31,14 @@ ListProxy::~ListProxy() {
}
QSharedPointer<QObject> ListProxy::get(QObject *itemToGet, int *index) const {
int row = 0;
for (auto item : mList)
if (item.get() == itemToGet) {
if (index) *index = row;
return item;
} else ++row;
return nullptr;
auto it = std::find(mList.begin(), mList.end(), itemToGet);
if (it != mList.end()) {
if (index != nullptr) *index = std::distance(mList.begin(), it);
return *it;
} else {
if (index != nullptr) *index = -1;
return nullptr;
}
}
// -----------------------------------------------------------------------------

View file

@ -160,13 +160,15 @@ FocusScope {
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
KeyNavigation.up: startDate
KeyNavigation.down: timeZoneCbox
KeyNavigation.left: startDate
KeyNavigation.left: endHour
KeyNavigation.right: endHour
onSelectedDateTimeChanged: {
mainItem.conferenceInfoGui.core.dateTime = selectedDateTime
endHour.minTime = selectedDateTime
endHour.maxTime = UtilsCpp.createDateTime(selectedDateTime, 23, 59)
mainItem.conferenceInfoGui.core.dateTime = selectedDateTime
endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600)
if (mainItem.isCreation) {
endHour.selectedDateTime = UtilsCpp.addSecs(selectedDateTime, 3600)
}
}
}
TimeComboBox {
@ -177,6 +179,10 @@ FocusScope {
background.visible: mainItem.isCreation
contentText.font.weight: (isCreation ? 700 : 400) * DefaultStyle.dp
onSelectedDateTimeChanged: mainItem.conferenceInfoGui.core.endDateTime = selectedDateTime
KeyNavigation.up: startDate
KeyNavigation.down: timeZoneCbox
KeyNavigation.left: startHour
KeyNavigation.right: startHour
}
Item {
Layout.fillWidth: true

View file

@ -401,7 +401,7 @@ AbstractMainPage {
leftPadding: 12 * DefaultStyle.dp
rightPadding: 12 * DefaultStyle.dp
focus: true
text: qsTr("Save")
text: qsTr("Enregistrer")
textSize: 13 * DefaultStyle.dp
KeyNavigation.left: titleText
KeyNavigation.right: backButton