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

QString QApt::Package::longDescription (  )  const

Member function that returns the long description of the package. Note that this also includes the summary/short description.

Returns:
The long description of the package as a QString

Definition at line 195 of file package.cpp.

References shortDescription().

{
    pkgCache::VerIterator ver = (*d->depCache)[*d->packageIter].CandidateVerIter(*d->depCache);

    if (!ver.end()) {
        QString rawDescription;
        pkgCache::DescIterator Desc = ver.TranslatedDescription();
        pkgRecords::Parser & parser = d->records->Lookup(Desc.FileList());
        rawDescription = QString::fromUtf8(parser.LongDesc().data());
        // Apt acutally returns the whole description, we just want the
        // extended part.
        rawDescription.remove(shortDescription() % '\n');
        // *Now* we're really raw. Sort of. ;)

        QString parsedDescription;
        // Split at double newline, by "section"
        QStringList sections = rawDescription.split("\n .");

        int i;
        for (i = 0; i < sections.count(); ++i) {
            sections[i].replace(QRegExp("\n( |\t)+(-|\\*)"), "\n\r " % QString::fromUtf8("\xE2\x80\xA2"));
            // There should be no new lines within a section.
            sections[i].remove('\n');
            // Hack to get the lists working again.
            sections[i].replace('\r', '\n');
            // Merge multiple whitespace chars into one
            sections[i].replace(QRegExp("\\ \\ +"), QString(' '));
            // Remove the initial whitespace
            sections[i].remove(0, 1);
            // Append to parsedDescription
            if (sections[i].startsWith("\n " % QString::fromUtf8("\xE2\x80\xA2 ")) || i == 0) {
                parsedDescription += sections[i];
            }  else {
                parsedDescription += "\n\n" % sections[i];
            }
        }

        return parsedDescription;
    } else {
        return QString();
    }
}


Generated by  Doxygen 1.6.0   Back to index