mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
feat(Call): display correctly forced display name and only sip uri in description
This commit is contained in:
parent
d7be2afbb7
commit
8bf34d85ca
5 changed files with 16 additions and 13 deletions
|
|
@ -71,7 +71,7 @@ CallModel::~CallModel () {
|
|||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString CallModel::getSipAddress () const {
|
||||
return ::Utils::coreStringToAppString(mCall->getRemoteAddress()->asStringUriOnly());
|
||||
return ::Utils::coreStringToAppString(mCall->getRemoteAddress()->asString());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -99,9 +99,10 @@ ContactModel *SipAddressesModel::mapSipAddressToContact (const QString &sipAddre
|
|||
|
||||
SipAddressObserver *SipAddressesModel::getSipAddressObserver (const QString &sipAddress) {
|
||||
SipAddressObserver *model = new SipAddressObserver(sipAddress);
|
||||
const QString cleanedSipAddress = cleanSipAddress(sipAddress);
|
||||
|
||||
{
|
||||
auto it = mSipAddresses.find(sipAddress);
|
||||
auto it = mSipAddresses.find(cleanedSipAddress);
|
||||
if (it != mSipAddresses.end()) {
|
||||
model->setContact(it->value("contact").value<ContactModel *>());
|
||||
model->setPresenceStatus(
|
||||
|
|
@ -113,10 +114,10 @@ SipAddressObserver *SipAddressesModel::getSipAddressObserver (const QString &sip
|
|||
}
|
||||
}
|
||||
|
||||
mObservers.insert(sipAddress, model);
|
||||
mObservers.insert(cleanedSipAddress, model);
|
||||
QObject::connect(
|
||||
model, &SipAddressObserver::destroyed, this, [this, model]() {
|
||||
const QString sipAddress = model->getSipAddress();
|
||||
const QString sipAddress = cleanSipAddress(model->getSipAddress());
|
||||
if (mObservers.remove(sipAddress, model) == 0)
|
||||
qWarning() << QStringLiteral("Unable to remove sip address `%1` from observers.").arg(sipAddress);
|
||||
});
|
||||
|
|
@ -190,6 +191,13 @@ bool SipAddressesModel::sipAddressIsValid (const QString &sipAddress) {
|
|||
return address && !address->getUsername().empty();
|
||||
}
|
||||
|
||||
QString SipAddressesModel::cleanSipAddress (const QString &sipAddress) {
|
||||
const int index = sipAddress.lastIndexOf('<');
|
||||
if (index == -1)
|
||||
return sipAddress;
|
||||
return sipAddress.mid(index + 1, sipAddress.lastIndexOf('>') - index - 1);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
bool SipAddressesModel::removeRow (int row, const QModelIndex &parent) {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ public:
|
|||
Q_INVOKABLE static bool addressIsValid (const QString &address);
|
||||
Q_INVOKABLE static bool sipAddressIsValid (const QString &sipAddress);
|
||||
|
||||
Q_INVOKABLE static QString cleanSipAddress (const QString &sipAddress);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import QtQuick 2.7
|
||||
|
||||
import Linphone 1.0
|
||||
import Linphone.Styles 1.0
|
||||
import LinphoneUtils 1.0
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ Column {
|
|||
}
|
||||
|
||||
Text {
|
||||
text: LinphoneUtils.cleanSipAddress(sipAddress)
|
||||
text: SipAddressesModel.cleanSipAddress(sipAddress)
|
||||
|
||||
color: sipAddressColor
|
||||
elide: Text.ElideRight
|
||||
|
|
|
|||
|
|
@ -84,10 +84,3 @@ function getContactUsername (contact) {
|
|||
name = _getUsername(object)
|
||||
return name == null ? 'Bad EGG' : name
|
||||
}
|
||||
|
||||
function cleanSipAddress (sipAddress) {
|
||||
var index = sipAddress.indexOf('<')
|
||||
return index === -1
|
||||
? sipAddress
|
||||
: sipAddress.substring(index + 1, sipAddress.lastIndexOf('>'))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue