void ListCasts::deleteData() { QString sql; RDSqlQuery *q; QString err_text; RDListViewItem *item=(RDListViewItem *)list_casts_view->selectedItem(); if(item==NULL) { return; } if(QMessageBox::question(this,tr("Delete Podcast"), tr("Are you sure you want to delete this podcast?"), QMessageBox::Yes,QMessageBox::No)== QMessageBox::No) { return; } QProgressDialog *pd= new QProgressDialog(tr("Deleting Podcast..."),"Cancel",2,this); pd->setCaption(tr("Progress")); pd->setMinimumDuration(0); pd->setProgress(0); qApp->processEvents(); sleep(1); qApp->processEvents(); RDPodcast *cast=new RDPodcast(item->id()); if(!cast->removeAudio(list_feed,&err_text,config->logXloadDebugData())) { if(QMessageBox::warning(this,tr("Remote Error"), tr("Unable to delete remote audio!\n")+ tr("The server said: \"")+err_text+"\".\n\n"+ tr("Continue deleting cast?"), QMessageBox::Yes,QMessageBox::No)==QMessageBox::No) { delete pd; delete cast; return; } } pd->setProgress(1); qApp->processEvents(); sql=QString().sprintf("delete from PODCASTS where ID=%u",item->id()); q=new RDSqlQuery(sql); delete q; sql=QString().sprintf("update FEEDS set LAST_BUILD_DATETIME=now() \ where ID=%u",list_feed_id); q=new RDSqlQuery(sql); delete q; RDDeleteCastCount(list_feed_id,item->id()); pd->reset(); delete pd; delete cast; delete item; }
void RDDeleteCastCount(unsigned feed_id,unsigned cast_id) { QString sql; RDSqlQuery *q; sql=QString().sprintf("select KEY_NAME from FEEDS where ID=%u",feed_id); q=new RDSqlQuery(sql); if(q->first()) { RDDeleteCastCount(q->value(0).toString(),cast_id); } delete q; }