Changeset View
Changeset View
Standalone View
Standalone View
tests/dump.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 37 | { | |||
---|---|---|---|---|---|
52 | QString mimetype = mimeDb.mimeTypeForFile(url).name(); | 52 | QString mimetype = mimeDb.mimeTypeForFile(url).name(); | ||
53 | 53 | | |||
54 | KFileMetaData::ExtractorCollection extractors; | 54 | KFileMetaData::ExtractorCollection extractors; | ||
55 | QList<KFileMetaData::Extractor*> exList = extractors.fetchExtractors(mimetype); | 55 | QList<KFileMetaData::Extractor*> exList = extractors.fetchExtractors(mimetype); | ||
56 | 56 | | |||
57 | QTextStream out(stdout); | 57 | QTextStream out(stdout); | ||
58 | out << url << " " << mimetype << "\n\n"; | 58 | out << url << " " << mimetype << "\n\n"; | ||
59 | 59 | | |||
60 | Q_FOREACH (KFileMetaData::Extractor* ex, exList) { | 60 | for (KFileMetaData::Extractor* ex : qAsConst(exList)) { | ||
61 | KFileMetaData::SimpleExtractionResult result(url, mimetype, | 61 | KFileMetaData::SimpleExtractionResult result(url, mimetype, | ||
62 | KFileMetaData::ExtractionResult::ExtractMetaData); | 62 | KFileMetaData::ExtractionResult::ExtractMetaData); | ||
63 | ex->extract(&result); | 63 | ex->extract(&result); | ||
64 | 64 | | |||
65 | out << "Extractor For: " << ex->mimetypes().join(QLatin1Char(' ')) << "\n"; | 65 | out << "Extractor For: " << ex->mimetypes().join(QLatin1Char(' ')) << "\n"; | ||
66 | KFileMetaData::PropertyMap properties = result.properties(); | 66 | KFileMetaData::PropertyMap properties = result.properties(); | ||
67 | KFileMetaData::PropertyMap::const_iterator it = properties.constBegin(); | 67 | KFileMetaData::PropertyMap::const_iterator it = properties.constBegin(); | ||
68 | for (; it != properties.constEnd(); it++) { | 68 | for (; it != properties.constEnd(); it++) { | ||
69 | out << KFileMetaData::PropertyInfo(it.key()).displayName() << " --> " | 69 | out << KFileMetaData::PropertyInfo(it.key()).displayName() << " --> " | ||
70 | << it.value().toString() << " (" << it.value().typeName() << ")\n"; | 70 | << it.value().toString() << " (" << it.value().typeName() << ")\n"; | ||
71 | } | 71 | } | ||
72 | out << "-------------\n"; | 72 | out << "-------------\n"; | ||
73 | } | 73 | } | ||
74 | 74 | | |||
75 | return 0; | 75 | return 0; | ||
76 | } | 76 | } |