DiffEditor: Make it possible to paste snippets.

Add property "plainText" to DiffEditorDocument which
is queried as last resort by the code paster.

Task-number: QTCREATORBUG-12546
Task-number: QTCREATORBUG-9669
Change-Id: Iea9cd0d296bcc8e8a7300072c1a4a9068c2ab102
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Friedemann Kleint
2014-11-13 09:11:56 +01:00
parent 9605244f6d
commit f268d0f8e1
3 changed files with 14 additions and 1 deletions

View File

@@ -215,8 +215,13 @@ void CodepasterPlugin::postEditor()
if (const BaseTextEditor *textEditor = qobject_cast<const BaseTextEditor *>(editor))
data = textEditor->selectedText();
if (data.isEmpty()) {
if (auto textDocument = qobject_cast<const TextDocument *>(document))
if (auto textDocument = qobject_cast<const TextDocument *>(document)) {
data = textDocument->plainText();
} else {
const QVariant textV = document->property("plainText"); // Diff Editor.
if (textV.type() == QVariant::String)
data = textV.toString();
}
}
post(data, mimeType);
}