Logo Search packages:      
Sourcecode: qapt version File versions  Download package

void QApt::Backend::restoreCacheState ( const CacheState state  )  [slot]

Restores the package cache to the given state.

Parameters:
state The state to restore the cache to

Definition at line 507 of file backend.cpp.

References QApt::Package::IsAuto, packageChanged(), QApt::Package::packageIterator(), QApt::Package::state(), QApt::Package::ToInstall, QApt::Package::ToKeep, QApt::Package::ToPurge, QApt::Package::ToReInstall, and QApt::Package::ToRemove.

Referenced by redo(), and undo().

{
    Q_D(Backend);

    pkgDepCache *deps = d->cache->depCache();
    pkgDepCache::ActionGroup group(*deps);

    for (unsigned i = 0; i < d->packages.size(); ++i) {
        Package *pkg = d->packages[i];
        int flags = pkg->state();
        int oldflags = state[i];

        if (oldflags != flags) {
            if (oldflags & Package::ToReInstall) {
                deps->MarkInstall(*(pkg->packageIterator()), true);
                deps->SetReInstall(*(pkg->packageIterator()), false);
            } else if (oldflags & Package::ToInstall) {
                deps->MarkInstall(*(pkg->packageIterator()), true);
            } else if (oldflags & Package::ToRemove) {
                deps->MarkDelete(*(pkg->packageIterator()), (bool)(oldflags & Package::ToPurge));
            } else if (oldflags & Package::ToKeep) {
                deps->MarkKeep(*(pkg->packageIterator()), false);
            }
            // fix the auto flag
            deps->MarkAuto(*pkg->packageIterator(), (oldflags & Package::IsAuto));
        }
    }
    emit packageChanged();
}


Generated by  Doxygen 1.6.0   Back to index