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

bool QApt::Backend::saveSelections ( const QString &  path  )  const [slot]

Writes a list of packages that have been marked for install, removal or upgrade

Parameters:
path The path to save the selection list to
Returns:
true if saving succeeded

false if the saving failed

Definition at line 673 of file backend.cpp.

References QApt::Package::ToInstall, and QApt::Package::ToRemove.

{
    Q_D(const Backend);

    QString selectionDocument;
    for (unsigned i = 0; i < d->packages.size(); ++i) {
        int flags = d->packages[i]->state();

        if (flags & Package::ToInstall) {
            selectionDocument.append(d->packages[i]->name() % "\t\tinstall" % '\n');
        } else if (flags & Package::ToRemove) {
            selectionDocument.append(d->packages[i]->name() % "\t\tdeinstall" % '\n');
        }
    }

    if (selectionDocument.isEmpty()) {
        return false;
    }

    QFile file(path);
    if (!file.open(QFile::WriteOnly | QFile::Text)) {
        return false;
    } else {
        QTextStream out(&file);
        out << selectionDocument;
    }

    return true;
}


Generated by  Doxygen 1.6.0   Back to index