KDECore
kmimeglobsfileparser.cpp
Go to the documentation of this file.
36 const QStringList globFiles = KGlobal::dirs()->findAllResources("xdgdata-mime", QString::fromLatin1("globs"));
47 KMimeGlobsFileParser::AllGlobs KMimeGlobsFileParser::parseGlobFiles(const QStringList& globFiles, QStringList& parsedFiles)
52 // At each level, we must be able to override (not just add to) the information that we read at higher levels
57 QString fileNamev2 = fileName + QLatin1Char('2'); // NOTE: this relies on u-m-d always generating the old globs file
76 // If we're not going to get the "cs" flag because smi is too old, then we need to emulate it for *.C at least.
77 const bool caseSensitiveHackNeeded = (KMimeType::sharedMimeInfoVersion() <= KDE_MAKE_VERSION(0, 60, 0));
123 if (caseSensitiveHackNeeded && (pattern == QLatin1String("*.C") || pattern == QLatin1String("*.c") || pattern == QLatin1String("core")))
136 // kDebug() << "Adding pattern" << pattern << "to mimetype" << mimeTypeName << "from globs file, with weight" << weight;
138 // kDebug() << " Adding pattern" << pattern << "to mimetype" << mimeTypeName << "from globs file, with weight" << weight << "flags" << flags;
167 //kDebug() << "pattern" << pattern << "glob.weight=" << glob.weight << "isFast=" << isFastPattern(pattern) << glob.flags;
169 // Store each patterns into either m_fastPatternDict (*.txt, *.html etc. with default weight 50)
173 if (glob.weight == 50 && isFastPattern(pattern) && ((glob.flags & KMimeTypeRepository::CaseSensitive) == 0)) {
#define KDE_MAKE_VERSION(a, b, c)
Make a number from the major, minor and release number of a KDE version.
Definition: kdeversion.h.cmake:75
bool hasPattern(const QString &mime, const QString &pattern) const
Definition: kmimeglobsfileparser_p.h:57
void removeMime(const QString &mime)
Definition: kmimeglobsfileparser.cpp:216
PatternsMap patternsMap() const
Definition: kmimeglobsfileparser.cpp:193
static int sharedMimeInfoVersion()
Returns the version of the installed update-mime-database program (from freedesktop.org shared-mime-info).
Definition: kmimetype.cpp:738
void addGlob(const Glob &glob)
Definition: kmimeglobsfileparser.cpp:158
GlobList m_highWeightGlobs
Definition: kmimeglobsfileparser_p.h:93
static bool parseGlobFile(QIODevice *file, Format format, AllGlobs &globs)
Definition: kmimeglobsfileparser.cpp:71
KMimeGlobsFileParser()
Definition: kmimeglobsfileparser.cpp:30
static bool isFastPattern(const QString &pattern)
Definition: kmimeglobsfileparser.cpp:147
static AllGlobs parseGlobFiles(const QStringList &globFiles, QStringList &parsedFiles)
Definition: kmimeglobsfileparser.cpp:47
GlobList m_lowWeightGlobs
Definition: kmimeglobsfileparser_p.h:94
QStringList findAllResources(const char *type, const QString &filter=QString(), SearchOptions options=NoSearchOptions) const
Tries to find all resources with the specified type.
Definition: kstandarddirs.cpp:900
QHash< QString, QStringList > m_fastPatterns
Definition: kmimeglobsfileparser_p.h:92
Result of the globs parsing, as data structures ready for efficient mimetype matching.
Definition: kmimeglobsfileparser_p.h:85
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.