Commit 18383a22 authored by Laurent Montel's avatar Laurent Montel 😁

Use tabbar here

parent e8f5eb1d
......@@ -18,8 +18,12 @@
02110-1301, USA.
*/
#include "emoticonlistwidgetselector.h"
#include "emoticontexteditselector.h"
#ifdef USE_UNICODE_TAB
#include "emoticonunicodetab.h"
#else
#include "emoticonlistwidgetselector.h"
#endif
#include "textutils.h"
#include <KEmoticons>
#include <kemoticonstheme.h>
......@@ -36,9 +40,15 @@ EmoticonTextEditSelector::EmoticonTextEditSelector(QWidget *parent)
QHBoxLayout *lay = new QHBoxLayout(this);
lay->setSpacing(0);
lay->setContentsMargins(0, 0, 0, 0);
#ifdef USE_UNICODE_TAB
mUnicodeTab = new EmoticonUnicodeTab(this);
lay->addWidget(mUnicodeTab);
connect(mUnicodeTab, &EmoticonUnicodeTab::itemSelected, this, &EmoticonTextEditSelector::slotItemSelected);
#else
mListEmoticon = new EmoticonListWidgetSelector(this);
lay->addWidget(mListEmoticon);
connect(mListEmoticon, &EmoticonListWidgetSelector::itemSelected, this, &EmoticonTextEditSelector::slotItemSelected);
#endif
}
EmoticonTextEditSelector::~EmoticonTextEditSelector()
......@@ -56,6 +66,11 @@ void EmoticonTextEditSelector::slotItemSelected(const QString &str)
void EmoticonTextEditSelector::loadEmoticons()
{
#ifdef USE_UNICODE_TAB
if (mUnicodeTab->count() == 0) {
mUnicodeTab->loadEmoticons();
}
#else
if (mListEmoticon->count() == 0) {
if (mEmojiPlainText) {
mListEmoticon->setEmoticons(TextUtils::unicodeFullEmoji());
......@@ -63,17 +78,26 @@ void EmoticonTextEditSelector::loadEmoticons()
mListEmoticon->loadEmotionsFromTheme();
}
}
#endif
}
bool EmoticonTextEditSelector::emojiPlainText() const
{
#ifdef USE_UNICODE_TAB
return mUnicodeTab->emojiPlainText();
#else
return mEmojiPlainText;
#endif
}
void EmoticonTextEditSelector::setEmojiPlainText(bool emojiPlainText)
{
#ifdef USE_UNICODE_TAB
mUnicodeTab->setEmojiPlainText(emojiPlainText);
#else
if (mEmojiPlainText != emojiPlainText) {
mEmojiPlainText = emojiPlainText;
mListEmoticon->clear();
}
#endif
}
......@@ -23,10 +23,10 @@
#include <QListWidgetItem>
#include <QWidget>
#define USE_UNICODE_TAB 1
namespace KPIMTextEdit {
class EmoticonListWidgetSelector;
class EmoticonUnicodeTab;
class EmoticonTextEditSelector : public QWidget
{
Q_OBJECT
......@@ -45,8 +45,12 @@ Q_SIGNALS:
private:
void slotItemSelected(const QString &str);
#ifdef USE_UNICODE_TAB
EmoticonUnicodeTab *mUnicodeTab = nullptr;
#else
EmoticonListWidgetSelector *mListEmoticon = nullptr;
bool mEmojiPlainText = false;
#endif
};
}
......
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