Quassel no longer gets a nervous breakdown when you select too many buffers - fixes...
[quassel.git] / src / uisupport / bufferviewfilter.cpp
index 7c85dfd..bb67e50 100644 (file)
@@ -97,6 +97,7 @@ void BufferViewFilter::setConfig(BufferViewConfig *config) {
 
   if(!config) {
     invalidate();
+    setObjectName("");
     return;
   }
 
@@ -127,6 +128,8 @@ void BufferViewFilter::configInitialized() {
 
   disconnect(config(), SIGNAL(initDone()), this, SLOT(configInitialized()));
 
+  setObjectName(config()->bufferViewName());
+
   invalidate();
   emit configChanged();
 }
@@ -281,7 +284,10 @@ bool BufferViewFilter::filterAcceptBuffer(const QModelIndex &source_bufferIndex)
   if(config()->networkId().isValid() && config()->networkId() != source_bufferIndex.data(NetworkModel::NetworkIdRole).value<NetworkId>())
     return false;
 
-  if(!(config()->allowedBufferTypes() & (BufferInfo::Type)source_bufferIndex.data(NetworkModel::BufferTypeRole).toInt()))
+  int allowedBufferTypes = config()->allowedBufferTypes();
+  if(!config()->networkId().isValid())
+    allowedBufferTypes &= ~BufferInfo::StatusBuffer;
+  if(!(allowedBufferTypes & source_bufferIndex.data(NetworkModel::BufferTypeRole).toInt()))
     return false;
 
   // the following dynamic filters may not trigger if the buffer is currently selected.
@@ -496,10 +502,7 @@ void BufferViewFilter::checkItemsForRemoval(const QModelIndex &topLeft, const QM
   emit _dataChanged(source_topLeft, source_bottomRight);
 }
 
-// ******************************
-//  Helper
-// ******************************
-bool bufferIdLessThan(const BufferId &left, const BufferId &right) {
+bool BufferViewFilter::bufferIdLessThan(const BufferId &left, const BufferId &right) {
   Q_CHECK_PTR(Client::networkModel());
   if(!Client::networkModel())
     return true;