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): ...@@ -177,6 +177,7 @@ class PreferencesWindow(base_class, ui_class):
# Account # Account
self.account_list.selectionModel().selectionChanged.connect(self._SH_AccountListSelectionChanged) 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.add_account_button.clicked.connect(self.show_add_account_dialog)
self.delete_account_button.clicked.connect(self._SH_DeleteAccountButtonClicked) self.delete_account_button.clicked.connect(self._SH_DeleteAccountButtonClicked)
...@@ -561,6 +562,14 @@ class PreferencesWindow(base_class, ui_class): ...@@ -561,6 +562,14 @@ class PreferencesWindow(base_class, ui_class):
self.display_name_editor.setText(account.display_name or u'') self.display_name_editor.setText(account.display_name or u'')
if account is not bonjour_account: if account is not bonjour_account:
self.password_editor.setText(account.auth.password) 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 # Media tab
self.account_audio_codecs_list.clear() self.account_audio_codecs_list.clear()
...@@ -728,6 +737,20 @@ class PreferencesWindow(base_class, ui_class): ...@@ -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.xcap_root_editor.inactiveText = u"Taken from the DNS TXT record for xcap.%s" % selected_account.id.domain
self.load_account_settings(selected_account) 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): def _SH_DeleteAccountButtonClicked(self):
model = self.account_list.model() model = self.account_list.model()
......
...@@ -150,6 +150,39 @@ ...@@ -150,6 +150,39 @@
<property name="margin"> <property name="margin">
<number>10</number> <number>10</number>
</property> </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"> <item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="account_enabled_button"> <widget class="QCheckBox" name="account_enabled_button">
<property name="text"> <property name="text">
...@@ -170,6 +203,19 @@ ...@@ -170,6 +203,19 @@
</property> </property>
</spacer> </spacer>
</item> </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"> <item row="1" column="0" colspan="2">
<widget class="Line" name="line"> <widget class="Line" name="line">
<property name="minimumSize"> <property name="minimumSize">
...@@ -183,52 +229,19 @@ ...@@ -183,52 +229,19 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="7" column="0" colspan="2">
<widget class="QLabel" name="display_name_label"> <widget class="QLabel" name="account_registration_label">
<property name="text"> <property name="layoutDirection">
<string>Display Name:</string> <enum>Qt::LeftToRight</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </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"> <property name="text">
<string>Password:</string> <string/>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<widget class="QWidget" name="media_tab"> <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