i want to refresh the FileTree, to update the FileStructure (to see new files etc.)
Because of that i’m doing fileList->refresh(); but than all sub-items are closed.
So i have to restore the openness state
But because DirectoryContentsList loads the files dynamically in a background thread, the restoreOpeness will not work. Because if you open a subitem, it takes a while, to reload its content.
If found a workaround, restoring the update state 10 times in a second, so that the DirectoryContentsList has enough time to reload the subitems. Is there a more elegant solution?
[code]void FileTreeBrowser::buttonClicked( Button* button )
{
if (button==refreshButton)
{
opennesState=fileTree->getOpennessState(true);
fileList->refresh();
DBG(opennesState->createDocument(String::empty));
timerCountdown=10;
startTimer(100);
}
}
void FileTreeBrowser::timerCallback()
{
if (opennesState!=0)
{
DBG(“Restore Openness State”)
fileTree->restoreOpennessState(*opennesState,true);
}
timerCountdown--;
if (timerCountdown<=0)
{
stopTimer();
}
}[/code]
