QMimeData * SensorBrowserModel::mimeData ( const QModelIndexList & indexes ) const { //virtual
    QMimeData *mimeData = new QMimeData();
    if(indexes.size() != 1) return mimeData;
    SensorInfo *sensor = getSensorInfo(indexes[0]);
    if(!sensor) return mimeData;
    // Create text drag object as
    // "<hostname> <sensorname> <sensortype> <sensordescription>".
    // Only the description may contain blanks.
    Q_ASSERT(sensor);
    Q_ASSERT(sensor->hostInfo());
    QString mDragText = sensor->hostInfo()->hostName() + ' ' +
        sensor->name() + ' ' +
        sensor->type()+ ' ' +
        sensor->description();


    mimeData->setData( "application/x-ksysguard", mDragText.toUtf8() );
    return mimeData;
}
void SensorBrowserModel::removeAllSensorUnderBranch(HostInfo* hostInfo, int parentId)  {

    QList<int> children = mTreeMap.value(parentId);

    for (int i = 0; i < children.size(); i++) {

        if (mTreeMap.contains(children[i]))  {
            //well our children is not a sensor so remove what is under him
            removeAllSensorUnderBranch(hostInfo,children[i]);

        } else  {
            //well this should be a sensor so remove it
            if (mSensorInfoMap.contains(children[i])) {
                SensorInfo* sensorToRemove = mSensorInfoMap.value(children[i]);
                Q_ASSERT(sensorToRemove);
                removeSensor(hostInfo, parentId, sensorToRemove->name());
            }
        }
    }


}