kio Library API Documentation

KFileMetaInfoItem Class Reference

This is one item of the meta information about a file (see KFileMetaInfo). More...

#include <kfilemetainfo.h>

List of all members.

Public Types

typedef KFileMimeTypeInfo::Hint Hint
typedef KFileMimeTypeInfo::Unit Unit
typedef KFileMimeTypeInfo::Attributes Attributes

Public Member Functions

 KFileMetaInfoItem (const KFileMimeTypeInfo::ItemInfo *mti, const QString &key, const QVariant &value)
 KFileMetaInfoItem (const KFileMetaInfoItem &item)
 Copy onstructor.

const KFileMetaInfoItemoperator= (const KFileMetaInfoItem &item)
 The assignment operator, so you can do:.

 KFileMetaInfoItem ()
 Default constructor.

QString key () const
QString translatedKey () const
const QVariantvalue () const
QString string (bool mangle=true) const
bool setValue (const QVariant &value)
 changes the value of the item

QVariant::Type type () const
 convenience method.

bool isEditable () const
 You can query if the application can edit the item and write it back to the file with this method.

bool isRemoved () const
 If you remove an item, it is only marked for removal for the file.

bool isModified () const
 If you change an item, it is marked as "dirty".

QString prefix () const
 This method returns a translated prefix to be displayed before the value.

QString suffix () const
 This method returns a translated suffix to be displayed after the value.

uint hint () const
uint unit () const
uint attributes () const
bool isValid () const

Protected Member Functions

void setAdded ()
void setRemoved ()
void ref ()
void deref ()

Protected Attributes

Data * d

Friends

class KFileMetaInfoGroup
QDataStreamoperator>> (QDataStream &s, KFileMetaInfoItem &)
QDataStreamoperator>> (QDataStream &s, KFileMetaInfoGroup &)
QDataStreamoperator<< (QDataStream &s, const KFileMetaInfoItem &)


Detailed Description

This is one item of the meta information about a file (see KFileMetaInfo).

Definition at line 499 of file kfilemetainfo.h.


Constructor & Destructor Documentation

KFileMetaInfoItem::KFileMetaInfoItem const KFileMetaInfoItem item  ) 
 

Copy onstructor.

Definition at line 100 of file kfilemetainfo.cpp.

KFileMetaInfoItem::KFileMetaInfoItem  ) 
 

Default constructor.

This creates an "invalid" item

Definition at line 107 of file kfilemetainfo.cpp.


Member Function Documentation

const KFileMetaInfoItem & KFileMetaInfoItem::operator= const KFileMetaInfoItem item  ) 
 

The assignment operator, so you can do:.

KFileMetaInfoItem item = info.item("Title");

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 118 of file kfilemetainfo.cpp.

QString KFileMetaInfoItem::key  )  const
 

Returns:
the key of this item

Definition at line 163 of file kfilemetainfo.cpp.

Referenced by setValue().

QString KFileMetaInfoItem::translatedKey  )  const
 

Returns:
a translation of the key for displaying to the user. If the plugin provides translation to the key, it's also in the user's language

Definition at line 168 of file kfilemetainfo.cpp.

Referenced by KFileItem::getToolTipText().

const QVariant & KFileMetaInfoItem::value  )  const
 

Returns:
the value of the item.

Definition at line 180 of file kfilemetainfo.cpp.

Referenced by KFileMetaInfoGroup::value().

QString KFileMetaInfoItem::string bool  mangle = true  )  const
 

Returns:
a string containing the value, if possible. If not, QString::null is returned. if mangle is true, the string will already contain prefix and suffix

Definition at line 185 of file kfilemetainfo.cpp.

Referenced by KFileItem::getToolTipText().

bool KFileMetaInfoItem::setValue const QVariant value  ) 
 

changes the value of the item

Definition at line 132 of file kfilemetainfo.cpp.

References QVariant::canCast(), and key().

QVariant::Type KFileMetaInfoItem::type  )  const
 

convenience method.

It does the same as value()->type()

Returns:
the type of the item

Definition at line 190 of file kfilemetainfo.cpp.

bool KFileMetaInfoItem::isEditable  )  const
 

You can query if the application can edit the item and write it back to the file with this method.

Note that this doesn't ensure that you have write access to the file and that enough space is available.

Returns:
true if the item's value can be changed, false if not

Definition at line 220 of file kfilemetainfo.cpp.

bool KFileMetaInfoItem::isRemoved  )  const
 

If you remove an item, it is only marked for removal for the file.

On the next KFileMetaInfo::applyChanges() , it will be removed from the file. With this method, you can ask if the item is marked for removal.

Returns:
true if the item was removed, false if not

Definition at line 158 of file kfilemetainfo.cpp.

bool KFileMetaInfoItem::isModified  )  const
 

If you change an item, it is marked as "dirty".

On the next KFileMetaInfo::applyChanges() , the change will be written to the file. With this method, you can ask if this item is dirty.

Returns:
true if the item contains changes that have not yet been written back into the file. Removing or adding an item counts as such a change

Definition at line 195 of file kfilemetainfo.cpp.

QString KFileMetaInfoItem::prefix  )  const
 

This method returns a translated prefix to be displayed before the value.

Think e.g. of the $ in $30

Returns:
the prefix

Definition at line 200 of file kfilemetainfo.cpp.

QString KFileMetaInfoItem::suffix  )  const
 

This method returns a translated suffix to be displayed after the value.

Think of the kbps in 128kbps *

Returns:
the suffix

Definition at line 205 of file kfilemetainfo.cpp.

uint KFileMetaInfoItem::hint  )  const
 

Returns:
the hint for this item. See KFileMimeTypeInfo::Hint

Definition at line 210 of file kfilemetainfo.cpp.

uint KFileMetaInfoItem::unit  )  const
 

Returns:
the unit for this item. See KFileMimeTypeInfo::Unit

uint KFileMetaInfoItem::attributes  )  const
 

Returns:
the atttributes for this item. See KFileMimeTypeInfo::Attributes

Definition at line 215 of file kfilemetainfo.cpp.

bool KFileMetaInfoItem::isValid  )  const
 

Returns:
true if the item is valid, i.e. if it contains data, false if it's invalid (created with the default constructor and not been assigned anything), or if KFileMetaInfoGroup::item() didn't find your requested item)

Definition at line 225 of file kfilemetainfo.cpp.

Referenced by KFileItem::getToolTipText().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:17:42 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001