# class KEmoticonsTheme

###

Module | kutils
Namespace |
Class | KEmoticonsTheme
Inherits |

This class contains the emoticons theme

### enums

- ParseModeEnum { DefaultParse, StrictParse, RelaxedParse, SkipHTML }
  typesafe object: ParseMode
- TokenType { Undefined, Image, Text }

enum details

### methods

- KEmoticonsTheme ( )

  returns ctor

- KEmoticonsTheme (ket)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  ket | KEmoticonsTheme |

  Copy constructor

- KEmoticonsTheme (p)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  p | KEmoticonsProvider |

  Another constructor where you set the KEmoticonsProvider p you should probably never use this, instead use KEmoticons.theme()

- addEmoticon (emo, text, option)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  emo | QString |
  text | QString |
  option | KEmoticonsProvider.AddEmoticonOption | KEmoticonsProvider.DoNotCopy

  Add the emoticon emo with text text

      KEmoticonsTheme theme = KEmoticons().theme();
      theme.addEmoticon("/path/to/smiley.png", ":) :-)");

  emo - path to the emoticon image

  text - the text of the emoticon separated by space for multiple text

  copy - whether or not copy emo into the theme directory Returns true if it can add the emoticon

- createNew ( )

  returns Nothing

  Create a new theme

- emoticonsMap ( )

  returns QHash<QString,QStringList>

  Returns a QHash that contains the emoticons path as keys and the text as values

- fileName ( )

  returns QString

  Returns the file name of the theme

- isNull ( )

  returns bool

  Check if the theme has a valid provider and it returns true if it can't find it

- loadTheme (path)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  path | QString |

  Load the theme inside the directory path

  path - path to the directory

- parseEmoticons (text, mode, exclude)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  text | QString |
  mode | KEmoticonsTheme.ParseMode | KEmoticonsTheme.DefaultParse
  exclude | QStringList | QStringList()

  Parse emoticons in text text with ParseMode mode and optionally excluding emoticons from exclude

      KEmoticonsTheme theme = KEmoticons().theme();
      QString text = ":D hi :)";
      QStringList exclude(":)");
      QString parsed = theme.parseEmoticons(text, KEmoticonsTheme.DefaultParse, exclude);
      // parsed will be " hi :)"

  text - the text to parse

  mode - how to parse the text

  exclude - a list of emoticons to exclude from the parsing Returns the text with emoticons replaced by html images SkipHTML is forced when using this function

- removeEmoticon (emo)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  emo | QString |

  Remove the emoticon emo, this will not delete the image file too

      KEmoticonsTheme theme = KEmoticons().theme();
      theme.removeEmoticon(":)");

  emo - the emoticon text to remove Returns true if it can delete the emoticon

- save ( )

  returns Nothing

  Save the emoticon theme

- setThemeName (name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QString |

  Set the theme name

  name - name of the theme

- themeName ( )

  returns QString

  Returns the theme name

- themePath ( )

  returns QString

  Returns the theme path

- tokenize (message, mode)

  returns QList<KEmoticonsTheme::Token>

  Argument | Type | Default
  --- | --- | ---
  message | QString |
  mode | KEmoticonsTheme.ParseMode | KEmoticonsTheme.DefaultParse

  Tokenize the message message with ParseMode mode

      KEmoticonsTheme theme = KEmoticons().theme();
      QString text = "hi :)";
      QList<Token> tokens = theme.tokenize(text, KEmoticonsTheme.DefaultParse);
      // tokens[0].text = "hi "
      // tokens[1].text = ":)"
      // tokens[1].picPath = "/path/to/:).png"
      // tokens[1].picHTMLCode = ""

### enums - detail

- ParseModeEnum { DefaultParse, StrictParse, RelaxedParse, SkipHTML }

  The possible parse modes

  typesafe object: ParseMode

DefaultParse - 0x0 -
StrictParse - 0x1 -
RelaxedParse - 0x2 -
SkipHTML - 0x4 -

- TokenType { Undefined, Image, Text }

  TokenType, a token might be an image ( emoticon ) or text.

  | Undefined | - | - |
  | Image | - | - |
  | Text | - | - |