diff --git a/CHANGES b/CHANGES index 6f03223a6c3b66fd39df2537097f47830878cac8..e04b6b3b427f468b61f76a0675ce79f81d71173a 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 bd8bdc39c89f7013b88a6f3785372269feaaad35..ec4f5c0894c5d42fab6a9f37188eaf2a474bd394 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 5382efe31b5d595b97a69c61aa5d2c24193cb8a0..95cfedc132c35b018a8c867cb270ab4914aa896d 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 966c8ef31cd3f543beb68e03e91db9a970e90dbb..19bf532f2804a395969213b0a00d1f6d0c9e20e5 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 a0cc73bbc37b8d5208326852c2d79effa6b15af7..49cbd9158251d0487c2686bd2771b120db6d711b 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 89ddbcaca516189dbe736429313d7d2bdf8fbe5c..d92a0704b96a12eab5c1efe04d20ef78c39b7ce5 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!