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

require 'singleton'

class TestSignal < KDE::ConfigSkeleton
  include Singleton

  SignalEmoticonSettingsChanged = 0x1,
  SignalStyleChanged = 0x2

  #
  # Set Current emoticon theme.
  #
  def setEmoticonTheme(v)
    item = findItem("emoticonTheme")
    if !item.immutable?
      item.property = @emoticonTheme = Qt::Variant.fromValue(v)
      @settingsChanged |= SignalEmoticonSettingsChanged
    end
  end

  def emoticonTheme=(v)
    setEmoticonTheme(v)
  end

  #
  # Get Current emoticon theme.
  #
  def emoticonTheme
    @emoticonTheme = findItem("emoticonTheme").property
    return @emoticonTheme.value
  end

  #
  # Set Enable emoticon support in Kopete.
  #
  def setUseEmoticon(v)
    item = findItem("useEmoticon")
    if !item.immutable?
      item.property = @useEmoticon = Qt::Variant.fromValue(v)
      @settingsChanged |= SignalEmoticonSettingsChanged
    end
  end

  def useEmoticon=(v)
    setUseEmoticon(v)
  end

  #
  # Get Enable emoticon support in Kopete.
  #
  def useEmoticon
    @useEmoticon = findItem("useEmoticon").property
    return @useEmoticon.value
  end

  #
  # Set Use strict mode in emoticon parsing.
  #
  def setEmoticonRequireSpace(v)
    item = findItem("emoticonRequireSpace")
    if !item.immutable?
      item.property = @emoticonRequireSpace = Qt::Variant.fromValue(v)
      @settingsChanged |= SignalEmoticonSettingsChanged
    end
  end

  def emoticonRequireSpace=(v)
    setEmoticonRequireSpace(v)
  end

  #
  # Get Use strict mode in emoticon parsing.
  #
  def emoticonRequireSpace
    @emoticonRequireSpace = findItem("emoticonRequireSpace").property
    return @emoticonRequireSpace.value
  end

  #
  # Set Absolute path to a directory containing a Adium/Kopete chat window style.
  #
  def setStylePath(v)
    item = findItem("stylePath")
    if !item.immutable?
      item.property = @stylePath = Qt::Variant.fromValue(v)
      @settingsChanged |= SignalStyleChanged
    end
  end

  def stylePath=(v)
    setStylePath(v)
  end

  #
  # Get Absolute path to a directory containing a Adium/Kopete chat window style.
  #
  def stylePath
    @stylePath = findItem("stylePath").property
    return @stylePath.value
  end

  #
  # Set Relative path to a CSS variant for the current style.
  #
  def setStyleCSSVariant(v)
    item = findItem("StyleCSSVariant")
    if !item.immutable?
      item.property = @styleCSSVariant = Qt::Variant.fromValue(v)
    end
  end

  def styleCSSVariant=(v)
    setStyleCSSVariant(v)
  end

  #
  # Get Relative path to a CSS variant for the current style.
  #
  def styleCSSVariant
    @styleCSSVariant = findItem("StyleCSSVariant").property
    return @styleCSSVariant.value
  end



  signals 'emoticonSettingsChanged()'

  #
  # Tell when a complete style change.
  #
  signals 'styleChanged(const QString & stylePath, const QString & StyleCSSVariant)'

  def initialize()
    super("kconfig_compiler_test_rc")

    # Appearance
    @emoticonTheme = Qt::Variant.fromValue("")
    @useEmoticon = Qt::Variant.fromValue(false)
    @emoticonRequireSpace = Qt::Variant.fromValue(false)
    @stylePath = Qt::Variant.fromValue("")
    @styleCSSVariant = Qt::Variant.fromValue("")
    @settingsChanged = 0
    setCurrentGroup("Appearance")

    itemEmoticonTheme = ItemString.new(currentGroup(), "emoticonTheme", @emoticonTheme.value, "Default")
    itemEmoticonTheme.property = @emoticonTheme
    addItem(itemEmoticonTheme)
    itemUseEmoticon = ItemBool.new(currentGroup(), "useEmoticon", @useEmoticon.value, true)
    itemUseEmoticon.property = @useEmoticon
    addItem(itemUseEmoticon)
    itemEmoticonRequireSpace = ItemBool.new(currentGroup(), "emoticonRequireSpace", @emoticonRequireSpace.value, true)
    itemEmoticonRequireSpace.property = @emoticonRequireSpace
    addItem(itemEmoticonRequireSpace)
    itemStylePath = ItemString.new(currentGroup(), "stylePath", @stylePath.value)
    itemStylePath.property = @stylePath
    addItem(itemStylePath)
    itemStyleCSSVariant = ItemString.new(currentGroup(), "styleVariant", @styleCSSVariant.value)
    itemStyleCSSVariant.property = @styleCSSVariant
    addItem(itemStyleCSSVariant, "StyleCSSVariant")
    readConfig
  end

  def usrWriteConfig
    super
    if @settingsChanged & SignalEmoticonSettingsChanged != 0
      emit emoticonSettingsChanged()
    end
    if @settingsChanged & SignalStyleChanged != 0
      emit styleChanged(@stylePath.value, @styleCSSVariant.value)
    end
    @settingsChanged = 0
  end
end
