adding new settings for proper message redirection
[quassel.git] / src / uisupport / bufferviewfilter.cpp
index 5899853..687cd80 100644 (file)
@@ -216,13 +216,15 @@ bool BufferViewFilter::filterAcceptBuffer(const QModelIndex &source_bufferIndex)
   if(!(config()->allowedBufferTypes() & (BufferInfo::Type)source_bufferIndex.data(NetworkModel::BufferTypeRole).toInt()))
     return false;
 
-  if(config()->hideInactiveBuffers() && !source_bufferIndex.data(NetworkModel::ItemActiveRole).toBool())
+  // the following dynamic filters may not trigger if the buffer is currently selected.
+  if(bufferId == Client::bufferModel()->standardSelectionModel()->currentIndex().data(NetworkModel::BufferIdRole).value<BufferId>())
+    return true;
+
+  if(config()->hideInactiveBuffers() && !source_bufferIndex.data(NetworkModel::ItemActiveRole).toBool() && activityLevel <= BufferInfo::OtherActivity)
     return false;
 
-  if(config()->minimumActivity() > activityLevel) {
-    if(bufferId != Client::bufferModel()->standardSelectionModel()->currentIndex().data(NetworkModel::BufferIdRole).value<BufferId>())
-      return false;
-  }
+  if(config()->minimumActivity() > activityLevel)
+    return false;
 
   return true;
 }
@@ -302,9 +304,6 @@ QVariant BufferViewFilter::data(const QModelIndex &index, int role) const {
 }
 
 QVariant BufferViewFilter::foreground(const QModelIndex &index) const {
-  if(!index.data(NetworkModel::ItemActiveRole).toBool())
-    return _FgColorInactiveActivity;
-
   BufferInfo::ActivityLevel activity = (BufferInfo::ActivityLevel)index.data(NetworkModel::BufferActivityRole).toInt();
 
   if(activity & BufferInfo::Highlight)
@@ -314,6 +313,9 @@ QVariant BufferViewFilter::foreground(const QModelIndex &index) const {
   if(activity & BufferInfo::OtherActivity)
     return _FgColorOtherActivity;
 
+  if(!index.data(NetworkModel::ItemActiveRole).toBool())
+    return _FgColorInactiveActivity;
+
   return _FgColorNoActivity;
 }