| 297 | | /** |
| 298 | | * After we have copied the text, we update the copy so that all emoticons are |
| 299 | | * replaced with their respective smiley. |
| 300 | | */ |
| 301 | | void MLView::slotCopy() |
| 302 | | { |
| 303 | | QTextCursor cr=textCursor(); |
| 304 | | if (!cr.hasSelection()) |
| 305 | | return; |
| 306 | | |
| 307 | | QString html = cr.selection().toHtml(); |
| 308 | | |
| 309 | | Emoticons::unparseMessage(html); |
| 310 | | |
| 311 | | QString text = QTextDocumentFragment::fromHtml(html).toPlainText(); |
| 312 | | |
| 313 | | QClipboard* cb = QApplication::clipboard(); |
| 314 | | cb->setText(text); |
| 315 | | if (cb->supportsSelection()) |
| 316 | | cb->setText(text, QClipboard::Selection); |
| | 296 | QMimeData* MLView::createMimeDataFromSelection() const |
| | 297 | { |
| | 298 | QMimeData* result = QTextEdit::createMimeDataFromSelection(); |
| | 299 | |
| | 300 | if (result->hasHtml()) |
| | 301 | { |
| | 302 | QString html = result->html(); |
| | 303 | Emoticons::unparseMessage(html); |
| | 304 | QTextDocumentFragment fragment = |
| | 305 | QTextDocumentFragment::fromHtml(html, document()); |
| | 306 | result->setText(fragment.toPlainText()); |
| | 307 | } |
| | 308 | |
| | 309 | return result; |