From f4fe343eca3eaf84f9ce300b59be9e83a70c204e Mon Sep 17 00:00:00 2001 From: Pavel Karelin Date: Mon, 1 Jan 2018 22:57:10 +0300 Subject: [PATCH] fix: Correct display the call confirm window (CallConfirmWidget) With an incoming call, the confirmation window (CallConfirmWidget) is only displayed when the caller is on the active tab. In other cases, the call confirmation window is not displayed, as a result, the call cannot be answered. The problem is manifested in Kubuntu 14.04 and Ubuntu 16.04 MATE (Qt 5.6.3/5.9.3) --- src/widget/chatformheader.cpp | 9 +++++++-- src/widget/chatformheader.h | 3 ++- src/widget/form/chatform.cpp | 3 ++- src/widget/form/genericchatform.cpp | 1 + 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/widget/chatformheader.cpp b/src/widget/chatformheader.cpp index d2d31db0f..3c55a4658 100644 --- a/src/widget/chatformheader.cpp +++ b/src/widget/chatformheader.cpp @@ -199,15 +199,20 @@ void ChatFormHeader::showOutgoingCall(bool video) updateButtonsView(); } -void ChatFormHeader::showCallConfirm(bool video) +void ChatFormHeader::createCallConfirm(bool video) { QWidget* btn = video ? videoButton : callButton; callConfirm = std::unique_ptr(new CallConfirmWidget(btn)); - callConfirm->show(); connect(callConfirm.get(), &CallConfirmWidget::accepted, this, &ChatFormHeader::callAccepted); connect(callConfirm.get(), &CallConfirmWidget::rejected, this, &ChatFormHeader::callRejected); } +void ChatFormHeader::showCallConfirm() +{ + if (callConfirm && !callConfirm->isVisible()) + callConfirm->show(); +} + void ChatFormHeader::removeCallConfirm() { callConfirm.reset(nullptr); diff --git a/src/widget/chatformheader.h b/src/widget/chatformheader.h index 4ba44fa06..d744cf0d2 100644 --- a/src/widget/chatformheader.h +++ b/src/widget/chatformheader.h @@ -60,7 +60,8 @@ public: void setMode(Mode mode); void showOutgoingCall(bool video); - void showCallConfirm(bool video); + void createCallConfirm(bool video); + void showCallConfirm(); void removeCallConfirm(); void updateCallButtons(bool online, bool audio, bool video = false); diff --git a/src/widget/form/chatform.cpp b/src/widget/form/chatform.cpp index 5c4e9663c..6ba5fb7f1 100644 --- a/src/widget/form/chatform.cpp +++ b/src/widget/form/chatform.cpp @@ -346,7 +346,8 @@ void ChatForm::onAvInvite(uint32_t friendId, bool video) Q_ARG(uint32_t, friendId), Q_ARG(bool, video)); onAvStart(friendId, video); } else { - headWidget->showCallConfirm(video); + headWidget->createCallConfirm(video); + headWidget->showCallConfirm(); lastCallIsVideo = video; auto msg = ChatMessage::createChatInfoMessage(tr("%1 calling").arg(displayedName), ChatMessage::INFO, QDateTime::currentDateTime()); diff --git a/src/widget/form/genericchatform.cpp b/src/widget/form/genericchatform.cpp index 7906684fb..87b8642d0 100644 --- a/src/widget/form/genericchatform.cpp +++ b/src/widget/form/genericchatform.cpp @@ -285,6 +285,7 @@ void GenericChatForm::show(ContentLayout* contentLayout) void GenericChatForm::showEvent(QShowEvent*) { msgEdit->setFocus(); + headWidget->showCallConfirm(); } bool GenericChatForm::event(QEvent* e)