mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-30 16:06:24 +00:00
feat(ui/views/App/Main/Assistant): supports display name
This commit is contained in:
parent
46e9c13b81
commit
b61cb10019
9 changed files with 89 additions and 16 deletions
|
|
@ -515,6 +515,10 @@ Server url not configured.</translation>
|
|||
<source>quitWarning</source>
|
||||
<translation>Your account has been created but is not yet validated. If you quit this view, you should add manually your account and validate it within 24 hours.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>displayNameLabel</source>
|
||||
<translation>Display name (optional)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CreateLinphoneSipAccountWithPhoneNumber</name>
|
||||
|
|
@ -534,6 +538,10 @@ Server url not configured.</translation>
|
|||
<source>usernameLabel</source>
|
||||
<translation>Username</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>displayNameLabel</source>
|
||||
<translation>Display name (optional)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DroppableTextArea</name>
|
||||
|
|
@ -982,10 +990,6 @@ to chat or see the conversation history.</translation>
|
|||
<source>defaultIdentityTitle</source>
|
||||
<translation>Default identity</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>defaultDisplaynameLabel</source>
|
||||
<translation>Display name</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>defaultUsernameLabel</source>
|
||||
<translation>Username</translation>
|
||||
|
|
@ -1026,6 +1030,10 @@ to chat or see the conversation history.</translation>
|
|||
<source>eraseAllPasswordsDescription</source>
|
||||
<translation>Are you sure you want to erase all passwords?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>defaultDisplayNameLabel</source>
|
||||
<translation>Display name</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsSipAccountsEdit</name>
|
||||
|
|
|
|||
|
|
@ -515,6 +515,10 @@ Url du serveur non configurée.</translation>
|
|||
<source>quitWarning</source>
|
||||
<translation>Votre compte a été crée mais il n'a pas été validé. Si vous quittez cette vue, vous devrez ajouter manuellement votre compte et le valider dans les 24 heures.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>displayNameLabel</source>
|
||||
<translation>Nom d'affichage (optionnel)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>CreateLinphoneSipAccountWithPhoneNumber</name>
|
||||
|
|
@ -534,6 +538,10 @@ Url du serveur non configurée.</translation>
|
|||
<source>usernameLabel</source>
|
||||
<translation>Nom d'utilisateur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>displayNameLabel</source>
|
||||
<translation>Nom d'affichage (optionnel)</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DroppableTextArea</name>
|
||||
|
|
@ -981,10 +989,6 @@ chatter ou voir l'historique de conversation.</translation>
|
|||
<source>defaultIdentityTitle</source>
|
||||
<translation>Identité par défaut</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>defaultDisplaynameLabel</source>
|
||||
<translation>Nom d'affichage</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>defaultUsernameLabel</source>
|
||||
<translation>Nom d'utilisateur</translation>
|
||||
|
|
@ -1025,6 +1029,10 @@ chatter ou voir l'historique de conversation.</translation>
|
|||
<source>eraseAllPasswordsDescription</source>
|
||||
<translation>Êtes-vous sûr de vouloir supprimer tous vos mots de passe ?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>defaultDisplayNameLabel</source>
|
||||
<translation>Nom d'affichage</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsSipAccountsEdit</name>
|
||||
|
|
|
|||
|
|
@ -207,6 +207,8 @@ void AssistantModel::setEmail (const QString &email) {
|
|||
emit emailChanged(email, error);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString AssistantModel::getPassword () const {
|
||||
return ::Utils::linphoneStringToQString(mAccountCreator->getPassword());
|
||||
}
|
||||
|
|
@ -237,6 +239,8 @@ void AssistantModel::setPassword (const QString &password) {
|
|||
emit passwordChanged(password, error);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString AssistantModel::getPhoneNumber () const {
|
||||
return ::Utils::linphoneStringToQString(mAccountCreator->getPhoneNumber());
|
||||
}
|
||||
|
|
@ -250,15 +254,43 @@ void AssistantModel::setPhoneNumber (const QString &phoneNumber) {
|
|||
emit phoneNumberChanged(phoneNumber, error);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString AssistantModel::getUsername () const {
|
||||
return ::Utils::linphoneStringToQString(mAccountCreator->getUsername());
|
||||
}
|
||||
|
||||
void AssistantModel::setUsername (const QString &username) {
|
||||
emit usernameChanged(
|
||||
username,
|
||||
mapAccountCreatorUsernameStatusToString(
|
||||
mAccountCreator->setUsername(::Utils::qStringToLinphoneString(username))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString AssistantModel::getDisplayName () const {
|
||||
return ::Utils::linphoneStringToQString(mAccountCreator->getDisplayName());
|
||||
}
|
||||
|
||||
void AssistantModel::setDisplayName (const QString &displayName) {
|
||||
emit displayNameChanged(
|
||||
displayName,
|
||||
mapAccountCreatorUsernameStatusToString(
|
||||
mAccountCreator->setDisplayName(::Utils::qStringToLinphoneString(displayName))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QString AssistantModel::mapAccountCreatorUsernameStatusToString (linphone::AccountCreatorUsernameStatus status) const {
|
||||
shared_ptr<linphone::Config> config = CoreManager::getInstance()->getCore()->getConfig();
|
||||
QString error;
|
||||
|
||||
switch (mAccountCreator->setUsername(::Utils::qStringToLinphoneString(username))) {
|
||||
switch (status) {
|
||||
case linphone::AccountCreatorUsernameStatusOk:
|
||||
break;
|
||||
case linphone::AccountCreatorUsernameStatusTooShort:
|
||||
|
|
@ -276,5 +308,5 @@ void AssistantModel::setUsername (const QString &username) {
|
|||
break;
|
||||
}
|
||||
|
||||
emit usernameChanged(username, error);
|
||||
return error;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class AssistantModel : public QObject {
|
|||
Q_PROPERTY(QString password READ getPassword WRITE setPassword NOTIFY passwordChanged);
|
||||
Q_PROPERTY(QString phoneNumber READ getPhoneNumber WRITE setPhoneNumber NOTIFY phoneNumberChanged);
|
||||
Q_PROPERTY(QString username READ getUsername WRITE setUsername NOTIFY usernameChanged);
|
||||
Q_PROPERTY(QString displayName READ getDisplayName WRITE setDisplayName NOTIFY displayNameChanged);
|
||||
|
||||
public:
|
||||
AssistantModel (QObject *parent = Q_NULLPTR);
|
||||
|
|
@ -52,6 +53,7 @@ signals:
|
|||
void passwordChanged (const QString &password, const QString &error);
|
||||
void phoneNumberChanged (const QString &phoneNumber, const QString &error);
|
||||
void usernameChanged (const QString &username, const QString &error);
|
||||
void displayNameChanged (const QString &displayName, const QString &error);
|
||||
|
||||
void activateStatusChanged (const QString &error);
|
||||
void createStatusChanged (const QString &error);
|
||||
|
|
@ -70,6 +72,11 @@ private:
|
|||
QString getUsername () const;
|
||||
void setUsername (const QString &username);
|
||||
|
||||
QString getDisplayName () const;
|
||||
void setDisplayName (const QString &displayName);
|
||||
|
||||
QString mapAccountCreatorUsernameStatusToString (linphone::AccountCreatorUsernameStatus status) const;
|
||||
|
||||
std::shared_ptr<linphone::AccountCreator> mAccountCreator;
|
||||
std::shared_ptr<Handlers> mHandlers;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -246,11 +246,11 @@ QString AccountSettingsModel::getPrimaryDisplayname () const {
|
|||
);
|
||||
}
|
||||
|
||||
void AccountSettingsModel::setPrimaryDisplayname (const QString &displayname) {
|
||||
void AccountSettingsModel::setPrimaryDisplayname (const QString &displayName) {
|
||||
shared_ptr<linphone::Core> core = CoreManager::getInstance()->getCore();
|
||||
shared_ptr<linphone::Address> primary = core->getPrimaryContactParsed();
|
||||
|
||||
primary->setDisplayName(::Utils::qStringToLinphoneString(displayname));
|
||||
primary->setDisplayName(::Utils::qStringToLinphoneString(displayName));
|
||||
core->setPrimaryContact(primary->asString());
|
||||
|
||||
emit accountSettingsUpdated();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ private:
|
|||
void setPrimaryUsername (const QString &username);
|
||||
|
||||
QString getPrimaryDisplayname () const;
|
||||
void setPrimaryDisplayname (const QString &displayname);
|
||||
void setPrimaryDisplayname (const QString &displayName);
|
||||
|
||||
QString getPrimarySipAddress () const;
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,14 @@ AssistantAbstractView {
|
|||
onTextChanged: assistantModel.username = text
|
||||
}
|
||||
}
|
||||
|
||||
FormGroup {
|
||||
label: qsTr('displayNameLabel')
|
||||
|
||||
TextField {
|
||||
onTextChanged: assistantModel.displayName = text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,16 @@ AssistantAbstractView {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('displayNameLabel')
|
||||
|
||||
TextField {
|
||||
onTextChanged: assistantModel.displayName = text
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@ TabContainer {
|
|||
|
||||
FormLine {
|
||||
FormGroup {
|
||||
label: qsTr('defaultDisplaynameLabel')
|
||||
label: qsTr('defaultDisplayNameLabel')
|
||||
|
||||
TextField {
|
||||
text: AccountSettingsModel.primaryDisplayname
|
||||
text: AccountSettingsModel.primarydisplayName
|
||||
|
||||
onEditingFinished: AccountSettingsModel.primaryDisplayname = text
|
||||
onEditingFinished: AccountSettingsModel.primarydisplayName = text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue