From 4433876ad625aeafd1cc7df23dd0ac71622cc9e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Anthony=20L=C3=A9onard?=
 <anthony.leonard@savoirfairelinux.com>
Date: Tue, 15 Nov 2016 11:22:27 -0500
Subject: [PATCH] Bring back username and RingID fields in config panel

It was deleted by mistake so it wasn't possible anymore
to enter an SIP username. This also display the RingID in
case of a Ring account.

Change-Id: I765ee261553249cb6fdec7f06bce1a11b53aaca1
Tuleap: #1312
---
 accountdetails.cpp |  5 ++++
 accountdetails.ui  | 58 ++++++++++++++++++++++++++++++++++++----------
 stylesheet.css     |  4 ++--
 3 files changed, 53 insertions(+), 14 deletions(-)

diff --git a/accountdetails.cpp b/accountdetails.cpp
index 4e57267..0ea405d 100644
--- a/accountdetails.cpp
+++ b/accountdetails.cpp
@@ -113,6 +113,8 @@ AccountDetails::setAccount(Account* currentAccount) {
         return;
 
     if (currentAccount_->protocol() == Account::Protocol::RING) {
+        ui->usernameLabel->setText(tr("RingID"));
+        ui->lrcfg_username->setReadOnly(true);
         if (currentAccount_->registeredName().isEmpty() ){ // If our user isn't registered on the blockhain
             ui->lrcfg_registeredName->clear();
             ui->lrcfg_registeredName->setReadOnly(false);
@@ -124,6 +126,9 @@ AccountDetails::setAccount(Account* currentAccount) {
             ui->lrcfg_registeredName->setReadOnly(true);
             ui->registerButton->hide();
         }
+    } else { // If currentAccount_ is of type SIP
+        ui->usernameLabel->setText(tr("Username"));
+        ui->lrcfg_username->setReadOnly(false);
     }
 
     codecModel_ = currentAccount->codecModel();
diff --git a/accountdetails.ui b/accountdetails.ui
index d7afdb1..cfd1352 100644
--- a/accountdetails.ui
+++ b/accountdetails.ui
@@ -324,7 +324,7 @@
                 </widget>
                </item>
                <item row="1" column="0">
-                <widget class="QLabel" name="usernameLabel">
+                <widget class="QLabel" name="registeredNameLabel">
                  <property name="sizePolicy">
                   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
                    <horstretch>0</horstretch>
@@ -340,7 +340,7 @@
                   <string notr="true">color: rgb(77, 77, 77);</string>
                  </property>
                  <property name="text">
-                  <string>Username</string>
+                  <string>Public username</string>
                  </property>
                  <property name="buddy">
                   <cstring>lrcfg_registeredName</cstring>
@@ -389,7 +389,7 @@
                  </item>
                 </layout>
                </item>
-               <item row="3" column="0">
+               <item row="4" column="0">
                 <widget class="QLabel" name="passwordLabel">
                  <property name="sizePolicy">
                   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -413,7 +413,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="3" column="1">
+               <item row="4" column="1">
                 <widget class="QLineEdit" name="lrcfg_password">
                  <property name="sizePolicy">
                   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -432,7 +432,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="4" column="0">
+               <item row="5" column="0">
                 <widget class="QLabel" name="proxyLabel">
                  <property name="sizePolicy">
                   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -456,7 +456,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="4" column="1">
+               <item row="5" column="1">
                 <widget class="QLineEdit" name="lrcfg_proxy">
                  <property name="sizePolicy">
                   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -472,7 +472,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="5" column="0">
+               <item row="6" column="0">
                 <widget class="QLabel" name="voicemailLabel">
                  <property name="sizePolicy">
                   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
@@ -496,7 +496,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="5" column="1">
+               <item row="6" column="1">
                 <widget class="QLineEdit" name="lrcfg_mailbox">
                  <property name="sizePolicy">
                   <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
@@ -512,7 +512,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="6" column="0">
+               <item row="7" column="0">
                 <widget class="QCheckBox" name="lrcfg_autoAnswer">
                  <property name="font">
                   <font>
@@ -527,7 +527,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="7" column="0">
+               <item row="8" column="0">
                 <widget class="QCheckBox" name="lrcfg_upnpEnabled">
                  <property name="enabled">
                   <bool>true</bool>
@@ -545,7 +545,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="8" column="0">
+               <item row="9" column="0">
                 <widget class="QLabel" name="label">
                  <property name="font">
                   <font>
@@ -560,7 +560,7 @@
                  </property>
                 </widget>
                </item>
-               <item row="8" column="1">
+               <item row="9" column="1">
                 <layout class="QHBoxLayout" name="horizontalLayout_2">
                  <item>
                   <widget class="QRadioButton" name="rtpRadio">
@@ -650,6 +650,40 @@
                  </property>
                 </widget>
                </item>
+               <item row="3" column="1">
+                <widget class="QLineEdit" name="lrcfg_username">
+                 <property name="sizePolicy">
+                  <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+                   <horstretch>0</horstretch>
+                   <verstretch>0</verstretch>
+                  </sizepolicy>
+                 </property>
+                 <property name="minimumSize">
+                  <size>
+                   <width>0</width>
+                   <height>30</height>
+                  </size>
+                 </property>
+                </widget>
+               </item>
+               <item row="3" column="0">
+                <widget class="QLabel" name="usernameLabel">
+                 <property name="font">
+                  <font>
+                   <pointsize>11</pointsize>
+                  </font>
+                 </property>
+                 <property name="styleSheet">
+                  <string notr="true">color: rgb(77, 77, 77);</string>
+                 </property>
+                 <property name="text">
+                  <string>Username</string>
+                 </property>
+                 <property name="buddy">
+                  <cstring>lrcfg_username</cstring>
+                 </property>
+                </widget>
+               </item>
               </layout>
              </item>
              <item>
diff --git a/stylesheet.css b/stylesheet.css
index 38198f8..2bd0e0e 100644
--- a/stylesheet.css
+++ b/stylesheet.css
@@ -504,7 +504,7 @@ QLineEdit#lrcfg_alias, QLineEdit#lrcfg_hostname, QLineEdit#lrcfg_password, QLine
 QLineEdit#lrcfg_mailbox, QLineEdit#lrcfg_tlsPassword, QLineEdit#lrcfg_tlsServerName,
 QLineEdit#lrcfg_turnServerRealm, QLineEdit#lrcfg_turnServerUsername, QLineEdit#lrcfg_turnServerPassword,
 QLineEdit#lrcfg_turnServer, QLineEdit#lrcfg_publishedAddress, QLineEdit#lrcfg_registeredName,
-QLineEdit#lrcfg_nameServiceURL{
+QLineEdit#lrcfg_nameServiceURL, QLineEdit#lrcfg_username{
     background: transparent;
     border-radius: 0px;
     border-style: solid;
@@ -528,7 +528,7 @@ QLineEdit#lrcfg_alias:focus, QLineEdit#lrcfg_hostname:focus, QLineEdit#lrcfg_pas
 QLineEdit#lrcfg_proxy:focus, QLineEdit#lrcfg_mailbox:focus, QLineEdit#lrcfg_tlsPassword:focus,
 QLineEdit#lrcfg_tlsServerName:focus, QLineEdit#lrcfg_turnServerRealm:focus, QLineEdit#lrcfg_turnServerUsername:focus,
 QLineEdit#lrcfg_turnServerPassword:focus, QLineEdit#lrcfg_turnServer:focus, QLineEdit#lrcfg_publishedAddress:focus,
-QLineEdit#lrcfg_registeredName:focus, QLineEdit#lrcfg_nameServiceURL:focus{
+QLineEdit#lrcfg_registeredName:focus, QLineEdit#lrcfg_nameServiceURL:focus, QLineEdit#lrcfg_username:focus{
     border-color: #3AC0D2;
 }
 
-- 
GitLab