(trunk, qt) #5193 'qt: open folder: if the first file in a torrent is not an immediate child of the torrent folder, wrong folder opened' -- fixed with patch from basinilya

This commit is contained in:
Jordan Lee 2012-12-27 17:46:11 +00:00
parent fb0ada6582
commit 144d3b952c
1 changed files with 5 additions and 4 deletions

View File

@ -638,14 +638,15 @@ TrMainWindow :: openFolder( )
{
const int torrentId( *getSelectedTorrents().begin() );
const Torrent * tor( myModel.getTorrentFromId( torrentId ) );
const QString path( tor->getPath( ) );
QString path( tor->getPath( ) );
const FileList files = tor->files();
const QString firstfile = files.at(0).filename;
int slashIndex = firstfile.indexOf('/');
if (files.size() == 1)
openSelect( path + "/" + files.at(0).filename );
else {
QDir dir( path + "/" + files.at(0).filename );
dir.cdUp();
openSelect( dir.path() );
path = path + "/" + firstfile.left(slashIndex);
openSelect( path );
}
}