X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fuisupport%2Fabstractbuffercontainer.cpp;h=ee34905c6fd2f831873b72850768cbc93b224142;hp=e8f505db00a92cf1a2cd6fd0da0ce3fea1af9063;hb=a453c963cf1872e14c83adf1d40a31821c166805;hpb=694f9bfbf7f1af19108461c7e00d133e55082bce diff --git a/src/uisupport/abstractbuffercontainer.cpp b/src/uisupport/abstractbuffercontainer.cpp index e8f505db..ee34905c 100644 --- a/src/uisupport/abstractbuffercontainer.cpp +++ b/src/uisupport/abstractbuffercontainer.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2012 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 * @@ -15,27 +15,21 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #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()) { @@ -45,7 +39,7 @@ void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, in if (model()->rowCount(parent) != end - start + 1) return; - foreach(BufferId id, _chatViews.keys()) { + foreach (BufferId id, _chatViews.keys()) { removeChatView(id); } _chatViews.clear(); @@ -53,7 +47,7 @@ void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, in 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; @@ -63,7 +57,6 @@ void AbstractBufferContainer::rowsAboutToBeRemoved(const QModelIndex &parent, in } } - void AbstractBufferContainer::removeBuffer(BufferId bufferId) { if (!_chatViews.contains(bufferId)) @@ -73,7 +66,6 @@ void AbstractBufferContainer::removeBuffer(BufferId bufferId) _chatViews.take(bufferId); } - /* Switching to first buffer is now handled in MainWin::clientNetworkUpdated() @@ -93,7 +85,7 @@ void AbstractBufferContainer::rowsInserted(const QModelIndex &parent, int start, } */ -void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) +void AbstractBufferContainer::currentChanged(const QModelIndex& current, const QModelIndex& previous) { Q_UNUSED(previous) @@ -106,7 +98,6 @@ void AbstractBufferContainer::currentChanged(const QModelIndex ¤t, const Q } } - void AbstractBufferContainer::setCurrentBuffer(BufferId bufferId) { BufferId prevBufferId = currentBuffer();