Commit 52ec38c6 authored by Laurent Montel's avatar Laurent Montel 😁

Fix clean signature

parent 75050208
......@@ -43,16 +43,17 @@ void RichTextComposerSignaturesTest::shouldCleanSignature()
emptySignature.setText(QStringLiteral("bla Bla\t"));
emptySignature.setEnabledSignature(true);
emptySignature.setInlinedHtml(false);
richtextComposerNg.insertSignature(emptySignature, KIdentityManagement::Signature::Start, KIdentityManagement::Signature::AddNewLines);
KIdentityManagement::Signature newSignature(QStringLiteral("Signature"));
newSignature.setText(QStringLiteral("Foo Bla\t"));
newSignature.setEnabledSignature(true);
newSignature.setInlinedHtml(false);
composerSignature->replaceSignature(emptySignature, newSignature);
richtextComposerNg.insertSignature(emptySignature, KIdentityManagement::Signature::Start, KIdentityManagement::Signature::AddNewLines);
composerSignature->cleanWhitespace(newSignature);
QCOMPARE(richtextComposerNg.toPlainText(), QStringLiteral("\n\nFoo Bla\t"));
composerSignature->replaceSignature(emptySignature, newSignature);
QCOMPARE(richtextComposerNg.toPlainText(), QStringLiteral("\n\nbla Bla "));
}
......@@ -143,14 +143,17 @@ RichTextComposerSignatures::RichTextComposerSignaturesPrivate::signaturePosition
bool RichTextComposerSignatures::replaceSignature(const KIdentityManagement::Signature &oldSig, const KIdentityManagement::Signature &newSig)
{
qDebug() << "bool RichTextComposerSignatures::replaceSignature(const KIdentityManagement::Signature &oldSig, const KIdentityManagement::Signature &newSig)";
bool found = false;
if (oldSig == newSig) {
return false;
}
qDebug() << "111bool RichTextComposerSignatures::replaceSignature(const KIdentityManagement::Signature &oldSig, const KIdentityManagement::Signature &newSig)";
QString oldSigText = oldSig.toPlainText();
if (oldSigText.isEmpty()) {
return false;
}
qDebug() << "222bool RichTextComposerSignatures::replaceSignature(const KIdentityManagement::Signature &oldSig, const KIdentityManagement::Signature &newSig)";
QTextCursor cursor(d->richTextComposer->document());
cursor.beginEditBlock();
int currentSearchPosition = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment