Hi munna
Have you test it?I am not able to delete any folder..
Are you shure this should work?Its not working:
void Manage::deleteArtist()
{
.
.
QString artist
= ui.
delete_artist_cb->currentText
();
QSqlQuery select_sound_path
("select value from config_tbl where config ='dsm_path'");
while(select_sound_path.next())
{
path = select_sound_path.value(0).toString();
}
QString artistDirectory
(path
+ "/" + artist
);
removeArtistDirectory(artistDirectory);
}
void Manage
::removeArtistDirectory(const QString &artistDirectory
) {
if(fileInfo.isDir())
{
QDir dir
(artistDirectory
);
for(int i = 0; i < fileList.count(); ++i)
{
remove(fileList.at(i));
}
dir.rmdir(artistDirectory);
}
else
{
QFile::remove(artistDirectory
);
}
}
void Manage::deleteArtist()
{
.
.
QString artist = ui.delete_artist_cb->currentText();
QString path;
QSqlQuery select_sound_path("select value from config_tbl where config ='dsm_path'");
while(select_sound_path.next())
{
path = select_sound_path.value(0).toString();
}
QString artistDirectory(path + "/" + artist);
removeArtistDirectory(artistDirectory);
}
void Manage::removeArtistDirectory(const QString &artistDirectory)
{
QMessageBox::information(this,"","remove function");
QMessageBox::information(this,"",artistDirectory);
QFileInfo fileInfo(artistDirectory);
if(fileInfo.isDir())
{
QDir dir(artistDirectory);
QStringList fileList = dir.entryList();
for(int i = 0; i < fileList.count(); ++i)
{
QMessageBox::information(this,"",fileList.at(i));
remove(fileList.at(i));
}
dir.rmdir(artistDirectory);
}
else
{
QFile::remove(artistDirectory);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks