[Bug 140917] Not possible to set cursor to beginning of message with templates
groot at kde.org
groot at kde.org
Thu Feb 15 15:02:41 GMT 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
groot kde org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |FIXED
------- Additional Comments From groot kde org 2007-02-15 16:02 -------
SVN commit 633860 by adridg:
When the message is set to a composer with a specific cursor position,
(ie. not 0, eg. from a template containing %CURSOR) then don't reset the
cursor position when appending the signature. This makes it possible
to use %CURSOR to place the cursor anywhere in a template. Useful
for reply templates, at any rate.
BUG: 140917
CCMAIL: kde-pim kde org
M +14 -2 branches/work/kdepim-3.5.5+/kmail/kmcomposewin.cpp
M +9 -0 branches/work/kdepim-3.5.5+/kmail/kmcomposewin.h
--- branches/work/kdepim-3.5.5+/kmail/kmcomposewin.cpp #633859:633860
@ -177,7 +177,8 @
mEncryptWithChiasmus( false ),
mComposer( 0 ),
mLabelWidth( 0 ),
- mAutoSaveTimer( 0 ), mLastAutoSaveErrno( 0 )
+ mAutoSaveTimer( 0 ), mLastAutoSaveErrno( 0 ),
+ mPreserveUserCursorPosition( false )
{
mClassicalRecipients = GlobalSettings::self()->recipientsEditorType() ==
GlobalSettings::EnumRecipientsEditorType::Classic;
@ -1982,6 +1983,11 @
QTimer::singleShot( 0, this, SLOT(slotAppendSignature()) );
}
+ if ( mMsg->getCursorPos() > 0 ) {
+ // The message has a cursor position explicitly set, so avoid
+ // changing it when appending the signature.
+ mPreserveUserCursorPosition = true;
+ }
}
setModified( isModified );
@ -4118,8 +4124,14 @
// for append and prepend, move the cursor to 0,0, for insertAt,
// keep it in the same row, but move to first column
- if ( !append && pos == 0 )
+ if ( ( !append && pos == 0 ) || mPreserveUserCursorPosition ) {
mEditor->setCursorPositionFromStart( (unsigned int)mMsg->getCursorPos() );
+ // Only keep the cursor from the mMsg *once* based on the
+ // preserve-cursor-position setting; this handles the case where
+ // the message comes from a template with a specific cursor
+ // position set and the signature is appended automatically.
+ mPreserveUserCursorPosition = false;
+ }
mEditor->sync();
}
}
--- branches/work/kdepim-3.5.5+/kmail/kmcomposewin.h #633859:633860
@ -862,6 +862,15 @
QPopupMenu *mActNowMenu;
QPopupMenu *mActLaterMenu;
+
+ /** If the message in this composer has a cursor position set (for
+ * instance because it comes from a template containing %CURSOR)
+ * then we need to preserve that cursor position even when auto-
+ * appending (or prepending) the signature during composer setup.
+ * Set to true *once* (and only in setMsg() at that) to avoid
+ * accidentally moving the cursor.
+ */
+ bool mPreserveUserCursorPosition;
};
#endif
More information about the Kdepim-bugs
mailing list