diff --git a/tests/ui/modules/Common/Collapse.qml b/tests/ui/modules/Common/Collapse.qml index 9050c6196..4a9b76da7 100644 --- a/tests/ui/modules/Common/Collapse.qml +++ b/tests/ui/modules/Common/Collapse.qml @@ -3,9 +3,9 @@ import QtQuick 2.7 import Common 1.0 import Common.Styles 1.0 -// =================================================================== +// ============================================================================= // A simple component to build collapsed item. -// =================================================================== +// ============================================================================= Item { id: collapse @@ -17,13 +17,13 @@ Item { signal collapsed (bool collapsed) - // ----------------------------------------------------------------- + // --------------------------------------------------------------------------- - function isCollapsed () { - return _collapsed + function setCollapsed (status) { + _collapsed = status } - // ----------------------------------------------------------------- + // --------------------------------------------------------------------------- implicitHeight: button.iconSize implicitWidth: button.iconSize @@ -39,7 +39,7 @@ Item { onClicked: _collapsed = !_collapsed } - // ----------------------------------------------------------------- + // --------------------------------------------------------------------------- states: State { when: _collapsed diff --git a/tests/ui/modules/Common/Menu/Menu.qml b/tests/ui/modules/Common/Menu/Menu.qml index 5e9ed2393..9f9bf2284 100644 --- a/tests/ui/modules/Common/Menu/Menu.qml +++ b/tests/ui/modules/Common/Menu/Menu.qml @@ -4,9 +4,9 @@ import QtQuick.Layouts 1.3 import Common 1.0 import Common.Styles 1.0 -// =================================================================== +// ============================================================================= // Responsive flat menu with visual indicators. -// =================================================================== +// ============================================================================= Rectangle { id: menu @@ -19,13 +19,17 @@ Rectangle { signal entrySelected (int entry) - // ----------------------------------------------------------------- + // --------------------------------------------------------------------------- + + function setSelectedEntry (entry) { + _selectedEntry = entry + } function resetSelectedEntry () { _selectedEntry = -1 } - // ----------------------------------------------------------------- + // --------------------------------------------------------------------------- color: MenuStyle.backgroundColor implicitHeight: content.height diff --git a/tests/ui/modules/Linphone/SmartSearchBar.qml b/tests/ui/modules/Linphone/SmartSearchBar.qml index c327a3a59..b5e3175e0 100644 --- a/tests/ui/modules/Linphone/SmartSearchBar.qml +++ b/tests/ui/modules/Linphone/SmartSearchBar.qml @@ -13,9 +13,8 @@ SearchBox { delegate: Rectangle { id: searchBoxEntry - width: parent.width height: searchBox.entryHeight - color: '#FFFFFF' + width: parent.width Rectangle { id: indicator @@ -85,9 +84,13 @@ SearchBox { ActionButton { icon: 'chat' - onClicked: window.setView('Conversation', { - sipAddress: $entry.sipAddress || $entry.vcard.sipAddresses[0] // FIXME: Display menu if many addresses. - }) + onClicked: { + searchBox.hideMenu() + window.ensureCollapsed() + window.setView('Conversation', { + sipAddress: $entry.sipAddress || $entry.vcard.sipAddresses[0] // FIXME: Display menu if many addresses. + }) + } } } } diff --git a/tests/ui/modules/Linphone/Timeline.qml b/tests/ui/modules/Linphone/Timeline.qml index 54b7f85f0..51d6b8eb9 100644 --- a/tests/ui/modules/Linphone/Timeline.qml +++ b/tests/ui/modules/Linphone/Timeline.qml @@ -17,7 +17,18 @@ ColumnLayout { // --------------------------------------------------------------------------- - function resetSelectedItem () { + function setSelectedEntry (sipAddress) { + var n = model.rowCount() + + for (var i = 0; i < n; i++) { + if (sipAddress === model.data(model.index(i, 0)).sipAddress) { + view.currentIndex = i + return + } + } + } + + function resetSelectedEntry () { view.currentIndex = -1 } @@ -25,12 +36,15 @@ ColumnLayout { spacing: 0 + // --------------------------------------------------------------------------- + // Legend. + // --------------------------------------------------------------------------- + Rectangle { Layout.fillWidth: true Layout.preferredHeight: TimelineStyle.legend.height color: TimelineStyle.legend.backgroundColor - // Legend. Row { anchors { fill: parent @@ -55,7 +69,10 @@ ColumnLayout { } } + // --------------------------------------------------------------------------- // History. + // --------------------------------------------------------------------------- + ScrollableListView { id: view diff --git a/tests/ui/views/App/MainWindow/Conversation.qml b/tests/ui/views/App/MainWindow/Conversation.qml index 80ef4f427..31cab0929 100644 --- a/tests/ui/views/App/MainWindow/Conversation.qml +++ b/tests/ui/views/App/MainWindow/Conversation.qml @@ -57,8 +57,8 @@ ColumnLayout { Layout.preferredHeight: ConversationStyle.bar.avatarSize Layout.preferredWidth: ConversationStyle.bar.avatarSize - image: _contact.avatar - presenceLevel: _contact.presenceLevel || Presence.White + image: _contact.vcard.avatar + presenceLevel: _contact.presenceLevel || -1 username: LinphoneUtils.getContactUsername(_contact) } diff --git a/tests/ui/views/App/MainWindow/MainWindow.qml b/tests/ui/views/App/MainWindow/MainWindow.qml index 0504e89b7..023a963ac 100644 --- a/tests/ui/views/App/MainWindow/MainWindow.qml +++ b/tests/ui/views/App/MainWindow/MainWindow.qml @@ -14,9 +14,21 @@ ApplicationWindow { id: window function setView (view, props) { + if (view === 'Home' || view === 'Contacts') { + menu.setSelectedEntry(view === 'Home' ? 0 : 1) + timeline.resetSelectedEntry() + } else if (view === 'Conversation') { + menu.resetSelectedEntry() + timeline.setSelectedEntry(props.sipAddress) + } + contentLoader.setSource(view + '.qml', props || {}) } + function ensureCollapsed () { + collapse.setCollapsed(true) + } + // --------------------------------------------------------------------------- // Window properties. // --------------------------------------------------------------------------- @@ -46,6 +58,8 @@ ApplicationWindow { spacing: MainWindowStyle.toolBar.spacing Collapse { + id: collapse + Layout.fillHeight: parent.height target: window targetHeight: MainWindowStyle.minimumHeight @@ -123,15 +137,7 @@ ApplicationWindow { icon: 'contact' }] - onEntrySelected: { - timeline.resetSelectedItem() - - if (entry === 0) { - setView('Home') - } else if (entry === 1) { - setView('Contacts') - } - } + onEntrySelected: !entry ? setView('Home') : setView('Contacts') } // History. @@ -142,10 +148,7 @@ ApplicationWindow { Layout.fillWidth: true model: TimelineModel - onEntrySelected: { - menu.resetSelectedEntry() - setView('Conversation', { sipAddress: entry }) - } + onEntrySelected: setView('Conversation', { sipAddress: entry }) } }