diff options
author | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-01-29 20:30:59 +0000 |
---|---|---|
committer | nils <nils@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-01-29 20:30:59 +0000 |
commit | d904227bfe0a5aea25fc24274ad86f2f886645a0 (patch) | |
tree | 44b77f673c2663c10dc3efd5d13bcc8f3619a331 | |
parent | show keys to delete in deletion dialog (diff) | |
download | gpg4usb-d904227bfe0a5aea25fc24274ad86f2f886645a0.tar.gz gpg4usb-d904227bfe0a5aea25fc24274ad86f2f886645a0.zip |
undoable encrypt and decrypt
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@454 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r-- | TODO | 6 | ||||
-rw-r--r-- | gpgwin.cpp | 16 |
2 files changed, 16 insertions, 6 deletions
@@ -33,14 +33,14 @@ attachments: - add tab for editor options, like font-size, line-break, tab-width, line-numbers,.. - update gpgme-library - clean header if quoted printable decoded -- add quote button +- add quote button [DONE] - fix overwrite file bug in file encryption [DONE] - add drag'n'drop features for keys [DONE] - add posibility to change password of key - check and add missing statusbar messages - add editorpage-method setmodified -- tab switching tab down doesn't work right in windows -- list keys to delete in warning dialog +- list keys to delete in warning dialog [DONE] +- undoable encrypt and decrypt [DONE] Release 0.3 - PGP-MIME, find and show inline encrypted files @@ -479,10 +479,15 @@ void GpgWin::encrypt() QStringList *uidList = mKeyList->getChecked(); QByteArray *tmp = new QByteArray(); -// if (mCtx->encrypt(uidList, edit.curTextPage.toPlainText().toUtf8(), tmp)) { if (mCtx->encrypt(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(); } } @@ -516,7 +521,12 @@ void GpgWin::decrypt() } } } - edit->curTextPage()->setPlainText(QString::fromUtf8(*decrypted)); + // beginEditBlock and endEditBlock() let operation look like single undo/redo operation + QTextCursor cursor(edit->curTextPage()->document()); + cursor.beginEditBlock(); + edit->curTextPage()->selectAll(); + edit->curTextPage()->insertPlainText(QString::fromUtf8(*decrypted)); + cursor.endEditBlock(); } } |