The paste without mime format was pressed
| 1061 | |
| 1062 | // The paste without mime format was pressed |
| 1063 | void NBrowserWindow::pasteWithoutFormatButtonPressed() { |
| 1064 | const QMimeData *mime = QApplication::clipboard()->mimeData(); |
| 1065 | if (!mime->hasText()) |
| 1066 | return; |
| 1067 | QString text = mime->text(); |
| 1068 | QApplication::clipboard()->clear(); |
| 1069 | QApplication::clipboard()->setText(text, QClipboard::Clipboard); |
| 1070 | this->editor->triggerPageAction(QWebPage::Paste); |
| 1071 | |
| 1072 | // This is done because pasting into an encryption block |
| 1073 | // can cause multiple cells (which can't happen). It |
| 1074 | // just goes through the table, extracts the data, & |
| 1075 | // puts it back as one table cell. |
| 1076 | if (insideEncryption) { |
| 1077 | QString js = QString( "function fixEncryption() { ") |
| 1078 | +QString(" var selObj = window.getSelection();") |
| 1079 | +QString(" var selRange = selObj.getRangeAt(0);") |
| 1080 | +QString(" var workingNode = window.getSelection().anchorNode;") |
| 1081 | +QString(" while(workingNode != null && workingNode.nodeName.toLowerCase() != 'table') { ") |
| 1082 | +QString(" workingNode = workingNode.parentNode;") |
| 1083 | +QString(" } ") |
| 1084 | +QString(" workingNode.innerHTML = window.browserWindow.fixEncryptionPaste(workingNode.innerHTML);") |
| 1085 | +QString("} fixEncryption();"); |
| 1086 | editor->page()->mainFrame()->evaluateJavaScript(js); |
| 1087 | } |
| 1088 | |
| 1089 | this->editor->setFocus(); |
| 1090 | microFocusChanged(); |
| 1091 | } |
| 1092 | |
| 1093 | // This basically removes all the table tags and returns just the contents. |
| 1094 | // This is called by JavaScript to fix encryption pastes. |
no test coverage detected