org.kde.koala
Class KFileMetaInfo

java.lang.Object
  extended by org.kde.koala.KFileMetaInfo
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KFileMetaInfo
extends java.lang.Object
implements org.kde.qt.QtSupport


Field Summary
static int ContentInfo
           
static int DontCare
           
static int Everything
           
static int ExtenedAttr
           
static int Fastest
          This is used to specify what a KFileMetaInfo object should read, so you can specify if you want to read "expensive" items or not.
static int Preferred
           
static int TechnicalInfo
           
static int Thumbnail
           
 
Constructor Summary
  KFileMetaInfo()
          Default constructor.
protected KFileMetaInfo(java.lang.Class dummy)
           
  KFileMetaInfo(KFileMetaInfo original)
          Copy constructor.
  KFileMetaInfo(KURL url)
           
  KFileMetaInfo(KURL url, java.lang.String mimeType)
           
  KFileMetaInfo(KURL url, java.lang.String mimeType, int what)
          Another constructor Similar to the above, but takes a URL so that meta-data may be retrieved over other protocols (ftp, etc.)
  KFileMetaInfo(java.lang.String path)
           
  KFileMetaInfo(java.lang.String path, java.lang.String mimeType)
           
  KFileMetaInfo(java.lang.String path, java.lang.String mimeType, int what)
          The constructor.
 
Method Summary
 boolean addGroup(java.lang.String name)
          Try to add the specified group.
protected  KFileMetaInfoGroup appendGroup(java.lang.String name)
           
 boolean applyChanges()
          This method writes all pending changes of the meta info back to the file.
 boolean contains(java.lang.String key)
          Checks whether an item with the given key exists.
 boolean containsGroup(java.lang.String key)
          Checks whether a group with the given key exists.
protected  void deref()
           
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
 java.util.ArrayList editableGroups()
          Returns the list of groups that you can add or remove from the file.
protected  void finalize()
          Deletes the wrapped C++ instance
 KFileMetaInfoGroup group(java.lang.String key)
          Returns the KFileMetaInfoGroup with the given key.
 java.util.ArrayList groups()
          Returns a list of all groups.
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
 boolean isEmpty()
          Returns false if the object contains data, true if it's empty.
 boolean isValid()
          Returns true if the item is valid, i.e.
 KFileMetaInfoItem item(java.lang.String key)
          Returns the KFileMetaInfoItem with the given key.
 java.lang.String mimeType()
          Returns the mime type of file.
 KFileMetaInfoGroup op_at(java.lang.String key)
          Returns the KFileMetaInfoGroup with the given key.
 java.lang.String path()
          Returns the path of file - or null if file is non-local
 java.util.ArrayList preferredGroups()
          Returns a list of the preferred groups.
 java.util.ArrayList preferredKeys()
          Returns a list of all preferred keys.
protected  void ref()
           
 java.util.ArrayList removedGroups()
          Returns a list of removed groups.
 boolean removeGroup(java.lang.String name)
          Remove the specified group.
 KFileMetaInfoItem saveItem(java.lang.String key)
           
 KFileMetaInfoItem saveItem(java.lang.String key, java.lang.String preferredGroup)
           
 KFileMetaInfoItem saveItem(java.lang.String key, java.lang.String preferredGroup, boolean createGroup)
          Saves the item with the given key.
 java.util.ArrayList supportedGroups()
          Returns a list of all supported groups.
 java.util.ArrayList supportedKeys()
          Returns a list of supported keys.
 KURL url()
          Returns the url of file
 org.kde.qt.QVariant value(java.lang.String key)
          Returns the value with the given key.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Fastest

public static final int Fastest
This is used to specify what a KFileMetaInfo object should read, so you can specify if you want to read "expensive" items or not.

See Also:
Constant Field Values

DontCare

public static final int DontCare
See Also:
Constant Field Values

TechnicalInfo

public static final int TechnicalInfo
See Also:
Constant Field Values

ContentInfo

public static final int ContentInfo
See Also:
Constant Field Values

ExtenedAttr

public static final int ExtenedAttr
See Also:
Constant Field Values

Thumbnail

public static final int Thumbnail
See Also:
Constant Field Values

Preferred

public static final int Preferred
See Also:
Constant Field Values

Everything

public static final int Everything
See Also:
Constant Field Values
Constructor Detail

KFileMetaInfo

protected KFileMetaInfo(java.lang.Class dummy)

KFileMetaInfo

public KFileMetaInfo(java.lang.String path,
                     java.lang.String mimeType,
                     int what)
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.

Parameters:
path - The file name. This must be the path to a local file.
mimeType - The name of the file's mimetype. If ommited, the mimetype is autodetected
what - one or more of the What enum values. It gives some hint to the plugin what information is desired. The plugin may still return more items.

KFileMetaInfo

public KFileMetaInfo(java.lang.String path,
                     java.lang.String mimeType)

KFileMetaInfo

public KFileMetaInfo(java.lang.String path)

KFileMetaInfo

public KFileMetaInfo(KURL url,
                     java.lang.String mimeType,
                     int what)
Another constructor Similar to the above, but takes a URL so that meta-data may be retrieved over other protocols (ftp, etc.)


KFileMetaInfo

public KFileMetaInfo(KURL url,
                     java.lang.String mimeType)

KFileMetaInfo

public KFileMetaInfo(KURL url)

KFileMetaInfo

public KFileMetaInfo()
Default constructor. This will create an invalid object (see isValid().


KFileMetaInfo

public KFileMetaInfo(KFileMetaInfo original)
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.

Method Detail

groups

public java.util.ArrayList groups()
Returns a list of all groups.

Returns:
the keys of the groups that the file has.

supportedGroups

public java.util.ArrayList supportedGroups()
Returns a list of all supported groups.

Returns:
the supported keys of the groups that the file has.

preferredGroups

public java.util.ArrayList preferredGroups()
Returns a list of the preferred groups.

Returns:
the keys of the preferred groups that the file has.

preferredKeys

public java.util.ArrayList preferredKeys()
Returns a list of all preferred keys.

Returns:
a list of all preferred keys.

supportedKeys

public java.util.ArrayList supportedKeys()
Returns a list of supported keys.

Returns:
a list of supported keys

editableGroups

public java.util.ArrayList editableGroups()
Returns the list of groups that you can add or remove from the file.

Returns:
the groups can be added or removed

item

public KFileMetaInfoItem item(java.lang.String key)
Returns the KFileMetaInfoItem with the given key.

Parameters:
key - the key of the item
Returns:
the item. Invalid if there is no item with the given key.

saveItem

public KFileMetaInfoItem saveItem(java.lang.String key,
                                  java.lang.String preferredGroup,
                                  boolean createGroup)
Saves the item with the given key.

Parameters:
key - the key of the item
preferredGroup - the preferred group, or null
createGroup - true to create the group if necessary
Returns:
the saved item

saveItem

public KFileMetaInfoItem saveItem(java.lang.String key,
                                  java.lang.String preferredGroup)

saveItem

public KFileMetaInfoItem saveItem(java.lang.String key)

group

public KFileMetaInfoGroup group(java.lang.String key)
Returns the KFileMetaInfoGroup with the given key.

Parameters:
key - the key of the item
Returns:
the group. Invalid if there is no group with the given key.

op_at

public KFileMetaInfoGroup op_at(java.lang.String key)
Returns the KFileMetaInfoGroup with the given key.

Parameters:
key - the key of the item
Returns:
the group. Invalid if there is no group with the given key.

addGroup

public boolean addGroup(java.lang.String name)
Try to add the specified group. This will only succeed if it is in the list of editableGroups().

Parameters:
name - the name of the group to add
Returns:
true if successful, false if not

removeGroup

public boolean removeGroup(java.lang.String name)
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!

Parameters:
name - the name of the group to remove
Returns:
true if successful, false if not

removedGroups

public java.util.ArrayList removedGroups()
Returns a list of removed groups.

Returns:
a list of removed groups.

applyChanges

public boolean applyChanges()
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.

Returns:
true if successful, false if not

contains

public boolean contains(java.lang.String key)
Checks whether an item with the given key exists.

Parameters:
key - the key to check
Returns:
whether an item for this key exists.

containsGroup

public boolean containsGroup(java.lang.String key)
Checks whether a group with the given key exists.

Parameters:
key - the key to check
Returns:
whether a group with this name exists.

value

public org.kde.qt.QVariant value(java.lang.String key)
Returns the value with the given key.

Parameters:
key - the key to retrieve
Returns:
the value. Invalid if it does not exist

isValid

public boolean isValid()
Returns true if the item is valid, i.e. if actually represents the info about a file, false if the object is uninitialized.

Returns:
true if valid, false otherwise

isEmpty

public boolean isEmpty()
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.

Returns:
true if empty, false otherwise

mimeType

public java.lang.String mimeType()
Returns the mime type of file.

Returns:
the file's mime type

path

public java.lang.String path()
Returns the path of file - or null if file is non-local

Returns:
the file's path - or null if file is non-local

url

public KURL url()
Returns the url of file

Returns:
the file's url

appendGroup

protected KFileMetaInfoGroup appendGroup(java.lang.String name)

ref

protected void ref()

deref

protected void deref()

finalize

protected void finalize()
                 throws java.lang.InternalError
Deletes the wrapped C++ instance

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.InternalError

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()


isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?