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

KUtils

  • 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
29class QString;
30
34class KEMOTICONS_EXPORT KEmoticonsTheme
35{
36public:
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);
210private:
211 class KEmoticonsThemeData;
215 QSharedDataPointer<KEmoticonsThemeData> d;
216};
217
218Q_DECLARE_OPERATORS_FOR_FLAGS(KEmoticonsTheme::ParseMode)
219
220#endif /* KEMOTICONS_THEME_H */
221
222// kate: space-indent on; indent-width 4; replace-tabs on;
KEmoticonsProvider
This is the base class for the emoticons provider plugins.
Definition: kemoticonsprovider.h:36
KEmoticonsProvider::AddEmoticonOption
AddEmoticonOption
Options to pass to addEmoticon.
Definition: kemoticonsprovider.h:53
KEmoticonsProvider::DoNotCopy
@ DoNotCopy
< Don't copy the emoticon file into the theme directory
Definition: kemoticonsprovider.h:54
KEmoticonsTheme
This class contains the emoticons theme.
Definition: kemoticonstheme.h:35
KEmoticonsTheme::ParseModeEnum
ParseModeEnum
The possible parse modes.
Definition: kemoticonstheme.h:41
KEmoticonsTheme::TokenType
TokenType
TokenType, a token might be an image ( emoticon ) or text.
Definition: kemoticonstheme.h:53
KEmoticonsTheme::Image
@ Image
Token contains a path to an image.
Definition: kemoticonstheme.h:55
KEmoticonsTheme::Undefined
@ Undefined
Undefined, for completeness only.
Definition: kemoticonstheme.h:54
QHash
QList
kemoticonsprovider.h
save
KAction * save(const QObject *recvr, const char *slot, QObject *parent)
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::Token::text
QString text
text
Definition: kemoticonstheme.h:77
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::picHTMLCode
QString picHTMLCode
<img> html code
Definition: kemoticonstheme.h:79
KEmoticonsTheme::Token::Token
Token()
Definition: kemoticonstheme.h:66
KEmoticonsTheme::Token::picPath
QString picPath
path to the image
Definition: kemoticonstheme.h:78
KEmoticonsTheme::Token::Token
Token(TokenType t, const QString &m)
Create a Token of type t, and text m.
Definition: kemoticonstheme.h:70
KEmoticonsTheme::Token::type
TokenType type
type
Definition: kemoticonstheme.h:76
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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