Bug 95362 - most recent message is not displayed in view, need to scroll
Summary: most recent message is not displayed in view, need to scroll
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Chat Window (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-17 20:29 UTC by S. Burmeister
Modified: 2007-11-14 15:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description S. Burmeister 2004-12-17 20:29:07 UTC
Version:            (using KDE KDE 3.3.2)
Installed from:    SuSE RPMs
OS:                Linux

I am using the history plugin. When a new chat is started by somebody, the "bubble" appears with the message, asking me whether to ignore or start the chat. If I start the chat, the last line displayed is the last line of the history and not the message that was displayed in the bubble.

kopete should make sure that the recent message is dislayed without the need to scroll, even if the history plugin is enabled.
Comment 1 Will Stephenson 2005-01-14 15:33:54 UTC
CVS commit by wstephens: 

Add an additional scroll down attempt after making a view visible.  The geometry of the khtmlview is incorrect before it has been shown, so any previous scrolldowns are ineffective.

BUG:95362


  M +9 -0      chatmessagepart.cpp   1.15
  M +6 -0      chatmessagepart.h   1.7
  M +4 -0      chatview.cpp   1.184


--- kdenetwork/kopete/kopete/chatwindow/chatmessagepart.cpp  #1.14:1.15
@@ -462,4 +462,10 @@ void ChatMessagePart::slotTransformCompl
 }
 
+void ChatMessagePart::keepScrolledDown()
+{
+        if ( !scrollPressed )
+                QTimer::singleShot( 1, this, SLOT( slotScrollView() ) );
+}
+
 const QString ChatMessagePart::styleHTML() const
 {
@@ -647,4 +653,7 @@ void ChatMessagePart::slotCopyURL()
 void ChatMessagePart::slotScrollView()
 {
+        // NB: view()->contentsHeight() is incorrect before the view has been shown in its window.
+        // Until this happens, the geometry has not been correctly calculated, so this scrollBy call
+        // will usually scroll to the top of the view.
         view()->scrollBy( 0, view()->contentsHeight() );
 }

--- kdenetwork/kopete/kopete/chatwindow/chatmessagepart.h  #1.6:1.7
@@ -51,4 +51,10 @@ public:
         void setStylesheet( const QString &style  );
 
+        /**
+         * Immediately scroll the chat to the bottom, as long as it has not been intentionally scrolled away from the bottom
+         * use 
+         */
+        void keepScrolledDown();
+
 public slots:
         /**

--- kdenetwork/kopete/kopete/chatwindow/chatview.cpp  #1.183:1.184
@@ -275,5 +275,9 @@ void ChatView::makeVisible()
 
         if ( !m_mainWindow->isVisible() )
+        {
                 m_mainWindow->show();
+                // scroll down post show and layout, otherwise the geometry is wrong to scroll to the bottom.
+                m_messagePart->keepScrolledDown();
+        }
 
         m_mainWindow->setActiveView( this );


Comment 2 Jan Ritzerfeld 2005-03-10 22:42:16 UTC
This works for newly opened chat windows/tabs. Using tabbed chatting all newly opened tabs scroll down correctly but when cycling around and getting back to the very first tab its content has moved "up" so that I have to scroll down (using today's cvs).
Comment 3 James Salter 2007-11-14 15:23:24 UTC
this exact problem is occuring in 0.12.7 for me.