mainview: fix account selection
- avoid duplicate call of LRC's setTopAccount()
- welcome view displays always the first account on the list, so passing the index is not necessary
- conversationsadapter and messagesadapter no longer listen to currentAccountChanged signal since there is a specific function for the setup
Gitlab: #12
Change-Id: Iac932d2596bf59c7528d83be799342ccefeea6b0
diff --git a/src/mainview/components/AccountComboBox.qml b/src/mainview/components/AccountComboBox.qml
index 5c58708..dce72c8 100644
--- a/src/mainview/components/AccountComboBox.qml
+++ b/src/mainview/components/AccountComboBox.qml
@@ -27,35 +27,29 @@
id: accountComboBox
signal accountChanged(int index)
- signal needToBackToWelcomePage(int index)
+ signal needToBackToWelcomePage()
signal needToUpdateSmartList(string accountId)
signal newAccountButtonClicked
signal settingBtnClicked
currentIndex: 0
- function backToWelcomePage(index) {
- accountComboBox.needToBackToWelcomePage(index)
+ function backToWelcomePage() {
+ needToBackToWelcomePage()
}
function updateSmartList(accountId) {
- accountComboBox.needToUpdateSmartList(accountId)
+ needToUpdateSmartList(accountId)
}
-
- /*
- * Refresh every item in accountListModel.
- */
+ // Refresh every item in accountListModel.
function updateAccountListModel() {
accountListModel.dataChanged(accountListModel.index(0, 0),
accountListModel.index(
accountListModel.rowCount() - 1, 0))
}
-
- /*
- * Reset accountListModel.
- */
+ // Reset accountListModel.
function resetAccountListModel() {
accountListModel.reset()
}
@@ -72,10 +66,7 @@
fillMode: Image.PreserveAspectFit
-
- /*
- * Base 64 format
- */
+ // Base 64 format
source: {
if (currentIndex !== -1)
return "data:image/png;base64," + accountListModel.data(
@@ -97,10 +88,7 @@
width: 12
height: 12
-
- /*
- * Visible when account is registered, enum REGISTERED == 5.
- */
+ // Visible when account is registered, enum REGISTERED == 5.
visible: {
if (currentIndex !== -1)
return accountListModel.data(
@@ -153,7 +141,6 @@
source: "qrc:/images/icons/round-arrow_drop_down-24px.svg"
}
-
Text {
id: textUsernameRoot
@@ -174,10 +161,7 @@
elideWidth: accountComboBox.width - userImageRoot.width - settingsButton.width
- arrowDropDown.width - qrCodeGenerateButton.width - 55
-
- /*
- * Role::Alias
- */
+ // Role::Alias
text: {
if (currentIndex !== -1)
return accountListModel.data(accountListModel.index(
@@ -197,9 +181,8 @@
- qrCodeGenerateButton.width - 55
- /*
- * Role::Username
- */
+
+ // Role::Username
text: {
if (currentIndex !== -1)
return accountListModel.data(accountListModel.index(
@@ -210,8 +193,6 @@
}
}
-
-
HoverableButton {
id: qrCodeGenerateButton
@@ -308,9 +289,8 @@
rootItemBackground.color = JamiTheme.backgroundColor
}
onMouseXChanged: {
- /*
- * Manually making button hover.
- */
+
+ // Manually making button hover.
qrCodeGenerateButton.backgroundColor = (isMouseOnButton(mouse, qrCodeGenerateButton)) ?
JamiTheme.hoverColor : "white"
@@ -334,10 +314,7 @@
indicator: null
-
- /*
- * Overwrite the combo box pop up to add footer (for add accounts).
- */
+ // Overwrite the combo box pop up to add footer (for add accounts).
popup: AccountComboBoxPopup {
id: comboBoxPopup