• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KUtils

  • sources
  • kde-4.12
  • kdelibs
  • kutils
  • kemoticons
kemoticonstheme.h
Go to the documentation of this file.
1 /**********************************************************************************
2  * Copyright (C) 2008 by Carlo Segato <brandon.ml@gmail.com> *
3  * Copyright (c) 2002-2003 by Stefan Gehn <metz@gehn.net> *
4  * Kopete (c) 2002-2008 by the Kopete developers <kopete-devel@kde.org> *
5  * Copyright (c) 2005 by Engin AYDOGAN <engin@bzzzt.biz> *
6  * *
7  * This library is free software; you can redistribute it and/or *
8  * modify it under the terms of the GNU Lesser General Public *
9  * License as published by the Free Software Foundation; either *
10  * version 2.1 of the License, or (at your option) any later version. *
11  * *
12  * This library is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * Lesser General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU Lesser General Public *
18  * License along with this library. If not, see <http://www.gnu.org/licenses/>.*
19  * *
20  **********************************************************************************/
21 
22 #ifndef KEMOTICONS_THEME_H
23 #define KEMOTICONS_THEME_H
24 
25 #include "kemoticonsprovider.h"
26 
27 #include <QtCore/QSharedDataPointer>
28 
29 class QString;
30 
34 class KEMOTICONS_EXPORT KEmoticonsTheme
35 {
36 public:
37 
41  enum ParseModeEnum {
42  DefaultParse = 0x0,
43  StrictParse = 0x1,
44  RelaxedParse = 0x2,
45  SkipHTML = 0x4
46  };
47 
48  Q_DECLARE_FLAGS(ParseMode, ParseModeEnum)
49 
50 
53  enum TokenType {
54  Undefined,
55  Image,
56  Text
57  };
58 
65  struct Token {
66  Token() : type(Undefined) {}
70  Token(TokenType t, const QString &m) : type(t), text(m) {}
74  Token(TokenType t, const QString &m, const QString &p, const QString &html)
75  : type(t), text(m), picPath(p), picHTMLCode(html) {}
76  TokenType type;
77  QString text;
78  QString picPath;
79  QString picHTMLCode;
80  };
81 
86  KEmoticonsTheme();
87 
91  KEmoticonsTheme(const KEmoticonsTheme &ket);
92 
97  KEmoticonsTheme(KEmoticonsProvider *p);
98 
102  ~KEmoticonsTheme();
103 
119  QString parseEmoticons(const QString &text, ParseMode mode = DefaultParse, const QStringList &exclude = QStringList()) const;
120 
133  QList<Token> tokenize(const QString &message, ParseMode mode = DefaultParse) const;
134 
139  bool loadTheme(const QString &path);
140 
150  bool removeEmoticon(const QString &emo);
151 
163  bool addEmoticon(const QString &emo, const QString &text, KEmoticonsProvider::AddEmoticonOption option = KEmoticonsProvider::DoNotCopy);
164 
168  void save();
169 
173  QString themeName() const;
174 
179  void setThemeName(const QString &name);
180 
184  QString themePath() const;
185 
189  QString fileName() const;
190 
194  QHash<QString, QStringList> emoticonsMap() const;
195 
199  void createNew();
200 
204  bool isNull() const;
205 
209  KEmoticonsTheme& operator=(const KEmoticonsTheme &ket);
210 private:
211  class KEmoticonsThemeData;
215  QSharedDataPointer<KEmoticonsThemeData> d;
216 };
217 
218 Q_DECLARE_OPERATORS_FOR_FLAGS(KEmoticonsTheme::ParseMode)
219 
220 #endif /* KEMOTICONS_THEME_H */
221 
222 // kate: space-indent on; indent-width 4; replace-tabs on;
KEmoticonsTheme
This class contains the emoticons theme.
Definition: kemoticonstheme.h:34
KEmoticonsTheme::Token::picPath
QString picPath
path to the image
Definition: kemoticonstheme.h:78
KEmoticonsTheme::Token::type
TokenType type
type
Definition: kemoticonstheme.h:76
KEmoticonsTheme::Image
Token contains a path to an image.
Definition: kemoticonstheme.h:55
KEmoticonsProvider
This is the base class for the emoticons provider plugins.
Definition: kemoticonsprovider.h:35
KEmoticonsTheme::ParseModeEnum
ParseModeEnum
The possible parse modes.
Definition: kemoticonstheme.h:41
QString
QHash< QString, QStringList >
kemoticonsprovider.h
KEmoticonsTheme::Undefined
Undefined, for completeness only.
Definition: kemoticonstheme.h:54
KEmoticonsTheme::Token::Token
Token(TokenType t, const QString &m, const QString &p, const QString &html)
Create a Token of type t, text m, image path p and html code html.
Definition: kemoticonstheme.h:74
KEmoticonsTheme::Token::Token
Token(TokenType t, const QString &m)
Create a Token of type t, and text m.
Definition: kemoticonstheme.h:70
KEmoticonsTheme::Token::picHTMLCode
QString picHTMLCode
html code
Definition: kemoticonstheme.h:79
QStringList
KEmoticonsProvider::DoNotCopy
< Don't copy the emoticon file into the theme directory
Definition: kemoticonsprovider.h:54
KEmoticonsTheme::Token::text
QString text
text
Definition: kemoticonstheme.h:77
KEmoticonsTheme::Token::Token
Token()
Definition: kemoticonstheme.h:66
KEmoticonsTheme::Token
A token consists of a QString text which is either a regular text or a path to image depending on the...
Definition: kemoticonstheme.h:65
KEmoticonsTheme::TokenType
TokenType
TokenType, a token might be an image ( emoticon ) or text.
Definition: kemoticonstheme.h:53
KEmoticonsProvider::AddEmoticonOption
AddEmoticonOption
Options to pass to addEmoticon.
Definition: kemoticonsprovider.h:53
save
KAction * save(const QObject *recvr, const char *slot, QObject *parent)
QList
Definition: dialog.h:29
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:34 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KUtils

Skip menu "KUtils"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal