cancelled conf ui
This commit is contained in:
parent
f68327bcf6
commit
94dd384129
7 changed files with 50 additions and 17 deletions
|
|
@ -175,8 +175,7 @@ private:
|
||||||
QVariantList mParticipants;
|
QVariantList mParticipants;
|
||||||
QSharedPointer<TimeZoneModel> mTimeZoneModel;
|
QSharedPointer<TimeZoneModel> mTimeZoneModel;
|
||||||
LinphoneEnums::ConferenceSchedulerState mConferenceSchedulerState;
|
LinphoneEnums::ConferenceSchedulerState mConferenceSchedulerState;
|
||||||
LinphoneEnums::ConferenceInfoState mConferenceInfoState =
|
LinphoneEnums::ConferenceInfoState mConferenceInfoState = LinphoneEnums::ConferenceInfoState::New;
|
||||||
LinphoneEnums::ConferenceInfoState::ConferenceInfoStateNew;
|
|
||||||
bool mHaveModel = false;
|
bool mHaveModel = false;
|
||||||
bool mIsScheduled;
|
bool mIsScheduled;
|
||||||
bool mIsEnded = false;
|
bool mIsEnded = false;
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,16 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> me) {
|
||||||
items->push_back(nullptr); // Add Dummy conference for today
|
items->push_back(nullptr); // Add Dummy conference for today
|
||||||
for (auto conferenceInfo : conferenceInfos) {
|
for (auto conferenceInfo : conferenceInfos) {
|
||||||
auto confInfoCore = build(conferenceInfo);
|
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]() {
|
mCoreModelConnection->invokeToCore([this, items]() {
|
||||||
mustBeInMainThread(getClassName());
|
mustBeInMainThread(getClassName());
|
||||||
|
|
@ -86,7 +95,23 @@ void ConferenceInfoList::setSelf(QSharedPointer<ConferenceInfoList> 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::conferenceInfoReceived, &ConferenceInfoList::lUpdate);
|
||||||
mCoreModelConnection->makeConnectToModel(
|
mCoreModelConnection->makeConnectToModel(
|
||||||
&CoreModel::conferenceInfoCreated, [this](const std::shared_ptr<linphone::ConferenceInfo> &confInfo) {
|
&CoreModel::conferenceInfoCreated, [this](const std::shared_ptr<linphone::ConferenceInfo> &confInfo) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
class CoreModel;
|
class CoreModel;
|
||||||
class ConferenceInfoCore;
|
class ConferenceInfoCore;
|
||||||
|
class AccountCore;
|
||||||
|
|
||||||
class ConferenceInfoList : public ListProxy, public AbstractObject {
|
class ConferenceInfoList : public ListProxy, public AbstractObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
@ -65,6 +66,7 @@ private:
|
||||||
QSharedPointer<SafeConnection<ConferenceInfoList, CoreModel>> mCoreModelConnection;
|
QSharedPointer<SafeConnection<ConferenceInfoList, CoreModel>> mCoreModelConnection;
|
||||||
std::shared_ptr<CoreModel> mCoreModel;
|
std::shared_ptr<CoreModel> mCoreModel;
|
||||||
QSharedPointer<ConferenceInfoCore> mLastConfInfoInserted;
|
QSharedPointer<ConferenceInfoCore> mLastConfInfoInserted;
|
||||||
|
QSharedPointer<AccountCore> mCurrentAccountCore;
|
||||||
bool mHaveCurrentDate = false;
|
bool mHaveCurrentDate = false;
|
||||||
int mCurrentDateIndex = -1;
|
int mCurrentDateIndex = -1;
|
||||||
DECLARE_ABSTRACT_OBJECT
|
DECLARE_ABSTRACT_OBJECT
|
||||||
|
|
|
||||||
|
|
@ -221,10 +221,10 @@ Q_ENUM_NS(ConferenceLayout)
|
||||||
linphone::Conference::Layout toLinphone(const LinphoneEnums::ConferenceLayout &layout);
|
linphone::Conference::Layout toLinphone(const LinphoneEnums::ConferenceLayout &layout);
|
||||||
LinphoneEnums::ConferenceLayout fromLinphone(const linphone::Conference::Layout &layout);
|
LinphoneEnums::ConferenceLayout fromLinphone(const linphone::Conference::Layout &layout);
|
||||||
|
|
||||||
enum ConferenceInfoState {
|
enum class ConferenceInfoState {
|
||||||
ConferenceInfoStateNew = int(linphone::ConferenceInfo::State::New),
|
New = int(linphone::ConferenceInfo::State::New),
|
||||||
ConferenceInfoStateUpdated = int(linphone::ConferenceInfo::State::Updated),
|
Updated = int(linphone::ConferenceInfo::State::Updated),
|
||||||
ConferenceInfoStateCancelled = int(linphone::ConferenceInfo::State::Cancelled)
|
Cancelled = int(linphone::ConferenceInfo::State::Cancelled)
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(ConferenceInfoState)
|
Q_ENUM_NS(ConferenceInfoState)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import QtQuick.Effects
|
||||||
|
|
||||||
import Linphone
|
import Linphone
|
||||||
import QtQml
|
import QtQml
|
||||||
import UtilsCpp 1.0
|
import UtilsCpp
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
|
|
@ -68,6 +68,7 @@ ListView {
|
||||||
id: itemDelegate
|
id: itemDelegate
|
||||||
height: 63 * DefaultStyle.dp + topOffset
|
height: 63 * DefaultStyle.dp + topOffset
|
||||||
width: mainItem.width
|
width: mainItem.width
|
||||||
|
enabled: !isCanceled
|
||||||
property var previousItem : mainItem.model.count > 0 && index > 0 ? mainItem.model.getAt(index-1) : null
|
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 var dateTime: !!$modelData && $modelData.core.haveModel ? $modelData.core.dateTime : UtilsCpp.getCurrentDateTime()
|
||||||
property string day : UtilsCpp.toDateDayNameString(dateTime)
|
property string day : UtilsCpp.toDateDayNameString(dateTime)
|
||||||
|
|
@ -77,7 +78,8 @@ ListView {
|
||||||
property int topOffset: (dateDay.visible && !isFirst? 8 * DefaultStyle.dp : 0)
|
property int topOffset: (dateDay.visible && !isFirst? 8 * DefaultStyle.dp : 0)
|
||||||
property var endDateTime: $modelData ? $modelData.core.endDateTime : UtilsCpp.getCurrentDateTime()
|
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{
|
RowLayout{
|
||||||
|
|
@ -167,8 +169,8 @@ ListView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
text: UtilsCpp.toDateHourString(dateTime) + " - " + UtilsCpp.toDateHourString(endDateTime)
|
text: itemDelegate.isCanceled ? qsTr("Réunion annulée") : UtilsCpp.toDateHourString(dateTime) + " - " + UtilsCpp.toDateHourString(endDateTime)
|
||||||
color: DefaultStyle.main2_500main
|
color: itemDelegate.isCanceled ? DefaultStyle.danger_500main : DefaultStyle.main2_500main
|
||||||
font {
|
font {
|
||||||
pixelSize: 14 * DefaultStyle.dp
|
pixelSize: 14 * DefaultStyle.dp
|
||||||
weight: 400 * DefaultStyle.dp
|
weight: 400 * DefaultStyle.dp
|
||||||
|
|
|
||||||
|
|
@ -400,11 +400,13 @@ Item {
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: accountProxy
|
model: accountProxy
|
||||||
|
delegate: Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: modelData.core
|
target: modelData.core
|
||||||
onMwiChanged: updateCumulatedMwi()
|
onMwiChanged: updateCumulatedMwi()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateCumulatedMwi() {
|
function updateCumulatedMwi() {
|
||||||
var count = 0
|
var count = 0
|
||||||
|
|
|
||||||
|
|
@ -587,6 +587,7 @@ AbstractMainPage {
|
||||||
contentImageColor: DefaultStyle.danger_500main
|
contentImageColor: DefaultStyle.danger_500main
|
||||||
inversedColors: true
|
inversedColors: true
|
||||||
property var isMeObj: UtilsCpp.isMe(mainItem.selectedConference?.core.organizerAddress)
|
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.source: AppIcons.trashCan
|
||||||
icon.width: 24 * DefaultStyle.dp
|
icon.width: 24 * DefaultStyle.dp
|
||||||
icon.height: 24 * DefaultStyle.dp
|
icon.height: 24 * DefaultStyle.dp
|
||||||
|
|
@ -597,7 +598,7 @@ AbstractMainPage {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (mainItem.selectedConference) {
|
if (mainItem.selectedConference) {
|
||||||
cancelAndDeleteConfDialog.cancel = isMeObj? isMeObj.value : false
|
cancelAndDeleteConfDialog.cancel = canCancel
|
||||||
cancelAndDeleteConfDialog.open()
|
cancelAndDeleteConfDialog.open()
|
||||||
// mainItem.contactDeletionRequested(mainItem.selectedConference)
|
// mainItem.contactDeletionRequested(mainItem.selectedConference)
|
||||||
deletePopup.close()
|
deletePopup.close()
|
||||||
|
|
@ -754,6 +755,7 @@ AbstractMainPage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Section {
|
Section {
|
||||||
|
visible: participantList.count > 0
|
||||||
content: RowLayout {
|
content: RowLayout {
|
||||||
Layout.preferredHeight: participantList.height
|
Layout.preferredHeight: participantList.height
|
||||||
width: 393 * DefaultStyle.dp
|
width: 393 * DefaultStyle.dp
|
||||||
|
|
@ -802,6 +804,7 @@ AbstractMainPage {
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
id: joinButton
|
id: joinButton
|
||||||
|
visible: mainItem.selectedConference && mainItem.selectedConference.core.state !== LinphoneEnums.ConferenceInfoState.Cancelled
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: qsTr("Rejoindre la réunion")
|
text: qsTr("Rejoindre la réunion")
|
||||||
topPadding: 11 * DefaultStyle.dp
|
topPadding: 11 * DefaultStyle.dp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue