qtinternetradio/ui/src/irsonghistorymodel.cpp
changeset 5 0930554dc389
parent 3 ee64f059b8e1
child 8 3b03c28289e6
--- a/qtinternetradio/ui/src/irsonghistorymodel.cpp	Fri May 14 15:43:29 2010 +0300
+++ b/qtinternetradio/ui/src/irsonghistorymodel.cpp	Thu May 27 12:46:34 2010 +0300
@@ -103,14 +103,16 @@
     return NULL;
 }
 
-void IRSongHistoryModel::clearAllList()
+void IRSongHistoryModel::clearList()
 {
     while (!mSongHistoryList.isEmpty())
     {
         IRQSongInfo *firstItem = mSongHistoryList.takeFirst();
         delete firstItem;
     }
-     
+
+    mHistoryEngine->clearAllSongHistory();
+
     emit modelChanged();
 }
 
@@ -126,20 +128,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;
+}