void PlaylistContainer::deletePlaylist(int kill_me) { Playlist *list_to_kill = getPlaylist(kill_me); if (!list_to_kill) { LOG(VB_GENERAL, LOG_ERR, LOC + "deletePlaylist() " + QString("Unknown playlist: %1").arg(kill_me)); return; } // First, we need to take out any **track** on any other // playlist that is actually a reference to this // playlist if (kill_me == pending_writeback_index) popBackPlaylist(); active_playlist->removeTrack(kill_me * -1); QList<Playlist*>::iterator it = all_other_playlists->begin(); for (; it != all_other_playlists->end(); ++it) { if ((*it) != list_to_kill) (*it)->removeTrack(kill_me * -1); } MSqlQuery query(MSqlQuery::InitCon()); query.prepare("DELETE FROM music_playlists WHERE playlist_id = :ID ;"); query.bindValue(":ID", kill_me); if (!query.exec() || query.numRowsAffected() < 1) { MythDB::DBError("playlist delete", query); } list_to_kill->removeAllTracks(); all_other_playlists->removeAll(list_to_kill); }
void MainWindow::ftpCommandFinished(int, bool error) { if (ftp->currentCommand() == QFtp::ConnectToHost) { if (error) { QMessageBox::information(this, tr("FTP"), tr("Unable to connect to the FTP server " "at %1. Please check that the host " "name is correct.")); //connectOrDisconnect(); return; } qDebug()<<"Connected.."; //connected but not logined return; } if (ftp->currentCommand() == QFtp::Login) { if(error) { QMessageBox::information(this, tr("FTP"),tr("Can't log in. Please check that the id or password is correct.")); return; } ftp->list(); //get all list currentDirectory = ""; login->hide(); show(); return; } if (ftp->currentCommand() == QFtp::List) //Recrusive { if(unparsedDirectory.size()) { ftp->list(unparsedDirectory.at(0)); currentDirectory = unparsedDirectory.at(0); unparsedDirectory.removeFirst(); } else { fullFilesList.sort(); #if 0 int i; for(i=0;i<fullFilesList.size();i++) qDebug()<<"[ " + fullFilesList.at(i) + " ]"; #endif getPlaylist(); } } if (ftp->currentCommand() == QFtp::Get) { if (error) { // statusLabel->setText(tr("Canceled download of %1.") // .arg(file->fileName())); file->close(); file->remove(); } else { // statusLabel->setText(tr("Downloaded %1 to current directory.") // .arg(file->fileName())); file->close(); } delete file; // enableDownloadButton(); // progressDialog->hide(); //TODO Check if(playlist downloading?) getPlaylist(); } if(ftp->currentCommand() == QFtp::Put) { qDebug()<<"PUT END"; file->close(); delete file; if(upList.size()) { doUpload(); } else { refreshTable(); //FIXME upload->close(); } } if(ftp->currentCommand() == QFtp::Remove) { qDebug()<<"DELETE END"; if(rmList.size()) doRemove(); } }