aboutsummaryrefslogtreecommitdiffstats
path: root/mainwindow.cpp
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-01-08 02:44:12 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2012-01-08 02:44:12 +0000
commit95dafa64d09565ad8deee2c8a4dafc4242d6f3a7 (patch)
treeb646d283d85cc42ee4d1826bb5c3da9574823316 /mainwindow.cpp
parentadd copyFingerprint button to detailsdialog (diff)
downloadgpg4usb-95dafa64d09565ad8deee2c8a4dafc4242d6f3a7.tar.gz
gpg4usb-95dafa64d09565ad8deee2c8a4dafc4242d6f3a7.zip
some code for preventing remove spacing from signatures. not yet finished.
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@734 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r--mainwindow.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 97cab33..d90ffd1 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -895,7 +895,25 @@ void MainWindow::cleanDoubleLinebreaks()
}
QString content = edit->curTextPage()->toPlainText();
- content.replace("\n\n", "\n");
+
+ /**
+ * make sure to not remove parts of signature
+ */
+ int start = content.indexOf(GpgConstants::PGP_SIGNED_BEGIN);
+ int startSig = content.indexOf(GpgConstants::PGP_SIGNATURE_BEGIN);
+
+ bool isSignature = false;
+ if(start > -1 || startSig > -1 ) {
+ isSignature=true;
+ }
+
+ if(isSignature) {
+ // cut between start+next \n and startSig, replace \n\n and then insert between
+ // start+next \n and startSig
+ } else {
+ content.replace("\n\n", "\n");
+ }
+
edit->fillTextEditWithText(content);
}