void VoreenVisualization::networkAssigned(ProcessorNetwork* network, ProcessorNetwork* /*previousNetwork*/) {

    if (network) {
        network->addObserver(static_cast<ProcessorNetworkObserver*>(this));
    }

    if (propertyListWidget_) {
        propertyListWidget_->setProcessorNetwork(network);
        qApp->processEvents();
    }

    if (networkEditorWidget_) {
        networkEditorWidget_->setProcessorNetwork(network);
        qApp->processEvents();
    }

    // assign network to evaluator, also initializes the network
    //evaluator_->setProcessorNetwork(network);
    //qApp->processEvents();

    if (networkEditorWidget_ && network) {
        networkEditorWidget_->selectPreviouslySelectedProcessors();
        qApp->processEvents();
    }

    // assign network to input mapping dialog
    if (inputMappingDialog_) {
        inputMappingDialog_->setProcessorNetwork(network);
        qApp->processEvents();
    }

    sharedContext_->getGLFocus();
    emit(newNetwork(network));
}
#include <QAbstractItemView>

#include "client.h"
#include "networkmodel.h"
#include "quassel.h"

BufferModel::BufferModel(NetworkModel *parent)
  : QSortFilterProxyModel(parent),
    _selectionModelSynchronizer(this)
{
  setSourceModel(parent);
  if(Quassel::isOptionSet("debugbufferswitches")) {
    connect(_selectionModelSynchronizer.selectionModel(), SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)),
	    this, SLOT(debug_currentChanged(const QModelIndex &, const QModelIndex &)));
  }
  connect(Client::instance(), SIGNAL(networkCreated(NetworkId)), this, SLOT(newNetwork(NetworkId)));
  connect(this, SIGNAL(rowsInserted(const QModelIndex &, int, int)), this, SLOT(newBuffers(const QModelIndex &, int, int)));
}

bool BufferModel::filterAcceptsRow(int sourceRow, const QModelIndex &parent) const {
  Q_UNUSED(sourceRow);
  // only networks and buffers are allowed
  if(!parent.isValid())
    return true;
  if(parent.data(NetworkModel::ItemTypeRole) == NetworkModel::NetworkItemType)
    return true;

  return false;
}

void BufferModel::newNetwork(NetworkId id) {