X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferviewfilter.cpp;h=1245579bc28be4080b0ad9a169bd8d9e2c4e4ade;hp=a1744f6279b401aaa77a1d101a49c64e869765b4;hb=5cda35fc55cf023172cdf81303cf6b617efc9775;hpb=8db1c0298b0b9baf3af072a5ef368b2f2d14169d diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index a1744f62..1245579b 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -22,6 +22,7 @@ #include +#include "buffermodel.h" #include "client.h" #include "networkmodel.h" @@ -146,16 +147,20 @@ void BufferViewFilter::removeBuffer(const QModelIndex &index) { bool BufferViewFilter::filterAcceptBuffer(const QModelIndex &source_bufferIndex) const { if(!_config) return true; - + + if(config()->networkId().isValid() && config()->networkId() != sourceModel()->data(source_bufferIndex, NetworkModel::NetworkIdRole).value()) + return false; + if(!(_config->allowedBufferTypes() & (BufferInfo::Type)source_bufferIndex.data(NetworkModel::BufferTypeRole).toInt())) return false; if(_config->hideInactiveBuffers() && !source_bufferIndex.data(NetworkModel::ItemActiveRole).toBool()) return false; - // FIXME: this can result in bad loops :( - // if(_config->minimumActivity() > source_bufferIndex.data(NetworkModel::BufferActivityRole).toInt()) - // return false; + if(_config->minimumActivity() > source_bufferIndex.data(NetworkModel::BufferActivityRole).toInt()) { + if(!Client::bufferModel()->standardSelectionModel()->isSelected(source_bufferIndex)) + return false; + } BufferId bufferId = sourceModel()->data(source_bufferIndex, NetworkModel::BufferIdRole).value(); return _config->bufferList().contains(bufferId); @@ -204,7 +209,7 @@ bool BufferViewFilter::bufferLessThan(const QModelIndex &source_left, const QMod if(config()) { return config()->bufferList().indexOf(leftBufferId) < config()->bufferList().indexOf(rightBufferId); } else - return leftBufferId < rightBufferId; + return bufferIdLessThan(leftBufferId, rightBufferId); } bool BufferViewFilter::networkLessThan(const QModelIndex &source_left, const QModelIndex &source_right) const { @@ -277,6 +282,6 @@ bool bufferIdLessThan(const BufferId &left, const BufferId &right) { if(leftType != rightType) return leftType < rightType; else - return Client::networkModel()->data(leftIndex, Qt::DisplayRole).toString() < Client::networkModel()->data(rightIndex, Qt::DisplayRole).toString(); + return QString::compare(Client::networkModel()->data(leftIndex, Qt::DisplayRole).toString(), Client::networkModel()->data(rightIndex, Qt::DisplayRole).toString(), Qt::CaseInsensitive) < 0; }