Commit 2b470ccc authored by Saul Ibarra's avatar Saul Ibarra

Added label with account registration status to preferences panel

parent da449a8a
......@@ -177,6 +177,7 @@ class PreferencesWindow(base_class, ui_class):
# Account
self.account_list.selectionModel().selectionChanged.connect(self._SH_AccountListSelectionChanged)
self.account_list.model().dataChanged.connect(self._SH_AccountListDataChanged)
self.add_account_button.clicked.connect(self.show_add_account_dialog)
self.delete_account_button.clicked.connect(self._SH_DeleteAccountButtonClicked)
......@@ -561,6 +562,14 @@ class PreferencesWindow(base_class, ui_class):
self.display_name_editor.setText(account.display_name or u'')
if account is not bonjour_account:
self.password_editor.setText(account.auth.password)
selected_index = self.account_list.selectionModel().selectedIndexes()[0]
selected_account_info = self.account_list.model().data(selected_index, Qt.UserRole)
if selected_account_info.registration_state:
self.account_registration_label.setText(u'Registration %s' % selected_account_info.registration_state.title())
else:
self.account_registration_label.setText(u'Not Registered')
else:
self.account_registration_label.setText(u'')
# Media tab
self.account_audio_codecs_list.clear()
......@@ -728,6 +737,20 @@ class PreferencesWindow(base_class, ui_class):
self.xcap_root_editor.inactiveText = u"Taken from the DNS TXT record for xcap.%s" % selected_account.id.domain
self.load_account_settings(selected_account)
def _SH_AccountListDataChanged(self, topLeft, bottomRight):
try:
selected_index = self.account_list.selectionModel().selectedIndexes()[0]
except IndexError:
pass
else:
account_info = self.account_list.model().data(topLeft, Qt.UserRole)
selected_account_info = self.account_list.model().data(selected_index, Qt.UserRole)
if selected_account_info is account_info:
if account_info.registration_state:
self.account_registration_label.setText(u'Registration %s' % account_info.registration_state.title())
else:
self.account_registration_label.setText(u'Not Registered')
def _SH_DeleteAccountButtonClicked(self):
model = self.account_list.model()
......
......@@ -150,6 +150,39 @@
<property name="margin">
<number>10</number>
</property>
<item row="3" column="0">
<widget class="QLabel" name="password_label">
<property name="text">
<string>Password:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="password_editor">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<spacer name="account_information_spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="account_enabled_button">
<property name="text">
......@@ -170,6 +203,19 @@
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="display_name_editor"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="display_name_label">
<property name="text">
<string>Display Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="Line" name="line">
<property name="minimumSize">
......@@ -183,52 +229,19 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="display_name_label">
<property name="text">
<string>Display Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="account_registration_label">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="display_name_editor"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="password_label">
<property name="text">
<string>Password:</string>
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="password_editor">
<property name="echoMode">
<enum>QLineEdit::Password</enum>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<spacer name="account_information_spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="media_tab">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment