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

void QApt::Backend::commitChanges (  )  [slot]

Commits all pending package state changes that have been made.

Definition at line 609 of file backend.cpp.

References QApt::Package::availableVersion(), QApt::Package::Held, QApt::Package::name(), QApt::Package::NewInstall, package(), QApt::Package::state(), QApt::Package::ToDowngrade, QApt::Package::ToInstall, QApt::Package::ToKeep, QApt::Package::ToPurge, QApt::Package::ToReInstall, QApt::Package::ToRemove, and QApt::Package::ToUpgrade.

{
    Q_D(Backend);

    QVariantMap packageList;

    foreach (const Package *package, d->packages) {
        int flags = package->state();
        // Cannot have any of these flags simultaneously
        int status = flags & (Package::ToKeep |
                              Package::NewInstall |
                              Package::ToReInstall |
                              Package::ToUpgrade |
                              Package::ToDowngrade |
                              Package::ToRemove);
        switch (status) {
           case Package::ToKeep:
               if (flags & Package::Held) {
                   packageList.insert(package->name(), Package::Held);
               }
               break;
           case Package::NewInstall:
               packageList.insert(package->name(), Package::ToInstall);
               qDebug() << "Installing:" << package->name();
               break;
           case Package::ToReInstall:
               packageList.insert(package->name(), Package::ToReInstall);
               break;
           case Package::ToUpgrade:
               packageList.insert(package->name(), Package::ToUpgrade);
               qDebug() << "Upgrading:" << package->name();
               break;
           case Package::ToDowngrade:
               packageList.insert(package->name() % ',' % package->availableVersion(), Package::ToDowngrade);
               qDebug() << "Downgrading:" << package->name() << package->availableVersion();
               break;
           case Package::ToRemove:
               if(flags & Package::ToPurge) {
                   packageList.insert(package->name(), Package::ToPurge);
               } else {
                   qDebug() << "Removing:" << package->name();
                   packageList.insert(package->name(), Package::ToRemove);
               }
               break;
        }
    }

    d->worker->setLocale(setlocale(LC_ALL, 0));
    d->worker->commitChanges(packageList);
}


Generated by  Doxygen 1.6.0   Back to index