/usr/include/KF5/KEmoticons/kemoticonsprovider.h is in libkf5emoticons-dev 5.28.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | /**********************************************************************************
* Copyright (C) 2008 by Carlo Segato <brandon.ml@gmail.com> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library. If not, see <http://www.gnu.org/licenses/>.*
* *
**********************************************************************************/
#ifndef KEMOTICONS_PROVIDER_H
#define KEMOTICONS_PROVIDER_H
#include <kemoticons_export.h>
#include <QtCore/QObject>
#include <QtCore/QStringList>
class KEmoticonsProviderPrivate;
struct Emoticon;
/**
* This is the base abstract class for the emoticon provider plugins.
*/
class KEMOTICONS_EXPORT KEmoticonsProvider : public QObject
{
Q_OBJECT
public:
struct Emoticon {
Emoticon() {}
/* sort by longest to shortest matchText */
bool operator < (const Emoticon &e) const
{
return matchText.length() > e.matchText.length();
}
QString matchText;
QString matchTextEscaped;
QString picPath;
QString picHTMLCode;
};
/**
* Options to pass to addEmoticon
*/
enum AddEmoticonOption {
DoNotCopy, /**<< Don't copy the emoticon file into the theme directory */
Copy /**<< Copy the emoticon file into the theme directory */
};
/**
* Default constructor
*/
explicit KEmoticonsProvider(QObject *parent = 0);
/**
* Destructor
*/
virtual ~KEmoticonsProvider();
/**
* Loads the emoticon theme inside the directory @p path
* @param path path to the directory
* @return @c true if the emoticon theme is successfully loaded
*/
virtual bool loadTheme(const QString &path) = 0;
/**
* Removes the emoticon @p emo. This doesn't delete the image file.
* @param emo the emoticon text to remove
* @return @c true if the emoticon theme is successfully removed
*/
virtual bool removeEmoticon(const QString &emo) = 0;
/**
* Adds the emoticon @p emo with text @p text
* @param emo path to the emoticon image
* @param text the emoticon text. If alternative texts are to be added,
* use spaces to separate them.
* @param copy whether or not to copy @p emo into the theme directory
* @return @c true if the emoticon is successfully added
*/
virtual bool addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option = DoNotCopy) = 0;
/**
* Saves the emoticon theme
*
* @deprecated since 5.0, use saveTheme() instead
*/
#ifndef KEMOTICONS_NO_DEPRECATED
KEMOTICONS_DEPRECATED void save();
#endif
/**
* Saves the emoticon theme
* @since 5.0
*/
virtual void saveTheme() = 0;
/**
* Returns the theme name
*/
QString themeName() const;
/**
* Sets the emoticon theme name
* @param name name of the theme
*/
void setThemeName(const QString &name);
/**
* Returns the emoticon theme path
*/
QString themePath() const;
/**
* Returns the file name of the emoticon theme
*/
QString fileName() const;
/**
* Returns a QHash that contains the emoticon path as keys and the text as values
*/
QHash<QString, QStringList> emoticonsMap() const;
/**
* Returns a QHash that contains emoticons indexed by the first char
*/
QHash<QChar, QList<Emoticon> > emoticonsIndex() const;
/**
* Creates a new theme
*
* @deprecated since 5.0, use newTheme() instead
*/
#ifndef KEMOTICONS_NO_DEPRECATED
KEMOTICONS_DEPRECATED void createNew();
#endif
/**
* Creates a new theme
* @since 5.0
*/
virtual void newTheme() = 0;
/**
* If a preferred size is set, all parsed emoticons will be
* returned with the @p size
*
* @param size The desired QSize of parsed emoticons
* @since 5.23
*/
void setPreferredEmoticonSize(const QSize &size);
/**
* Returns size in which parsed emoticons will be returned.
*
* If the QSize returned is not valid (isValid() == false),
* then the default will be used, that is the actual file size.
*
* @since 5.23
*/
QSize preferredEmoticonSize() const;
protected:
/**
* Sets the theme inside the directory @p path
* @param path path to the directory
* @since 5.0
*/
void setThemePath(const QString &path);
/**
* Copies the emoticon image to the theme directory
* @param emo path to the emoticon image
* @return true if the emoticon is successfully copied
* @since 5.0
*/
bool copyEmoticon(const QString &emo);
/**
* Clears the emoticons map
*/
void clearEmoticonsMap();
/**
* Inserts a new item in the emoticon map
*
* @deprecated since 5.0, use addMapItem() instead
*/
#ifndef KEMOTICONS_NO_DEPRECATED
KEMOTICONS_DEPRECATED void addEmoticonsMap(QString key, QStringList value);
#endif
/**
* Inserts a new item in the emoticon map
* @since 5.0
* @see emoticonsMap()
*/
void addMapItem(QString key, QStringList value);
/**
* Removes an item from the emoticon map
*
* @deprecated since 5.0, use removeMapItem() instead
*/
#ifndef KEMOTICONS_NO_DEPRECATED
KEMOTICONS_DEPRECATED void removeEmoticonsMap(QString key);
#endif
/**
* Removes an item from the emoticon map
* @since 5.0
* @see emoticonsMap()
*/
void removeMapItem(QString key);
/**
* Adds an emoticon to the index
* @param path path to the emoticon
* @param emoList list of text associated with this emoticon
*
* @deprecated since 5.0, use addIndexItem() instead
*/
#ifndef KEMOTICONS_NO_DEPRECATED
KEMOTICONS_DEPRECATED void addEmoticonIndex(const QString &path, const QStringList &emoList);
#endif
/**
* Adds an emoticon to the index
* @param path path to the emoticon
* @param emoList list of text associated with this emoticon
* @since 5.0
* @see emoticonsIndex()
*/
void addIndexItem(const QString &path, const QStringList &emoList);
/**
* Removes an emoticon from the index
* @param path path to the emoticon
* @param emoList list of text associated with this emoticon
*
* @deprecated since 5.0, use removeIndexItem() instead
*/
#ifndef KEMOTICONS_NO_DEPRECATED
KEMOTICONS_DEPRECATED void removeEmoticonIndex(const QString &path, const QStringList &emoList);
#endif
/**
* Removes an emoticon from the index
* @param path path to the emoticon
* @param emoList list of text associated with this emoticon
* @since 5.0
* @see emoticonsIndex()
*/
void removeIndexItem(const QString &path, const QStringList &emoList);
private:
/**
* Private implementation class
*/
const QScopedPointer<KEmoticonsProviderPrivate> d;
};
#endif /* KEMOTICONS_PROVIDER_H */
|