Class KConfig
In: lib/kreadwriteconfig.rb
Parent: Object

Wrapper library for KDE script utilities kwriteconfig and kreadconfig.

Methods

new   read   write  

Public Class methods

Ensures the given file exists, is a file and is writable. If the file is in fact a relative path it will be hold relative to KDE‘s local config directory (usually $HOME/.kde/share/config).

  KConfig.new("../apps/amarok/dbrc") => "/home/user/.kde/share/apps/amarok/dbrc"

If the initialization gets invoked with the relative variable set to true the path will be hold relative to the current working directory instead of KDE‘s local config.

  KConfig.new("../apps/amarok/dbrc",true) => "/home/user/apps/amarok/dbrc"

Public Instance methods

Read config entries using kreadconfig.

  • group is the configuration group (e.g. [KDE])
  • key is the configuration key (e.g. Color)

To read the following config:

  [KDE]
  Color=true

  KConfig.new("kderc").read("KDE","Color","bool") => true

Write config entries using kwriteconfig.

  • group is the configuration group (e.g. [KDE])
  • key is the configuration key (e.g. Color)
  • value is the key value (e.g. Blue)

To write the following config:

  [KDE]
  Color=Blue

  KConfig.new("kderc").write("KDE","Color","Blue")

[Validate]