[Bug 140917] Not possible to set cursor to beginning of message with templates

Thomas McGuire Thomas.McGuire at gmx.net
Wed Aug 15 15:40:19 BST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=140917         
Thomas.McGuire gmx net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From Thomas.McGuire gmx net  2007-08-15 16:40 -------
SVN commit 700430 by tmcguire:

Fix the cursor position for templates.
Now %CURSOR works again, this was somehow lost in porting.
Additionally, it is now possible again to set the cursor to the first line.

BUG: 140917
CCBUG: 141459

 M  +2 -3      kmcomposewin.cpp  
 M  +8 -0      kmedit.cpp  
 M  +4 -0      kmedit.h  


--- trunk/KDE/kdepim/kmail/kmcomposewin.cpp #700429:700430
 @ -4635,9 +4635,8  @
 void KMComposeWin::setReplyFocus( bool hasMessage )
 {
   mEditor->setFocus();
-  if ( hasMessage ) {
-    mEditor->setCursorPosition( 1, 0 );
-  }
+  if ( hasMessage )
+    mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() );
 }
 
 void KMComposeWin::setFocusToSubject()
--- trunk/KDE/kdepim/kmail/kmedit.cpp #700429:700430
 @ -759,4 +759,12  @
   }
 }
 
+void KMEdit::setCursorPositionFromStart( unsigned int pos ) {
+  unsigned int l = 0;
+  unsigned int c = 0;
+  posToRowCol( pos, l, c );
+  setCursorPosition( l, c );
+  ensureCursorVisible();
+}
+
 #include "kmedit.moc"
--- trunk/KDE/kdepim/kmail/kmedit.h #700429:700430
 @ -91,6 +91,10  @
 
   unsigned int lineBreakColumn() const;
 
+  /** set cursor to absolute position pos */
+  void setCursorPositionFromStart(unsigned int pos);
+
+
 signals:
   void spellcheck_done( int result );
   void attachPNGImageData( const QByteArray &image );



More information about the Kdepim-bugs mailing list