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];
|
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;
|
if (index < 0 || index >= mAddressList.count()) return;
|
||||||
auto map = mAddressList[index].toMap();
|
auto map = mAddressList[index].toMap();
|
||||||
|
if (Utils::isUsername(address)) {
|
||||||
|
address = Utils::interpretUrl(address);
|
||||||
|
}
|
||||||
auto oldLabel = map["label"].toString();
|
auto oldLabel = map["label"].toString();
|
||||||
if (/*oldLabel != label || */ map["address"] != address) {
|
if (/*oldLabel != label || */ map["address"] != address) {
|
||||||
mAddressList.replace(index, createFriendAddressVariant(label.isEmpty() ? oldLabel : label, address));
|
mAddressList.replace(index, createFriendAddressVariant(label.isEmpty() ? oldLabel : label, address));
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public:
|
||||||
QVariant getAddressAt(int index) const;
|
QVariant getAddressAt(int index) const;
|
||||||
Q_INVOKABLE void appendAddress(const QString &addr);
|
Q_INVOKABLE void appendAddress(const QString &addr);
|
||||||
Q_INVOKABLE void removeAddress(int index);
|
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);
|
void setDefaultAddress(const QString &address);
|
||||||
QString getDefaultAddress() const;
|
QString getDefaultAddress() const;
|
||||||
|
|
|
||||||
|
|
@ -283,15 +283,18 @@ QString Utils::formatDateElapsedTime(const QDateTime &date) {
|
||||||
return QString::number(s) + " s";
|
return QString::number(s) + " s";
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Utils::generateLinphoneSipAddress(const QString &uri) {
|
QString Utils::interpretUrl(const QString &uri) {
|
||||||
QString ret = uri;
|
QString address = uri;
|
||||||
if (!ret.startsWith("sip:")) {
|
|
||||||
ret.prepend("sip:");
|
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")) {
|
return address;
|
||||||
ret.append("@sip.linphone.org");
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Utils::findAvatarByAddress(const QString &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 int secsTo(const QString &start, const QString &end);
|
||||||
Q_INVOKABLE static QDateTime addSecs(QDateTime date, int secs);
|
Q_INVOKABLE static QDateTime addSecs(QDateTime date, int secs);
|
||||||
Q_INVOKABLE static QDateTime addYears(QDateTime date, int years);
|
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 QString findAvatarByAddress(const QString &address);
|
||||||
Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address);
|
Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address);
|
||||||
static QString generateSavedFilename(const QString &from, const QString &to);
|
static QString generateSavedFilename(const QString &from, const QString &to);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import QtQuick.Effects
|
||||||
|
|
||||||
import Linphone
|
import Linphone
|
||||||
import UtilsCpp
|
import UtilsCpp
|
||||||
|
import SettingsCpp
|
||||||
|
|
||||||
// Fill contact, account or call
|
// Fill contact, account or call
|
||||||
// Initials will be displayed if there isn't any avatar.
|
// Initials will be displayed if there isn't any avatar.
|
||||||
|
|
@ -15,13 +16,14 @@ StackView {
|
||||||
property AccountGui account: null
|
property AccountGui account: null
|
||||||
property FriendGui contact: null
|
property FriendGui contact: null
|
||||||
property CallGui call: null
|
property CallGui call: null
|
||||||
property string address: account
|
property string _address: account
|
||||||
? account.core.identityAddress
|
? account.core.identityAddress
|
||||||
: call
|
: call
|
||||||
? call.core.peerAddress
|
? call.core.peerAddress
|
||||||
: contact
|
: contact
|
||||||
? contact.core.defaultAddress
|
? contact.core.defaultAddress
|
||||||
: ''
|
: ''
|
||||||
|
property string address: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_address) : _address
|
||||||
property var displayNameObj: UtilsCpp.getDisplayName(address)
|
property var displayNameObj: UtilsCpp.getDisplayName(address)
|
||||||
property string displayNameVal: displayNameObj ? displayNameObj.value : ""
|
property string displayNameVal: displayNameObj ? displayNameObj.value : ""
|
||||||
property bool haveAvatar: (account && account.core.pictureUri )
|
property bool haveAvatar: (account && account.core.pictureUri )
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,14 @@ import QtQuick.Controls
|
||||||
|
|
||||||
import Linphone
|
import Linphone
|
||||||
import UtilsCpp
|
import UtilsCpp
|
||||||
|
import SettingsCpp
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
id: mainItem
|
id: mainItem
|
||||||
property AccountGui account: null
|
property AccountGui account: null
|
||||||
property var displayName: account ? UtilsCpp.getDisplayName(account.core.identityAddress) : ""
|
property var displayName: account ? UtilsCpp.getDisplayName(account.core.identityAddress) : ""
|
||||||
property string topText: displayName ? displayName.value : ""
|
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
|
spacing: 0
|
||||||
width: topTextItem.implicitWidth
|
width: topTextItem.implicitWidth
|
||||||
Text {
|
Text {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import QtCore
|
import QtCore
|
||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Controls as Control
|
import QtQuick.Controls as Control
|
||||||
import QtQuick.Dialogs
|
import QtQuick.Dialogs
|
||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Linphone
|
import Linphone
|
||||||
import UtilsCpp 1.0
|
import UtilsCpp
|
||||||
|
import SettingsCpp
|
||||||
|
|
||||||
RightPanelLayout {
|
RightPanelLayout {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
|
|
@ -167,9 +168,10 @@ RightPanelLayout {
|
||||||
contentItem: RowLayout {
|
contentItem: RowLayout {
|
||||||
TextField {
|
TextField {
|
||||||
onEditingFinished: {
|
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
|
backgroundColor: DefaultStyle.grey_0
|
||||||
Layout.preferredWidth: width
|
Layout.preferredWidth: width
|
||||||
Layout.preferredHeight: height
|
Layout.preferredHeight: height
|
||||||
|
|
@ -285,4 +287,4 @@ RightPanelLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,8 @@ import QtQuick.Effects
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls as Control
|
import QtQuick.Controls as Control
|
||||||
import Linphone
|
import Linphone
|
||||||
import UtilsCpp 1.0
|
import UtilsCpp
|
||||||
|
import SettingsCpp
|
||||||
|
|
||||||
// Display a sticker from a call or from an account.
|
// Display a sticker from a call or from an account.
|
||||||
// The Avatar is shown while the camera become available.
|
// The Avatar is shown while the camera become available.
|
||||||
|
|
@ -180,7 +181,8 @@ Item {
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
horizontalAlignment: Text.AlignHCenter
|
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
|
color: DefaultStyle.grey_0
|
||||||
font {
|
font {
|
||||||
pixelSize: 14 * DefaultStyle.dp
|
pixelSize: 14 * DefaultStyle.dp
|
||||||
|
|
@ -245,11 +247,12 @@ Item {
|
||||||
anchors.leftMargin: 10 * DefaultStyle.dp
|
anchors.leftMargin: 10 * DefaultStyle.dp
|
||||||
anchors.bottomMargin: 10 * DefaultStyle.dp
|
anchors.bottomMargin: 10 * DefaultStyle.dp
|
||||||
width: implicitWidth
|
width: implicitWidth
|
||||||
text: mainItem.peerAddress != ''
|
property string _text: mainItem.peerAddress != ''
|
||||||
? mainItem.peerAddress
|
? mainItem.peerAddress
|
||||||
: mainItem.account && mainItem.identityAddress
|
: mainItem.account && mainItem.identityAddress
|
||||||
? mainItem.identityAddress.value
|
? mainItem.identityAddress.value
|
||||||
: ""
|
: ""
|
||||||
|
text: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_text) : _text
|
||||||
color: DefaultStyle.grey_0
|
color: DefaultStyle.grey_0
|
||||||
font {
|
font {
|
||||||
pixelSize: 14 * DefaultStyle.dp
|
pixelSize: 14 * DefaultStyle.dp
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls as Control
|
import QtQuick.Controls as Control
|
||||||
import Linphone
|
import Linphone
|
||||||
import UtilsCpp 1.0
|
import UtilsCpp
|
||||||
|
import SettingsCpp
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
|
|
@ -148,7 +149,8 @@ ColumnLayout {
|
||||||
spacing: 0
|
spacing: 0
|
||||||
Text {
|
Text {
|
||||||
id: sipAddr
|
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
|
font.pixelSize: 14 * DefaultStyle.dp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import QtQuick 2.15
|
import QtQuick
|
||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls as Control
|
import QtQuick.Controls as Control
|
||||||
import Linphone
|
import Linphone
|
||||||
import UtilsCpp 1.0
|
import UtilsCpp
|
||||||
import EnumsToStringCpp 1.0
|
import EnumsToStringCpp
|
||||||
import SettingsCpp 1.0
|
import SettingsCpp
|
||||||
|
|
||||||
AbstractMainPage {
|
AbstractMainPage {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
|
|
@ -427,7 +427,8 @@ AbstractMainPage {
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
text: modelData.address
|
property string _text: modelData.address
|
||||||
|
text: SettingsCpp.onlyDisplaySipUriUsername ? UtilsCpp.getUsername(_text) : _text
|
||||||
font {
|
font {
|
||||||
pixelSize: 14 * DefaultStyle.dp
|
pixelSize: 14 * DefaultStyle.dp
|
||||||
weight: 400 * DefaultStyle.dp
|
weight: 400 * DefaultStyle.dp
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import QtQuick.Effects
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls as Control
|
import QtQuick.Controls as Control
|
||||||
import Linphone
|
import Linphone
|
||||||
import UtilsCpp 1.0
|
import UtilsCpp
|
||||||
|
|
||||||
// TODO : spacing
|
// TODO : spacing
|
||||||
AbstractMainPage {
|
AbstractMainPage {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue