mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 14:42:51 -04:00
removed infinite loop when openning a rscollection file
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8135 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
68d25b324a
commit
20deecd6d3
1 changed files with 35 additions and 30 deletions
|
@ -500,40 +500,45 @@ bool RsCollectionDialog::addChild(QTreeWidgetItem* parent, const std::vector<Col
|
||||||
*/
|
*/
|
||||||
void RsCollectionDialog::directoryLoaded(QString dirLoaded)
|
void RsCollectionDialog::directoryLoaded(QString dirLoaded)
|
||||||
{
|
{
|
||||||
if(!_dirLoaded)
|
if(!_dirLoaded)
|
||||||
{
|
{
|
||||||
|
|
||||||
QFileInfo lastDir = Settings->getLastDir(RshareSettings::LASTDIR_EXTRAFILE);
|
QFileInfo lastDir = Settings->getLastDir(RshareSettings::LASTDIR_EXTRAFILE);
|
||||||
if (lastDir.absoluteFilePath() == "") return;
|
if (lastDir.absoluteFilePath() == "") return;
|
||||||
if (lastDir.absoluteFilePath() == dirLoaded) _dirLoaded = true;
|
if (lastDir.absoluteFilePath() == dirLoaded) _dirLoaded = true;
|
||||||
|
|
||||||
// Check all parent directory to see if it is loaded
|
// Check all parent directory to see if it is loaded
|
||||||
//as QFileSystemModel don't load all
|
//as QFileSystemModel don't load all
|
||||||
do {
|
do {
|
||||||
if(lastDir.absolutePath()==dirLoaded) {
|
if(lastDir.absolutePath()==dirLoaded) {
|
||||||
//Only expand loaded directory
|
//Only expand loaded directory
|
||||||
QModelIndex lastDirIdx = _dirModel->index(lastDir.absoluteFilePath());
|
QModelIndex lastDirIdx = _dirModel->index(lastDir.absoluteFilePath());
|
||||||
//Select LASTDIR_EXTRAFILE or last parent found when loaded
|
//Select LASTDIR_EXTRAFILE or last parent found when loaded
|
||||||
if (!lastDirIdx.isValid()){
|
if (!lastDirIdx.isValid()){
|
||||||
_dirLoaded = true;
|
_dirLoaded = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Ask dirModel to load next parent directory
|
//Ask dirModel to load next parent directory
|
||||||
while (_dirModel->canFetchMore(lastDirIdx)) _dirModel->fetchMore(lastDirIdx);
|
while (_dirModel->canFetchMore(lastDirIdx)) _dirModel->fetchMore(lastDirIdx);
|
||||||
|
|
||||||
//Ask to Expand last loaded parent
|
//Ask to Expand last loaded parent
|
||||||
lastDirIdx = _tree_proxyModel->mapFromSource(lastDirIdx);
|
lastDirIdx = _tree_proxyModel->mapFromSource(lastDirIdx);
|
||||||
if (lastDirIdx.isValid()){
|
if (lastDirIdx.isValid()){
|
||||||
ui._systemFileTW->expand(lastDirIdx);
|
ui._systemFileTW->expand(lastDirIdx);
|
||||||
ui._systemFileTW->setCurrentIndex(lastDirIdx);
|
ui._systemFileTW->setCurrentIndex(lastDirIdx);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (lastDir.absoluteFilePath() == lastDir.absolutePath()) break;
|
//std::cerr << "lastDir = " << lastDir.absoluteFilePath().toStdString() << std::endl;
|
||||||
lastDir = lastDir.absolutePath();
|
|
||||||
} while (true); //(lastDir.absoluteFilePath() != lastDir.absolutePath());
|
QDir c = lastDir.dir() ;
|
||||||
}
|
if(!c.cdUp())
|
||||||
|
break ;
|
||||||
|
|
||||||
|
lastDir = QFileInfo(c.path());
|
||||||
|
} while (true); //(lastDir.absoluteFilePath() != lastDir.absolutePath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue