+ // posting an event ensures that the item will not be removed as
+ // the result of another event. this could result in bad segfaults
+ QCoreApplication::postEvent(this, new ClearWebPreviewEvent());
+ }
+#endif
+}
+
+void ChatScene::showWebPreview() {
+#ifdef HAVE_WEBKIT
+ if(webPreview.previewItem)
+ addItem(webPreview.previewItem);
+#endif
+}
+
+void ChatScene::clearWebPreviewEvent(ClearWebPreviewEvent *event) {
+#ifdef HAVE_WEBKIT
+ event->accept();
+ if(webPreview.previewItem) {
+ if(webPreview.previewItem->scene()) {