diff options
author | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-12-05 23:19:53 +0000 |
---|---|---|
committer | ubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910> | 2011-12-05 23:19:53 +0000 |
commit | b2c02478a0a9ac8d597333ba5030a1f1a175b2c2 (patch) | |
tree | 6c59b419f5ef4c6651d3659b79352a8e819b645a /textedit.cpp | |
parent | add functonality for opening online help in qtextbrowser tab (diff) | |
download | gpg4usb-b2c02478a0a9ac8d597333ba5030a1f1a175b2c2.tar.gz gpg4usb-b2c02478a0a9ac8d597333ba5030a1f1a175b2c2.zip |
fix broken cut/copy/paste actions
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@657 34ebc366-c3a9-4b3c-9f84-69acf7962910
Diffstat (limited to 'textedit.cpp')
-rw-r--r-- | textedit.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/textedit.cpp b/textedit.cpp index 5ad8976..e189754 100644 --- a/textedit.cpp +++ b/textedit.cpp @@ -211,6 +211,7 @@ void TextEdit::removeTab(int index) * If it returns false, the close event should be aborted. */ bool TextEdit::maybeSaveCurrentTab(bool askToSave) { + EditorPage *page = curPage(); QTextDocument *document = page->getTextPage()->document(); @@ -309,7 +310,11 @@ bool TextEdit::maybeSaveAnyTab() QTextEdit* TextEdit::curTextPage() { EditorPage *curTextPage = qobject_cast<EditorPage *>(tabWidget->currentWidget()); - return curTextPage->getTextPage(); + if(curTextPage != 0) { + return curTextPage->getTextPage(); + } else { + return 0; + } } @@ -445,7 +450,7 @@ QHash<int, QString> TextEdit::unsavedDocuments() { void TextEdit::cut() { - if (tabWidget->count() == 0) { + if (tabWidget->count() == 0 || curTextPage() == 0) { return; } @@ -454,7 +459,7 @@ void TextEdit::cut() void TextEdit::copy() { - if (tabWidget->count() == 0) { + if (tabWidget->count() == 0 || curTextPage() == 0) { return; } @@ -463,7 +468,7 @@ void TextEdit::copy() void TextEdit::paste() { - if (tabWidget->count() == 0) { + if (tabWidget->count() == 0 || curTextPage() == 0) { return; } @@ -472,7 +477,7 @@ void TextEdit::paste() void TextEdit::undo() { - if (tabWidget->count() == 0) { + if (tabWidget->count() == 0 || curTextPage() == 0) { return; } @@ -481,7 +486,7 @@ void TextEdit::undo() void TextEdit::redo() { - if (tabWidget->count() == 0) { + if (tabWidget->count() == 0 || curTextPage() == 0) { return; } @@ -490,7 +495,7 @@ void TextEdit::redo() void TextEdit::selectAll() { - if (tabWidget->count() == 0) { + if (tabWidget->count() == 0 || curTextPage() == 0) { return; } |