org.kde.koala
Class KRootProp

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

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

Access KDE desktop resources stored on the root window. A companion to the KConfig class. The KRootProp class is used for reading and writing configuration entries to properties on the root window. All configuration entries are of the form "key=value".

Author:
Mark Donohoe (donohe@kde.org)
See Also:
KConfig.KConfig(org.kde.koala.KConfigBackEnd)

Constructor Summary
  KRootProp()
           
protected KRootProp(java.lang.Class dummy)
           
  KRootProp(java.lang.String rProp)
          Constructs a KRootProp object for the property rProp.
 
Method Summary
 void destroy()
          Destroys the property completely.
 void dispose()
          Delete the wrapped C++ instance ahead of finalize()
protected  void finalize()
          Deletes the wrapped C++ instance
 boolean isDisposed()
          Has the wrapped C++ instance been deleted?
 java.util.ArrayList listEntries()
          Returns a list of all keys.
 java.lang.String prop()
          Returns the name of the property under which keys are searched.
 org.kde.qt.QColor readColorEntry(java.lang.String rKey)
           
 org.kde.qt.QColor readColorEntry(java.lang.String rKey, org.kde.qt.QColor pDefault)
          Reads a QColor.
 java.lang.String readEntry(java.lang.String rKey)
           
 java.lang.String readEntry(java.lang.String rKey, java.lang.String pDefault)
          Reads the value of an entry specified by rKey in the current property.
 org.kde.qt.QFont readFontEntry(java.lang.String rKey)
           
 org.kde.qt.QFont readFontEntry(java.lang.String rKey, org.kde.qt.QFont pDefault)
          Reads a QFont value.
 int readNumEntry(java.lang.String rKey)
           
 int readNumEntry(java.lang.String rKey, int nDefault)
          Reads a numerical value.
 java.lang.String removeEntry(java.lang.String rKey)
          Removes an entry.
 void setProp()
           
 void setProp(java.lang.String rProp)
          Sets the property in which keys will be searched.
 void sync()
          Flushes the entry cache.
 java.lang.String writeEntry(java.lang.String rKey, int nValue)
          Writes the (key/value) pair.
 java.lang.String writeEntry(java.lang.String rKey, org.kde.qt.QColor rColor)
          Writes the (key/value) pair.
 java.lang.String writeEntry(java.lang.String rKey, org.kde.qt.QFont rFont)
          Writes the (key/value) pair.
 java.lang.String writeEntry(java.lang.String rKey, java.lang.String rValue)
          Writes a (key/value) pair.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KRootProp

protected KRootProp(java.lang.Class dummy)

KRootProp

public KRootProp(java.lang.String rProp)
Constructs a KRootProp object for the property rProp.

Parameters:
rProp - the property that will be searched, null to do nothing
See Also:
setProp(java.lang.String)

KRootProp

public KRootProp()
Method Detail

setProp

public void setProp(java.lang.String rProp)
Sets the property in which keys will be searched.

Parameters:
rProp - the property that will be searched

setProp

public void setProp()

prop

public java.lang.String prop()
Returns the name of the property under which keys are searched.

Returns:
the property that will be searched

destroy

public void destroy()
Destroys the property completely. I.e. all entries will be cleared and the property will be removed from the root window.


readEntry

public java.lang.String readEntry(java.lang.String rKey,
                                  java.lang.String pDefault)
Reads the value of an entry specified by rKey in the current property.

Parameters:
rKey - The key to search for.
pDefault - A default value returned if the key was not found.
Returns:
The value for this key or the default if no value was found.

readEntry

public java.lang.String readEntry(java.lang.String rKey)

readNumEntry

public int readNumEntry(java.lang.String rKey,
                        int nDefault)
Reads a numerical value. Reads the value of an entry specified by rKey in the current property and interprets it numerically.

Parameters:
rKey - The key to search for.
nDefault - A default value returned if the key was not found.
Returns:
The value for this key or the default if no value was found.

readNumEntry

public int readNumEntry(java.lang.String rKey)

readFontEntry

public org.kde.qt.QFont readFontEntry(java.lang.String rKey,
                                      org.kde.qt.QFont pDefault)
Reads a QFont value. Reads the value of an entry specified by rKey in the current property and interpret it as a font object.

Parameters:
rKey - The key to search for.
pDefault - A default value returned if the key was not found.
Returns:
The value for this key or a default font if no value was found.

readFontEntry

public org.kde.qt.QFont readFontEntry(java.lang.String rKey)

readColorEntry

public org.kde.qt.QColor readColorEntry(java.lang.String rKey,
                                        org.kde.qt.QColor pDefault)
Reads a QColor. Reads the value of an entry specified by rKey in the current property and interprets it as a color.

Parameters:
rKey - The key to search for.
pDefault - A default value returned if the key was not found.
Returns:
The value for this key or a default color if no value was found.

readColorEntry

public org.kde.qt.QColor readColorEntry(java.lang.String rKey)

writeEntry

public java.lang.String writeEntry(java.lang.String rKey,
                                   java.lang.String rValue)
Writes a (key/value) pair. This is stored to the current property when destroying the config object or when calling sync().

Parameters:
rKey - The key to write.
rValue - The value to write.
Returns:
The old value for this key. If this key did not exist, a null string is returned.

writeEntry

public java.lang.String writeEntry(java.lang.String rKey,
                                   int nValue)
Writes the (key/value) pair. Same as above, but writes a numerical value.

Parameters:
rKey - The key to write.
nValue - The value to write.
Returns:
The old value for this key. If this key did not exist, a null string is returned.

writeEntry

public java.lang.String writeEntry(java.lang.String rKey,
                                   org.kde.qt.QFont rFont)
Writes the (key/value) pair. Same as above, but writes a font.

Parameters:
rKey - The key to write.
rFont - The font to write.
Returns:
The old value for this key. If this key did not exist, a null string is returned.

writeEntry

public java.lang.String writeEntry(java.lang.String rKey,
                                   org.kde.qt.QColor rColor)
Writes the (key/value) pair. Same as above, but writes a color.

Parameters:
rKey - The key to write.
rColor - The color to write.
Returns:
The old value for this key. If this key did not exist, a null string is returned.

removeEntry

public java.lang.String removeEntry(java.lang.String rKey)
Removes an entry.

Parameters:
rKey - The key to remove.
Returns:
The old value for this key. If this key did not exist, a null string is returned.

listEntries

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

Returns:
An ArrayList containing all the keys.

sync

public void sync()
Flushes the entry cache. Writes back dirty configuration entries to the current property, This is called automatically from the destructor.


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?