Patch (was Stability)

Vadim Lebedev vadim at mbdsys.com
Thu Aug 14 15:16:02 CEST 2008


Apllied,

I had to modify it for the main tree bcause QtChatWindow here does not 
had access to config object

Thanks
Vadim
Ralf Schlatterbeck wrote:
> On Mon, Aug 04, 2008 at 08:46:17PM +0200, Ralf Schlatterbeck wrote:
>   
>> So either QtWengoPhone::currentUserProfileWillDieEventHandlerSlot is not
>> the right spot to call closeAllTabs for the ChatWindow or this isn't the
>> right approach altogether.
>>     
>
> I'm now closing the chat windows in the Qt method that is called when
> the disconnect method is selected from the menu. This already has a
> dialog box that asks for confirmation when there is an active call and
> seems the right place. Works for us in Kvats.
>
> Have you seen my earlier patch for the problem when pressing "Connect"
> while already connecting
> http://article.gmane.org/gmane.comp.voip.qutecom.devel/191
> this probably should be applied first.
>
> # HG changeset patch
> # User Ralf Schlatterbeck <rsc at runtux.com>
> # Date 1218534845 -7200
> # Node ID 6c7f2639cbd8199327352ea75d454930ec164c29
> # Parent  f2ee82624dba46f951970756e8129b63aab098dc
> Fix crash when disconnecting/reconnecting with open chat window.
> The client would crash when reopening the same chat window after
> reconnect that was open before disconnecting. Fixes Kvats issue99.
> This is implemented by closing all chat windows in the QT disconnect
> routine.
>
> diff -r f2ee82624dba -r 6c7f2639cbd8 wengophone/src/presentation/qt/QtToolBar.cpp
> --- a/wengophone/src/presentation/qt/QtToolBar.cpp	Tue Aug 12 11:19:27 2008 +0200
> +++ b/wengophone/src/presentation/qt/QtToolBar.cpp	Tue Aug 12 11:54:05 2008 +0200
> @@ -426,6 +426,8 @@ void QtToolBar::logOff() {
>  			}
>  		}
>  		////
> +                // Close Chat
> +                _qtWengoPhone.closeChatWindow ();
>  		
>  		// disable menubar and toolbar to avoid crashes
>  		_ui->menuBar->setEnabled(false);
> diff -r f2ee82624dba -r 6c7f2639cbd8 wengophone/src/presentation/qt/QtWengoPhone.cpp
> --- a/wengophone/src/presentation/qt/QtWengoPhone.cpp	Tue Aug 12 11:19:27 2008 +0200
> +++ b/wengophone/src/presentation/qt/QtWengoPhone.cpp	Tue Aug 12 11:54:05 2008 +0200
> @@ -22,6 +22,7 @@
>  #include "ui_WengoPhoneWindow.h"
>  
>  #include <presentation/PFactory.h>
> +#include <presentation/qt/chat/QtChatWindow.h>
>  
>  #include <cutil/global.h>
>  
> @@ -307,6 +308,7 @@ QtCallBar & QtWengoPhone::getQtCallBar()
>  
>  void QtWengoPhone::setChatWindow(QWidget * chatWindow) {
>  	if (!chatWindow) {
> +		_chatWindow = NULL;
>  		_ui->actionOpenChatWindow->setEnabled(false);
>  	}
>  	else {
> @@ -317,6 +319,13 @@ void QtWengoPhone::setChatWindow(QWidget
>  
>  QWidget * QtWengoPhone::getChatWindow() const {
>  	return _chatWindow;
> +}
> +
> +void QtWengoPhone::closeChatWindow() {
> +        if (_chatWindow)
> +        {
> +            ((QtChatWindow *)_chatWindow)->closeAllTabs ();
> +        }
>  }
>  
>  void QtWengoPhone::setQtContactList(QtContactList * qtContactList) {
> diff -r f2ee82624dba -r 6c7f2639cbd8 wengophone/src/presentation/qt/QtWengoPhone.h
> --- a/wengophone/src/presentation/qt/QtWengoPhone.h	Tue Aug 12 11:19:27 2008 +0200
> +++ b/wengophone/src/presentation/qt/QtWengoPhone.h	Tue Aug 12 11:54:05 2008 +0200
> @@ -132,6 +132,7 @@ public:
>  
>  	void setChatWindow(QWidget * chatWindow);
>  	QWidget * getChatWindow() const;
> +        void closeChatWindow ();
>  
>  	void showHistory();
>  
> diff -r f2ee82624dba -r 6c7f2639cbd8 wengophone/src/presentation/qt/chat/QtChatWindow.cpp
> --- a/wengophone/src/presentation/qt/chat/QtChatWindow.cpp	Tue Aug 12 11:19:27 2008 +0200
> +++ b/wengophone/src/presentation/qt/chat/QtChatWindow.cpp	Tue Aug 12 11:54:05 2008 +0200
> @@ -435,19 +435,32 @@ void QtChatWindow::updateToolBarActions(
>  	if (widget) {
>  		contactId = widget->getContactId();
>  		qtContactList = _qtWengoPhone.getQtContactList();
> -		contactProfile = qtContactList->getCContactList().getContactProfile(contactId.toStdString());
> -
> -		_ui->actionCallContact->setEnabled(contactProfile.hasCall()
> -			&& contactProfile.isAvailable());
> -		_ui->actionSendSms->setEnabled(!contactProfile.getMobilePhone().empty() && !config.getSmsFeatureUseSip());
> -		_ui->actionSendFile->setEnabled(widget->canDoFileTransfer());
> -
> -		_ui->actionCreateChatConf->setEnabled(widget->canDoMultiChat());
> -		_ui->actionContactInfo->setEnabled(true);
> -		//TODO: uncomment when block a contact will be implemented
> -		//_ui->actionBlockContact->setEnabled(!contactProfile.isBlocked());
> -		_ui->actionBlockContact->setEnabled(false);
> -		////
> +                if (qtContactList)
> +                {
> +                    contactProfile = qtContactList->getCContactList().getContactProfile(contactId.toStdString());
> +
> +                    _ui->actionCallContact->setEnabled(contactProfile.hasCall()
> +                            && contactProfile.isAvailable());
> +                    _ui->actionSendSms->setEnabled(!contactProfile.getMobilePhone().empty() && !config.getSmsFeatureUseSip());
> +                    _ui->actionSendFile->setEnabled(widget->canDoFileTransfer());
> +
> +                    _ui->actionCreateChatConf->setEnabled(widget->canDoMultiChat());
> +                    _ui->actionContactInfo->setEnabled(true);
> +                    //TODO: uncomment when block a contact will be implemented
> +                    //_ui->actionBlockContact->setEnabled(!contactProfile.isBlocked());
> +                    _ui->actionBlockContact->setEnabled(false);
> +                    ////
> +                }
> +                else
> +                {
> +                    _ui->actionCallContact->setEnabled(false);
> +                    _ui->actionSendSms->setEnabled(false);
> +                    _ui->actionSendFile->setEnabled(false);
> +
> +                    _ui->actionCreateChatConf->setEnabled(false);
> +                    _ui->actionContactInfo->setEnabled(false);
> +                    _ui->actionBlockContact->setEnabled(false);
> +                }
>  	}
>  }
>  
> @@ -763,10 +776,14 @@ void QtChatWindow::saveActiveTabChatHist
>  }
>  
>  void QtChatWindow::closeEvent(QCloseEvent *event) {
> -	//LOG_DEBUG(" femeture des sessions ");
> -	//while(_tabWidget->count()>0) {
> -	//	closeActiveTab();
> -	//}
> +        //closeAllTabs();
> +}
> +
> +void QtChatWindow::closeAllTabs() {
> +	LOG_DEBUG("closing all Chat tabs");
> +	while(_tabWidget->count()>0) {
> +		closeActiveTab();
> +	}
>  }
>  
>  static QTextEdit* getActiveTextEdit() {
> diff -r f2ee82624dba -r 6c7f2639cbd8 wengophone/src/presentation/qt/chat/QtChatWindow.h
> --- a/wengophone/src/presentation/qt/chat/QtChatWindow.h	Tue Aug 12 11:19:27 2008 +0200
> +++ b/wengophone/src/presentation/qt/chat/QtChatWindow.h	Tue Aug 12 11:54:05 2008 +0200
> @@ -89,6 +89,8 @@ public Q_SLOTS:
>  
>  	void closeActiveTab();
>  
> +	void closeAllTabs();
> +
>  	void statusChangedSlot(QString contactId);
>  
>  	void saveActiveTabChatHistory();
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qutecom.org/pipermail/qutecom-dev/attachments/20080814/1f907070/attachment-0001.htm 


More information about the QuteCom-dev mailing list