fix #LINQT-1796 don't scroll to main list when selecting contact from favorites \

fix crash
This commit is contained in:
Gaëlle Braud 2025-07-17 13:31:47 +00:00
parent dce74eb958
commit 98d9179419
7 changed files with 16 additions and 14 deletions

View file

@ -22,11 +22,11 @@ set(APP_TARGETS ${LinphoneCxx_TARGET}
${LibLinphone_TARGET})#Liblinphone ${LibLinphone_TARGET})#Liblinphone
set(QT_DEFAULT_MAJOR_VERSION 6) set(QT_DEFAULT_MAJOR_VERSION 6)
set(QT_PACKAGES Core Quick Qml Widgets Svg Multimedia Test NetworkAuth Concurrent)# Search Core at first for initialize Qt scripts for next find_packages. set(QT_PACKAGES Quick Qml Widgets Svg Multimedia Test NetworkAuth Concurrent Core5Compat)# Search Core at first for initialize Qt scripts for next find_packages.
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
list(APPEND QT_PACKAGES DBus) list(APPEND QT_PACKAGES DBus)
endif() endif()
find_package(Qt6 REQUIRED COMPONENTS Core) find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS ${QT_PACKAGES}) find_package(Qt6 REQUIRED COMPONENTS ${QT_PACKAGES})
find_package(Qt6 REQUIRED COMPONENTS LinguistTools) find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
@ -214,6 +214,7 @@ foreach(T ${APP_TARGETS})
target_link_libraries(${TARGET_NAME} PUBLIC ${T}) target_link_libraries(${TARGET_NAME} PUBLIC ${T})
endforeach() endforeach()
target_link_libraries(${TARGET_NAME} PRIVATE Qt6::Core)
foreach(T ${QT_PACKAGES}) foreach(T ${QT_PACKAGES})
target_link_libraries(${TARGET_NAME} PRIVATE Qt6::${T}) target_link_libraries(${TARGET_NAME} PRIVATE Qt6::${T})
endforeach() endforeach()

View file

@ -101,8 +101,11 @@ void ChatList::setSelf(QSharedPointer<ChatList> me) {
connectItem(chat); connectItem(chat);
} }
mustBeInMainThread(getClassName()); mustBeInMainThread(getClassName());
resetData<ChatCore>(*chats); clearData();
delete chats; for(auto chat: *chats) {
add(chat);
}
delete chats;
}); });
}); });
}); });

View file

@ -57,7 +57,8 @@ void ParticipantInfoList::setChatCore(const QSharedPointer<ChatCore> &chatCore)
QStringList participantAddresses; QStringList participantAddresses;
QList<QSharedPointer<ParticipantGui>> participantList; QList<QSharedPointer<ParticipantGui>> participantList;
auto participants = mChatCore->getParticipants(); auto participants = mChatCore->getParticipants();
resetData<ParticipantCore>(participants); resetData();
for(auto p: participants) add(p);
}; };
connect(mChatCore.get(), &ChatCore::participantsChanged, this, buildList); connect(mChatCore.get(), &ChatCore::participantsChanged, this, buildList);
buildList(); buildList();
@ -71,4 +72,4 @@ QVariant ParticipantInfoList::data(const QModelIndex &index, int role) const {
return QVariant::fromValue(new ParticipantGui(mList[row].objectCast<ParticipantCore>())); return QVariant::fromValue(new ParticipantGui(mList[row].objectCast<ParticipantCore>()));
} }
return QVariant(); return QVariant();
} }

View file

@ -409,7 +409,7 @@ void CoreModel::onCallStateChanged(const std::shared_ptr<linphone::Core> &core,
linphone::Call::State state, linphone::Call::State state,
const std::string &message) { const std::string &message) {
if (state == linphone::Call::State::IncomingReceived) { if (state == linphone::Call::State::IncomingReceived) {
App::getInstance()->getNotifier()->notifyReceivedCall(call); if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedCall(call);
if (!core->getConfig()->getBool(SettingsModel::UiSection, "disable_command_line", false) && if (!core->getConfig()->getBool(SettingsModel::UiSection, "disable_command_line", false) &&
!core->getConfig()->getString(SettingsModel::UiSection, "command_line", "").empty()) { !core->getConfig()->getString(SettingsModel::UiSection, "command_line", "").empty()) {
QString command = Utils::coreStringToAppString( QString command = Utils::coreStringToAppString(
@ -513,14 +513,14 @@ void CoreModel::onMessageReceived(const std::shared_ptr<linphone::Core> &core,
emit unreadNotificationsChanged(); emit unreadNotificationsChanged();
std::list<std::shared_ptr<linphone::ChatMessage>> messages; std::list<std::shared_ptr<linphone::ChatMessage>> messages;
messages.push_back(message); messages.push_back(message);
App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages);
emit messageReceived(core, room, message); emit messageReceived(core, room, message);
} }
void CoreModel::onMessagesReceived(const std::shared_ptr<linphone::Core> &core, void CoreModel::onMessagesReceived(const std::shared_ptr<linphone::Core> &core,
const std::shared_ptr<linphone::ChatRoom> &room, const std::shared_ptr<linphone::ChatRoom> &room,
const std::list<std::shared_ptr<linphone::ChatMessage>> &messages) { const std::list<std::shared_ptr<linphone::ChatMessage>> &messages) {
emit unreadNotificationsChanged(); emit unreadNotificationsChanged();
App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages); if (App::getInstance()->getNotifier()) App::getInstance()->getNotifier()->notifyReceivedMessages(room, messages);
emit messagesReceived(core, room, messages); emit messagesReceived(core, room, messages);
} }

View file

@ -169,6 +169,7 @@ ListView {
if (isFullyVisible) if (isFullyVisible)
modelData.core.lMarkAsRead() modelData.core.lMarkAsRead()
} }
Component.onCompleted: if (index === mainItem.count - 1) mainItem.lastItemVisible = isFullyVisible
chatMessage: modelData chatMessage: modelData
chat: mainItem.chat chat: mainItem.chat
searchedTextPart: mainItem.filterText searchedTextPart: mainItem.filterText

View file

@ -59,10 +59,6 @@ ListView {
onVisibleChanged: if (visible && !expanded) expanded = true onVisibleChanged: if (visible && !expanded) expanded = true
property var _currentItemY: currentItem?.y
on_CurrentItemYChanged: if(_currentItemY){
updatePosition()
}
onYChanged: updatePosition() onYChanged: updatePosition()
// Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea.

View file

@ -28,7 +28,7 @@ AbstractWindow {
property var accountProxy property var accountProxy
// TODO : use this to make the border transparent // TODO : use this to make the border transparent
flags: Qt.Window | Qt.WindowTitleHint flags: Qt.Window
// menuBar: Rectangle { // menuBar: Rectangle {
// width: parent.width // width: parent.width
// height: Math.round(40 * DefaultStyle.dp) // height: Math.round(40 * DefaultStyle.dp)