diff --git a/retroshare-gui/src/gui/chat/ChatWidget.ui b/retroshare-gui/src/gui/chat/ChatWidget.ui
index ff0b9bef4..cfb99c205 100644
--- a/retroshare-gui/src/gui/chat/ChatWidget.ui
+++ b/retroshare-gui/src/gui/chat/ChatWidget.ui
@@ -259,25 +259,6 @@ border-image: url(:/images/closepressed.png)
- -
-
-
-
- 0
- 0
-
-
-
-
- 0
- 30
-
-
-
- Qt::CustomContextMenu
-
-
-
-
@@ -300,6 +281,25 @@ border-image: url(:/images/closepressed.png)
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 30
+
+
+
+ Qt::CustomContextMenu
+
+
+
@@ -725,6 +725,11 @@ border-image: url(:/images/closepressed.png)
1
+
+ MimeTextEdit
+ QTextEdit
+ gui/common/MimeTextEdit.h
+
diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.cpp b/retroshare-gui/src/gui/common/MimeTextEdit.cpp
new file mode 100644
index 000000000..e6a69dccb
--- /dev/null
+++ b/retroshare-gui/src/gui/common/MimeTextEdit.cpp
@@ -0,0 +1,67 @@
+/****************************************************************
+ * This file is distributed under the following license:
+ *
+ * Copyright (c) 2010, RetroShare Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ ****************************************************************/
+
+#include
+#include
+#include "MimeTextEdit.h"
+#include "util/HandleRichText.h"
+
+MimeTextEdit::MimeTextEdit(QWidget *parent)
+ : QTextEdit(parent)
+{
+}
+
+bool MimeTextEdit::canInsertFromMimeData(const QMimeData* source) const
+{
+#if QT_VERSION >= 0x040700
+ // embedded images are not supported before QT 4.7.0
+// if (source != NULL) {
+// if (source->hasImage()) {
+// return true;
+// }
+// }
+#endif
+
+ return QTextEdit::canInsertFromMimeData(source);
+}
+
+void MimeTextEdit::insertFromMimeData(const QMimeData* source)
+{
+#if QT_VERSION >= 0x040700
+ // embedded images are not supported before QT 4.7.0
+// if (source != NULL) {
+// if (source->hasImage()) {
+// // insert as embedded image
+// QImage image = qvariant_cast(source->imageData());
+// if (image.isNull() == false) {
+// QString encodedImage;
+// if (RsHtml::makeEmbeddedImage(image, encodedImage, 640*480)) {
+// QTextDocumentFragment fragment = QTextDocumentFragment::fromHtml(encodedImage);
+// this->textCursor().insertFragment(fragment);
+// return;
+// }
+// }
+// }
+// }
+#endif
+
+ return QTextEdit::insertFromMimeData(source);
+}
diff --git a/retroshare-gui/src/gui/common/MimeTextEdit.h b/retroshare-gui/src/gui/common/MimeTextEdit.h
new file mode 100644
index 000000000..6617ba501
--- /dev/null
+++ b/retroshare-gui/src/gui/common/MimeTextEdit.h
@@ -0,0 +1,40 @@
+/****************************************************************
+ * This file is distributed under the following license:
+ *
+ * Copyright (c) 2012, RetroShare Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ ****************************************************************/
+
+#ifndef MIMETEXTEDIT_H
+#define MIMETEXTEDIT_H
+
+#include
+
+class MimeTextEdit : public QTextEdit
+{
+ Q_OBJECT
+
+public:
+ MimeTextEdit(QWidget *parent = 0);
+
+protected:
+ virtual bool canInsertFromMimeData(const QMimeData* source) const;
+ virtual void insertFromMimeData(const QMimeData* source);
+
+};
+
+#endif // MIMETEXTEDIT_H
diff --git a/retroshare-gui/src/gui/msgs/MessageComposer.ui b/retroshare-gui/src/gui/msgs/MessageComposer.ui
index b03abe4c4..ca46e8114 100644
--- a/retroshare-gui/src/gui/msgs/MessageComposer.ui
+++ b/retroshare-gui/src/gui/msgs/MessageComposer.ui
@@ -640,7 +640,7 @@
-
-
+
4
@@ -950,6 +950,11 @@
1
+
+ MimeTextEdit
+ QTextEdit
+ gui/common/MimeTextEdit.h
+
FriendSelectionWidget
QWidget
diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro
index 4514faaf4..7f154ec01 100644
--- a/retroshare-gui/src/retroshare-gui.pro
+++ b/retroshare-gui/src/retroshare-gui.pro
@@ -378,6 +378,7 @@ HEADERS += rshare.h \
gui/common/LinkTextBrowser.h \
gui/common/UserNotify.h \
gui/common/HeaderFrame.h \
+ gui/common/MimeTextEdit.h \
gui/style/RSStyle.h \
gui/style/StyleDialog.h \
gui/MessagesDialog.h \
@@ -639,6 +640,7 @@ SOURCES += main.cpp \
gui/common/LinkTextBrowser.cpp \
gui/common/UserNotify.cpp \
gui/common/HeaderFrame.cpp \
+ gui/common/MimeTextEdit.cpp \
gui/style/RSStyle.cpp \
gui/style/StyleDialog.cpp \
gui/settings/rsharesettings.cpp \