Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 3cb339c0 authored by Laurent Montel's avatar Laurent Montel 😁

Move it in textutils

parent bc3576b6
......@@ -19,7 +19,7 @@
*/
#include "emoticontexteditselector.h"
#include "textutils.h"
#include <KEmoticons>
#include <kemoticonstheme.h>
......@@ -93,7 +93,7 @@ void EmoticonTextEditSelector::slotCreateEmoticonList()
{
mListEmoticon->clear();
if (mEmojiPlainText) {
const QList<uint> lstEmoji{0x1F50E, 0x1F603, 0x1F604, 0x1F601, 0x1F606, 0x1F605}; //Add more
const QList<uint> lstEmoji = TextUtils::unicodeEmoji();
for (uint emoji : lstEmoji) {
const QString str = QString::fromUcs4(&emoji, 1);
new EmoticonTextEditItem(str, mListEmoticon);
......
......@@ -165,3 +165,9 @@ QString TextUtils::flowText(QString &wrappedText, const QString &indent, int max
return result.left(result.length() - 1);
}
QList<uint> TextUtils::unicodeEmoji()
{
const QList<uint> lstEmoji{0x1F50E, 0x1F603, 0x1F604, 0x1F601, 0x1F606, 0x1F605}; //Add more
return lstEmoji;
}
......@@ -55,6 +55,8 @@ KPIMTEXTEDIT_EXPORT Q_REQUIRED_RESULT bool containsFormatting(const QTextDocumen
* "> this is a test."
*/
KPIMTEXTEDIT_EXPORT Q_REQUIRED_RESULT QString flowText(QString &text, const QString &indent, int maxLength);
KPIMTEXTEDIT_EXPORT Q_REQUIRED_RESULT QList<uint> unicodeEmoji();
}
}
......
......@@ -23,6 +23,7 @@
#include <QVBoxLayout>
#include <QTextEdit>
#include "textutils.h"
class Window : public QWidget
{
......@@ -36,7 +37,7 @@ public:
edit->setReadOnly(true);
mainLayout->addWidget(edit);
QString str;
const QList<uint> lstEmoji{0x1F50E, 0x1F603, 0x1F604, 0x1F601, 0x1F606, 0x1F605}; //Add more
const QList<uint> lstEmoji = KPIMTextEdit::TextUtils::unicodeEmoji();
for (uint emoji : lstEmoji) {
str += QString::fromUcs4(&emoji, 1);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment