KDECore
kmimetype.cpp
Go to the documentation of this file.
80 if ((unsigned char)(p[i]) < 32 && p[i] != 9 && p[i] != 10 && p[i] != 13) // ASCII control character
143 // remote executable file? stop here (otherwise findFromContent can do that better for local files)
176 if no glob matches, or if more than one glob matches, use default mimetype and mark as "can be refined".
231 KMimeType::Ptr mime = KMimeTypeRepository::self()->findFromContent(device, &magicAccuracy, beginning);
234 //kDebug(servicesDebugArea()) << "findFromContent said" << (mime?mime->name():QString()) << "with accuracy" << magicAccuracy;
244 //kDebug(servicesDebugArea()) << "sniffedMime=" << sniffedMime << "mimeFromPattern=" << mimeFromPattern->name();
473 // and for the root of the protocol (e.g. trash:/) the protocol icon has priority over the mimetype icon
627 kWarning() << "No file found for" << file << ", even though the file appeared in a directory listing.";
628 kWarning() << "Either it was just removed, or the directory doesn't have executable permission...";
689 kFatal() << "Programming error in KMimeType XML loading, please create a bug report on http://bugs.kde.org and attach the file" << fullPath;
KMimeType::Ptr defaultMimeTypePtr()
Definition: kmimetyperepository.cpp:662
QString toLocalFile(AdjustPathOption trailing=LeaveTrailingSlash) const
Definition: kurl.cpp:885
static bool determineMimetypeFromExtension(const QString &protocol)
Returns whether mimetypes can be determined based on extension for this protocol. ...
Definition: kprotocolinfo.cpp:328
static QString iconNameForUrl(const KUrl &url, mode_t mode=0)
Return the filename of the icon associated with the mimetype, for a given url.
Definition: kmimetype.cpp:460
QStringList patternsForMimetype(const QString &mimeType)
Return the patterns (globs) for a given mimetype TEMPORARY method, it will go away once we can requir...
Definition: kmimetyperepository.cpp:599
KMimeType::Ptr findMimeTypeByName(const QString &_name, KMimeType::FindByNameOption options=KMimeType::DontResolveAlias)
Creates a KMimeType.
Definition: kmimetyperepository.cpp:59
static QString favIconForUrl(const KUrl &url)
Return the "favicon" (see http://www.favicon.com) for the given url, if available.
Definition: kmimetype.cpp:488
static bool matchFileName(const QString &filename, const QString &pattern)
Returns true if the given filename matches the given pattern.
Definition: kmimetype.cpp:775
QString mainExtension() const
Return the primary extension associated with this mimetype, if any.
Definition: kmimetype.cpp:743
static Ptr findByPath(const QString &path, mode_t mode=0, bool fast_mode=false, int *accuracy=0)
Finds a KMimeType with the given url.
Definition: kmimetype.cpp:329
Represent a mime type, like "text/plain", and the data that is associated with it.
Definition: kmimetype.h:46
A service type is, well, a type of service, where a service is an application or plugin.
Definition: kservicetype.h:43
static int sharedMimeInfoVersion()
Returns the version of the installed update-mime-database program (from freedesktop.org shared-mime-info).
Definition: kmimetype.cpp:738
static QString extractKnownExtension(const QString &fileName)
Determines the extension from a filename (or full path) using the mimetype database.
Definition: kmimetype.cpp:354
Definition: ksycocafactory.h:28
static bool matchFileName(const QString &filename, const QString &pattern)
Definition: kmimetyperepository.cpp:98
virtual QVariant property(const QString &name) const
Definition: kservicetype.cpp:154
static KMimeType::Ptr defaultMimeTypePtr()
Returns the default mimetype.
Definition: kmimetype.cpp:43
QStringList languageList() const
Returns the language codes selected by user, ordered by decreasing priority.
Definition: klocale.cpp:439
QString iconName(const KUrl &url=KUrl()) const
Return the filename of the icon associated with the mimetype.
Definition: kmimetype.cpp:604
QStringList parents(const QString &mime)
Returns the list of parents for a given mimetype.
Definition: kmimetyperepository.cpp:294
static KProtocolInfoFactory * self()
The instance of the KProtocolInfoFactory.
Definition: kprotocolinfofactory.cpp:119
virtual QStringList propertyNames() const
Definition: kservicetype.cpp:169
QStringList patterns() const
Retrieve the list of patterns associated with the MIME Type.
Definition: kmimetype.cpp:610
static QString icon(const QString &protocol)
Returns the name of the icon, associated with the specified protocol.
Definition: kprotocolinfo.cpp:287
QStringList parentMimeTypes() const
If this mimetype is a subclass of one or more other mimetypes, return the list of those mimetypes...
Definition: kmimetype.cpp:565
bool isDefault() const
Return true if this mimetype is the default mimetype.
Definition: kmimetype.cpp:48
bool useFavIcons()
Returns true if KMimeType::favIconForUrl should talk to kded's favicons module.
Definition: kmimetyperepository.cpp:681
bool is(const QString &mimeTypeName) const
Do not use name()=="somename" anymore, to check for a given mimetype.
Definition: kmimetype.cpp:556
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
QStringList allParentMimeTypes() const
Return all parent mimetypes of this mimetype, direct or indirect.
Definition: kmimetype.cpp:586
KProtocolInfo::Ptr findProtocol(const QString &protocol)
Definition: kprotocolinfofactory.cpp:91
int sharedMimeInfoVersion()
Definition: kmimetyperepository.cpp:783
QString resolveAlias(const QString &mime)
Check if mime is an alias, and return the canonical name for it if it is, otherwise empty...
Definition: kmimetyperepository.cpp:85
virtual int serviceOffersOffset() const
Definition: kmimetype.cpp:780
virtual QVariant property(const QString &name) const
Definition: kmimetype.cpp:436
QString protocol() const
Returns the protocol for the URL (i.e., file, http, etc.), lowercased.
Definition: kurl.cpp:672
QString comment() const
Returns the descriptive comment associated, if any.
Definition: kservicetype.cpp:232
static Ptr findByNameAndContent(const QString &name, const QByteArray &data, mode_t mode=0, int *accuracy=0)
Tries to find out the MIME type of filename/url and a data chunk.
Definition: kmimetype.cpp:337
QString userSpecifiedIconName() const
Returns the user-specified icon for this mimetype.
Definition: kmimetype.cpp:731
static Ptr findByContent(const QByteArray &data, int *accuracy=0)
Tries to find out the MIME type of a data chunk by looking for certain magic numbers and characterist...
Definition: kmimetype.cpp:361
static QString defaultMimeType()
Returns the name of the default mimetype.
Definition: kmimetype.cpp:597
static Ptr findByUrl(const KUrl &url, mode_t mode=0, bool is_local_file=false, bool fast_mode=false, int *accuracy=0)
Finds a KMimeType with the given url.
Definition: kmimetype.cpp:316
void checkEssentialMimeTypes()
This function makes sure that vital mime types are installed.
Definition: kmimetyperepository.cpp:616
QString parentMimeType() const
If this mimetype is a subclass of another mimetype, return the name of the parent.
Definition: kmimetype.cpp:532
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
Returns the URL as string, with all escape sequences intact, encoded in a given charset.
Definition: kurl.cpp:1035
static Ptr mimeType(const QString &name, FindByNameOption options=ResolveAliases)
Retrieve a pointer to the mime type name.
Definition: kmimetype.cpp:58
static KMimeType::Ptr findFromMode(const QString &path, mode_t mode, bool is_local_file)
Definition: kmimetype.cpp:86
QStringList resourceDirs(const char *type) const
This function is used internally by almost all other function as it serves and fills the directories ...
Definition: kstandarddirs.cpp:1069
int serviceOffersOffset(const QString &mimeTypeName)
Returns the offset into the service offers for a given mimetype.
Definition: kmimetypefactory.cpp:55
static Ptr findByFileContent(const QString &fileName, int *accuracy=0)
Tries to find out the MIME type of a file by looking for certain magic numbers and characteristic str...
Definition: kmimetype.cpp:375
Definition: kmimetype_p.h:24
static bool isBufferBinaryData(const QByteArray &data)
Returns whether a buffer has an internal format that is not human readable.
Definition: kmimetype.cpp:74
QString fileName(const DirectoryOptions &options=IgnoreTrailingSlash) const
Returns the filename of the path.
Definition: kurl.cpp:1283
QString canonicalName(const QString &mime)
Resolve mime if it's an alias, and return it otherwise.
Definition: kmimetyperepository.cpp:90
virtual QStringList propertyNames() const
Definition: kmimetype.cpp:448
static void collectParentMimeTypes(const QString &mime, QStringList &allParents)
Definition: kmimetype.cpp:571
static bool isBinaryData(const QString &fileName)
Returns whether a file has an internal format that is not human readable.
Definition: kmimetype.cpp:397
This file is part of the KDE documentation.
Documentation copyright © 1996-2017 The KDE developers.
Generated on Wed May 10 2017 09:29:42 by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2017 The KDE developers.
Generated on Wed May 10 2017 09:29:42 by doxygen 1.8.13 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.