diff -r bfc95e24a059 -r c9471d26c7f2 qtinternetradio/ui/src/irsonghistorymodel.cpp --- a/qtinternetradio/ui/src/irsonghistorymodel.cpp Mon Jun 21 22:33:45 2010 +0100 +++ b/qtinternetradio/ui/src/irsonghistorymodel.cpp Thu Jul 22 16:31:41 2010 +0100 @@ -68,24 +68,33 @@ QString artistName = mSongHistoryList.at(row)->getArtistName().trimmed(); if( "" == artistName ) { - artistName = hbTrId("txt_irad_list_unknown_artist"); +#ifdef SUBTITLE_STR_BY_LOCID + artistName = hbTrId("txt_irad_list_unknown_artist_p"); +#else + artistName = hbTrId("Unknown artist"); +#endif } QString songName = mSongHistoryList.at(row)->getSongName().trimmed(); if( "" == songName ) { - songName = hbTrId("txt_irad_list_unknown_song"); +#ifdef SUBTITLE_STR_BY_LOCID + songName = hbTrId("txt_irad_list_unknown_song_p"); +#else + songName = hbTrId("Unknown song"); +#endif } + QString stationName = mSongHistoryList.at(row)->getStationName().trimmed(); if (Qt::Vertical == mOrientation) { - list.append("<" + artistName + ">"); - list.append("<" + songName + ">"); + list.append(artistName); + list.append(songName); } else { - list.append("<" + artistName +"> - <" + songName + ">"); - list.append(""); + list.append(artistName + " - " + songName); + list.append(stationName); } return list; } @@ -103,14 +112,16 @@ return NULL; } -void IRSongHistoryModel::clearAllList() +void IRSongHistoryModel::clearList() { while (!mSongHistoryList.isEmpty()) { IRQSongInfo *firstItem = mSongHistoryList.takeFirst(); delete firstItem; } - + + mHistoryEngine->clearAllSongHistory(); + emit modelChanged(); } @@ -126,20 +137,26 @@ mHistoryEngine->getAllSongHistory(mSongHistoryList); emit modelChanged(); -} - -void IRSongHistoryModel::clearHisotrySongDB() -{ - while (!mSongHistoryList.isEmpty()) - { - IRQSongInfo *firstItem = mSongHistoryList.takeFirst(); - delete firstItem; - } - mHistoryEngine->clearAllSongHistory(); - emit modelChanged(); } void IRSongHistoryModel::setOrientation(Qt::Orientation aOrientation) { mOrientation = aOrientation; } + +bool IRSongHistoryModel::deleteOneItem(int aIndex) +{ + bool ret = mHistoryEngine->deleteOneSongHistoryItem(aIndex); + + if( !ret ) + { + return false; + } + + beginRemoveRows(QModelIndex(), aIndex, aIndex); + mSongHistoryList.removeAt(aIndex); + endRemoveRows(); + + emit modelChanged(); + return true; +}