Commit df38b4eb authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Ming Rui Zhang

notifications: prevent notifications for outgoing calls

Change-Id: I98df72f4e3a4e710dc2279b6b5388ab613254338
parent 8cc7fc7d
...@@ -213,7 +213,7 @@ CallWidget::CallWidget(QWidget* parent) : ...@@ -213,7 +213,7 @@ CallWidget::CallWidget(QWidget* parent) :
[this](const std::string& accountId, const std::string& conversation, [this](const std::string& accountId, const std::string& conversation,
uint64_t interactionId, const interaction::Info& interaction) { uint64_t interactionId, const interaction::Info& interaction) {
if (LRCInstance::getCurrAccId() != accountId) { if (LRCInstance::getCurrAccId() != accountId) {
onIncomingMessage(accountId, conversation, interactionId, interaction); onNewInteraction(accountId, conversation, interactionId, interaction);
} }
}); });
...@@ -304,7 +304,7 @@ CallWidget::getLeftPanelWidth() ...@@ -304,7 +304,7 @@ CallWidget::getLeftPanelWidth()
} }
void void
CallWidget::onIncomingMessage(const std::string& accountId, const std::string& convUid, CallWidget::onNewInteraction(const std::string& accountId, const std::string& convUid,
uint64_t interactionId, const interaction::Info& interaction) uint64_t interactionId, const interaction::Info& interaction)
{ {
Q_UNUSED(interactionId); Q_UNUSED(interactionId);
...@@ -315,7 +315,8 @@ CallWidget::onIncomingMessage(const std::string& accountId, const std::string& c ...@@ -315,7 +315,8 @@ CallWidget::onIncomingMessage(const std::string& accountId, const std::string& c
if (conversation.uid.empty()) { if (conversation.uid.empty()) {
return; return;
} }
if (!QApplication::focusWidget() || LRCInstance::getCurrAccId() != accountId) { if (!interaction.authorUri.empty() &&
(!QApplication::focusWidget() || LRCInstance::getCurrAccId() != accountId)) {
auto bestName = Utils::bestNameForConversation(conversation, *convModel); auto bestName = Utils::bestNameForConversation(conversation, *convModel);
Utils::showSystemNotification(this, Utils::showSystemNotification(this,
QString::fromStdString(bestName), QString::fromStdString(bestName),
...@@ -1164,7 +1165,7 @@ CallWidget::connectConversationModel() ...@@ -1164,7 +1165,7 @@ CallWidget::connectConversationModel()
[this](const std::string& convUid, uint64_t interactionId, [this](const std::string& convUid, uint64_t interactionId,
const lrc::api::interaction::Info& interaction) { const lrc::api::interaction::Info& interaction) {
auto accountId = LRCInstance::getCurrAccId(); auto accountId = LRCInstance::getCurrAccId();
onIncomingMessage(accountId, convUid, interactionId, interaction); onNewInteraction(accountId, convUid, interactionId, interaction);
} }
); );
interactionRemovedConnection_ = QObject::connect( interactionRemovedConnection_ = QObject::connect(
......
...@@ -105,7 +105,7 @@ private slots: ...@@ -105,7 +105,7 @@ private slots:
private: private:
void callTerminating(const std::string& callid); void callTerminating(const std::string& callid);
void onIncomingMessage(const std::string& accountId, const std::string& convUid, void onNewInteraction(const std::string& accountId, const std::string& convUid,
uint64_t interactionId, const lrc::api::interaction::Info& interaction); uint64_t interactionId, const lrc::api::interaction::Info& interaction);
void conversationsButtonClicked(); void conversationsButtonClicked();
void invitationsButtonClicked(); void invitationsButtonClicked();
......
...@@ -272,20 +272,18 @@ Utils::setStackWidget(QStackedWidget* stack, QWidget* widget) ...@@ -272,20 +272,18 @@ Utils::setStackWidget(QStackedWidget* stack, QWidget* widget)
} }
} }
void Utils::showSystemNotification(QWidget* widget, const QString & message, long delay) void Utils::showSystemNotification(QWidget* widget, const QString& message, long delay)
{ {
GlobalSystemTray::instance().showMessage(message, "", QIcon(":images/jami.png")); GlobalSystemTray::instance().showMessage(message, "", QIcon(":images/jami.png"));
QApplication::alert(widget, delay); QApplication::alert(widget, delay);
} }
void Utils::showSystemNotification(QWidget* widget, void Utils::showSystemNotification(QWidget* widget,
const QString & sender, const QString & sender,
const QString & message, const QString & message,
long delay) long delay)
{ {
QIcon(); GlobalSystemTray::instance().showMessage(sender, message, QIcon(":images/jami.png"));
GlobalSystemTray::instance()
.showMessage(sender, message, QIcon(":images/jami.png"));
QApplication::alert(widget, delay); QApplication::alert(widget, delay);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment