diff --git a/Linphone/core/conference/ConferenceInfoCore.hpp b/Linphone/core/conference/ConferenceInfoCore.hpp index 41a702a7..587511a1 100644 --- a/Linphone/core/conference/ConferenceInfoCore.hpp +++ b/Linphone/core/conference/ConferenceInfoCore.hpp @@ -175,8 +175,7 @@ private: QVariantList mParticipants; QSharedPointer mTimeZoneModel; LinphoneEnums::ConferenceSchedulerState mConferenceSchedulerState; - LinphoneEnums::ConferenceInfoState mConferenceInfoState = - LinphoneEnums::ConferenceInfoState::ConferenceInfoStateNew; + LinphoneEnums::ConferenceInfoState mConferenceInfoState = LinphoneEnums::ConferenceInfoState::New; bool mHaveModel = false; bool mIsScheduled; bool mIsEnded = false; diff --git a/Linphone/core/conference/ConferenceInfoList.cpp b/Linphone/core/conference/ConferenceInfoList.cpp index a73507fb..b4e0b352 100644 --- a/Linphone/core/conference/ConferenceInfoList.cpp +++ b/Linphone/core/conference/ConferenceInfoList.cpp @@ -63,7 +63,16 @@ void ConferenceInfoList::setSelf(QSharedPointer me) { items->push_back(nullptr); // Add Dummy conference for today for (auto conferenceInfo : conferenceInfos) { auto confInfoCore = build(conferenceInfo); - if (confInfoCore) items->push_back(confInfoCore); + // Cancelled conference organized ourself me must be hidden + if (conferenceInfo->getState() == linphone::ConferenceInfo::State::Cancelled) { + auto myAddress = defaultAccount->getContactAddress(); + if (myAddress && myAddress->weakEqual(conferenceInfo->getOrganizer())) continue; + } + if (confInfoCore) { + qDebug() << log().arg("Add conf") << confInfoCore->getSubject() << "with state" + << confInfoCore->getConferenceInfoState(); + items->push_back(confInfoCore); + } } mCoreModelConnection->invokeToCore([this, items]() { mustBeInMainThread(getClassName()); @@ -86,7 +95,23 @@ void ConferenceInfoList::setSelf(QSharedPointer me) { }); }); - mCoreModelConnection->makeConnectToModel(&CoreModel::defaultAccountChanged, &ConferenceInfoList::lUpdate); + // This is needed because account does not have a contact address until + // it is connected, so we can't verify if it is the organizer of a deleted + // conference (which must hidden) + auto connectModel = [this] { + mCoreModelConnection->invokeToModel([this]() { + if (mCurrentAccountCore) disconnect(mCurrentAccountCore.get()); + auto defaultAccount = CoreModel::getInstance()->getCore()->getDefaultAccount(); + if (defaultAccount) { + mCurrentAccountCore = AccountCore::create(defaultAccount); + connect(mCurrentAccountCore.get(), &AccountCore::registrationStateChanged, this, + &ConferenceInfoList::lUpdate); + } + }); + }; + mCoreModelConnection->makeConnectToModel(&CoreModel::defaultAccountChanged, connectModel); + connectModel(); + mCoreModelConnection->makeConnectToModel(&CoreModel::conferenceInfoReceived, &ConferenceInfoList::lUpdate); mCoreModelConnection->makeConnectToModel( &CoreModel::conferenceInfoCreated, [this](const std::shared_ptr &confInfo) { diff --git a/Linphone/core/conference/ConferenceInfoList.hpp b/Linphone/core/conference/ConferenceInfoList.hpp index e696957c..4f23b120 100644 --- a/Linphone/core/conference/ConferenceInfoList.hpp +++ b/Linphone/core/conference/ConferenceInfoList.hpp @@ -28,6 +28,7 @@ class CoreModel; class ConferenceInfoCore; +class AccountCore; class ConferenceInfoList : public ListProxy, public AbstractObject { Q_OBJECT @@ -65,6 +66,7 @@ private: QSharedPointer> mCoreModelConnection; std::shared_ptr mCoreModel; QSharedPointer mLastConfInfoInserted; + QSharedPointer mCurrentAccountCore; bool mHaveCurrentDate = false; int mCurrentDateIndex = -1; DECLARE_ABSTRACT_OBJECT diff --git a/Linphone/tool/LinphoneEnums.hpp b/Linphone/tool/LinphoneEnums.hpp index 31ab27cb..3aff8ed6 100644 --- a/Linphone/tool/LinphoneEnums.hpp +++ b/Linphone/tool/LinphoneEnums.hpp @@ -221,10 +221,10 @@ Q_ENUM_NS(ConferenceLayout) linphone::Conference::Layout toLinphone(const LinphoneEnums::ConferenceLayout &layout); LinphoneEnums::ConferenceLayout fromLinphone(const linphone::Conference::Layout &layout); -enum ConferenceInfoState { - ConferenceInfoStateNew = int(linphone::ConferenceInfo::State::New), - ConferenceInfoStateUpdated = int(linphone::ConferenceInfo::State::Updated), - ConferenceInfoStateCancelled = int(linphone::ConferenceInfo::State::Cancelled) +enum class ConferenceInfoState { + New = int(linphone::ConferenceInfo::State::New), + Updated = int(linphone::ConferenceInfo::State::Updated), + Cancelled = int(linphone::ConferenceInfo::State::Cancelled) }; Q_ENUM_NS(ConferenceInfoState) diff --git a/Linphone/view/Control/Display/Meeting/MeetingListView.qml b/Linphone/view/Control/Display/Meeting/MeetingListView.qml index e49b02bd..be6891f1 100644 --- a/Linphone/view/Control/Display/Meeting/MeetingListView.qml +++ b/Linphone/view/Control/Display/Meeting/MeetingListView.qml @@ -4,7 +4,7 @@ import QtQuick.Effects import Linphone import QtQml -import UtilsCpp 1.0 +import UtilsCpp ListView { id: mainItem @@ -68,6 +68,7 @@ ListView { id: itemDelegate height: 63 * DefaultStyle.dp + topOffset width: mainItem.width + enabled: !isCanceled property var previousItem : mainItem.model.count > 0 && index > 0 ? mainItem.model.getAt(index-1) : null property var dateTime: !!$modelData && $modelData.core.haveModel ? $modelData.core.dateTime : UtilsCpp.getCurrentDateTime() property string day : UtilsCpp.toDateDayNameString(dateTime) @@ -76,8 +77,9 @@ ListView { property bool isFirst : ListView.previousSection !== ListView.section property int topOffset: (dateDay.visible && !isFirst? 8 * DefaultStyle.dp : 0) property var endDateTime: $modelData ? $modelData.core.endDateTime : UtilsCpp.getCurrentDateTime() - - property var haveModel: $modelData && $modelData.core.haveModel || false + + property var haveModel: !!$modelData && $modelData != undefined && $modelData.core.haveModel || false + property bool isCanceled: $modelData.core.state === LinphoneEnums.ConferenceInfoState.Cancelled RowLayout{ @@ -167,8 +169,8 @@ ListView { } } Text { - text: UtilsCpp.toDateHourString(dateTime) + " - " + UtilsCpp.toDateHourString(endDateTime) - color: DefaultStyle.main2_500main + text: itemDelegate.isCanceled ? qsTr("Réunion annulée") : UtilsCpp.toDateHourString(dateTime) + " - " + UtilsCpp.toDateHourString(endDateTime) + color: itemDelegate.isCanceled ? DefaultStyle.danger_500main : DefaultStyle.main2_500main font { pixelSize: 14 * DefaultStyle.dp weight: 400 * DefaultStyle.dp diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index abdedacc..fbc86a47 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -400,9 +400,11 @@ Item { Repeater { model: accountProxy - Connections { - target: modelData.core - onMwiChanged: updateCumulatedMwi() + delegate: Item { + Connections { + target: modelData.core + onMwiChanged: updateCumulatedMwi() + } } } diff --git a/Linphone/view/Page/Main/Meeting/MeetingPage.qml b/Linphone/view/Page/Main/Meeting/MeetingPage.qml index 51ee2786..2780d290 100644 --- a/Linphone/view/Page/Main/Meeting/MeetingPage.qml +++ b/Linphone/view/Page/Main/Meeting/MeetingPage.qml @@ -587,6 +587,7 @@ AbstractMainPage { contentImageColor: DefaultStyle.danger_500main inversedColors: true property var isMeObj: UtilsCpp.isMe(mainItem.selectedConference?.core.organizerAddress) + property bool canCancel: isMeObj && isMeObj.value && mainItem.selectedConference.core.state !== LinphoneEnums.ConferenceInfoState.Cancelled icon.source: AppIcons.trashCan icon.width: 24 * DefaultStyle.dp icon.height: 24 * DefaultStyle.dp @@ -597,7 +598,7 @@ AbstractMainPage { onClicked: { if (mainItem.selectedConference) { - cancelAndDeleteConfDialog.cancel = isMeObj? isMeObj.value : false + cancelAndDeleteConfDialog.cancel = canCancel cancelAndDeleteConfDialog.open() // mainItem.contactDeletionRequested(mainItem.selectedConference) deletePopup.close() @@ -754,6 +755,7 @@ AbstractMainPage { } } Section { + visible: participantList.count > 0 content: RowLayout { Layout.preferredHeight: participantList.height width: 393 * DefaultStyle.dp @@ -802,6 +804,7 @@ AbstractMainPage { } Button { id: joinButton + visible: mainItem.selectedConference && mainItem.selectedConference.core.state !== LinphoneEnums.ConferenceInfoState.Cancelled Layout.fillWidth: true text: qsTr("Rejoindre la réunion") topPadding: 11 * DefaultStyle.dp