diff --git a/Linphone/core/friend/FriendCore.cpp b/Linphone/core/friend/FriendCore.cpp index 0f79de878..4214ec211 100644 --- a/Linphone/core/friend/FriendCore.cpp +++ b/Linphone/core/friend/FriendCore.cpp @@ -92,6 +92,7 @@ FriendCore::FriendCore(const std::shared_ptr &contact, bool is mIsStored = isStored; mIsLdap = ToolModel::friendIsInFriendList(ToolModel::getLdapFriendList(), contact); mIsCardDAV = (sourceFlags & (int)linphone::MagicSearch::Source::RemoteCardDAV) != 0; + mIsAppFriend = ToolModel::friendIsInFriendList(ToolModel::getAppFriendList(), contact); } else { mIsSaved = false; mStarred = false; @@ -119,6 +120,7 @@ FriendCore::FriendCore(const FriendCore &friendCore) { mIsSaved = friendCore.mIsSaved; mIsStored = friendCore.mIsStored; mIsLdap = friendCore.mIsLdap; + mIsAppFriend = friendCore.mIsAppFriend; mIsCardDAV = friendCore.mIsCardDAV; } @@ -743,6 +745,10 @@ bool FriendCore::isCardDAV() const { return mIsCardDAV; } +bool FriendCore::isAppFriend() const { + return mIsAppFriend; +} + bool FriendCore::getReadOnly() const { return isLdap() || isCardDAV(); // TODO add conditions for friends retrieved via HTTP // [misc]vcards-contacts-list= & CardDAV diff --git a/Linphone/core/friend/FriendCore.hpp b/Linphone/core/friend/FriendCore.hpp index a6cec35f7..9d2edc631 100644 --- a/Linphone/core/friend/FriendCore.hpp +++ b/Linphone/core/friend/FriendCore.hpp @@ -72,6 +72,7 @@ class FriendCore : public QObject, public AbstractObject { Q_PROPERTY(bool starred READ getStarred WRITE lSetStarred NOTIFY starredChanged) Q_PROPERTY(bool readOnly READ getReadOnly CONSTANT) Q_PROPERTY(bool isLdap READ isLdap CONSTANT) + Q_PROPERTY(bool isAppFriend READ isAppFriend CONSTANT) Q_PROPERTY(bool isCardDAV READ isCardDAV CONSTANT) public: @@ -148,6 +149,7 @@ public: void onPresenceReceived(LinphoneEnums::ConsolidatedPresence consolidatedPresence, QDateTime presenceTimestamp); bool isLdap() const; + bool isAppFriend() const; bool isCardDAV() const; bool getReadOnly() const; @@ -207,7 +209,7 @@ protected: bool mIsSaved; bool mIsStored; QString mVCardString; - bool mIsLdap, mIsCardDAV; + bool mIsLdap, mIsCardDAV, mIsAppFriend; std::shared_ptr mFriendModel; QSharedPointer> mFriendModelConnection; QSharedPointer> mCoreModelConnection; diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 05028c8b6..3ffc98f5a 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -1000,7 +1000,7 @@ menu_see_existing_contact "Voir le contact" - See contact + Show contact diff --git a/Linphone/model/friend/FriendsManager.cpp b/Linphone/model/friend/FriendsManager.cpp index b36a77aa3..e0b7f3bf3 100644 --- a/Linphone/model/friend/FriendsManager.cpp +++ b/Linphone/model/friend/FriendsManager.cpp @@ -19,7 +19,6 @@ */ #include "FriendsManager.hpp" - #include "model/core/CoreModel.hpp" #include "tool/Utils.hpp" #include diff --git a/Linphone/model/tool/ToolModel.cpp b/Linphone/model/tool/ToolModel.cpp index d312e812c..b3e8a9ba9 100644 --- a/Linphone/model/tool/ToolModel.cpp +++ b/Linphone/model/tool/ToolModel.cpp @@ -130,10 +130,10 @@ std::shared_ptr ToolModel::findFriendByAddress(std::shared_ptr auto friendsManager = FriendsManager::getInstance(); QString key = Utils::coreStringToAppString(linphoneAddr->asStringUriOnly()); if (friendsManager->isInKnownFriends(key)) { -// qDebug() << "Friend have been found in known friend, return it"; +// qDebug() << key << "have been found in known friend, return it"; return friendsManager->getKnownFriendAtKey(key); } else if (friendsManager->isInUnknownFriends(key)) { -// qDebug() << "Friend have been found in unknown friend, return it"; +// qDebug() << key << "have been found in unknown friend, return it"; return friendsManager->getUnknownFriendAtKey(key); } auto f = CoreModel::getInstance()->getCore()->findFriend(linphoneAddr); diff --git a/Linphone/view/Page/Main/Call/CallPage.qml b/Linphone/view/Page/Main/Call/CallPage.qml index 323e4c4bd..5afd1e585 100644 --- a/Linphone/view/Page/Main/Call/CallPage.qml +++ b/Linphone/view/Page/Main/Call/CallPage.qml @@ -496,12 +496,11 @@ AbstractMainPage { visible: mainItem.selectedRowHistoryGui != undefined callHistoryGui: selectedRowHistoryGui - property var contactObj: UtilsCpp.findFriendByAddress( - specificAddress) - + property var contactObj: UtilsCpp.findFriendByAddress(specificAddress) contact: contactObj && contactObj.value || null specificAddress: callHistoryGui && callHistoryGui.core.remoteAddress || "" + property bool isLocalFriend: contact ? contact.core.isAppFriend : false buttonContent: PopupButton { id: detailOptions @@ -523,21 +522,16 @@ AbstractMainPage { anchors.fill: parent IconLabelButton { Layout.fillWidth: true - property bool isLdap: contactDetail.contact?.core?.isLdap - || false - property bool isCardDAV: contactDetail.contact?.core?.isCardDAV - || false - property bool isLocalFriend: contactDetail.contact && !isLdap && !isCardDAV - //: "Voir le contact" - text: isLocalFriend ? qsTr("menu_see_existing_contact") : - //: "Ajouter aux contacts" + //: "Show contact" + text: contactDetail.isLocalFriend ? qsTr("menu_see_existing_contact") : + //: "Add to contacts" qsTr("menu_add_address_to_contacts") icon.source: AppIcons.plusCircle icon.width: Math.round(32 * DefaultStyle.dp) icon.height: Math.round(32 * DefaultStyle.dp) onClicked: { detailOptions.close() - if (isLocalFriend) + if (contactDetail.isLocalFriend) mainWindow.displayContactPage( contactDetail.contactAddress) else