Show save image option only when it is needed

This commit is contained in:
hunbernd 2015-12-12 22:41:15 +01:00
parent bbebd6a5d7
commit bc4691ceb4
4 changed files with 21 additions and 4 deletions

View file

@ -41,3 +41,11 @@ void ImageUtil::extractImage(QWidget *window, QTextCursor cursor)
QMessageBox::warning(window, QApplication::translate("ImageUtil", "Save image"), QApplication::translate("ImageUtil", "Not an image"));
}
}
bool ImageUtil::checkImage(QTextCursor cursor)
{
cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, 1);
cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, 2);
QString imagestr = cursor.selection().toHtml();
return imagestr.indexOf("base64,") != -1;
}