Remove obsolete methods
[quassel.git] / src / qtui / chatscene.cpp
index 4fdf92a..e20f3d6 100644 (file)
 #include <QGraphicsSceneMouseEvent>
 #include <QMenu>
 #include <QPersistentModelIndex>
-#include <QWebView>
+
+#ifdef HAVE_WEBKIT
+#  include <QWebView>
+#endif
 
 #include "chatitem.h"
 #include "chatline.h"
@@ -385,9 +388,15 @@ void ChatScene::updateForViewport(qreal width, qreal height) {
 void ChatScene::setWidth(qreal width) {
   if(width == _sceneRect.width())
     return;
+  layout(width);
+}
 
+void ChatScene::layout(qreal width) {
   // clock_t startT = clock();
 
+  if(width < 0)
+    width = _sceneRect.width();
+
   // disabling the index while doing this complex updates is about
   // 2 to 10 times faster!
   //setItemIndexMethod(QGraphicsScene::NoIndex);
@@ -708,7 +717,12 @@ void ChatScene::selectionToClipboard(QClipboard::Mode mode) {
   stringToClipboard(selection(), mode);
 }
 
-void ChatScene::stringToClipboard(const QString &str, QClipboard::Mode mode) {
+void ChatScene::stringToClipboard(const QString &str_, QClipboard::Mode mode) {
+  QString str = str_;
+  // remove trailing linefeeds
+  if(str.endsWith('\n'))
+    str.chop(1);
+
   switch(mode) {
     case QClipboard::Clipboard:
       QApplication::clipboard()->setText(str);