X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferviewfilter.cpp;h=e02549c6b6c1a6be36cc476c026fb6cbf0c1990e;hp=ec6a56e415ef1383be2f8583bb5bd647061dd0e2;hb=99bb37d9938f3d88ce7551ded454146359fadc03;hpb=d54beb43e2714e0c035271bc3f32fc869551c6cb diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index ec6a56e4..e02549c6 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -18,10 +18,10 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include - #include "bufferviewfilter.h" +#include + #include "buffermodel.h" #include "client.h" #include "networkmodel.h" @@ -155,9 +155,9 @@ void BufferViewFilter::addBuffer(const BufferId &bufferId) { } void BufferViewFilter::removeBuffer(const QModelIndex &index) { - if(!config()) + if(!config() || !index.isValid() || index.data(NetworkModel::ItemTypeRole) != NetworkModel::BufferItemType) return; - + BufferId bufferId = data(index, NetworkModel::BufferIdRole).value(); config()->requestRemoveBuffer(bufferId); } @@ -266,7 +266,7 @@ QVariant BufferViewFilter::foreground(const QModelIndex &index) const { } void BufferViewFilter::source_rowsInserted(const QModelIndex &parent, int start, int end) { - if(parent.data(NetworkModel::ItemTypeRole) != NetworkModel::NetworkItemType) + if(parent.data(NetworkModel::ItemTypeRole) != NetworkModel::BufferItemType) return; if(!config() || !config()->addNewBuffersAutomatically()) @@ -282,7 +282,7 @@ void BufferViewFilter::source_rowsInserted(const QModelIndex &parent, int start, void BufferViewFilter::checkPreviousCurrentForRemoval(const QModelIndex ¤t, const QModelIndex &previous) { Q_UNUSED(current); if(previous.isValid()) - QCoreApplication::instance()->postEvent(this, new CheckRemovalEvent(previous)); + QCoreApplication::postEvent(this, new CheckRemovalEvent(previous)); } void BufferViewFilter::customEvent(QEvent *event) {