mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
Fix wrong address on contact edition.
Fix wrong avatar initials in contact details and fix synchronization. Make only one contact search and filter results on each lists. Fix contact aggregation.
This commit is contained in:
parent
6d96359b0a
commit
5a0dd7216e
7 changed files with 43 additions and 38 deletions
|
|
@ -458,7 +458,19 @@ void FriendCore::remove() {
|
|||
}
|
||||
}
|
||||
|
||||
void FriendCore::save() { // Save Values to model
|
||||
void FriendCore::save() { // Save Values to model
|
||||
if (mAddressList.size() > 0) {
|
||||
auto it = std::find_if(mAddressList.begin(), mAddressList.end(), [this](const QVariant &a) {
|
||||
return a.toMap()["address"].toString() == mDefaultAddress;
|
||||
});
|
||||
if (it == mAddressList.end()) {
|
||||
mDefaultAddress = mAddressList[0].toMap()["address"].toString();
|
||||
emit defaultAddressChanged();
|
||||
}
|
||||
} else {
|
||||
mDefaultAddress = "";
|
||||
emit defaultAddressChanged();
|
||||
}
|
||||
FriendCore *thisCopy = new FriendCore(*this); // Pointer to avoid multiple copies in lambdas
|
||||
|
||||
if (mFriendModel) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ VariantList::VariantList(QObject *parent) {
|
|||
}
|
||||
|
||||
VariantList::VariantList(QList<QVariant> list, QObject *parent) {
|
||||
set(list);
|
||||
setModel(list);
|
||||
}
|
||||
|
||||
VariantList::~VariantList() {
|
||||
|
|
@ -36,11 +36,11 @@ int VariantList::rowCount(const QModelIndex &parent) const {
|
|||
return mList.count();
|
||||
}
|
||||
|
||||
void VariantList::set(QList<QVariant> list) {
|
||||
void VariantList::setModel(QList<QVariant> list) {
|
||||
beginResetModel();
|
||||
mList = list;
|
||||
endResetModel();
|
||||
emit listModelChanged();
|
||||
emit modelChanged();
|
||||
}
|
||||
|
||||
void VariantList::replace(int index, QVariant newValue) {
|
||||
|
|
@ -52,4 +52,4 @@ QVariant VariantList::data(const QModelIndex &index, int role) const {
|
|||
if (!index.isValid() || row < 0 || row >= mList.count()) return QVariant();
|
||||
if (role == Qt::DisplayRole) return mList[row];
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@
|
|||
|
||||
class VariantList : public AbstractListProxy<QVariant>, public AbstractObject {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QList<QVariant> model WRITE set NOTIFY listModelChanged)
|
||||
Q_PROPERTY(QList<QVariant> model WRITE setModel NOTIFY modelChanged)
|
||||
public:
|
||||
VariantList(QObject *parent = Q_NULLPTR);
|
||||
VariantList(QList<QVariant> list, QObject *parent = Q_NULLPTR);
|
||||
~VariantList();
|
||||
|
||||
void set(QList<QVariant> list);
|
||||
void setModel(QList<QVariant> list);
|
||||
|
||||
void replace(int index, QVariant newValue);
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ public:
|
|||
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
||||
signals:
|
||||
void listModelChanged();
|
||||
void modelChanged();
|
||||
|
||||
private:
|
||||
DECLARE_ABSTRACT_OBJECT
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ ColumnLayout {
|
|||
id: mainItem
|
||||
spacing: 30 * DefaultStyle.dp
|
||||
|
||||
property var contact
|
||||
property FriendGui contact
|
||||
property string contactAddress: contact && contact.core.defaultAddress || ""
|
||||
property string contactName: contact && contact.core.displayName || ""
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ ColumnLayout {
|
|||
width: 100 * DefaultStyle.dp
|
||||
height: 100 * DefaultStyle.dp
|
||||
contact: mainItem.contact || null
|
||||
address: !contact && mainItem.contactAddress || mainItem.contactName
|
||||
address: mainItem.contactAddress || mainItem.contactName
|
||||
}
|
||||
Item {
|
||||
id: rightButton
|
||||
|
|
|
|||
|
|
@ -229,6 +229,9 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
contactMenuVisible: false
|
||||
searchBarText: searchBar.text
|
||||
model: MagicSearchProxy {
|
||||
searchText: searchBarText.length === 0 ? "*" : searchBarText
|
||||
}
|
||||
onContactSelected: (contact) => {
|
||||
if (contact.core.allAddresses.length > 1) {
|
||||
startCallPopup.contact = contact
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ ListView {
|
|||
id: mainItem
|
||||
Layout.preferredHeight: contentHeight
|
||||
height: contentHeight
|
||||
visible: count > 0
|
||||
visible: contentHeight > 0
|
||||
clip: true
|
||||
|
||||
property string searchBarText
|
||||
|
|
@ -17,7 +17,7 @@ ListView {
|
|||
property bool contactMenuVisible: true
|
||||
property bool initialHeadersVisible: true
|
||||
property bool displayNameCapitalization: true
|
||||
|
||||
property bool showOnlyFavourites: false
|
||||
property int delegateLeftMargin: 0
|
||||
currentIndex: -1
|
||||
|
||||
|
|
@ -33,20 +33,22 @@ ListView {
|
|||
signal contactSelected(var contact)
|
||||
signal contactStarredChanged()
|
||||
signal contactDeletionRequested(FriendGui contact)
|
||||
|
||||
onContactStarredChanged: model.forceUpdate()
|
||||
|
||||
|
||||
model: MagicSearchProxy {
|
||||
searchText: searchBarText.length === 0 ? "*" : searchBarText
|
||||
searchText: searchBarText.length === 0 ? "*" : searchBarText
|
||||
}
|
||||
|
||||
|
||||
delegate: Item {
|
||||
id: itemDelegate
|
||||
height: 56 * DefaultStyle.dp
|
||||
height: display ? 56 * DefaultStyle.dp : 0
|
||||
width: mainItem.width
|
||||
property var previousItem : mainItem.model.count > 0 && index > 0 ? mainItem.model.getAt(index-1) : null
|
||||
property var previousDisplayName: previousItem ? previousItem.core.displayName : ""
|
||||
property var displayName: modelData.core.displayName
|
||||
property bool display: !mainItem.showOnlyFavourites || modelData.core.starred
|
||||
|
||||
visible: display
|
||||
Connections {
|
||||
target: modelData.core
|
||||
onStarredChanged: mainItem.contactStarredChanged()
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ AbstractMainPage {
|
|||
function goToNewCall() {
|
||||
listStackView.replace(newCallItem)
|
||||
}
|
||||
|
||||
property MagicSearchProxy allFriends: MagicSearchProxy {
|
||||
searchText: searchBar.text.length === 0 ? "*" : searchBar.text
|
||||
aggregationFlag: LinphoneEnums.MagicSearchAggregation.Friend
|
||||
}
|
||||
|
||||
Dialog {
|
||||
id: dialog
|
||||
|
|
@ -139,7 +144,7 @@ AbstractMainPage {
|
|||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
ColumnLayout {
|
||||
visible: favoriteList.count > 0
|
||||
visible: favoriteList.contentHeight > 0
|
||||
RowLayout {
|
||||
Text {
|
||||
text: qsTr("Favoris")
|
||||
|
|
@ -163,18 +168,8 @@ AbstractMainPage {
|
|||
id: favoriteList
|
||||
hoverEnabled: mainItem.leftPanelEnabled
|
||||
Layout.fillWidth: true
|
||||
onContactStarredChanged: contactList.model.forceUpdate()
|
||||
Connections {
|
||||
target: mainItem
|
||||
onForceListsUpdate: {
|
||||
contactList.model.forceUpdate()
|
||||
}
|
||||
}
|
||||
model: MagicSearchProxy {
|
||||
searchText: searchBar.text.length === 0 ? "*" : searchBar.text
|
||||
sourceFlags: LinphoneEnums.MagicSearchSource.FavoriteFriends
|
||||
aggregationFlag: LinphoneEnums.MagicSearchAggregation.Friend
|
||||
}
|
||||
showOnlyFavourites: true
|
||||
model: allFriends
|
||||
onSelectedContactChanged: {
|
||||
if (selectedContact) {
|
||||
contactList.currentIndex = -1
|
||||
|
|
@ -214,13 +209,7 @@ AbstractMainPage {
|
|||
hoverEnabled: mainItem.leftPanelEnabled
|
||||
Layout.fillWidth: true
|
||||
searchBarText: searchBar.text
|
||||
onContactStarredChanged: favoriteList.model.forceUpdate()
|
||||
Connections {
|
||||
target: mainItem
|
||||
onForceListsUpdate: {
|
||||
contactList.model.forceUpdate()
|
||||
}
|
||||
}
|
||||
model: allFriends
|
||||
onSelectedContactChanged: {
|
||||
if (selectedContact) {
|
||||
favoriteList.currentIndex = -1
|
||||
|
|
@ -290,7 +279,6 @@ AbstractMainPage {
|
|||
model: VariantList {
|
||||
model: mainItem.selectedContact ? mainItem.selectedContact.core.allAddresses : []
|
||||
}
|
||||
// model: contactDetail.selectedContact && contactDetail.selectedContact.core.addresses
|
||||
delegate: Item {
|
||||
width: addrList.width
|
||||
height: 70 * DefaultStyle.dp
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue