From 02062e44674ba88ea5ab62c806abb879d520ee43 Mon Sep 17 00:00:00 2001 From: nils Date: Tue, 12 Jul 2011 22:28:23 +0000 Subject: make sign undoable,change return value checkErr to int git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@495 34ebc366-c3a9-4b3c-9f84-69acf7962910 --- gpgwin.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gpgwin.cpp') diff --git a/gpgwin.cpp b/gpgwin.cpp index 5c66324..0028c38 100644 --- a/gpgwin.cpp +++ b/gpgwin.cpp @@ -690,9 +690,14 @@ void GpgWin::sign() QStringList *uidList = mKeyList->getChecked(); QByteArray *tmp = new QByteArray(); - if (mCtx->sign(uidList, edit->curTextPage()->toPlainText().toUtf8(), tmp)) { + if (mCtx->sign(uidList, edit->curTextPage()->toPlainText().toUtf8(), tmp)) { QString *tmp2 = new QString(*tmp); - edit->curTextPage()->setPlainText(*tmp2); + // beginEditBlock and endEditBlock() let operation look like single undo/redo operation + QTextCursor cursor(edit->curTextPage()->document()); + cursor.beginEditBlock(); + edit->curTextPage()->selectAll(); + edit->curTextPage()->insertPlainText(*tmp2); + cursor.endEditBlock(); } } -- cgit