Commit 072ebc27 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Show or not search tab

parent b890a9c8
......@@ -21,10 +21,6 @@ EmoticonUnicodeProxyModel::~EmoticonUnicodeProxyModel()
bool EmoticonUnicodeProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
{
if (mCategories.isEmpty()) {
const QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent);
const QString identifier = sourceIndex.data(EmoticonUnicodeModel::UnicodeEmoji).toString();
qDebug() << " identifier " << identifier;
return QSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
}
const QModelIndex sourceIndex = sourceModel()->index(source_row, 0, source_parent);
......
......@@ -31,9 +31,12 @@ EmoticonUnicodeTab::~EmoticonUnicodeTab()
void EmoticonUnicodeTab::searchUnicode(const QString &str)
{
qDebug() << " str" << str;
bool searchVisible = !str.trimmed().isEmpty();
setTabVisible(mSearchTabIndex, searchVisible);
if (searchVisible) {
setCurrentIndex(mSearchTabIndex);
}
mEmoticonUnicodeProxyModel->setFilterFixedString(str);
// TODO show search page + update proxyfilter + switch to search page
}
void EmoticonUnicodeTab::createSearchTab()
......@@ -43,8 +46,8 @@ void EmoticonUnicodeTab::createSearchTab()
mEmoticonUnicodeProxyModel = new EmoticonUnicodeProxyModel(this);
mEmoticonUnicodeProxyModel->setSourceModel(emoticonModel);
emoticonModel->setEmoticonList(EmoticonUnicodeUtils::unicodeFaceEmoji() + EmoticonUnicodeUtils::unicodeAnimalsEmoji());
allEmojisView->setModel(emoticonModel);
const int index = addTab(allEmojisView, i18n("full"));
allEmojisView->setModel(mEmoticonUnicodeProxyModel);
mSearchTabIndex = addTab(allEmojisView, i18n("full"));
// if (!str.isEmpty()) {
// setTabToolTip(index, str);
// }
......@@ -86,6 +89,7 @@ void EmoticonUnicodeTab::loadEmoticons()
createPlainTextEmoticonTab(i18n("Dishware"), EmoticonUnicodeUtils::unicodeDishwareEmoji());
createPlainTextEmoticonTab(i18n("Hotel"), EmoticonUnicodeUtils::unicodeHotelEmoji());
createPlainTextEmoticonTab(i18n("Award-Medal"), EmoticonUnicodeUtils::unicodeAwardMedalEmoji());
setTabVisible(mSearchTabIndex, false);
}
void EmoticonUnicodeTab::createPlainTextEmoticonTab(const QString &str, const QVector<EmoticonUnicodeUtils::EmoticonStruct> &emoticons)
......
......@@ -35,6 +35,7 @@ private:
void createPlainTextEmoticonTab(const QString &str, const QVector<EmoticonUnicodeUtils::EmoticonStruct> &emoticons);
void createSearchTab();
EmoticonUnicodeProxyModel *mEmoticonUnicodeProxyModel = nullptr;
int mSearchTabIndex = -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