From 5ef841a929e1785b5e3627d2fb4af2194e58716d Mon Sep 17 00:00:00 2001 From: yanmorin <yanmorin> Date: Tue, 2 May 2006 21:44:11 +0000 Subject: [PATCH] Fix flashing button bug --- CHANGES | 2 +- src/call.h | 5 +++++ src/gui/qt/PhoneLineButton.cpp | 14 ++++++++++++-- src/gui/qt/PhoneLineButton.hpp | 10 ++++++++-- src/managerimpl.cpp | 10 +++++++--- src/sipvoiplink.cpp | 8 ++++++++ 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 6f03223a6c..e04b6b3b42 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,5 @@ SFLphoned (0.7.0) / 2006-..-.. - * partially fix: click on a flashing button (only if the button is not red) + * fix: click on flashing buttons * fix: send ringing, hangup, busy message * fix for using call command two times in a row * add --disable-sflphoneqt 2006-05-01 diff --git a/src/call.h b/src/call.h index bd8bdc39c8..ec4f5c0894 100644 --- a/src/call.h +++ b/src/call.h @@ -65,6 +65,11 @@ public: void setPeerName(const std::string& name) { _peerName = name; } const std::string& getPeerName() { return _peerName; } + /** + * Tell if the call is incoming + */ + bool isIncoming() { return (_type == Incoming) ? true : false; } + /** * Set the connection state of the call (protected by mutex) */ diff --git a/src/gui/qt/PhoneLineButton.cpp b/src/gui/qt/PhoneLineButton.cpp index 5382efe31b..95cfedc132 100644 --- a/src/gui/qt/PhoneLineButton.cpp +++ b/src/gui/qt/PhoneLineButton.cpp @@ -1,5 +1,6 @@ /* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. + * Copyright (C) 2004-2006 Savoir-Faire Linux inc. + * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Jean-Philippe Barrette-LaPierre * <jean-philippe.barrette-lapierre@savoirfairelinux.com> * @@ -41,6 +42,7 @@ PhoneLineButton::PhoneLineButton(unsigned int line, this, SLOT(swap())); connect(this, SIGNAL(clicked()), this, SLOT(sendClicked())); + mIsFlashing = false; } void @@ -65,6 +67,7 @@ void PhoneLineButton::suspend() { setDown(false); + mIsFlashing = true; mTimer->start(500); } @@ -72,11 +75,18 @@ void PhoneLineButton::sendClicked() { if(isOn()) { + mIsFlashing = false; mTimer->stop(); emit selected(mLine); } else { - emit unselected(mLine); + if (mIsFlashing) { + mIsFlashing = false; + mTimer->stop(); + emit selected(mLine); + } else { + emit unselected(mLine); + } } } diff --git a/src/gui/qt/PhoneLineButton.hpp b/src/gui/qt/PhoneLineButton.hpp index 966c8ef31c..19bf532f28 100644 --- a/src/gui/qt/PhoneLineButton.hpp +++ b/src/gui/qt/PhoneLineButton.hpp @@ -1,5 +1,6 @@ /* - * Copyright (C) 2004-2005 Savoir-Faire Linux inc. + * Copyright (C) 2004-2006 Savoir-Faire Linux inc. + * Author: Yan Morin <yan.morin@savoirfairelinux.com> * Author: Jean-Philippe Barrette-LaPierre * <jean-philippe.barrette-lapierre@savoirfairelinux.com> * @@ -59,7 +60,12 @@ private: unsigned int mLine; QTimer *mTimer; unsigned int mFace; - + + /** + * If the line is flashing, we want to retreive it + * on or off + */ + bool mIsFlashing; }; #endif // defined(__J_PUSH_BUTTON_H__) diff --git a/src/managerimpl.cpp b/src/managerimpl.cpp index a0cc73bbc3..49cbd91582 100644 --- a/src/managerimpl.cpp +++ b/src/managerimpl.cpp @@ -389,9 +389,13 @@ ManagerImpl::refuseCall (const CallID& id) return false; } bool returnValue = getAccountLink(accountid)->refuse(id); - removeWaitingCall(id); - removeCallAccount(id); - switchCall(""); + // if the call was outgoing or established, we didn't refuse it + // so the method did nothing + if (returnValue) { + removeWaitingCall(id); + removeCallAccount(id); + switchCall(""); + } return returnValue; } diff --git a/src/sipvoiplink.cpp b/src/sipvoiplink.cpp index 89ddbcaca5..d92a0704b9 100644 --- a/src/sipvoiplink.cpp +++ b/src/sipvoiplink.cpp @@ -773,8 +773,16 @@ bool SIPVoIPLink::refuse (const CallID& id) { SIPCall* call = getSIPCall(id); + if (call==0) { _debug("Call doesn't exist\n"); return false; } + // can't refuse outgoing call or connected + if (!call->isIncoming() || call->getConnectionState() == Call::Connected) { + _debug("It's not an incoming call, or it's already answered\n"); + return false; + } + + osip_message_t *answerMessage = NULL; eXosip_lock(); // not BUSY.. where decline the invitation! -- GitLab