KFileMetaInfo Class Reference
This is the class for objects that hold meta information about a file. Meta Information about a file. More...
#include <kfilemetainfo.h>
Public Types | |
typedef KFileMimeTypeInfo::Hint | Hint |
typedef KFileMimeTypeInfo::Unit | Unit |
typedef KFileMimeTypeInfo::Attributes | Attributes |
enum | What { Fastest = 0x1, DontCare = 0x2, TechnicalInfo = 0x4, ContentInfo = 0x8, ExtenedAttr = 0x10, Thumbnail = 0x20, Preferred = 0x40, Everything = 0xffff } |
Public Member Functions | |
KFileMetaInfo (const QString &path, const QString &mimeType=QString::null, uint what=Fastest) | |
KFileMetaInfo (const KURL &url, const QString &mimeType=QString::null, uint what=Fastest) | |
KFileMetaInfo () | |
KFileMetaInfo (const KFileMetaInfo &original) | |
const KFileMetaInfo & | operator= (const KFileMetaInfo &info) |
QStringList | groups () const |
QStringList | supportedGroups () const |
QStringList | preferredGroups () const |
QStringList | preferredKeys () const |
QStringList | supportedKeys () const |
QStringList | editableGroups () const |
KFileMetaInfoItem | item (const QString &key) const |
KFileMetaInfoItem | item (const KFileMetaInfoItem::Hint hint) const |
KFileMetaInfoItem | saveItem (const QString &key, const QString &preferredGroup=QString::null, bool createGroup=true) |
KFileMetaInfoGroup | group (const QString &key) const |
KFileMetaInfoGroup | operator[] (const QString &key) const |
bool | addGroup (const QString &name) |
bool | removeGroup (const QString &name) |
QStringList | removedGroups () |
bool | applyChanges () |
bool | contains (const QString &key) const |
bool | containsGroup (const QString &key) const |
const QVariant | value (const QString &key) const |
bool | isValid () const |
bool | isEmpty () const |
QString | mimeType () const |
QString | path () const |
KURL | url () const |
Protected Member Functions | |
KFileMetaInfoGroup | appendGroup (const QString &name) |
KFilePlugin *const | plugin () const |
void | ref () |
void | deref () |
Protected Attributes | |
Data * | d |
Friends | |
class | KFilePlugin |
QDataStream & | operator>> (QDataStream &s, KFileMetaInfo &) |
QDataStream & | operator<< (QDataStream &s, const KFileMetaInfo &) |
Detailed Description
This is the class for objects that hold meta information about a file. Meta Information about a file.The information is kept in form of a system of key/value pairs. See also KFileMetaInfoItem. This information is retrieved from the file through a plugin system, and this class is the main interface to it. If you want to write your own plugin, have a look at KFilePlugin. There are basically two different kinds of meta information: Fixed ones that the plugin knows about (e.g. an mp3 id3v1 tag has a well defined fixed list of fields), and variable keys that exist in mimetypes that support their own key/value system (comments in png files are of this type). Almost every file has fixed keys, but some also have variable keys.
The groups and the What enum are not yet supported, but already added to the interface so that adding support doesn't break compatibility.
Definition at line 890 of file kfilemetainfo.h.
Member Enumeration Documentation
|
This is used to specify what a KFileMetaInfo object should read, so you can specify if you want to read "expensive" items or not.
Definition at line 902 of file kfilemetainfo.h. |
Constructor & Destructor Documentation
|
The constructor. creating a KFileMetaInfo item through this will autoload the plugin belonging to the mimetype and try to get meta information about the specified file. If no info is available, you'll get an empty (not invalid) object. You can test for it with the isEmpty() method.
Definition at line 296 of file kfilemetainfo.cpp. References KURL::setPath(). |
|
Another constructor. Similar to the above, but takes a URL so that meta-data may be retrieved over other protocols (ftp, etc.) Definition at line 305 of file kfilemetainfo.cpp. |
|
Default constructor. This will create an invalid object (see isValid(). Definition at line 347 of file kfilemetainfo.cpp. |
|
Copy constructor. This creates a copy of the original object, but that copy will point to the same data, so if you change the original, the copy will be changed, too. After all, they are referring to the same file. Definition at line 340 of file kfilemetainfo.cpp. |
Member Function Documentation
|
The assignment operator, so you can do e.g.: KFileMetaInfo info; if (something) info = KFileMetaInfo("/the/file"); This will create a shared copy of the object. The actual data is automatically deleted if all copies go out of scope. Definition at line 496 of file kfilemetainfo.cpp. References d. |
|
Returns a list of all groups.
Definition at line 369 of file kfilemetainfo.cpp. Referenced by contains(), containsGroup(), item(), preferredGroups(), and saveItem(). |
|
Returns a list of all supported groups.
Definition at line 357 of file kfilemetainfo.cpp. References isValid(). Referenced by editableGroups(). |
|
Returns a list of the preferred groups.
Definition at line 394 of file kfilemetainfo.cpp. References group(), groups(), and isValid(). Referenced by item(), preferredKeys(), and saveItem(). |
|
Returns a list of all preferred keys.
Definition at line 420 of file kfilemetainfo.cpp. References preferredGroups(). Referenced by KFileItem::getToolTipText(). |
|
Returns a list of supported keys.
Definition at line 363 of file kfilemetainfo.cpp. References isValid(). |
|
Returns the list of groups that you can add or remove from the file.
Definition at line 379 of file kfilemetainfo.cpp. References KFileMimeTypeInfo::GroupInfo::attributes(), and supportedGroups(). |
|
Returns the KFileMetaInfoItem with the given
Definition at line 594 of file kfilemetainfo.cpp. References groups(), KFileMetaInfoItem::isValid(), and preferredGroups(). Referenced by KFileItem::getToolTipText(), and saveItem(). |
|
Returns the KFileMetaInfoItem with the given
Definition at line 605 of file kfilemetainfo.cpp. References groups(), KFileMetaInfoItem::isValid(), and preferredGroups(). |
|
Saves the item with the given
Definition at line 617 of file kfilemetainfo.cpp. References addGroup(), KFileMetaInfoGroup::addItem(), group(), groups(), KFileMetaInfoItem::isValid(), isValid(), item(), preferredGroups(), and KFileMimeTypeInfo::GroupInfo::supportedKeys(). |
|
Returns the KFileMetaInfoGroup with the given
Definition at line 433 of file kfilemetainfo.cpp. Referenced by addGroup(), preferredGroups(), and saveItem(). |
|
Returns the KFileMetaInfoGroup with the given
Definition at line 1061 of file kfilemetainfo.h. |
|
Try to add the specified group. This will only succeed if it is in the list of editableGroups().
Definition at line 442 of file kfilemetainfo.cpp. References KFileMetaInfoGroup::appendItem(), KFileMimeTypeInfo::ItemInfo::attributes(), group(), isValid(), KFileMimeTypeInfo::GroupInfo::itemInfo(), KFileMimeTypeInfo::ItemInfo::key(), KFileMetaInfoGroup::setAdded(), and KFileMimeTypeInfo::GroupInfo::supportedKeys(). Referenced by saveItem(). |
|
Remove the specified group. This will only succeed if it is in the list of editableGroups(). Beware that this also removes all the items in that group, so always ask the user before removing it!
Definition at line 479 of file kfilemetainfo.cpp. |
|
Returns a list of removed groups.
Definition at line 491 of file kfilemetainfo.cpp. |
|
This method writes all pending changes of the meta info back to the file. If any items are marked as removed, they are really removed from the list. The info object as well as all items are updated.
Definition at line 524 of file kfilemetainfo.cpp. References kdDebug(), plugin(), and KFilePlugin::writeInfo(). |
|
Checks whether an item with the given
Definition at line 578 of file kfilemetainfo.cpp. References KFileMetaInfoGroup::contains(), and groups(). |
|
Checks whether a group with the given
Definition at line 589 of file kfilemetainfo.cpp. References groups(). |
|
Returns true if the item is valid, i.e. if actually represents the info about a file, false if the object is uninitialized.
Definition at line 509 of file kfilemetainfo.cpp. Referenced by addGroup(), KFileItem::getToolTipText(), KFileItem::metaInfo(), mimeType(), plugin(), preferredGroups(), saveItem(), supportedGroups(), and supportedKeys(). |
|
Returns false if the object contains data, true if it's empty. You'll get an empty object if no plugin for the file could be found.
Definition at line 515 of file kfilemetainfo.cpp. Referenced by KFileItem::getToolTipText(). |
|
Returns the mime type of file.
Definition at line 572 of file kfilemetainfo.cpp. References isValid(). |
|
Returns the path of file - or QString::null if file is non-local.
Definition at line 714 of file kfilemetainfo.cpp. |
|
Returns the url of file.
Definition at line 719 of file kfilemetainfo.cpp. References KURL::url(). |
|
Definition at line 565 of file kfilemetainfo.cpp. References isValid(). Referenced by applyChanges(). |
The documentation for this class was generated from the following files: