Bug 74562

Summary: Disable sending in chatwindow if connection is lost during the typing of a message
Product: [Applications] kopete Reporter: A T Somers <andre>
Component: Main ApplicationAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description A T Somers 2004-02-08 12:55:29 UTC
Version:           0.7.95 (using KDE 3.1.4)
Installed from:    compiled sources
Compiler:          gcc version 2.95.3 20010315 (SuSE)
OS:          Linux (i686) release 2.4.18-4GB

I was typing a rather long message to another ICQ user (explaining some API details). During that time, I somehow got disconnected. When I tried sending the message, I got an error telling me that I needed to be connected to send the message. After that, the message I typed was just gone.
I would have expected a message that can't be send to stay in the area that you typed in, so that I can rectify the problem and try sending again.
Comment 1 Stefan Gehn 2004-02-08 13:02:41 UTC
Ctrl-Z (Undo) should bring it back.
Comment 2 A T Somers 2004-02-08 13:12:24 UTC
Subject: Re:  If connection is lost during the typing of a message, the contents of the message gets lost on sending

It does not, but even if it would, I think it's not obvious to the user at 
all...

Comment 3 Matt Rogers 2004-02-14 21:08:48 UTC
mine! 
Comment 4 Matt Rogers 2004-02-14 22:27:21 UTC
Fixed in CVS. Will backport for KDE 3.2.1 shortly
Comment 5 Matt Rogers 2004-02-14 22:36:33 UTC
CVS commit by mattr: 

Backport the fix for bug 74562. Disable the send button if we go offline
while typing.

CCMAIL: 74562-done@bugs.kde.org


  M +21 -11    chatview.cpp   1.113.2.2


--- kdenetwork/kopete/kopete/chatwindow/chatview.cpp  #1.113.2.1:1.113.2.2
@@ -782,10 +782,18 @@ void ChatView::slotMarkMessageRead()
 }
 
-void ChatView::slotContactStatusChanged( KopeteContact *contact, const KopeteOnlineStatus & /* newStatus */ , const KopeteOnlineStatus & /* oldstatus */)
+void ChatView::slotContactStatusChanged( KopeteContact *contact, const KopeteOnlineStatus &newStatus, const KopeteOnlineStatus & /* oldstatus */)
 {
-        if(KopetePrefs::prefs()->showEvents() && contact)
+        if ( contact && KopetePrefs::prefs()->showEvents() )
         {
-                if( contact->metaContact() )
+                if ( contact->account() && contact == contact->account()->myself() )
+                {
+                        //Seperate notification for the 'self' contact
+                        if ( newStatus.status() != KopeteOnlineStatus::Connecting )
                 {
+                                if ( newStatus.status() == KopeteOnlineStatus::Offline )
+                                        mainWindow()->setSendEnabled( false );
+                                else
+                                        mainWindow()->setSendEnabled( true );
+
                         sendInternalMessage( i18n( "%2 has changed their status to %1." )
 #if QT_VERSION < 0x030200
@@ -796,4 +804,6 @@ void ChatView::slotContactStatusChanged(
                         );
                 }
+                }
+        }
                 else
                 {
@@ -806,5 +816,5 @@ void ChatView::slotContactStatusChanged(
                         );
                 }
-        }
+
 
         if(m_tabBar)


Comment 6 Richard Smith 2004-02-22 02:17:15 UTC
CVS commit by lilachaze: 

Properly fix bug 74562 and other problems with the send button being enabled
at the wrong time. Should now only disable the send button if there's
nothing to send, or if clicking on the contact in the contact list would
refuse to open a window.
CCMAIL: 74562@bugs.kde.org


  M +48 -16    chatview.cpp   1.126
  M +15 -1     chatview.h   1.39
  M +13 -2     kopetechatwindow.cpp   1.72
  M +2 -2      kopetechatwindow.h   1.25