/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2016 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
#include "client.h"
#include "clientbufferviewconfig.h"
#include "graphicalui.h"
-#include "iconloader.h"
#include "networkmodel.h"
#include "uistyle.h"
-class CheckRemovalEvent : public QEvent
-{
-public:
- CheckRemovalEvent(const QModelIndex &source_index) : QEvent(QEvent::User), index(source_index) {};
- QPersistentModelIndex index;
-};
-
/*****************************************
* The Filter for the Tree View
setDynamicSortFilter(true);
- connect(this, SIGNAL(_dataChanged(const QModelIndex &, const QModelIndex &)),
- this, SLOT(_q_sourceDataChanged(QModelIndex, QModelIndex)));
-
_enableEditMode.setCheckable(true);
_enableEditMode.setChecked(_editMode);
connect(&_enableEditMode, SIGNAL(toggled(bool)), this, SLOT(enableEditMode(bool)));
if (enable == false) {
addBuffers(QList<BufferId>::fromSet(_toAdd));
QSet<BufferId>::const_iterator iter;
- for (iter = _toTempRemove.constBegin(); iter != _toTempRemove.constEnd(); iter++) {
+ for (iter = _toTempRemove.constBegin(); iter != _toTempRemove.constEnd(); ++iter) {
if (config()->temporarilyRemovedBuffers().contains(*iter))
continue;
config()->requestRemoveBuffer(*iter);
}
- for (iter = _toRemove.constBegin(); iter != _toRemove.constEnd(); iter++) {
+ for (iter = _toRemove.constBegin(); iter != _toRemove.constEnd(); ++iter) {
if (config()->removedBuffers().contains(*iter))
continue;
config()->requestRemoveBufferPermanently(*iter);
if (!config())
return true;
+ if (config()->hideInactiveNetworks() && !(sourceModel()->data(source_index, NetworkModel::ItemActiveRole).toBool())) {
+ return false;
+ }
+
if (!config()->networkId().isValid()) {
return true;
}
}
-void BufferViewFilter::checkPreviousCurrentForRemoval(const QModelIndex ¤t, const QModelIndex &previous)
-{
- Q_UNUSED(current);
- if (previous.isValid())
- QCoreApplication::postEvent(this, new CheckRemovalEvent(previous));
-}
-
-
-void BufferViewFilter::customEvent(QEvent *event)
-{
- if (event->type() != QEvent::User)
- return;
-
- CheckRemovalEvent *removalEvent = static_cast<CheckRemovalEvent *>(event);
- checkItemForRemoval(removalEvent->index);
-
- event->accept();
-}
-
-
-void BufferViewFilter::checkItemsForRemoval(const QModelIndex &topLeft, const QModelIndex &bottomRight)
-{
- QModelIndex source_topLeft = mapToSource(topLeft);
- QModelIndex source_bottomRight = mapToSource(bottomRight);
- emit _dataChanged(source_topLeft, source_bottomRight);
-}
-
-
bool BufferViewFilter::bufferIdLessThan(const BufferId &left, const BufferId &right)
{
Q_CHECK_PTR(Client::networkModel());