equal
deleted
inserted
replaced
447 d->setCurrentStation( d->mWrapper->currentFrequency() ); |
447 d->setCurrentStation( d->mWrapper->currentFrequency() ); |
448 |
448 |
449 endRemoveRows(); |
449 endRemoveRows(); |
450 } |
450 } |
451 } |
451 } |
|
452 /*! |
|
453 * Removes stations based on model indices |
|
454 */ |
|
455 void RadioStationModel::removeByModelIndices( QModelIndexList& indices, bool removefavorite ) |
|
456 { |
|
457 // List needs to be sorted and indices needs to go throught from largest to smallest. |
|
458 // This is for keeping QmodelIndexing in sync after begin- and endremoverows, which |
|
459 // are needed for each item separately |
|
460 qSort( indices ); |
|
461 QModelIndexList::const_iterator iter = indices.constEnd(); |
|
462 QModelIndexList::const_iterator begin = indices.constBegin(); |
|
463 RadioStation station; |
|
464 while( iter != begin ) { |
|
465 iter--; |
|
466 station = stationAt( (*iter).row() ); |
|
467 if( removefavorite ) { |
|
468 setFavoriteByPreset( station.presetIndex(), false ); |
|
469 } else { |
|
470 removeStation( station ); |
|
471 } |
|
472 } |
|
473 } |
452 |
474 |
453 /*! |
475 /*! |
454 * Public slot |
476 * Public slot |
455 * Removes all stations |
477 * Removes all stations |
456 */ |
478 */ |