Enabled embedded images in private chat and messages (only for QT version 4.7.0 and higher)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6083 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-01-22 00:14:10 +00:00
parent a2a27a874f
commit 138a35b2a2
3 changed files with 24 additions and 24 deletions

View file

@ -118,10 +118,10 @@ ChatWidget::ChatWidget(QWidget *parent) :
ui->chatTextEdit->installEventFilter(this); ui->chatTextEdit->installEventFilter(this);
//#if QT_VERSION < 0x040700 #if QT_VERSION < 0x040700
// embedded images are not supported before QT 4.7.0 // embedded images are not supported before QT 4.7.0
ui->attachPictureButton->setVisible(false); ui->attachPictureButton->setVisible(false);
//#endif #endif
resetStatusBar(); resetStatusBar();
} }

View file

@ -33,11 +33,11 @@ bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
{ {
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
// embedded images are not supported before QT 4.7.0 // embedded images are not supported before QT 4.7.0
// if (source != NULL) { if (source != NULL) {
// if (source->hasImage()) { if (source->hasImage()) {
// return true; return true;
// } }
// } }
#endif #endif
return QTextEdit::canInsertFromMimeData(source); return QTextEdit::canInsertFromMimeData(source);
@ -47,20 +47,20 @@ void MimeTextEdit::insertFromMimeData(const QMimeData* source)
{ {
#if QT_VERSION >= 0x040700 #if QT_VERSION >= 0x040700
// embedded images are not supported before QT 4.7.0 // embedded images are not supported before QT 4.7.0
// if (source != NULL) { if (source != NULL) {
// if (source->hasImage()) { if (source->hasImage()) {
// // insert as embedded image // insert as embedded image
// QImage image = qvariant_cast<QImage>(source->imageData()); QImage image = qvariant_cast<QImage>(source->imageData());
// if (image.isNull() == false) { if (image.isNull() == false) {
// QString encodedImage; QString encodedImage;
// if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) { if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) {
// QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage); QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
// this->textCursor().insertFragment(fragment); this->textCursor().insertFragment(fragment);
// return; return;
// } }
// } }
// } }
// } }
#endif #endif
return QTextEdit::insertFromMimeData(source); return QTextEdit::insertFromMimeData(source);

View file

@ -310,10 +310,10 @@ MessageComposer::MessageComposer(QWidget *parent, Qt::WFlags flags)
ui.hashBox->setDropWidget(this); ui.hashBox->setDropWidget(this);
ui.hashBox->setAutoHide(true); ui.hashBox->setAutoHide(true);
//#if QT_VERSION < 0x040700 #if QT_VERSION < 0x040700
// embedded images are not supported before QT 4.7.0 // embedded images are not supported before QT 4.7.0
ui.imagebtn->setVisible(false); ui.imagebtn->setVisible(false);
//#endif #endif
/* Hide platform specific features */ /* Hide platform specific features */
#ifdef Q_WS_WIN #ifdef Q_WS_WIN