mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-07 15:08:24 +00:00
display only usernames on config RC.
This commit is contained in:
parent
846f043b6d
commit
42a00cc236
11 changed files with 47 additions and 30 deletions
|
|
@ -349,9 +349,12 @@ QVariant FriendCore::getAddressAt(int index) const {
|
|||
return mAddressList[index];
|
||||
}
|
||||
|
||||
void FriendCore::setAddressAt(int index, const QString &label, const QString &address) {
|
||||
void FriendCore::setAddressAt(int index, const QString &label, QString address) {
|
||||
if (index < 0 || index >= mAddressList.count()) return;
|
||||
auto map = mAddressList[index].toMap();
|
||||
if (Utils::isUsername(address)) {
|
||||
address = Utils::interpretUrl(address);
|
||||
}
|
||||
auto oldLabel = map["label"].toString();
|
||||
if (/*oldLabel != label || */ map["address"] != address) {
|
||||
mAddressList.replace(index, createFriendAddressVariant(label.isEmpty() ? oldLabel : label, address));
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public:
|
|||
QVariant getAddressAt(int index) const;
|
||||
Q_INVOKABLE void appendAddress(const QString &addr);
|
||||
Q_INVOKABLE void removeAddress(int index);
|
||||
Q_INVOKABLE void setAddressAt(int index, const QString &label, const QString &address);
|
||||
Q_INVOKABLE void setAddressAt(int index, const QString &label, QString address);
|
||||
|
||||
void setDefaultAddress(const QString &address);
|
||||
QString getDefaultAddress() const;
|
||||
|
|
|
|||
|
|
@ -283,15 +283,18 @@ QString Utils::formatDateElapsedTime(const QDateTime &date) {
|
|||
return QString::number(s) + " s";
|
||||
}
|
||||
|
||||
QString Utils::generateLinphoneSipAddress(const QString &uri) {
|
||||
QString ret = uri;
|
||||
if (!ret.startsWith("sip:")) {
|
||||
ret.prepend("sip:");
|
||||
QString Utils::interpretUrl(const QString &uri) {
|
||||
QString address = uri;
|
||||
|
||||
if (!address.contains('@')) {
|
||||
App::postModelBlock([address, uri]() mutable {
|
||||
auto addr = ToolModel::interpretUrl(uri);
|
||||
if (addr) address = Utils::coreStringToAppString(addr->asStringUriOnly());
|
||||
});
|
||||
} else if (!address.startsWith("sip:")) {
|
||||
address.prepend("sip:");
|
||||
}
|
||||
if (!ret.endsWith("@sip.linphone.org")) {
|
||||
ret.append("@sip.linphone.org");
|
||||
}
|
||||
return ret;
|
||||
return address;
|
||||
}
|
||||
|
||||
QString Utils::findAvatarByAddress(const QString &address) {
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public:
|
|||
Q_INVOKABLE static int secsTo(const QString &start, const QString &end);
|
||||
Q_INVOKABLE static QDateTime addSecs(QDateTime date, int secs);
|
||||
Q_INVOKABLE static QDateTime addYears(QDateTime date, int years);
|
||||
Q_INVOKABLE static QString generateLinphoneSipAddress(const QString &uri);
|
||||
Q_INVOKABLE static QString interpretUrl(const QString &uri);
|
||||
Q_INVOKABLE static QString findAvatarByAddress(const QString &address);
|
||||
Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address);
|
||||
static QString generateSavedFilename(const QString &from, const QString &to);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import QtQuick.Effects
|
|||
|
||||
import Linphone
|
||||
import UtilsCpp
|
||||
import SettingsCpp
|
||||
|
||||
// Fill contact, account or call
|
||||
// Initials will be displayed if there isn't any avatar.
|
||||
|
|
@ -15,13 +16,14 @@ StackView {
|
|||
property AccountGui account: null
|
||||
property FriendGui contact: null
|
||||
property CallGui call: null
|
||||
property string address: account
|
||||
property string _address: account
|
||||
? account.core.identityAddress
|
||||
: call
|
||||
? call.core.peerAddress
|
||||
: contact
|
||||
? contact.core.defaultAddress
|
||||
: ''
|
||||
property string address: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_address) : _address
|
||||
property var displayNameObj: UtilsCpp.getDisplayName(address)
|
||||
property string displayNameVal: displayNameObj ? displayNameObj.value : ""
|
||||
property bool haveAvatar: (account && account.core.pictureUri )
|
||||
|
|
|
|||
|
|
@ -4,13 +4,14 @@ import QtQuick.Controls
|
|||
|
||||
import Linphone
|
||||
import UtilsCpp
|
||||
import SettingsCpp
|
||||
|
||||
ColumnLayout{
|
||||
id: mainItem
|
||||
property AccountGui account: null
|
||||
property var displayName: account ? UtilsCpp.getDisplayName(account.core.identityAddress) : ""
|
||||
property string topText: displayName ? displayName.value : ""
|
||||
property string bottomText: account ? account.core.identityAddress : ""
|
||||
property string bottomText: account ? SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(account.core.identityAddress) : account.core.identityAddress : ""
|
||||
spacing: 0
|
||||
width: topTextItem.implicitWidth
|
||||
Text {
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
import QtCore
|
||||
import QtQuick 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Controls as Control
|
||||
import QtQuick.Dialogs
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import Linphone
|
||||
import UtilsCpp 1.0
|
||||
import UtilsCpp
|
||||
import SettingsCpp
|
||||
|
||||
RightPanelLayout {
|
||||
id: mainItem
|
||||
|
|
@ -167,9 +168,10 @@ RightPanelLayout {
|
|||
contentItem: RowLayout {
|
||||
TextField {
|
||||
onEditingFinished: {
|
||||
if (text.length != 0) mainItem.contact.core.setAddressAt(index, qsTr("Address SIP"), text)
|
||||
if (text.length != 0) mainItem.contact.core.setAddressAt(index, qsTr("Adresse SIP"), text)
|
||||
}
|
||||
initialText: modelData.address
|
||||
property string _initialText: modelData.address
|
||||
initialText: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_initialText) : _initialText
|
||||
backgroundColor: DefaultStyle.grey_0
|
||||
Layout.preferredWidth: width
|
||||
Layout.preferredHeight: height
|
||||
|
|
@ -285,4 +287,4 @@ RightPanelLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@ import QtQuick.Effects
|
|||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Control
|
||||
import Linphone
|
||||
import UtilsCpp 1.0
|
||||
import UtilsCpp
|
||||
import SettingsCpp
|
||||
|
||||
// Display a sticker from a call or from an account.
|
||||
// The Avatar is shown while the camera become available.
|
||||
|
|
@ -180,7 +181,8 @@ Item {
|
|||
Text {
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: mainItem.call && mainItem.call.core.peerAddress
|
||||
property string _text: mainItem.call && mainItem.call.core.peerAddress
|
||||
text: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_text) : _text
|
||||
color: DefaultStyle.grey_0
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
|
|
@ -245,11 +247,12 @@ Item {
|
|||
anchors.leftMargin: 10 * DefaultStyle.dp
|
||||
anchors.bottomMargin: 10 * DefaultStyle.dp
|
||||
width: implicitWidth
|
||||
text: mainItem.peerAddress != ''
|
||||
property string _text: mainItem.peerAddress != ''
|
||||
? mainItem.peerAddress
|
||||
: mainItem.account && mainItem.identityAddress
|
||||
? mainItem.identityAddress.value
|
||||
: ""
|
||||
text: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_text) : _text
|
||||
color: DefaultStyle.grey_0
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Control
|
||||
import Linphone
|
||||
import UtilsCpp 1.0
|
||||
import UtilsCpp
|
||||
import SettingsCpp
|
||||
|
||||
ColumnLayout {
|
||||
id: mainItem
|
||||
|
|
@ -148,7 +149,8 @@ ColumnLayout {
|
|||
spacing: 0
|
||||
Text {
|
||||
id: sipAddr
|
||||
text: UtilsCpp.generateLinphoneSipAddress(searchbar.text)
|
||||
property string _text: UtilsCpp.interpretUrl(searchbar.text)
|
||||
text: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_text) : _text
|
||||
font.pixelSize: 14 * DefaultStyle.dp
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Control
|
||||
import Linphone
|
||||
import UtilsCpp 1.0
|
||||
import EnumsToStringCpp 1.0
|
||||
import SettingsCpp 1.0
|
||||
import UtilsCpp
|
||||
import EnumsToStringCpp
|
||||
import SettingsCpp
|
||||
|
||||
AbstractMainPage {
|
||||
id: mainItem
|
||||
|
|
@ -427,7 +427,8 @@ AbstractMainPage {
|
|||
}
|
||||
Text {
|
||||
Layout.fillWidth: true
|
||||
text: modelData.address
|
||||
property string _text: modelData.address
|
||||
text: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_text) : _text
|
||||
font {
|
||||
pixelSize: 14 * DefaultStyle.dp
|
||||
weight: 400 * DefaultStyle.dp
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import QtQuick.Effects
|
|||
import QtQuick.Layouts
|
||||
import QtQuick.Controls as Control
|
||||
import Linphone
|
||||
import UtilsCpp 1.0
|
||||
import UtilsCpp
|
||||
|
||||
// TODO : spacing
|
||||
AbstractMainPage {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue