mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
(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:
parent
fb0ada6582
commit
144d3b952c
1 changed files with 5 additions and 4 deletions
|
@ -638,14 +638,15 @@ TrMainWindow :: openFolder( )
|
||||||
{
|
{
|
||||||
const int torrentId( *getSelectedTorrents().begin() );
|
const int torrentId( *getSelectedTorrents().begin() );
|
||||||
const Torrent * tor( myModel.getTorrentFromId( torrentId ) );
|
const Torrent * tor( myModel.getTorrentFromId( torrentId ) );
|
||||||
const QString path( tor->getPath( ) );
|
QString path( tor->getPath( ) );
|
||||||
const FileList files = tor->files();
|
const FileList files = tor->files();
|
||||||
|
const QString firstfile = files.at(0).filename;
|
||||||
|
int slashIndex = firstfile.indexOf('/');
|
||||||
if (files.size() == 1)
|
if (files.size() == 1)
|
||||||
openSelect( path + "/" + files.at(0).filename );
|
openSelect( path + "/" + files.at(0).filename );
|
||||||
else {
|
else {
|
||||||
QDir dir( path + "/" + files.at(0).filename );
|
path = path + "/" + firstfile.left(slashIndex);
|
||||||
dir.cdUp();
|
openSelect( path );
|
||||||
openSelect( dir.path() );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue