• 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
kemoticonsprovider.h
Go to the documentation of this file.
1 /**********************************************************************************
2  * Copyright (C) 2008 by Carlo Segato <brandon.ml@gmail.com> *
3  * *
4  * This library is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU Lesser General Public *
6  * License as published by the Free Software Foundation; either *
7  * version 2.1 of the License, or (at your option) any later version. *
8  * *
9  * This library is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12  * Lesser General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU Lesser General Public *
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.*
16  * *
17  **********************************************************************************/
18 
19 #ifndef KEMOTICONS_PROVIDER_H
20 #define KEMOTICONS_PROVIDER_H
21 
22 #include "kemoticons_export.h"
23 #include <QtCore/QObject>
24 #include <QtCore/QVariant>
25 #include <QtCore/QStringList>
26 #include <QtCore/QPair>
27 
28 class QString;
29 class KEmoticonsProviderPrivate;
30 struct Emoticon;
31 
35 class KEMOTICONS_EXPORT KEmoticonsProvider : public QObject
36 {
37  Q_OBJECT
38 public:
39  struct Emoticon
40  {
41  Emoticon(){}
42  /* sort by longest to shortest matchText */
43  bool operator < (const Emoticon &e) const { return matchText.length() > e.matchText.length(); }
44  QString matchText;
45  QString matchTextEscaped;
46  QString picPath;
47  QString picHTMLCode;
48  };
49 
53  enum AddEmoticonOption {
54  DoNotCopy,
55  Copy
56  };
57 
61  explicit KEmoticonsProvider(QObject *parent = 0);
62 
66  virtual ~KEmoticonsProvider();
67 
72  virtual bool loadTheme(const QString &path);
73 
79  virtual bool removeEmoticon(const QString &emo);
80 
88  virtual bool addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option = DoNotCopy);
89 
93  virtual void save();
94 
98  QString themeName() const;
99 
104  void setThemeName(const QString &name);
105 
109  QString themePath() const;
110 
114  QString fileName() const;
115 
119  QHash<QString, QStringList> emoticonsMap() const;
120 
124  QHash<QChar, QList<Emoticon> > emoticonsIndex() const;
125 
129  virtual void createNew();
130 
131 protected:
135  void clearEmoticonsMap();
136 
140  void addEmoticonsMap(QString key, QStringList value);
141 
145  void removeEmoticonsMap(QString key);
146 
152  void addEmoticonIndex(const QString &path, const QStringList &emoList);
153 
159  void removeEmoticonIndex(const QString &path, const QStringList &emoList);
160 
164  KEmoticonsProviderPrivate * const d;
165 };
166 
167 #endif /* KEMOTICONS_PROVIDER_H */
168 
169 // kate: space-indent on; indent-width 4; replace-tabs on;
KEmoticonsProvider::Emoticon::picHTMLCode
QString picHTMLCode
Definition: kemoticonsprovider.h:47
KEmoticonsProvider::Emoticon::picPath
QString picPath
Definition: kemoticonsprovider.h:46
KEmoticonsProvider::Emoticon::matchTextEscaped
QString matchTextEscaped
Definition: kemoticonsprovider.h:45
KEmoticonsProvider
This is the base class for the emoticons provider plugins.
Definition: kemoticonsprovider.h:35
Copy
QString
QHash< QString, QStringList >
QObject
KEmoticonsProvider::Emoticon::Emoticon
Emoticon()
Definition: kemoticonsprovider.h:41
kemoticons_export.h
QStringList
KEmoticonsProvider::DoNotCopy
< Don't copy the emoticon file into the theme directory
Definition: kemoticonsprovider.h:54
KEmoticonsProvider::Emoticon::matchText
QString matchText
Definition: kemoticonsprovider.h:44
KEmoticonsProvider::Emoticon
Definition: kemoticonsprovider.h:39
KEmoticonsProvider::d
KEmoticonsProviderPrivate *const d
Private class.
Definition: kemoticonsprovider.h:164
KEmoticonsProvider::AddEmoticonOption
AddEmoticonOption
Options to pass to addEmoticon.
Definition: kemoticonsprovider.h:53
save
KAction * save(const QObject *recvr, const char *slot, QObject *parent)
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