Only try to extract images if the image uploader is enabled (#4246)
* Only try to extract images if the image uploader is enabled * Add changelog entry
This commit is contained in:
@@ -286,31 +286,34 @@ bool ResizingTextEdit::canInsertFromMimeData(const QMimeData *source) const
|
||||
|
||||
void ResizingTextEdit::insertFromMimeData(const QMimeData *source)
|
||||
{
|
||||
if (source->hasImage())
|
||||
if (getSettings()->imageUploaderEnabled)
|
||||
{
|
||||
this->imagePasted.invoke(source);
|
||||
return;
|
||||
}
|
||||
|
||||
if (source->hasUrls())
|
||||
{
|
||||
bool hasUploadable = false;
|
||||
auto mimeDb = QMimeDatabase();
|
||||
for (const QUrl &url : source->urls())
|
||||
{
|
||||
QMimeType mime = mimeDb.mimeTypeForUrl(url);
|
||||
if (mime.name().startsWith("image"))
|
||||
{
|
||||
hasUploadable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUploadable)
|
||||
if (source->hasImage())
|
||||
{
|
||||
this->imagePasted.invoke(source);
|
||||
return;
|
||||
}
|
||||
|
||||
if (source->hasUrls())
|
||||
{
|
||||
bool hasUploadable = false;
|
||||
auto mimeDb = QMimeDatabase();
|
||||
for (const QUrl &url : source->urls())
|
||||
{
|
||||
QMimeType mime = mimeDb.mimeTypeForUrl(url);
|
||||
if (mime.name().startsWith("image"))
|
||||
{
|
||||
hasUploadable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasUploadable)
|
||||
{
|
||||
this->imagePasted.invoke(source);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
insertPlainText(source->text());
|
||||
|
||||
Reference in New Issue
Block a user