Esempio n. 1
0
xpr_bool_t Pidl::getAttributes(LPSHELLFOLDER aShellFolder, LPCITEMIDLIST aPidl, xpr_ulong_t &aAttributes)
{
    HRESULT sComResult = aShellFolder->GetAttributesOf(1, (LPCITEMIDLIST *)&aPidl, &aAttributes);
    if (FAILED(sComResult))
    {
        return XPR_FALSE;
    }

    filterAttributes(aShellFolder, aPidl, aAttributes);

    return XPR_TRUE;
}
Esempio n. 2
0
xpr_ulong_t Pidl::getAttributes(LPSHELLFOLDER aShellFolder, LPCITEMIDLIST aPidl)
{
    xpr_ulong_t sAttributes = SFGAO_CAPABILITYMASK | SFGAO_DISPLAYATTRMASK | SFGAO_CONTENTSMASK | 0x7F300000;

    HRESULT sComResult = aShellFolder->GetAttributesOf(1, (LPCITEMIDLIST *)&aPidl, &sAttributes);
    if (FAILED(sComResult))
    {
        return 0;
    }

    filterAttributes(aShellFolder, aPidl, sAttributes);

    return sAttributes;
}
Esempio n. 3
0
// Richtext simplification filter: Remove hard-coded font settings,
// <style> elements, <p> attributes other than 'align' and
// and unnecessary meta-information.
QString simplifyRichTextFilter(const QString &in, bool *isPlainTextPtr = 0)
{
	unsigned elementCount = 0;
	bool paragraphAlignmentFound = false;
	QString out;
	QXmlStreamReader reader(in);
	QXmlStreamWriter writer(&out);
	writer.setAutoFormatting(false);
	writer.setAutoFormattingIndent(0);

	while (!reader.atEnd()) {
		switch (reader.readNext()) {
		case QXmlStreamReader::StartElement:
			elementCount++;
			if (filterElement(reader.name())) {
				const QStringRef name = reader.name();
				QXmlStreamAttributes attributes = reader.attributes();
				filterAttributes(name, &attributes, &paragraphAlignmentFound);
				writer.writeStartElement(name.toString());
				if (!attributes.isEmpty())
					writer.writeAttributes(attributes);
			} else
				reader.readElementText(); // Skip away all nested elements and characters.
			break;
		case QXmlStreamReader::Characters:
			if (!isWhiteSpace(reader.text()))
				writer.writeCharacters(reader.text().toString());
			break;
		case QXmlStreamReader::EndElement:
			writer.writeEndElement();
			break;
		default:
			break;
		}
	}
	// Check for plain text (no spans, just <html><head><body><p>)
	if (isPlainTextPtr)
		*isPlainTextPtr = !paragraphAlignmentFound && elementCount == 4u; //
	return out;
}