/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2019 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
***************************************************************************/
#include "abstractbuffercontainer.h"
+
#include "client.h"
#include "clientbacklogmanager.h"
#include "networkmodel.h"
-AbstractBufferContainer::AbstractBufferContainer(QWidget *parent)
- : AbstractItemView(parent),
- _currentBuffer(0)
-{
-}
-
+AbstractBufferContainer::AbstractBufferContainer(QWidget* parent)
+ : AbstractItemView(parent)
+ , _currentBuffer(0)
+{}
-AbstractBufferContainer::~AbstractBufferContainer()
-{
-}
-
-
-void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end)
+void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex& parent, int start, int end)
{
Q_ASSERT(model());
if (!parent.isValid()) {
if (model()->rowCount(parent) != end - start + 1)
return;
- foreach(BufferId id, _chatViews.keys()) {
+ foreach (BufferId id, _chatViews.keys()) {
removeChatView(id);
}
_chatViews.clear();
else {
// check if there are explicitly buffers removed
for (int i = start; i <= end; i++) {
- QVariant variant = parent.child(i, 0).data(NetworkModel::BufferIdRole);
+ QVariant variant = parent.model()->index(i, 0, parent).data(NetworkModel::BufferIdRole);
if (!variant.isValid())
continue;
}
}
-
void AbstractBufferContainer::removeBuffer(BufferId bufferId)
{
if (!_chatViews.contains(bufferId))
_chatViews.take(bufferId);
}
-
/*
Switching to first buffer is now handled in MainWin::clientNetworkUpdated()
}
*/
-void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
+void AbstractBufferContainer::currentChanged(const QModelIndex& current, const QModelIndex& previous)
{
Q_UNUSED(previous)
}
}
-
void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId)
{
BufferId prevBufferId = currentBuffer();