From a19f260fe137f37cfbd90736fa98572b1d46c617 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> Date: Fri, 24 Apr 2015 18:00:44 -0400 Subject: [PATCH] credential: Synchronize username Refs #71613 --- src/account.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/account.cpp b/src/account.cpp index 7d9c841c..c73690f3 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -1046,6 +1046,21 @@ void Account::setHostname(const QString& detail) void Account::setUsername(const QString& detail) { d_ptr->setAccountProperty(DRing::Account::ConfProperties::USERNAME, detail); + switch (protocol()) { + case Account::Protocol::IAX: + case Account::Protocol::RING: + case Account::Protocol::COUNT__: + //nothing to do + break; + case Account::Protocol::SIP: + if (credentialModel()->rowCount()) + credentialModel()->setData(credentialModel()->index(0,0),detail,CredentialModel::Role::NAME); + else { + const QModelIndex idx = credentialModel()->addCredentials(); + credentialModel()->setData(idx,detail,CredentialModel::Role::NAME); + } + break; + }; } ///Set the account mailbox, usually a number, but can be anything -- GitLab