| 1111 | } |
| 1112 | |
| 1113 | bool PythonConsole::canInsertFromMimeData(const QMimeData* source) const |
| 1114 | { |
| 1115 | if (source->hasText()) { |
| 1116 | return true; |
| 1117 | } |
| 1118 | if (source->hasUrls()) { |
| 1119 | QList<QUrl> uri = source->urls(); |
| 1120 | for (const auto& it : uri) { |
| 1121 | QFileInfo info(it.toLocalFile()); |
| 1122 | if (info.exists() && info.isFile()) { |
| 1123 | QString ext = info.suffix().toLower(); |
| 1124 | if (ext == QLatin1String("py") || ext == QLatin1String("fcmacro")) { |
| 1125 | return true; |
| 1126 | } |
| 1127 | } |
| 1128 | } |
| 1129 | } |
| 1130 | |
| 1131 | return false; |
| 1132 | } |
| 1133 | |
| 1134 | /** |
| 1135 | * Allow one to paste plain text or urls of text files. |