Fix the search when the same address couldn't be used after inviting and declining, in participants list of conference.

This commit is contained in:
Julien Wadel 2022-08-22 11:04:14 +02:00
parent e648b40db6
commit 0794293a69
4 changed files with 25 additions and 2 deletions

View file

@ -23,6 +23,7 @@
#include "components/contact/ContactModel.hpp"
#include "components/contact/VcardModel.hpp"
#include "components/core/CoreManager.hpp"
#include "components/participant/ParticipantListModel.hpp"
#include "components/sip-addresses/SipAddressesModel.hpp"
#include "components/sip-addresses/SipAddressesSorter.hpp"
@ -35,6 +36,7 @@
// -----------------------------------------------------------------------------
SearchSipAddressesProxyModel::SearchSipAddressesProxyModel (QObject *parent) : QSortFilterProxyModel(parent) {
mParticipantListModel = nullptr;
setSourceModel(new SearchSipAddressesModel(this));
sort(0);
}
@ -45,11 +47,22 @@ SearchSipAddressesModel * SearchSipAddressesProxyModel::getModel(){
return qobject_cast<SearchSipAddressesModel*>(sourceModel());
}
ParticipantListModel * SearchSipAddressesProxyModel::getParticipantListModel() const{
return mParticipantListModel;
}
void SearchSipAddressesProxyModel::setFilter (const QString &pattern){
mFilter = pattern;
getModel()->setFilter(pattern);
}
void SearchSipAddressesProxyModel::setParticipantListModel(ParticipantListModel * model){
if(mParticipantListModel != model){
mParticipantListModel = model;
emit participantListModelChanged();
}
}
void SearchSipAddressesProxyModel::addAddressToIgnore(const QString& address){
std::shared_ptr<linphone::Address> a = Utils::interpretUrl(address);
if(a) {
@ -79,7 +92,9 @@ bool SearchSipAddressesProxyModel::filterAcceptsRow (int sourceRow, const QModel
const SearchResultModel * model = sourceModel()->data(index).value<SearchResultModel*>();
if(!model)
return false;
else
else if(mParticipantListModel){
return !mParticipantListModel->contains(Utils::coreStringToAppString(model->getAddress()->asStringUriOnly()));
}else
return !mResultsToIgnore.contains(Utils::coreStringToAppString(model->getAddress()->asStringUriOnly()));
}

View file

@ -23,6 +23,7 @@
#include <QSortFilterProxyModel>
class ParticipantListModel;
class SearchSipAddressesModel;
// =============================================================================
@ -34,18 +35,22 @@ public:
SearchSipAddressesProxyModel (QObject *parent = Q_NULLPTR);
Q_PROPERTY(SearchSipAddressesModel * model READ getModel CONSTANT)
Q_PROPERTY(ParticipantListModel *participantListModel READ getParticipantListModel WRITE setParticipantListModel NOTIFY participantListModelChanged)
Q_INVOKABLE void addAddressToIgnore(const QString& address);
Q_INVOKABLE void removeAddressToIgnore(const QString& address);
Q_INVOKABLE bool isIgnored(const QString& address) const;
SearchSipAddressesModel * getModel();
ParticipantListModel * getParticipantListModel() const;
Q_INVOKABLE void setFilter (const QString &pattern);
void setResultExceptions(QAbstractListModel* exceptionList);
void setParticipantListModel( ParticipantListModel *model);
signals:
void participantListModelChanged();
void resultExceptionsChanged();
protected:
@ -55,7 +60,7 @@ protected:
private:
QMap<QString, bool> mResultsToIgnore;
QString mFilter;
ParticipantListModel *mParticipantListModel = nullptr;
};
#endif

View file

@ -21,6 +21,8 @@ SearchBox {
property string previousText: text
onTextChanged: if( text != '') previousText = text;
property alias participantListModel : searchModel.participantListModel
function addAddressToIgnore(entry){
searchModel.addAddressToIgnore(entry)
}

View file

@ -54,6 +54,7 @@ ColumnLayout {
selectedParticipants.addAddress(entry.sipAddress)
},
}]
participantListModel: selectedParticipants.participantListModel
onEntryClicked: {
selectedParticipants.addAddress(entry.sipAddress)