diff --git a/Linphone/core/conference/ConferenceInfoProxy.cpp b/Linphone/core/conference/ConferenceInfoProxy.cpp index 8dc46c40b..4dcde6ef5 100644 --- a/Linphone/core/conference/ConferenceInfoProxy.cpp +++ b/Linphone/core/conference/ConferenceInfoProxy.cpp @@ -93,7 +93,7 @@ bool ConferenceInfoProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sou return res; } else return mFilterType == -1; } else { - return !mList->haveCurrentDate() && - mList->getCount() > 1; // if mlist count == 1 there is only the dummy row which we don't display alone + return !mList->haveCurrentDate() && mList->getCount() > 1 && + mSearchText.isEmpty(); // if mlist count == 1 there is only the dummy row which we don't display alone } } \ No newline at end of file diff --git a/Linphone/core/search/MagicSearchList.cpp b/Linphone/core/search/MagicSearchList.cpp index dd208cb39..8d76129b1 100644 --- a/Linphone/core/search/MagicSearchList.cpp +++ b/Linphone/core/search/MagicSearchList.cpp @@ -176,15 +176,11 @@ QVariant MagicSearchList::data(const QModelIndex &index, int role) const { int MagicSearchList::findFriendIndexByAddress(const QString &address) { int i = 0; - qDebug() << "[MagicSearchList] LOOKING FOR ADDRESS" << address; - for (auto &item : mList) { - qDebug() << "item" << item; - auto isFriendCore = item.objectCast(); - if (!isFriendCore) continue; - qDebug() << "[MagicSearchList] SEARCH IN FRIEND" << isFriendCore->getDisplayName(); - for (auto &friendAddress : isFriendCore->getAllAddresses()) { + for (int i = 0; i < getCount();) { + auto friendCore = getAt(i); + if (!friendCore) continue; + for (auto &friendAddress : friendCore->getAllAddresses()) { auto map = friendAddress.toMap(); - // qDebug() << "COMPARE" << map["address"].toString(); if (map["address"].toString() == address) { return i; } diff --git a/Linphone/core/timezone/TimeZoneList.cpp b/Linphone/core/timezone/TimeZoneList.cpp index db93e04a1..3d5346bb8 100644 --- a/Linphone/core/timezone/TimeZoneList.cpp +++ b/Linphone/core/timezone/TimeZoneList.cpp @@ -58,35 +58,21 @@ void TimeZoneList::initTimeZones() { } } -QHash TimeZoneList::roleNames() const { - QHash roles; - roles[Qt::DisplayRole] = "$modelData"; - roles[Qt::DisplayRole + 1] = "$timeZoneModel"; - return roles; -} - QVariant TimeZoneList::data(const QModelIndex &index, int role) const { int row = index.row(); if (!index.isValid() || row < 0 || row >= mList.count()) return QVariant(); auto timeZoneModel = getAt(row); if (!timeZoneModel) return QVariant(); - if (role == Qt::DisplayRole) { - int offset = timeZoneModel->getStandardTimeOffset() / 3600; - int absOffset = std::abs(offset); + int offset = timeZoneModel->getStandardTimeOffset() / 3600; + int absOffset = std::abs(offset); - return QStringLiteral("(GMT%1%2%3:00) %4 %5") - .arg(offset >= 0 ? "+" : "-") - .arg(absOffset < 10 ? "0" : "") - .arg(absOffset) - .arg(timeZoneModel->getCountryName()) - .arg(timeZoneModel->getTimeZone().comment().isEmpty() ? "" - : (" - " + timeZoneModel->getTimeZone().comment())); - } else { - return QVariant::fromValue(timeZoneModel.get()); - } - - return QVariant(); + return QStringLiteral("(GMT%1%2%3:00) %4 %5") + .arg(offset >= 0 ? "+" : "-") + .arg(absOffset < 10 ? "0" : "") + .arg(absOffset) + .arg(timeZoneModel->getCountryName()) + .arg(timeZoneModel->getTimeZone().comment().isEmpty() ? "" : (" - " + timeZoneModel->getTimeZone().comment())); } int TimeZoneList::get(const QTimeZone &timeZone) const { diff --git a/Linphone/core/timezone/TimeZoneList.hpp b/Linphone/core/timezone/TimeZoneList.hpp index c2b54f824..8c82ff9c3 100644 --- a/Linphone/core/timezone/TimeZoneList.hpp +++ b/Linphone/core/timezone/TimeZoneList.hpp @@ -38,7 +38,6 @@ public: void initTimeZones(); int get(const QTimeZone &timeZone = QTimeZone::systemTimeZone()) const; - QHash roleNames() const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; private: diff --git a/Linphone/view/App/AppWindow.qml b/Linphone/view/App/AppWindow.qml index aff098aee..6b83b25ef 100644 --- a/Linphone/view/App/AppWindow.qml +++ b/Linphone/view/App/AppWindow.qml @@ -8,6 +8,11 @@ import SettingsCpp 1.0 ApplicationWindow { id: mainWindow + MouseArea { + anchors.fill: parent + onClicked: forceActiveFocus() + } + Component { id: popupComp InformationPopup{} diff --git a/Linphone/view/App/Layout/MainLayout.qml b/Linphone/view/App/Layout/MainLayout.qml index 49451f80b..dc6f31288 100644 --- a/Linphone/view/App/Layout/MainLayout.qml +++ b/Linphone/view/App/Layout/MainLayout.qml @@ -21,7 +21,7 @@ Item { signal addAccountRequest() signal openNewCall() signal openCallHistory() - signal displayContact(string contactAddress) + signal displayContactRequested(string contactAddress) signal createContactRequested(string name, string address) function goToNewCall() { @@ -32,9 +32,9 @@ Item { tabbar.currentIndex = 0 mainItem.openCallHistory() } - function goToContactPage(contactAddress) { + function displayContactPage(contactAddress) { tabbar.currentIndex = 1 - mainItem.displayContact(contactAddress) + mainItem.displayContactRequested(contactAddress) } function createContact(name, address) { @@ -390,12 +390,12 @@ Item { id: contactPage Connections { target: mainItem - function onCreateContactRequested (name, address) { + function onCreateContactRequested(name, address) { contactPage.createContact(name, address) } - function onDisplayContact (contactAddress) { - contactPage.displayContact(contactAddress) - } + function onDisplayContactRequested(contactAddress) { + contactPage.initialFriendToDisplay = contactAddress + } } } Item{} diff --git a/Linphone/view/App/Main.qml b/Linphone/view/App/Main.qml index 0e22ce4b1..f2105c30d 100644 --- a/Linphone/view/App/Main.qml +++ b/Linphone/view/App/Main.qml @@ -33,9 +33,9 @@ AppWindow { mainWindowStackView.replace(mainPage, StackView.Immediate) mainWindowStackView.currentItem.goToNewCall() } - function goToContactPage(contactAddress) { + function displayContactPage(contactAddress) { mainWindowStackView.replace(mainPage, StackView.Immediate) - mainWindowStackView.currentItem.goToContactPage(contactAddress) + mainWindowStackView.currentItem.displayContactPage(contactAddress) } function transferCallSucceed() { mainWindowStackView.replace(mainPage, StackView.Immediate) diff --git a/Linphone/view/Item/Contact/ContactsList.qml b/Linphone/view/Item/Contact/ContactsList.qml index 4e2b80702..7d3b6cba1 100644 --- a/Linphone/view/Item/Contact/ContactsList.qml +++ b/Linphone/view/Item/Contact/ContactsList.qml @@ -49,12 +49,11 @@ ListView { signal contactAddedToSelection() function selectContact(address) { - console.log("select", address) var index = magicSearchProxy.findFriendIndexByAddress(address) - console.log("index in selection", index) if (index != -1) { mainItem.currentIndex = index } + return index } function addContactToSelection(address) { if (multiSelectionEnabled) { diff --git a/Linphone/view/Item/Meeting/MeetingSetUp.qml b/Linphone/view/Item/Meeting/MeetingSetUp.qml index fd4ba9c46..aed8ead2c 100644 --- a/Linphone/view/Item/Meeting/MeetingSetUp.qml +++ b/Linphone/view/Item/Meeting/MeetingSetUp.qml @@ -293,10 +293,10 @@ ColumnLayout { ComboBox { id: timeZoneCbox - Layout.fillWidth: true + Layout.preferredWidth: 307 * DefaultStyle.dp Layout.preferredHeight: 30 * DefaultStyle.dp hoverEnabled: true - listView.implicitHeight: 152 * DefaultStyle.dp + listView.implicitHeight: 250 * DefaultStyle.dp constantImageSource: AppIcons.globe weight: 700 * DefaultStyle.dp leftMargin: 0 @@ -312,33 +312,33 @@ ColumnLayout { var modelIndex = timeZoneCbox.model.index(currentIndex, 0) mainItem.conferenceInfoGui.core.timeZoneModel = timeZoneCbox.model.data(modelIndex, Qt.DisplayRole + 1) } - }, - - ComboBox { - id: repeaterCbox - enabled: false - Component.onCompleted: console.log("TODO : handle conf repetition") - constantImageSource: AppIcons.reloadArrow - Layout.fillWidth: true - Layout.preferredHeight: height - height: 30 * DefaultStyle.dp - width: 307 * DefaultStyle.dp - weight: 700 * DefaultStyle.dp - leftMargin: 0 - currentIndex: 0 - background: Rectangle { - visible: parent.hovered || parent.down - anchors.fill: parent - color: DefaultStyle.grey_100 - } - model: [ - {text: qsTr("Une fois")}, - {text: qsTr("Tous les jours")}, - {text: qsTr("Tous les jours de la semaine (Lun-Ven)")}, - {text: qsTr("Toutes les semaines")}, - {text: qsTr("Tous les mois")} - ] } + + // ComboBox { + // id: repeaterCbox + // enabled: false + // Component.onCompleted: console.log("TODO : handle conf repetition") + // constantImageSource: AppIcons.reloadArrow + // Layout.fillWidth: true + // Layout.preferredHeight: height + // height: 30 * DefaultStyle.dp + // width: 307 * DefaultStyle.dp + // weight: 700 * DefaultStyle.dp + // leftMargin: 0 + // currentIndex: 0 + // background: Rectangle { + // visible: parent.hovered || parent.down + // anchors.fill: parent + // color: DefaultStyle.grey_100 + // } + // model: [ + // {text: qsTr("Une fois")}, + // {text: qsTr("Tous les jours")}, + // {text: qsTr("Tous les jours de la semaine (Lun-Ven)")}, + // {text: qsTr("Toutes les semaines")}, + // {text: qsTr("Tous les mois")} + // ] + // } ] diff --git a/Linphone/view/Page/Main/CallPage.qml b/Linphone/view/Page/Main/CallPage.qml index a924c2649..a4eab2c80 100644 --- a/Linphone/view/Page/Main/CallPage.qml +++ b/Linphone/view/Page/Main/CallPage.qml @@ -9,7 +9,7 @@ import SettingsCpp AbstractMainPage { id: mainItem noItemButtonText: qsTr("Nouvel appel") - emptyListText: qsTr("Historique d'appel vide") + emptyListText: qsTr("Aucun appel") newItemIconSource: AppIcons.newCall property var selectedRowHistoryGui @@ -199,6 +199,11 @@ AbstractMainPage { } visible: historyListView.count === 0 Layout.alignment: Qt.AlignHCenter + Binding on text { + when: searchBar.text.length !== 0 + value: qsTr("Aucun appel correspondant") + restoreMode: Binding.RestoreBindingOrValue + } } ListView { id: historyListView @@ -552,7 +557,7 @@ AbstractMainPage { } onClicked: { detailOptions.close() - if (detailOptions.friendGui) mainWindow.goToContactPage(contactDetail.contactAddress) + if (detailOptions.friendGui) mainWindow.displayContactPage(contactDetail.contactAddress) else mainItem.createContactRequested(contactDetail.contactName, contactDetail.contactAddress) } } @@ -563,6 +568,7 @@ AbstractMainPage { iconSource: AppIcons.copy } onClicked: { + detailOptions.close() var success = UtilsCpp.copyToClipboard(mainItem.selectedRowHistoryGui && mainItem.selectedRowHistoryGui.core.remoteAddress) if (success) UtilsCpp.showInformationPopup(qsTr("Copié"), qsTr("L'adresse a été copiée dans le presse-papier"), true) else UtilsCpp.showInformationPopup(qsTr("Erreur"), qsTr("Erreur lors de la copie de l'adresse"), false) diff --git a/Linphone/view/Page/Main/ContactPage.qml b/Linphone/view/Page/Main/ContactPage.qml index 6d1973d17..8cca63691 100644 --- a/Linphone/view/Page/Main/ContactPage.qml +++ b/Linphone/view/Page/Main/ContactPage.qml @@ -16,6 +16,8 @@ AbstractMainPage { // disable left panel contact list interaction while a contact is being edited property bool leftPanelEnabled: true property FriendGui selectedContact + property string initialFriendToDisplay + onSelectedContactChanged: { if (selectedContact) { if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactDetail") rightPanelStackView.push(contactDetail) @@ -42,10 +44,6 @@ AbstractMainPage { rightPanelStackView.push(contactEdition, {"contact": friendGui, "title": qsTr("Modifier contact"), "saveButtonText": qsTr("Enregistrer")}) } - function displayContact(contactAddress) { - contactList.selectContact(contactAddress) - } - // rightPanelStackView.initialItem: contactDetail Binding { mainItem.showDefaultItem: false @@ -311,6 +309,11 @@ AbstractMainPage { } ContactsList{ id: contactList + onCountChanged: { + if (initialFriendToDisplay.length !== 0) { + if (selectContact(initialFriendToDisplay) != -1) initialFriendToDisplay = "" + } + } Layout.fillWidth: true Layout.preferredHeight: contentHeight interactive: false diff --git a/Linphone/view/Page/Main/MeetingPage.qml b/Linphone/view/Page/Main/MeetingPage.qml index 925ba2648..330b04536 100644 --- a/Linphone/view/Page/Main/MeetingPage.qml +++ b/Linphone/view/Page/Main/MeetingPage.qml @@ -124,12 +124,9 @@ AbstractMainPage { property string objectName: "listLayout" Control.StackView.onDeactivated: { mainItem.selectedConference = null - // mainItem.showDefaultItem.visible = false - // mainItem.righPanelStackView.clear() } Control.StackView.onActivated: { mainItem.selectedConference = conferenceList.selectedConference - // mainItem.showDefaultItem = conferenceList.count == 0 } Binding { target: mainItem @@ -183,6 +180,11 @@ AbstractMainPage { weight: 800 * DefaultStyle.dp } visible: mainItem.showDefaultItem + Binding on text { + when: searchBar.text.length !== 0 + value: qsTr("Aucune réunion correspondante") + restoreMode: Binding.RestoreBindingOrValue + } } RowLayout {