# This file is generated by rbkconfig_compiler from test6.kcfg.
# All changes you do to this file will be lost.

class Test6 < KDE::ConfigSkeleton

  #
  # Set Block colors.
  #
  def setColor(v)
    item = findItem("Color")
    if !item.immutable?
      item.property = @color = Qt::Variant.fromValue(v)
    end
  end

  def color=(v)
    setColor(v)
  end

  #
  # Get Block colors.
  #
  def color
    @color = findItem("Color").property
    return @color.value
  end

  #
  # Set foo bar
  #
  def setFooBar(v)
    item = findItem("FooBar")
    if !item.immutable?
      item.property = @fooBar = Qt::Variant.fromValue(v)
    end
  end

  def fooBar=(v)
    setFooBar(v)
  end

  #
  # Get foo bar
  #
  def fooBar
    @fooBar = findItem("FooBar").property
    return @fooBar.value
  end

  #
  # Set Age
  #
  def setAge(v)
    if v < 8
      puts "setAge: value #{v} is less than the minimum value of 8"
      v = 8
    end

    if v > 88
      puts "setAge: value #{v} is greater than the maximum value of 88"
      v = 88
    end

    item = findItem("Age")
    if !item.immutable?
      item.property = @age = Qt::Variant.fromValue(v)
    end
  end

  def age=(v)
    setAge(v)
  end

  #
  # Get Age
  #
  def age
    @age = findItem("Age").property
    return @age.value
  end

  def initialize(number)
    super("test4rc")
    @paramnumber = Qt::Variant.fromValue(number)

    # Foo
    @color = Qt::Variant.fromValue(Qt::Color.new)

    # Bar$(Number)
    @fooBar = Qt::Variant.fromValue("")
    @age = Qt::Variant.fromValue(0)
    setCurrentGroup("Foo")

    itemColor = ItemColor.new(currentGroup(), "color ##{@paramnumber.value}", @color.value, Qt::Color.new("red"))
    itemColor.property = @color
    addItem(itemColor, "Color")

    setCurrentGroup("Bar#{@paramnumber.value}")

    itemFooBar = ItemString.new(currentGroup(), "foo bar", @fooBar.value)
    itemFooBar.property = @fooBar
    addItem(itemFooBar, "FooBar")
    itemAge = ItemInt.new(currentGroup(), "Age", @age.value, 35)
    itemAge.property = @age
    itemAge.minValue = 8
    itemAge.maxValue = 88
    addItem(itemAge)
  end

end
