void FancyPlotterSettings::setColorForSelectedItem(const QColor &color)
{
    const QModelIndex index = mView->selectionModel()->currentIndex();
    if ( !index.isValid() )
        return;

    SensorModelEntry sensor = mModel->sensor( index );

    sensor.setColor( color );
    mModel->setSensor( sensor, index );
}
void FancyPlotterSettings::editSensor()
{
  if ( !mView->selectionModel() )
    return;

  const QModelIndex index = mView->selectionModel()->currentIndex();
  if ( !index.isValid() )
    return;

  SensorModelEntry sensor = mModel->sensor( index );

  KColorDialog dialog(this, true);
  connect(&dialog, SIGNAL(colorSelected(QColor)), this, SLOT(setColorForSelectedItem(QColor)));
  QColor color = sensor.color();
  dialog.setColor(color);
  int result = dialog.exec();

  if ( result == KColorDialog::Accepted )
    sensor.setColor( dialog.color() );
  //If it's not accepted, make sure we set the color back to how it was
  mModel->setSensor( sensor, index );
}