Commit d5086fbc authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Remove the emoticons kcm

Most applications nowadays rely on unicode emoji. This kcm them becomes
more confusing than helpful, only catering to applications that use the
KEmoticons framework, which aren't many and can include the kcm in-app
if they desire as much.
parent df3155e4
......@@ -40,7 +40,6 @@ add_subdirectory( desktoppaths )
add_subdirectory(activities)
add_subdirectory(componentchooser)
add_subdirectory(emoticons)
add_subdirectory(icons)
add_subdirectory(kded)
add_subdirectory(formats)
......
# KI18N Translation Domain for this library
add_definitions(-DTRANSLATION_DOMAIN=\"kcm5_emoticons\")
set(kcmemoticons_SRCS emoticonslist.cpp)
ki18n_wrap_ui(kcmemoticons_SRCS emoticonslist.ui)
add_library(kcm_emoticons MODULE ${kcmemoticons_SRCS})
target_link_libraries(kcm_emoticons
KF5::NewStuff
KF5::Completion
KF5::KDELibs4Support
KF5::Emoticons)
install(TARGETS kcm_emoticons DESTINATION ${KDE_INSTALL_PLUGINDIR} )
########### install files ###############
install( FILES emoticons.desktop DESTINATION ${KDE_INSTALL_KSERVICES5DIR} )
install( FILES emoticons.knsrc DESTINATION ${KDE_INSTALL_KNSRCDIR} )
#!/usr/bin/env bash
$EXTRACTRC *.ui >> rc.cpp
$XGETTEXT *.cpp -o $podir/kcm5_emoticons.pot
[Desktop Entry]
Exec=kcmshell5 emoticons
Icon=face-smile
Type=Service
X-DocPath=kcontrol/emoticons/index.html
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_emoticons
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=icons
X-KDE-Weight=110
Name=Emoticons
Name[af]=Emotikons
Name[ar]=الوجوه التّعبيرية
Name[as]=ভাব-প্ৰতীক
Name[ast]=Fustaxes
Name[be@latin]=Smajliki
Name[bg]=Емотикони
Name[bn]=ইমোট-আইকন
Name[bn_IN]=ইমোআইকন
Name[bs]=Emotikoni
Name[ca]=Emoticones
Name[ca@valencia]=Emoticones
Name[cs]=Emotikony
Name[csb]=Emòtikónczi
Name[da]=Emotikoner
Name[de]=Emoticons
Name[el]=Εικονίδια διάθεσης
Name[en_GB]=Emoticons
Name[eo]=Miensimboloj
Name[es]=Emoticonos
Name[et]=Emotikonid
Name[eu]=Aurpegierak
Name[fa]=صورتک
Name[fi]=Hymiöt
Name[fr]=Émoticônes
Name[fy]=Emobyldkaikes
Name[ga]=Straoiseoga
Name[gl]=Emoticonas
Name[gu]=લાગણીઓ
Name[he]=רגשונים
Name[hi]=हँसमुख
Name[hne]=चेहराचिनहा
Name[hr]=Emoticons
Name[hsb]=Emotikony
Name[hu]=Emotikonok
Name[ia]=Emoticones
Name[id]=Emoticon
Name[is]=Tjáningartákn
Name[it]=Faccine
Name[ja]=感情アイコン
Name[kk]=Көңіл күйі белгілері
Name[km]=សញ្ញា​អារម្មណ៍
Name[kn]=ಭಾವನಾಚಿಹ್ನೆಗಳು (ಎಮೋಟಿಕಾನ್)
Name[ko]=이모티콘
Name[ku]=Emotîkon
Name[lt]=Jaustukai
Name[lv]=Emocijzīmes
Name[mai]=भाव-प्रतीक
Name[mk]=Емотикони
Name[ml]=വികാരചിഹ്നങ്ങള്‍
Name[mr]=भावप्रतिमा
Name[nb]=Humørfjes
Name[nds]=Snuten
Name[nl]=Emoticons
Name[nn]=Fjesingar
Name[or]=Emoticons
Name[pa]=ਈਮੋਸ਼ਨ
Name[pl]=Emotikony
Name[pt]=Ícones Emotivos
Name[pt_BR]=Emoticons
Name[ro]=Emoticoni
Name[ru]=Смайлики
Name[si]=ඉමොටිකොන
Name[sk]=Emotikony
Name[sl]=Izrazne ikone
Name[sr]=Емотикони
Name[sr@ijekavian]=Емотикони
Name[sr@ijekavianlatin]=Emotikoni
Name[sr@latin]=Emotikoni
Name[sv]=Smilisar
Name[ta]=உணர்வோயியங்கள்
Name[te]=ఎమొటికాన్లు
Name[tg]=Тасвирчаҳо
Name[th]=ไอคอนสื่ออารมณ์
Name[tr]=Duygu Simgeleri
Name[ug]=چىراي ئىپادىلىرى
Name[uk]=Емоційки
Name[uz]=His-tuygʻular
Name[uz@cyrillic]=Ҳис-туйғулар
Name[vi]=Hình biểu cảm
Name[wa]=Xhinêyes
Name[x-test]=xxEmoticonsxx
Name[zh_CN]=表情符号
Name[zh_TW]=表情圖示
Comment=Choose emoticon theme
Comment[ca]=Trieu el tema de les emoticones
Comment[ca@valencia]=Trieu el tema de les emoticones
Comment[cs]=Vyberte motiv emotikonů
Comment[da]=Vælg emotikontema
Comment[de]=Emoticon-Design auswählen
Comment[en_GB]=Choose emoticon theme
Comment[es]=Escoger un tema de emoticonos
Comment[et]=Emotikoniteema valimine
Comment[eu]=Aukeratu aurpegiera-gaia
Comment[fi]=Valitse hymiöteema
Comment[fr]=Choisir le thème d'émoticônes
Comment[gl]=Escoller un tema de emoticonas
Comment[hu]=Az emotikon témájának kiválasztása
Comment[ia]=Selige le thema de emoticon
Comment[id]=Pilihlah tema emoticon
Comment[it]=Scegli tema di faccine
Comment[ja]=感情アイコンテーマをカスタマイズ
Comment[ko]=이모티콘 테마 선택
Comment[lt]=Pasirinkti jaustukų apipavidalinimą
Comment[nl]=Emoticonthema kiezen
Comment[nn]=Vel fjesingtema
Comment[pa]=ਈਮੋਸ਼ਨ ਥੀਮ ਚੁਣੋ
Comment[pl]=Wybierz zestaw emotikon
Comment[pt]=Escolher o tema de ícones emotivos
Comment[pt_BR]=Escolha o tema de emoticons
Comment[ru]=Выбор набора смайликов
Comment[sk]=Výber témy emotikonov
Comment[sl]=Izberi temo čustvenčkov
Comment[sv]=Välj smilistema
Comment[tg]=Мавзӯи тасвирчаҳоро интихоб намоед
Comment[uk]=Вибір теми емоційок
Comment[x-test]=xxChoose emoticon themexx
Comment[zh_CN]=选择表情主题
Comment[zh_TW]=選擇表情符號主題
X-KDE-Keywords=Emoticons
X-KDE-Keywords[ar]=الوجوه التعبيرية,وجوه تعبيرية,ابتسامات
X-KDE-Keywords[ast]=Fustaxes
X-KDE-Keywords[bg]=Emoticons,Емотикони
X-KDE-Keywords[bn]=ইমোট-আইকন
X-KDE-Keywords[bs]=Emotikoni
X-KDE-Keywords[ca]=Emoticones
X-KDE-Keywords[ca@valencia]=Emoticones
X-KDE-Keywords[cs]=Emotikony
X-KDE-Keywords[da]=Emotikoner
X-KDE-Keywords[de]=Emoticons
X-KDE-Keywords[el]=Εικονίδια διάθεσης
X-KDE-Keywords[en_GB]=Emoticons
X-KDE-Keywords[eo]=Miensimboloj
X-KDE-Keywords[es]=Emoticonos
X-KDE-Keywords[et]=Emotikonid
X-KDE-Keywords[eu]=Aurpegierak
X-KDE-Keywords[fa]=صورتک
X-KDE-Keywords[fi]=Hymiöt
X-KDE-Keywords[fr]=Émoticônes
X-KDE-Keywords[ga]=Straoiseoga
X-KDE-Keywords[gl]=Emoticonas
X-KDE-Keywords[gu]=લાગણીઓ
X-KDE-Keywords[he]=רגשונים
X-KDE-Keywords[hi]=हँसमुख
X-KDE-Keywords[hu]=Emotikonok
X-KDE-Keywords[ia]=Emoticones
X-KDE-Keywords[id]=Emoticons
X-KDE-Keywords[is]=Tjáningartákn
X-KDE-Keywords[it]=Faccine
X-KDE-Keywords[ja]=感情アイコン
X-KDE-Keywords[kk]=Emoticons,Көңіл күйі белгілері
X-KDE-Keywords[km]=សញ្ញា​អារម្មណ៍
X-KDE-Keywords[ko]=이모티콘
X-KDE-Keywords[lt]=Jaustukai
X-KDE-Keywords[lv]=Emocijzīmes
X-KDE-Keywords[mr]=भावप्रतिमा
X-KDE-Keywords[nb]=Humørfjes
X-KDE-Keywords[nds]=Snuten,Emoticons
X-KDE-Keywords[nl]=Emoticons
X-KDE-Keywords[nn]=Fjesingar
X-KDE-Keywords[pa]=ਈਮੋਸ਼ਨ
X-KDE-Keywords[pl]=Emotikony
X-KDE-Keywords[pt]=Ícones Emotivos
X-KDE-Keywords[pt_BR]=Emoticons
X-KDE-Keywords[ro]=Emoticoni
X-KDE-Keywords[ru]=Emoticons,смайлики,смайлы,улыбочки
X-KDE-Keywords[sk]=Emotikony
X-KDE-Keywords[sl]=Čustvenčki
X-KDE-Keywords[sr]=emoticons,емотикони
X-KDE-Keywords[sr@ijekavian]=emoticons,емотикони
X-KDE-Keywords[sr@ijekavianlatin]=emoticons,emotikoni
X-KDE-Keywords[sr@latin]=emoticons,emotikoni
X-KDE-Keywords[sv]=Smilisar
X-KDE-Keywords[tg]=Тасвирчаҳо
X-KDE-Keywords[tr]=Duygu Simgeleri
X-KDE-Keywords[ug]=چىراي ئىپادىلىرى
X-KDE-Keywords[uk]=емоційка,емоційки,смайлик,смайлики
X-KDE-Keywords[vi]=Hình biểu cảm
X-KDE-Keywords[wa]=Xhinêyes
X-KDE-Keywords[x-test]=xxEmoticonsxx
X-KDE-Keywords[zh_CN]=Emoticons,表情符号
X-KDE-Keywords[zh_TW]=Emoticons
[KNewStuff3]
Name=Emoticons
Name[af]=Emotikons
Name[ar]=الوجوه التّعبيرية
Name[as]=ভাব-প্ৰতীক
Name[ast]=Fustaxes
Name[be@latin]=Smajliki
Name[bg]=Емотикони
Name[bn]=ইমোট-আইকন
Name[bn_IN]=ইমোআইকন
Name[bs]=Emotikoni
Name[ca]=Emoticones
Name[ca@valencia]=Emoticones
Name[cs]=Emotikony
Name[csb]=Emòtikónczi
Name[da]=Emotikoner
Name[de]=Emoticons
Name[el]=Εικονίδια διάθεσης
Name[en_GB]=Emoticons
Name[eo]=Miensimboloj
Name[es]=Emoticonos
Name[et]=Emotikonid
Name[eu]=Aurpegierak
Name[fa]=صورتک
Name[fi]=Hymiöt
Name[fr]=Émoticônes
Name[fy]=Emobyldkaikes
Name[ga]=Straoiseoga
Name[gl]=Emoticonas
Name[gu]=લાગણીઓ
Name[he]=רגשונים
Name[hi]=हँसमुख
Name[hne]=चेहराचिनहा
Name[hr]=Emoticons
Name[hsb]=Emotikony
Name[hu]=Emotikonok
Name[ia]=Emoticones
Name[id]=Emoticon
Name[is]=Tjáningartákn
Name[it]=Faccine
Name[ja]=感情アイコン
Name[kk]=Көңіл күйі белгілері
Name[km]=សញ្ញា​អារម្មណ៍
Name[kn]=ಭಾವನಾಚಿಹ್ನೆಗಳು (ಎಮೋಟಿಕಾನ್)
Name[ko]=이모티콘
Name[ku]=Emotîkon
Name[lt]=Jaustukai
Name[lv]=Emocijzīmes
Name[mai]=भाव-प्रतीक
Name[mk]=Емотикони
Name[ml]=വികാരചിഹ്നങ്ങള്‍
Name[mr]=भावप्रतिमा
Name[nb]=Humørfjes
Name[nds]=Snuten
Name[nl]=Emoticons
Name[nn]=Fjesingar
Name[or]=Emoticons
Name[pa]=ਈਮੋਸ਼ਨ
Name[pl]=Emotikony
Name[pt]=Ícones Emotivos
Name[pt_BR]=Emoticons
Name[ro]=Emoticoni
Name[ru]=Смайлики
Name[si]=ඉමොටිකොන
Name[sk]=Emotikony
Name[sl]=Izrazne ikone
Name[sr]=Емотикони
Name[sr@ijekavian]=Емотикони
Name[sr@ijekavianlatin]=Emotikoni
Name[sr@latin]=Emotikoni
Name[sv]=Smilisar
Name[ta]=உணர்வோயியங்கள்
Name[te]=ఎమొటికాన్లు
Name[tg]=Тасвирчаҳо
Name[th]=ไอคอนสื่ออารมณ์
Name[tr]=Duygu Simgeleri
Name[ug]=چىراي ئىپادىلىرى
Name[uk]=Емоційки
Name[uz]=His-tuygʻular
Name[uz@cyrillic]=Ҳис-туйғулар
Name[vi]=Hình biểu cảm
Name[wa]=Xhinêyes
Name[x-test]=xxEmoticonsxx
Name[zh_CN]=表情符号
Name[zh_TW]=表情圖示
ProvidersUrl=https://autoconfig.kde.org/ocs/providers.xml
Categories=Emoticon Theme
TargetDir=emoticons
Uncompress=always
/***************************************************************************
* Copyright (C) 2007 by Carlo Segato <brandon.ml@gmail.com> *
* Copyright (C) 2008 Montel Laurent <montel@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "emoticonslist.h"
#include <kconfigwidgets_version.h>
#include <QString>
#include <QDir>
#include <QIcon>
#include <QLabel>
#include <QListWidgetItem>
#include <QUrl>
#include <KGlobal>
#include <KMessageBox>
#include <KAboutData>
#include <KStandardDirs>
#include <KFileDialog>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KInputDialog>
#include <KUrlRequesterDialog>
#include <kmessagebox_queued.h>
#include <kio/netaccess.h>
#include <KNS3/DownloadDialog>
#include <KLocalizedString>
EditDialog::EditDialog(QWidget *parent, const QString &name)
: KDialog(parent)
{
setCaption(name);
setupDlg();
}
EditDialog::EditDialog(QWidget *parent, const QString &name, QListWidgetItem *itm, const QString &file)
: KDialog(parent)
{
setCaption(name);
emoticon = file;
setupDlg();
leText->setText(itm->text());
btnIcon->setIcon(itm->icon());
}
void EditDialog::setupDlg()
{
wdg = new QWidget(this);
QVBoxLayout *vl = new QVBoxLayout;
QHBoxLayout *hb = new QHBoxLayout;
leText = new KLineEdit(this);
btnIcon = new QPushButton(this);
btnIcon->setFixedSize(QSize(64, 64));
btnIcon->setIconSize(QSize(64, 64));
QLabel *lab = new QLabel(i18n("Insert the string for the emoticon. If you want multiple strings, separate them by spaces."), wdg);
lab->setWordWrap(true);
vl->addWidget(lab);
hb->addWidget(btnIcon);
hb->addWidget(leText);
vl->addLayout(hb);
wdg->setLayout(vl);
setMainWidget(wdg);
connect(btnIcon, &QPushButton::clicked, this, &EditDialog::btnIconClicked);
connect(leText, &KLineEdit::textChanged, this, &EditDialog::updateOkButton);
updateOkButton();
leText->setFocus();
}
void EditDialog::btnIconClicked()
{
const QUrl url = KFileDialog::getImageOpenUrl();
if (!url.isLocalFile())
return;
emoticon = url.toLocalFile();
if (emoticon.isEmpty())
return;
btnIcon->setIcon(QPixmap(emoticon));
updateOkButton();
}
void EditDialog::updateOkButton()
{
enableButtonOk(!leText->text().isEmpty() && !emoticon.isEmpty());
}
K_PLUGIN_FACTORY(EmoticonsFactory, registerPlugin<EmoticonList>();)
EmoticonList::EmoticonList(QWidget *parent, const QVariantList &args)
: KCModule(parent, args)
{
KAboutData *about = new KAboutData(QStringLiteral("kcm_emoticons"), i18n("Emoticons"), QStringLiteral("1.0"), QString(), KAboutLicense::GPL);
setAboutData(about);
// setButtons(Apply | Help);
setupUi(this);
btAdd->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
btEdit->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename")));
btRemoveEmoticon->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
btNew->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
btGetNew->setIcon(QIcon::fromTheme(QStringLiteral("get-hot-new-stuff")));
btInstall->setIcon(QIcon::fromTheme(QStringLiteral("document-import")));
btRemoveTheme->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete")));
connect(themeList, &QListWidget::itemSelectionChanged, this, &EmoticonList::selectTheme);
connect(themeList, &QListWidget::itemSelectionChanged, this, &EmoticonList::updateButton);
connect(btRemoveTheme, &QPushButton::clicked, this, &EmoticonList::btRemoveThemeClicked);
connect(btInstall, &QPushButton::clicked, this, &EmoticonList::installEmoticonTheme);
connect(btNew, &QPushButton::clicked, this, &EmoticonList::newTheme);
connect(btGetNew, &QPushButton::clicked, this, &EmoticonList::getNewStuff);
connect(cbStrict, &QCheckBox::clicked, this, &EmoticonList::somethingChanged);
connect(btAdd, &QPushButton::clicked, this, &EmoticonList::addEmoticon);
connect(btEdit, &QPushButton::clicked, this, &EmoticonList::editEmoticon);
connect(btRemoveEmoticon, &QPushButton::clicked, this, &EmoticonList::btRemoveEmoticonClicked);
connect(emoList, &QListWidget::itemSelectionChanged, this, &EmoticonList::updateButton);
connect(emoList, &QListWidget::itemDoubleClicked, this, &EmoticonList::editEmoticon);
}
EmoticonList::~EmoticonList()
{
}
bool caseInsensitiveLessThan(const QString &s1, const QString &s2)
{
return (QString::localeAwareCompare(s1, s2) < 0);
}
void EmoticonList::load()
{
delFiles.clear();
themeList->clear();
emoMap.clear();
emoList->clear();
QStringList themeList = kEmoticons.themeList();
std::sort(themeList.begin(), themeList.end(), caseInsensitiveLessThan);
for (int i = 0; i < themeList.count(); i++) {
loadTheme(themeList.at(i));
}
if (kEmoticons.parseMode() & KEmoticonsTheme::StrictParse) {
cbStrict->setChecked(true);
} else {
cbStrict->setChecked(false);
}
updateButton();
emit changed(false);
}
void EmoticonList::save()
{
for (int i = 0; i < delFiles.size(); i++) {
KIO::NetAccess::del(QUrl(delFiles.at(i)), this);
}
foreach (KEmoticonsTheme t, emoMap) {
t.save();
}
if (themeList->currentItem()) {
kEmoticons.setTheme(themeList->currentItem()->text());
}
if (cbStrict->isChecked()) {
kEmoticons.setParseMode((kEmoticons.parseMode() |= KEmoticonsTheme::StrictParse) &= ~KEmoticonsTheme::RelaxedParse);
} else {
kEmoticons.setParseMode((kEmoticons.parseMode() |= KEmoticonsTheme::RelaxedParse) &= ~KEmoticonsTheme::StrictParse);
}
}
void EmoticonList::somethingChanged()
{
emit changed(true);
}
void EmoticonList::updateButton()
{
const bool can = canEditTheme();
btRemoveEmoticon->setEnabled(themeList->currentItem() && emoList->selectedItems().size() && can);
btRemoveTheme->setEnabled(themeList->currentItem() && themeList->currentItem()->text() != QLatin1String("Glass") && themeList->count() > 1 && can);
btEdit->setEnabled(themeList->currentItem() && emoList->selectedItems().size() && can);
btAdd->setEnabled(themeList->currentItem() && can);
}
void EmoticonList::selectTheme()
{
qDebug() << "current_item: " << themeList->currentItem();
updateButton();
if (!themeList->currentItem()) {
emoList->clear();
return;
}
if (!themeList->currentItem()) {
themeList->currentItem()->setSelected(true);
return;
}
emoList->clear();
KEmoticonsTheme em = emoMap.value(themeList->currentItem()->text());
QHash<QString, QStringList>::const_iterator it = em.emoticonsMap().constBegin();
for (; it != em.emoticonsMap().constEnd(); ++it) {
QString text;
if (it.value().size()) {
text = it.value().at(0);
for (int i = 1; i < it.value().size(); i++) {
text += QLatin1Char(' ') + it.value().at(i);
}
}
new QListWidgetItem(QIcon(it.key()), text, emoList);
}
emit markAsChanged();
}
void EmoticonList::btRemoveThemeClicked()
{
if (!themeList->currentItem()) {
return;
}
const QString name = themeList->currentItem()->text();
delFiles.append(KStandardDirs::locate("emoticons", name + QDir::separator()));
delete themeList->currentItem();
emoMap.remove(name);
emit changed();
}
void EmoticonList::installEmoticonTheme()
{
const QUrl themeURL = KUrlRequesterDialog::getUrl(QUrl(), this, i18n("Drag or Type Emoticon Theme URL"));
if (themeURL.isEmpty())
return;
if (!themeURL.isLocalFile()) {
KMessageBox::queuedMessageBox(this, KMessageBox::Error, i18n("Emoticon themes must be installed from local files."),
i18n("Could Not Install Emoticon Theme"));
return;
}
const QStringList installed = kEmoticons.installTheme(themeURL.toLocalFile());
for (int i = 0; i < installed.size(); i++)
loadTheme(installed.at(i));
}
void EmoticonList::btRemoveEmoticonClicked()
{
if (!emoList->currentItem()) {
return;
}
QListWidgetItem *itm = emoList->currentItem();
KEmoticonsTheme theme = emoMap.value(themeList->currentItem()->text());
const QString fPath = theme.emoticonsMap().key(itm->text().split(QLatin1Char(' ')));
if (theme.removeEmoticon(itm->text())) {
int ret = KMessageBox::questionYesNo(this, i18n("Do you want to remove %1 too?", fPath), i18n("Delete emoticon"));
if (ret == KMessageBox::Yes) {
delFiles.append(fPath);
}
delete itm;
themeList->currentItem()->setIcon(QIcon(previewEmoticon(theme)));
emit changed();
}
}
void EmoticonList::addEmoticon()
{
if (!themeList->currentItem())
return;
EditDialog *dlg = new EditDialog(this, i18n("Add Emoticon"));
if (dlg->exec() == QDialog::Rejected) {
delete dlg;
return;
}
KEmoticonsTheme theme = emoMap.value(themeList->currentItem()->text());