X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fbufferviewfilter.cpp;h=58a053aa30d9c9e2f35ef8c43c53f743233d0a9e;hp=3e4886cd87337baacf811ac904bb0a8a160adacf;hb=43e72e1cdba9451c58d322bf638e3bf761be71ac;hpb=ac84f5fd1e6a260bf4c147f623fae22ec3220647 diff --git a/src/uisupport/bufferviewfilter.cpp b/src/uisupport/bufferviewfilter.cpp index 3e4886cd..58a053aa 100644 --- a/src/uisupport/bufferviewfilter.cpp +++ b/src/uisupport/bufferviewfilter.cpp @@ -39,7 +39,6 @@ BufferViewFilter::BufferViewFilter(QAbstractItemModel *model, BufferViewConfig * setSourceModel(model); connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(source_rowsInserted(const QModelIndex &, int, int))); - // setSortCaseSensitivity(Qt::CaseInsensitive); setDynamicSortFilter(true); } @@ -116,7 +115,7 @@ bool BufferViewFilter::dropMimeData(const QMimeData *data, Qt::DropAction action } void BufferViewFilter::addBuffer(const BufferId &bufferId) { - if(config()->bufferList().contains(bufferId)) + if(!config() || config()->bufferList().contains(bufferId)) return; int pos = config()->bufferList().count(); @@ -254,14 +253,16 @@ 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()) return; + QModelIndex child; for(int row = start; row <= end; row++) { - addBuffer(parent.child(row, 0).data(NetworkModel::BufferIdRole).value()); + child = sourceModel()->index(row, 0, parent); + addBuffer(sourceModel()->data(child, NetworkModel::BufferIdRole).value()); } } @@ -282,6 +283,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; }