[Kde-pim] branches/work/kdepim-3.5.5+/kmail
Adriaan de Groot
groot at kde.org
Thu Feb 15 15:02:30 GMT 2007
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 at 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
_______________________________________________
kde-pim mailing list
kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
More information about the kde-pim
mailing list