Bring back highlights
[quassel.git] / src / qtui / chatline.cpp
index 6e4982a..5f03d9d 100644 (file)
@@ -35,6 +35,8 @@ ChatLine::ChatLine(const QModelIndex &index, QGraphicsItem *parent) : QGraphicsI
   _timestampItem->setPos(0,0);
   _width = _height = 0;
   _selection = 0;
   _timestampItem->setPos(0,0);
   _width = _height = 0;
   _selection = 0;
+
+  if(_contentsItem->data(MessageModel::FlagsRole).toInt() & Message::Highlight) setHighlighted(true);
 }
 
 ChatLine::~ChatLine() {
 }
 
 ChatLine::~ChatLine() {
@@ -75,15 +77,21 @@ qreal ChatLine::setGeometry(qreal width, qreal firstHandlePos, qreal secondHandl
 
 void ChatLine::setSelected(bool selected, ChatLineModel::ColumnType minColumn) {
   if(selected) {
 
 void ChatLine::setSelected(bool selected, ChatLineModel::ColumnType minColumn) {
   if(selected) {
-    _selection = (_selection & 0x80) | 0x40 | minColumn;
-    for(int i = 0; i < minColumn; i++) item((ChatLineModel::ColumnType)i)->clearSelection();
-    for(int i = minColumn; i <= ChatLineModel::ContentsColumn; i++) item((ChatLineModel::ColumnType)i)->setFullSelection();
-  }
-  else {
-    _selection &= 0x80;
-    for(int i = 0; i <= ChatLineModel::ContentsColumn; i++) item((ChatLineModel::ColumnType)i)->clearSelection();
+    quint8 sel = (_selection & 0x80) | 0x40 | minColumn;
+    if(sel != _selection) {
+      _selection = sel;
+      for(int i = 0; i < minColumn; i++) item((ChatLineModel::ColumnType)i)->clearSelection();
+      for(int i = minColumn; i <= ChatLineModel::ContentsColumn; i++) item((ChatLineModel::ColumnType)i)->setFullSelection();
+      update();
+    }
+  } else {
+    quint8 sel = _selection & 0x80;
+    if(sel != _selection) {
+      _selection = sel;
+      for(int i = 0; i <= ChatLineModel::ContentsColumn; i++) item((ChatLineModel::ColumnType)i)->clearSelection();
+      update();
+    }
   }
   }
-  update();
 }
 
 void ChatLine::setHighlighted(bool highlighted) {
 }
 
 void ChatLine::setHighlighted(bool highlighted) {