Lines 1331-1336
Link Here
|
1331 |
(void) new KAction (i18n("Append S&ignature"), 0, this, |
1331 |
(void) new KAction (i18n("Append S&ignature"), 0, this, |
1332 |
SLOT(slotAppendSignature()), |
1332 |
SLOT(slotAppendSignature()), |
1333 |
actionCollection(), "append_signature"); |
1333 |
actionCollection(), "append_signature"); |
|
|
1334 |
(void) new KAction (i18n("Prepend S&ignature"), 0, this, |
1335 |
SLOT(slotPrependSignature()), |
1336 |
actionCollection(), "prepend_signature"); |
1337 |
(void) new KAction (i18n("Insert Signature At C&ursor Position"), "edit", 0, this, |
1338 |
SLOT(slotInsertSignatureAtCursor()), |
1339 |
actionCollection(), "insert_signature_at_cursor_position"); |
1340 |
|
1341 |
|
1334 |
mAttachPK = new KAction (i18n("Attach &Public Key..."), 0, this, |
1342 |
mAttachPK = new KAction (i18n("Attach &Public Key..."), 0, this, |
1335 |
SLOT(slotInsertPublicKey()), |
1343 |
SLOT(slotInsertPublicKey()), |
1336 |
actionCollection(), "attach_public_key"); |
1344 |
actionCollection(), "attach_public_key"); |
Lines 2022-2028
Link Here
|
2022 |
// Not user friendy if this modal fileseletor opens before the |
2030 |
// Not user friendy if this modal fileseletor opens before the |
2023 |
// composer. |
2031 |
// composer. |
2024 |
// |
2032 |
// |
2025 |
QTimer::singleShot( 200, this, SLOT(slotAppendSignature()) ); |
2033 |
//QTimer::singleShot( 200, this, SLOT(slotAppendSignature()) ); |
|
|
2034 |
if ( GlobalSettings::self()->prependSignature() ) { |
2035 |
QTimer::singleShot( 0, this, SLOT(slotPrependSignature()) ); |
2036 |
} else { |
2037 |
QTimer::singleShot( 0, this, SLOT(slotAppendSignature()) ); |
2038 |
} |
2039 |
|
2026 |
} |
2040 |
} |
2027 |
setModified( isModified ); |
2041 |
setModified( isModified ); |
2028 |
|
2042 |
|
Lines 4146-4151
Link Here
|
4146 |
//---------------------------------------------------------------------------- |
4160 |
//---------------------------------------------------------------------------- |
4147 |
void KMComposeWin::slotAppendSignature() |
4161 |
void KMComposeWin::slotAppendSignature() |
4148 |
{ |
4162 |
{ |
|
|
4163 |
insertSignature(); |
4164 |
} |
4165 |
|
4166 |
//---------------------------------------------------------------------------- |
4167 |
void KMComposeWin::slotPrependSignature() |
4168 |
{ |
4169 |
insertSignature( false ); |
4170 |
} |
4171 |
|
4172 |
//---------------------------------------------------------------------------- |
4173 |
void KMComposeWin::slotInsertSignatureAtCursor() |
4174 |
{ |
4175 |
insertSignature( false, mEditor->currentLine() ); |
4176 |
} |
4177 |
|
4178 |
//---------------------------------------------------------------------------- |
4179 |
void KMComposeWin::insertSignature( bool append, int pos ) |
4180 |
{ |
4149 |
bool mod = mEditor->isModified(); |
4181 |
bool mod = mEditor->isModified(); |
4150 |
|
4182 |
|
4151 |
const KPIM::Identity & ident = |
4183 |
const KPIM::Identity & ident = |
Lines 4150-4159
Link Here
|
4150 |
|
4180 |
|
4151 |
const KPIM::Identity & ident = |
4181 |
const KPIM::Identity & ident = |
4152 |
kmkernel->identityManager()->identityForUoidOrDefault( mIdentity->currentIdentity() ); |
4182 |
kmkernel->identityManager()->identityForUoidOrDefault( mIdentity->currentIdentity() ); |
4153 |
mOldSigText = ident.signatureText(); |
4183 |
mOldSigText = ident.signatureText(); |
|
|
4184 |
|
4185 |
if ( !GlobalSettings::self()->dashDashSignature() && !mOldSigText.isEmpty() ) |
4186 |
mOldSigText = mOldSigText.remove( 0, 4 ); |
4154 |
if( !mOldSigText.isEmpty() ) |
4187 |
if( !mOldSigText.isEmpty() ) |
4155 |
{ |
4188 |
{ |
4156 |
mEditor->append(mOldSigText); |
4189 |
if ( append ) { |
|
|
4190 |
mEditor->append(mOldSigText); |
4191 |
} else { |
4192 |
mEditor->insertAt(mOldSigText, pos, 0); |
4193 |
} |
4194 |
|
4157 |
mEditor->setModified(mod); |
4195 |
mEditor->setModified(mod); |
4158 |
// mEditor->setContentsPos( 0, 0 ); |
4196 |
// mEditor->setContentsPos( 0, 0 ); |
4159 |
if ( mPreserveUserCursorPosition ) { |
4197 |
if ( mPreserveUserCursorPosition ) { |
Lines 4156-4168
Link Here
|
4156 |
|
4200 |
|
4157 |
mEditor->setModified(mod); |
4201 |
mEditor->setModified(mod); |
4158 |
// mEditor->setContentsPos( 0, 0 ); |
4202 |
// mEditor->setContentsPos( 0, 0 ); |
4159 |
if ( mPreserveUserCursorPosition ) { |
4203 |
|
4160 |
mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() ); |
4204 |
// if the cursor is explicitly set in a template, set the cursor position |
4161 |
// Only keep the cursor from the mMsg *once* based on the |
4205 |
// to the template position, offsetting for the prepended signature length |
4162 |
// preserve-cursor-position setting; this handles the case where |
4206 |
// if applicable, otherwise set it to above the sig for {pre,ap}pend/insert |
4163 |
// the message comes from a template with a specific cursor |
4207 |
if ( mPreserveUserCursorPosition ) { |
4164 |
// position set and the signature is appended automatically. |
4208 |
if ( append && pos == 0 ) |
4165 |
mPreserveUserCursorPosition = false; |
4209 |
mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() ); |
4166 |
} |
4210 |
else |
|
|
4211 |
mEditor->setCursorPositionFromStart( (unsigned int) mMsg->getCursorPos() + mOldSigText.length() ); |
4212 |
// Only keep the cursor from the mMsg *once* based on the |
4213 |
// preserve-cursor-position setting; this handles the case where |
4214 |
// the message comes from a template with a specific cursor |
4215 |
// position set and the signature is appended automatically. |
4216 |
mPreserveUserCursorPosition = false; |
4217 |
} else { if ( append ) { |
4218 |
QString tmpMsgText = mEditor->text(); |
4219 |
mEditor->setCursorPositionFromStart( tmpMsgText.length() - mOldSigText.length() ); |
4220 |
} |
4221 |
else { if ( pos != 0 ) |
4222 |
mEditor->setCursorPosition( pos, 0 ); |
4223 |
else |
4224 |
mEditor->setCursorPosition( 0 , 0 ); |
4225 |
} |
4226 |
} |
4227 |
|
4167 |
mEditor->sync(); |
4228 |
mEditor->sync(); |
4168 |
} |
4229 |
} |
4169 |
} |
4230 |
} |