mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-17 20:08:28 +00:00
feat(ManageAccounts): display unread message count on each proxy config
This commit is contained in:
parent
1e35340244
commit
3cab5c6dd1
10 changed files with 63 additions and 23 deletions
|
|
@ -426,6 +426,7 @@
|
|||
<file>ui/views/App/Main/Dialogs/About.qml</file>
|
||||
<file>ui/views/App/Main/Dialogs/AuthenticationRequest.js</file>
|
||||
<file>ui/views/App/Main/Dialogs/AuthenticationRequest.qml</file>
|
||||
<file>ui/views/App/Main/Dialogs/ManageAccount.js</file>
|
||||
<file>ui/views/App/Main/Dialogs/ManageAccounts.qml</file>
|
||||
<file>ui/views/App/Main/Home.qml</file>
|
||||
<file>ui/views/App/Main/InviteFriends.qml</file>
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@ QVariantList AccountSettingsModel::getAccounts () const {
|
|||
{
|
||||
QVariantMap account;
|
||||
account["sipAddress"] = Utils::coreStringToAppString(core->getPrimaryContactParsed()->asStringUriOnly());
|
||||
account["unreadMessageCount"] = core->getUnreadChatMessageCountFromLocal(core->getPrimaryContactParsed());
|
||||
accounts << account;
|
||||
}
|
||||
|
||||
|
|
@ -369,6 +370,7 @@ QVariantList AccountSettingsModel::getAccounts () const {
|
|||
QVariantMap account;
|
||||
account["sipAddress"] = Utils::coreStringToAppString(proxyConfig->getIdentityAddress()->asStringUriOnly());
|
||||
account["proxyConfig"].setValue(proxyConfig);
|
||||
account["unreadMessageCount"] = proxyConfig->getUnreadChatMessageCount();
|
||||
accounts << account;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ function getSelectedEntryText () {
|
|||
return ''
|
||||
}
|
||||
|
||||
function getEntryIcon (item) {
|
||||
function getItemIcon (item) {
|
||||
var iconRole = comboBox.iconRole
|
||||
if (iconRole == null || iconRole.length === 0) {
|
||||
return ''
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ Controls.ComboBox {
|
|||
container: comboBox
|
||||
flattenedModel: comboBox.textRole.length &&
|
||||
(typeof modelData !== 'undefined' ? modelData : model)
|
||||
itemIcon: Logic.getEntryIcon(item)
|
||||
itemIcon: Logic.getItemIcon(item)
|
||||
width: comboBox.width
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ Controls.ItemDelegate {
|
|||
property var flattenedModel
|
||||
property var itemIcon
|
||||
|
||||
default property alias _content: content.data
|
||||
|
||||
hoverEnabled: true
|
||||
|
||||
background: Rectangle {
|
||||
|
|
@ -64,7 +66,14 @@ Controls.ItemDelegate {
|
|||
pointSize: CommonItemDelegateStyle.contentItem.text.pointSize
|
||||
}
|
||||
|
||||
text: item.flattenedModel[textRole] || modelData
|
||||
text: item.flattenedModel[container.textRole] || modelData
|
||||
}
|
||||
|
||||
Item {
|
||||
id: content
|
||||
|
||||
Layout.preferredWidth: CommonItemDelegateStyle.contentItem.iconSize
|
||||
Layout.preferredHeight: CommonItemDelegateStyle.contentItem.iconSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
// =============================================================================
|
||||
|
||||
function getEntryIcon (item) {
|
||||
function getItemIcon (item) {
|
||||
var iconRole = view.iconRole
|
||||
if (iconRole == null || iconRole.length === 0) {
|
||||
return ''
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ ScrollableListViewField {
|
|||
container: view
|
||||
flattenedModel: view.textRole.length &&
|
||||
(typeof modelData !== 'undefined' ? modelData : model)
|
||||
itemIcon: Logic.getEntryIcon(item)
|
||||
itemIcon: Logic.getItemIcon(item)
|
||||
width: parent.width
|
||||
|
||||
onClicked: activated(index)
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ ActionButton 1.0 Form/ActionButton.qml
|
|||
ActionSwitch 1.0 Form/ActionSwitch.qml
|
||||
CheckBoxText 1.0 Form/CheckBoxText.qml
|
||||
ComboBox 1.0 Form/ComboBox.qml
|
||||
CommonItemDelegate 1.0 Form/CommonItemDelegate.qml
|
||||
DroppableTextArea 1.0 Form/DroppableTextArea.qml
|
||||
ListForm 1.0 Form/ListForm.qml
|
||||
ListItemSelector 1.0 Form/ListItemSelector.qml
|
||||
|
|
|
|||
15
ui/views/App/Main/Dialogs/ManageAccount.js
Normal file
15
ui/views/App/Main/Dialogs/ManageAccount.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// =============================================================================
|
||||
// `ManageAccount.qml` Logic.
|
||||
// =============================================================================
|
||||
|
||||
function getItemIcon (data) {
|
||||
var proxyConfig = data.proxyConfig
|
||||
if (!proxyConfig) {
|
||||
return ''
|
||||
}
|
||||
|
||||
var description = AccountSettingsModel.getProxyConfigDescription(proxyConfig)
|
||||
return description.registerEnabled && description.registrationState !== AccountSettingsModel.RegistrationStateRegistered
|
||||
? 'generic_error'
|
||||
: ''
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@ import Utils 1.0
|
|||
|
||||
import App.Styles 1.0
|
||||
|
||||
import 'ManageAccount.js' as Logic
|
||||
|
||||
// =============================================================================
|
||||
|
||||
DialogPlus {
|
||||
|
|
@ -53,29 +55,39 @@ DialogPlus {
|
|||
FormGroup {
|
||||
label: qsTr('selectAccountLabel')
|
||||
|
||||
ListItemSelector {
|
||||
ScrollableListViewField {
|
||||
width: parent.width
|
||||
height: ManageAccountsStyle.accountSelector.height
|
||||
|
||||
currentIndex: Utils.findIndex(AccountSettingsModel.accounts, function (account) {
|
||||
return account.sipAddress === AccountSettingsModel.sipAddress
|
||||
})
|
||||
radius: 0
|
||||
|
||||
model: AccountSettingsModel.accounts
|
||||
iconRole: (function (data) {
|
||||
var proxyConfig = data.proxyConfig
|
||||
if (!proxyConfig) {
|
||||
return ''
|
||||
ScrollableListView {
|
||||
id: view
|
||||
|
||||
property string textRole: 'sipAddress' // Used by delegate.
|
||||
|
||||
anchors.fill: parent
|
||||
currentIndex: Utils.findIndex(AccountSettingsModel.accounts, function (account) {
|
||||
return account.sipAddress === AccountSettingsModel.sipAddress
|
||||
})
|
||||
model: AccountSettingsModel.accounts
|
||||
|
||||
delegate: CommonItemDelegate {
|
||||
id: item
|
||||
|
||||
container: view
|
||||
flattenedModel: modelData
|
||||
itemIcon: Logic.getItemIcon(flattenedModel)
|
||||
width: parent.width
|
||||
|
||||
onClicked: AccountSettingsModel.setDefaultProxyConfig(flattenedModel.proxyConfig)
|
||||
|
||||
MessageCounter {
|
||||
anchors.fill: parent
|
||||
count: flattenedModel.unreadMessageCount
|
||||
}
|
||||
}
|
||||
|
||||
var description = AccountSettingsModel.getProxyConfigDescription(proxyConfig)
|
||||
return description.registerEnabled && description.registrationState !== AccountSettingsModel.RegistrationStateRegistered
|
||||
? 'generic_error'
|
||||
: ''
|
||||
})
|
||||
textRole: 'sipAddress'
|
||||
|
||||
onActivated: AccountSettingsModel.setDefaultProxyConfig(model[index].proxyConfig)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue