diff --git a/sflphone-client-kde/SFLPhone.cpp b/sflphone-client-kde/SFLPhone.cpp index a7ddd9cb6f6c7e0f8712e789bbb5c9f1756754eb..7013f52145a33d57acec76a1c3d21cf572e218d2 100644 --- a/sflphone-client-kde/SFLPhone.cpp +++ b/sflphone-client-kde/SFLPhone.cpp @@ -11,7 +11,6 @@ #include "sflphone_const.h" #include "instance_interface_singleton.h" -#include "configurationmanager_interface_singleton.h" SFLPhone::SFLPhone(QWidget *parent) @@ -125,34 +124,37 @@ bool SFLPhone::queryClose() return true; } -void SFLPhone::sendNotif(QString caller) +void SFLPhone::putForeground() +{ + activateWindow(); + hide(); + activateWindow(); + show(); + activateWindow(); +} + +void SFLPhone::trayIconSignal() { - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); if(! isActiveWindow()) { trayIcon->setIcon(QIcon(ICON_TRAY_NOTIF)); iconChanged = true; } +} + +void SFLPhone::sendNotif(QString caller) +{ trayIcon->showMessage( tr2i18n("Incoming call"), tr2i18n("You have an incoming call from : ") + caller + ".\n" + tr2i18n("Click to accept or refuse it."), QSystemTrayIcon::Warning, 20000); - if(configurationManager.popupMode()) - { - qDebug() << "pop up"; - activateWindow(); - hide(); - show(); - } } void SFLPhone::on_trayIcon_messageClicked() { qDebug() << "on_trayIcon_messageClicked"; - activateWindow(); - hide(); - show(); + putForeground(); } void SFLPhone::changeEvent(QEvent * event) @@ -179,18 +181,9 @@ void SFLPhone::on_trayIcon_activated(QSystemTrayIcon::ActivationReason reason) else { qDebug() << "isnotactive -> show()"; - activateWindow(); - hide(); - show(); + putForeground(); } break; -// case QSystemTrayIcon::DoubleClick: -// iconComboBox->setCurrentIndex((iconComboBox->currentIndex() + 1) -// % iconComboBox->count()); -// break; -// case QSystemTrayIcon::MiddleClick: -// showMessage(); -// break; default: qDebug() << "Tray icon activated with unknown reason."; break; diff --git a/sflphone-client-kde/SFLPhone.h b/sflphone-client-kde/SFLPhone.h index 60473e7f55296c164375b91e14c55c34d7d447c5..ccf9e46da73ad8bce8e5ac27cd589e1b136d438e 100644 --- a/sflphone-client-kde/SFLPhone.h +++ b/sflphone-client-kde/SFLPhone.h @@ -41,6 +41,8 @@ public: ~SFLPhone(); void setupActions(); void sendNotif(QString caller); + void putForeground(); + void trayIconSignal(); private slots: diff --git a/sflphone-client-kde/sflphone_kdeview.cpp b/sflphone-client-kde/sflphone_kdeview.cpp index 724ff100f59fd995586cbd4d9981afb866c28802..5189686db0203e4692a7f99a47632f6e6eeb5b15 100644 --- a/sflphone-client-kde/sflphone_kdeview.cpp +++ b/sflphone-client-kde/sflphone_kdeview.cpp @@ -1332,11 +1332,20 @@ void sflphone_kdeView::on1_error(MapStringString details) void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString & callID) { qDebug() << "Signal : Incoming Call !"; + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); Call * call = callList->addIncomingCall(callID); addCallToCallList(call); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); SFLPhone * window = (SFLPhone * ) this->parent(); - window->sendNotif(call->getPeerName().isEmpty() ? call->getPeerPhoneNumber() : call->getPeerName()); + window->trayIconSignal(); + if(configurationManager.popupMode()) + { + window->putForeground(); + } + if(configurationManager.getNotify()) + { + window->sendNotif(call->getPeerName().isEmpty() ? call->getPeerPhoneNumber() : call->getPeerName()); + } } void sflphone_kdeView::on1_incomingMessage(const QString &accountID, const QString &message)