Finishing the switch to types.h and the resulting cleanup.
[quassel.git] / src / qtopia / chatwidget.cpp
index 8c81f44..4475962 100644 (file)
@@ -24,6 +24,7 @@
 
 ChatWidget::ChatWidget(QWidget *parent) : QTextEdit(parent) {
   setStyleSheet("background-color: rgba(255, 255, 255, 60%)");
+  setTextInteractionFlags(Qt::TextBrowserInteraction);
 }
 
 void ChatWidget::setContents(QList<ChatLine *> lines) {
@@ -47,7 +48,10 @@ void ChatWidget::appendMsg(AbstractUiMsg *msg) {
 void ChatWidget::appendChatLine(ChatLine *line) {
   QTextCursor cursor = textCursor();
   moveCursor(QTextCursor::End);
-  insertChatLine(line);
+  if(!document()->isEmpty()) insertPlainText("\n");
+  insertStyledText(line->styledSender());
+  insertPlainText(" ");
+  insertStyledText(line->styledText());
   setTextCursor(cursor);
 }
 
@@ -60,7 +64,11 @@ void ChatWidget::appendChatLines(QList<ChatLine *> list) {
 void ChatWidget::prependChatLine(ChatLine *line) {
   QTextCursor cursor = textCursor();
   moveCursor(QTextCursor::Start);
-  insertChatLine(line);
+  bool flg = document()->isEmpty();
+  insertStyledText(line->styledSender());
+  insertPlainText(" ");
+  insertStyledText(line->styledText());
+  if(!flg) insertPlainText("\n");
   setTextCursor(cursor);
 }
 
@@ -71,10 +79,10 @@ void ChatWidget::prependChatLines(QList<ChatLine *> list) {
 }
 
 void ChatWidget::insertChatLine(ChatLine *line) {
+  if(!document()->isEmpty()) insertPlainText("\n");
   insertStyledText(line->styledSender());
   insertPlainText(" ");
   insertStyledText(line->styledText());
-  insertPlainText("\n");
 }
 
 void ChatWidget::insertStyledText(const QtopiaUiStyle::StyledText &stext) {