Added NOTIFY to readOnly property on friendcode + default value

This commit is contained in:
Christophe Deschamps 2024-09-27 17:50:14 +02:00
parent 36d63098a7
commit 46a42456ab
2 changed files with 6 additions and 2 deletions

View file

@ -100,6 +100,7 @@ FriendCore::FriendCore(const std::shared_ptr<linphone::Friend> &contact) : QObje
mStarred = false;
}
mIsLdap = false;
connect(this, &FriendCore::addressChanged, &FriendCore::allAddressesChanged);
connect(this, &FriendCore::phoneNumberChanged, &FriendCore::allAddressesChanged);
}
@ -116,6 +117,7 @@ FriendCore::FriendCore(const FriendCore &friendCore) {
mJob = friendCore.mJob;
mPictureUri = friendCore.mPictureUri;
mIsSaved = friendCore.mIsSaved;
mIsLdap = friendCore.mIsLdap;
}
FriendCore::~FriendCore() {
@ -622,7 +624,7 @@ void FriendCore::save() { // Save Values to model
(core->getDefaultFriendList()->addFriend(contact) == linphone::FriendList::Status::OK);
if (created) {
core->getDefaultFriendList()->updateSubscriptions();
emit CoreModel::getInstance() -> friendCreated(contact);
emit CoreModel::getInstance()->friendCreated(contact);
}
mCoreModelConnection->invokeToCore([this, created]() {
if (created) setSelf(mCoreModelConnection->mCore);
@ -655,6 +657,7 @@ bool FriendCore::getIsLdap() const {
void FriendCore::setIsLdap(bool data) {
if (mIsLdap != data) {
mIsLdap = data;
emit readOnlyChanged();
}
}

View file

@ -67,7 +67,7 @@ class FriendCore : public QObject, public AbstractObject {
Q_PROPERTY(bool isSaved READ getIsSaved NOTIFY isSavedChanged)
Q_PROPERTY(QString pictureUri READ getPictureUri WRITE setPictureUri NOTIFY pictureUriChanged)
Q_PROPERTY(bool starred READ getStarred WRITE lSetStarred NOTIFY starredChanged)
Q_PROPERTY(bool readOnly READ getReadOnly CONSTANT)
Q_PROPERTY(bool readOnly READ getReadOnly NOTIFY readOnlyChanged)
public:
// Should be call from model Thread. Will be automatically in App thread after initialization
@ -168,6 +168,7 @@ signals:
void devicesChanged();
void verifiedDevicesChanged();
void lSetStarred(bool starred);
void readOnlyChanged();
protected:
void writeIntoModel(std::shared_ptr<FriendModel> model) const;