Summary: | most recent message is not displayed in view, need to scroll | ||
---|---|---|---|
Product: | [Applications] kopete | Reporter: | S. Burmeister <sven.burmeister> |
Component: | Chat Window | Assignee: | Kopete Developers <kopete-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
S. Burmeister
2004-12-17 20:29:07 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 ); 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). this exact problem is occuring in 0.12.7 for me. |