diff --git a/tests/resources.qrc b/tests/resources.qrc index 3e3342b71..7937a92e6 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -127,6 +127,7 @@ ui/modules/Linphone/Presence/PresenceString.qml ui/modules/Linphone/qmldir ui/modules/Linphone/Select/SelectContact.qml + ui/modules/Linphone/SmartSearchBar.qml ui/modules/Linphone/Styles/Account/AccountStatusStyle.qml ui/modules/Linphone/Styles/ChatStyle.qml ui/modules/Linphone/Styles/Contact/AvatarStyle.qml diff --git a/tests/src/components/contacts/ContactModel.hpp b/tests/src/components/contacts/ContactModel.hpp index a6f509a52..f5e05e78b 100644 --- a/tests/src/components/contacts/ContactModel.hpp +++ b/tests/src/components/contacts/ContactModel.hpp @@ -10,6 +10,7 @@ // =================================================================== class ContactModel : public QObject { + friend class ContactsListModel; friend class ContactsListProxyModel; Q_OBJECT; diff --git a/tests/src/components/contacts/ContactsListModel.cpp b/tests/src/components/contacts/ContactsListModel.cpp index d4ea5b526..0b28ef3c8 100644 --- a/tests/src/components/contacts/ContactsListModel.cpp +++ b/tests/src/components/contacts/ContactsListModel.cpp @@ -59,6 +59,7 @@ bool ContactsListModel::removeRows (int row, int count, const QModelIndex &paren ContactModel *contact = m_list[row]; m_list.removeAt(row); + m_linphone_friends->removeFriend(contact->m_linphone_friend); contact->deleteLater(); } diff --git a/tests/src/components/contacts/ContactsListModel.hpp b/tests/src/components/contacts/ContactsListModel.hpp index cfb7abe1f..5ba186f13 100644 --- a/tests/src/components/contacts/ContactsListModel.hpp +++ b/tests/src/components/contacts/ContactsListModel.hpp @@ -25,7 +25,6 @@ public: bool removeRow (int row, const QModelIndex &parent = QModelIndex()); bool removeRows (int row, int count, const QModelIndex &parent = QModelIndex()); - public slots: // See: http://doc.qt.io/qt-5/qtqml-cppintegration-data.html#data-ownership // The returned value must have a explicit parent or a QQmlEngine::CppOwnership. diff --git a/tests/src/components/smart-search-bar/SmartSearchBarModel.cpp b/tests/src/components/smart-search-bar/SmartSearchBarModel.cpp new file mode 100644 index 000000000..5c486c816 --- /dev/null +++ b/tests/src/components/smart-search-bar/SmartSearchBarModel.cpp @@ -0,0 +1 @@ +#include "SmartSearchBarModel.hpp" diff --git a/tests/src/components/smart-search-bar/SmartSearchBarModel.hpp b/tests/src/components/smart-search-bar/SmartSearchBarModel.hpp new file mode 100644 index 000000000..0d56ab8a0 --- /dev/null +++ b/tests/src/components/smart-search-bar/SmartSearchBarModel.hpp @@ -0,0 +1,9 @@ +#ifndef SMART_SEARCH_BAR_MODEL_H_ +#define SMART_SEARCH_BAR_MODEL_H_ + +class SmartSearchBarModel { + + +}; + +#endif diff --git a/tests/ui/modules/Linphone/SmartSearchBar.qml b/tests/ui/modules/Linphone/SmartSearchBar.qml new file mode 100644 index 000000000..436624278 --- /dev/null +++ b/tests/ui/modules/Linphone/SmartSearchBar.qml @@ -0,0 +1,25 @@ +import Common 1.0 +import Linphone 1.0 + +// =================================================================== + +SearchBox { + id: searchBox + + delegate: Contact { + contact: $contact + width: parent.width + + actions: [ + ActionButton { + icon: 'call' + onClicked: CallsWindow.show() + }, + + ActionButton { + icon: 'video_call' + onClicked: CallsWindow.show() + } + ] + } +} diff --git a/tests/ui/modules/Linphone/qmldir b/tests/ui/modules/Linphone/qmldir index 84540b032..54dda1f0b 100644 --- a/tests/ui/modules/Linphone/qmldir +++ b/tests/ui/modules/Linphone/qmldir @@ -27,5 +27,8 @@ PresenceString 1.0 Presence/PresenceString.qml # Select SelectContact 1.0 Select/SelectContact.qml +# SmartSearchBar +SmartSearchBar 1.0 SmartSearchBar.qml + # Timeline Timeline 1.0 Timeline.qml diff --git a/tests/ui/views/App/MainWindow/MainWindow.qml b/tests/ui/views/App/MainWindow/MainWindow.qml index e86b9656c..6cb793ce9 100644 --- a/tests/ui/views/App/MainWindow/MainWindow.qml +++ b/tests/ui/views/App/MainWindow/MainWindow.qml @@ -28,7 +28,7 @@ ApplicationWindow { visible: true onActiveFocusItemChanged: activeFocusItem == null && - searchBox.hideMenu() + smartSearchBar.hideMenu() // ----------------------------------------------------------------- // Toolbar properties. @@ -82,32 +82,14 @@ ApplicationWindow { } } - SearchBox { - id: searchBox + SmartSearchBar { + id: smartSearchBar Layout.fillWidth: true entryHeight: MainWindowStyle.searchBox.entryHeight maxMenuHeight: MainWindowStyle.searchBox.maxHeight - placeholderText: qsTr('mainSearchBarPlaceholder') - model: ContactsListProxyModel {} - - delegate: Contact { - contact: $contact - width: parent.width - - actions: [ - ActionButton { - icon: 'call' - onClicked: CallsWindow.show() - }, - - ActionButton { - icon: 'video_call' - onClicked: CallsWindow.show() - } - ] - } + placeholderText: qsTr('mainSearchBarPlaceholder') } } }