void Main::updateAvailability(QListViewItem* i) { if ( !i || !i->parent() ) { // section. do nothing for now } else { ChoiceItem* choice = (ChoiceItem*)i; QStringList deps = rdependencies[choice->id]; for (QStringList::ConstIterator it = deps.begin(); it != deps.end(); ++it) { ChoiceItem* d = item[*it]; QStringList ddeps = dependencies[d->id]; bool av = TRUE; for (QStringList::ConstIterator dit = ddeps.begin(); av && dit != ddeps.end(); ++dit) { ChoiceItem* dd = item[*dit]; if ( dd ) { if ( dd->isDefined() || !dd->isAvailable() ) av = FALSE; } else qDebug("%s ???",(*dit).latin1()); } if ( d->isAvailable() != av ) { d->setAvailable(av); updateAvailability(d); } } qDebug("%s: %d",choice->id.latin1(),choice->isAvailable()); } }
void UniUpdateManager::processRequest(int id, bool error) { if (error) emit updateAvailability(CannotConnect, QString()); // We send the changelog if (m_changelogId == id) { emit updateAvailability(Available, m_changelogBuffer->buffer()); m_changelogId = -1; } else if (m_patchId == id) { // We have to rename the file so Windows can execute it (dumb system of extensions!!!) QString patchFileName = QDir::toNativeSeparators(m_patch->fileName()); m_patch->close(); QFile::rename(patchFileName, patchFileName + ".exe"); emit patchReady(patchFileName + ".exe"); m_patchId = -1; } }