mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 10:52:49 +00:00
generic: drop support for emoticons
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
39786a163e
commit
08eb4a8558
69 changed files with 4 additions and 3633 deletions
|
@ -48,7 +48,6 @@
|
||||||
# KDE4_KDEUI_LIBS - the kdeui library and all depending libraries
|
# KDE4_KDEUI_LIBS - the kdeui library and all depending libraries
|
||||||
# KDE4_KIO_LIBS - the kio library and all depending libraries
|
# KDE4_KIO_LIBS - the kio library and all depending libraries
|
||||||
# KDE4_KPARTS_LIBS - the kparts library and all depending libraries
|
# KDE4_KPARTS_LIBS - the kparts library and all depending libraries
|
||||||
# KDE4_KEMOTICONS_LIBS - the kemoticons library and all depending libraries
|
|
||||||
# KDE4_KIDLETIME_LIBS - the kidletime library and all depending libraries
|
# KDE4_KIDLETIME_LIBS - the kidletime library and all depending libraries
|
||||||
# KDE4_KCMUTILS_LIBS - the kcmutils library and all depending libraries
|
# KDE4_KCMUTILS_LIBS - the kcmutils library and all depending libraries
|
||||||
# KDE4_KFILE_LIBS - the kfile library and all depending libraries
|
# KDE4_KFILE_LIBS - the kfile library and all depending libraries
|
||||||
|
@ -288,7 +287,6 @@ set(_kde_libraries
|
||||||
kdecore
|
kdecore
|
||||||
kdeui
|
kdeui
|
||||||
kdnssd
|
kdnssd
|
||||||
kemoticons
|
|
||||||
kexiv2
|
kexiv2
|
||||||
kfile
|
kfile
|
||||||
kidletime
|
kidletime
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
# KDE4_INSTALL_ICONS
|
# KDE4_INSTALL_ICONS
|
||||||
# KDE4_INSTALL_AUTH_HELPER_FILES
|
# KDE4_INSTALL_AUTH_HELPER_FILES
|
||||||
# KDE4_AUTH_INSTALL_ACTIONS
|
# KDE4_AUTH_INSTALL_ACTIONS
|
||||||
# KDE4_INSTALL_TS_FILES
|
|
||||||
|
|
||||||
# Copyright (c) 2006-2009 Alexander Neundorf, <neundorf@kde.org>
|
# Copyright (c) 2006-2009 Alexander Neundorf, <neundorf@kde.org>
|
||||||
# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org>
|
# Copyright (c) 2006, 2007, Laurent Montel, <montel@kde.org>
|
||||||
|
|
|
@ -390,9 +390,6 @@ install(
|
||||||
KCategorizedView
|
KCategorizedView
|
||||||
KCategoryDrawer
|
KCategoryDrawer
|
||||||
KCategorizedSortFilterProxyModel
|
KCategorizedSortFilterProxyModel
|
||||||
KEmoticons
|
|
||||||
KEmoticonsProvider
|
|
||||||
KEmoticonsTheme
|
|
||||||
KFilterProxySearchLine
|
KFilterProxySearchLine
|
||||||
KWidgetItemDelegate
|
KWidgetItemDelegate
|
||||||
KWidgetJobTracker
|
KWidgetJobTracker
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include "../kemoticons.h"
|
|
|
@ -1 +0,0 @@
|
||||||
#include "../kemoticonsprovider.h"
|
|
|
@ -1 +0,0 @@
|
||||||
#include "../kemoticonstheme.h"
|
|
|
@ -119,7 +119,6 @@ int main(int argc, char **argv)
|
||||||
"cache", I18N_NOOP("Cached information (e.g. favicons, web-pages)"),
|
"cache", I18N_NOOP("Cached information (e.g. favicons, web-pages)"),
|
||||||
"config", I18N_NOOP("Configuration files"),
|
"config", I18N_NOOP("Configuration files"),
|
||||||
"data", I18N_NOOP("Where applications store data"),
|
"data", I18N_NOOP("Where applications store data"),
|
||||||
"emoticons", I18N_NOOP("Emoticons"),
|
|
||||||
"exe", I18N_NOOP("Executables in $prefix/bin"),
|
"exe", I18N_NOOP("Executables in $prefix/bin"),
|
||||||
"html", I18N_NOOP("HTML documentation"),
|
"html", I18N_NOOP("HTML documentation"),
|
||||||
"icon", I18N_NOOP("Icons"),
|
"icon", I18N_NOOP("Icons"),
|
||||||
|
|
|
@ -140,8 +140,6 @@ qtplugins
|
||||||
%lib/kde4/plugins
|
%lib/kde4/plugins
|
||||||
kcfg
|
kcfg
|
||||||
share/config.kcfg
|
share/config.kcfg
|
||||||
emoticons
|
|
||||||
share/emoticons
|
|
||||||
xdgdata-apps
|
xdgdata-apps
|
||||||
applications
|
applications
|
||||||
xdgdata-icon
|
xdgdata-icon
|
||||||
|
@ -189,8 +187,6 @@ static const char types_string[] =
|
||||||
"%lib/kde4/plugins\0"
|
"%lib/kde4/plugins\0"
|
||||||
"kcfg\0"
|
"kcfg\0"
|
||||||
"share/config.kcfg\0"
|
"share/config.kcfg\0"
|
||||||
"emoticons\0"
|
|
||||||
"share/emoticons\0"
|
|
||||||
"xdgdata-apps\0"
|
"xdgdata-apps\0"
|
||||||
"applications\0"
|
"applications\0"
|
||||||
"xdgdata-icon\0"
|
"xdgdata-icon\0"
|
||||||
|
@ -211,9 +207,9 @@ static const int types_indices[] = {
|
||||||
0, 5, 16, 21, 36, 41, 53, 60,
|
0, 5, 16, 21, 36, 41, 53, 60,
|
||||||
73, 80, 94, 100, 113, 120, 133, 142,
|
73, 80, 94, 100, 113, 120, 133, 142,
|
||||||
162, 175, 199, 209, 226, 236, 252, 256,
|
162, 175, 199, 209, 226, 236, 252, 256,
|
||||||
260, 267, 277, 287, 305, 310, 328, 338,
|
260, 267, 277, 287, 305, 310, 328, 341,
|
||||||
354, 367, 380, 393, 399, 414, 422, 435,
|
354, 367, 373, 388, 396, 409, 429, 442,
|
||||||
455, 468, 473, 486, 492, 510, -1
|
447, 460, 466, 484, -1
|
||||||
};
|
};
|
||||||
|
|
||||||
static void tokenize(QStringList& token, const QString& str,
|
static void tokenize(QStringList& token, const QString& str,
|
||||||
|
|
|
@ -65,7 +65,6 @@ class KConfig;
|
||||||
* @li @c cache - Cached information (e.g. favicons, web-pages)
|
* @li @c cache - Cached information (e.g. favicons, web-pages)
|
||||||
* @li @c config - Configuration files.
|
* @li @c config - Configuration files.
|
||||||
* @li @c data - Where applications store data.
|
* @li @c data - Where applications store data.
|
||||||
* @li @c emoticons - Emoticons themes
|
|
||||||
* @li @c exe - Executables in $prefix/bin. findExe() for a function that takes $PATH into account.
|
* @li @c exe - Executables in $prefix/bin. findExe() for a function that takes $PATH into account.
|
||||||
* @li @c html - HTML documentation.
|
* @li @c html - HTML documentation.
|
||||||
* @li @c icon - Icons, see KIconLoader.
|
* @li @c icon - Icons, see KIconLoader.
|
||||||
|
@ -617,7 +616,6 @@ public:
|
||||||
* @li @c module - @c lib[suffix]/kde4
|
* @li @c module - @c lib[suffix]/kde4
|
||||||
* @li @c qtplugins - @c lib[suffix]/kde4/plugins
|
* @li @c qtplugins - @c lib[suffix]/kde4/plugins
|
||||||
* @li @c kcfg - @c share/config.kcfg
|
* @li @c kcfg - @c share/config.kcfg
|
||||||
* @li @c emoticons - @c share/emoticons
|
|
||||||
* @li @c xdgdata-apps - @c applications
|
* @li @c xdgdata-apps - @c applications
|
||||||
* @li @c xdgdata-icon - @c icons
|
* @li @c xdgdata-icon - @c icons
|
||||||
* @li @c xdgdata-pixmap - @c pixmaps
|
* @li @c xdgdata-pixmap - @c pixmaps
|
||||||
|
|
|
@ -3,60 +3,13 @@ project(kutils)
|
||||||
include_directories(
|
include_directories(
|
||||||
${KDE4_KDEUI_INCLUDES}
|
${KDE4_KDEUI_INCLUDES}
|
||||||
${KDE4_KPARTS_INCLUDES}
|
${KDE4_KPARTS_INCLUDES}
|
||||||
# keep it, required by kemoticons and others
|
# keep it, required by kidletime and others
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory(kmediaplayer)
|
add_subdirectory(kmediaplayer)
|
||||||
add_subdirectory(kexiv2)
|
add_subdirectory(kexiv2)
|
||||||
|
|
||||||
########### kemoticons ################
|
|
||||||
|
|
||||||
add_subdirectory(kemoticons)
|
|
||||||
|
|
||||||
set(kemoticons_LIB_SRCS
|
|
||||||
kemoticons/kemoticons.cpp
|
|
||||||
kemoticons/kemoticonstheme.cpp
|
|
||||||
kemoticons/kemoticonsprovider.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_library(kemoticons ${LIBRARY_TYPE} ${kemoticons_LIB_SRCS})
|
|
||||||
|
|
||||||
target_link_libraries(kemoticons PUBLIC
|
|
||||||
${KDE4_KDECORE_LIBS}
|
|
||||||
${KDE4_KDEUI_LIBS}
|
|
||||||
${KDE4_KIO_LIBS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set_target_properties(kemoticons PROPERTIES
|
|
||||||
VERSION ${GENERIC_LIB_VERSION}
|
|
||||||
SOVERSION ${GENERIC_LIB_SOVERSION}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
kemoticons/kemoticonsTheme.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
generate_export_header(kemoticons)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/kemoticons_export.h
|
|
||||||
kemoticons/kemoticons.h
|
|
||||||
kemoticons/kemoticonstheme.h
|
|
||||||
kemoticons/kemoticonsprovider.h
|
|
||||||
DESTINATION ${KDE4_INCLUDE_INSTALL_DIR}
|
|
||||||
COMPONENT Devel
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS kemoticons
|
|
||||||
EXPORT kdelibsLibraryTargets
|
|
||||||
${INSTALL_TARGETS_DEFAULT_ARGS}
|
|
||||||
)
|
|
||||||
|
|
||||||
######## kidletime ####################
|
######## kidletime ####################
|
||||||
|
|
||||||
set(kidletime_LIB_SRCS
|
set(kidletime_LIB_SRCS
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
# for the export headers
|
|
||||||
include_directories(${CMAKE_BINARY_DIR}/kutils)
|
|
||||||
|
|
||||||
add_subdirectory(providers)
|
|
||||||
|
|
||||||
if(ENABLE_TESTING)
|
|
||||||
add_subdirectory(tests)
|
|
||||||
endif()
|
|
|
@ -1,299 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* Copyright (C) 2007 by Carlo Segato <brandon.ml@gmail.com> *
|
|
||||||
* Copyright (C) 2008 Montel Laurent <montel@kde.org> *
|
|
||||||
* *
|
|
||||||
* 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/>.*
|
|
||||||
* *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
#include "kemoticons.h"
|
|
||||||
#include "kemoticonsprovider.h"
|
|
||||||
|
|
||||||
#include <QFile>
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
#include <kpluginloader.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
#include <kconfiggroup.h>
|
|
||||||
#include <ktar.h>
|
|
||||||
#include <kzip.h>
|
|
||||||
#include <kmimetype.h>
|
|
||||||
#include <kdirwatch.h>
|
|
||||||
|
|
||||||
class KEmoticonsPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
KEmoticonsPrivate(KEmoticons *parent);
|
|
||||||
~KEmoticonsPrivate();
|
|
||||||
void loadServiceList();
|
|
||||||
KEmoticonsProvider *loadProvider(const KService::Ptr &service);
|
|
||||||
KEmoticonsTheme loadTheme(const QString &name);
|
|
||||||
|
|
||||||
QList<KService::Ptr> m_loaded;
|
|
||||||
QHash<QString, KEmoticonsTheme> m_themes;
|
|
||||||
KDirWatch *m_dirwatch;
|
|
||||||
KEmoticons *q;
|
|
||||||
|
|
||||||
//private slots
|
|
||||||
void themeChanged(const QString &path);
|
|
||||||
};
|
|
||||||
|
|
||||||
KEmoticonsPrivate::KEmoticonsPrivate(KEmoticons *parent)
|
|
||||||
: q(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsPrivate::~KEmoticonsPrivate()
|
|
||||||
{
|
|
||||||
delete m_dirwatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool priorityLessThan(const KService::Ptr &s1, const KService::Ptr &s2)
|
|
||||||
{
|
|
||||||
return (s1->property("X-KDE-Priority").toInt() > s2->property("X-KDE-Priority").toInt());
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsPrivate::loadServiceList()
|
|
||||||
{
|
|
||||||
QString constraint("(exist Library)");
|
|
||||||
m_loaded = KServiceTypeTrader::self()->query("KEmoticons", constraint);
|
|
||||||
qSort(m_loaded.begin(), m_loaded.end(), priorityLessThan);
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsProvider *KEmoticonsPrivate::loadProvider(const KService::Ptr &service)
|
|
||||||
{
|
|
||||||
KPluginFactory *factory = KPluginLoader(service->library()).factory();
|
|
||||||
if (!factory) {
|
|
||||||
kWarning() << "Invalid plugin factory for" << service->library();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
KEmoticonsProvider *provider = factory->create<KEmoticonsProvider>(0);
|
|
||||||
return provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsPrivate::themeChanged(const QString &path)
|
|
||||||
{
|
|
||||||
QFileInfo info(path);
|
|
||||||
QString name = info.dir().dirName();
|
|
||||||
|
|
||||||
if (m_themes.contains(name)) {
|
|
||||||
loadTheme(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme KEmoticonsPrivate::loadTheme(const QString &name)
|
|
||||||
{
|
|
||||||
const int numberOfTheme = m_loaded.size();
|
|
||||||
for (int i = 0; i < numberOfTheme; ++i) {
|
|
||||||
const QString fName = m_loaded.at(i)->property("X-KDE-EmoticonsFileName").toString();
|
|
||||||
const QString path = KGlobal::dirs()->findResource("emoticons", name + '/' + fName);
|
|
||||||
|
|
||||||
if (QFile::exists(path)) {
|
|
||||||
KEmoticonsProvider *provider = loadProvider(m_loaded.at(i));
|
|
||||||
KEmoticonsTheme theme(provider);
|
|
||||||
theme.loadTheme(path);
|
|
||||||
m_themes.insert(name, theme);
|
|
||||||
|
|
||||||
if (!m_dirwatch->contains(path)) {
|
|
||||||
m_dirwatch->addFile(path);
|
|
||||||
}
|
|
||||||
return theme;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return KEmoticonsTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticons::KEmoticons()
|
|
||||||
: d(new KEmoticonsPrivate(this))
|
|
||||||
{
|
|
||||||
d->loadServiceList();
|
|
||||||
d->m_dirwatch = new KDirWatch;
|
|
||||||
connect(d->m_dirwatch, SIGNAL(dirty(QString)), this, SLOT(themeChanged(QString)));
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticons::~KEmoticons()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme KEmoticons::theme()
|
|
||||||
{
|
|
||||||
return theme(currentThemeName());
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme KEmoticons::theme(const QString &name)
|
|
||||||
{
|
|
||||||
if (d->m_themes.contains(name)) {
|
|
||||||
return d->m_themes.value(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->loadTheme(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticons::currentThemeName()
|
|
||||||
{
|
|
||||||
KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "Emoticons");
|
|
||||||
QString name = config.readEntry("emoticonsTheme", "kde4");
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList KEmoticons::themeList()
|
|
||||||
{
|
|
||||||
QStringList ls;
|
|
||||||
const QStringList themeDirs = KGlobal::dirs()->findDirs("emoticons", "");
|
|
||||||
|
|
||||||
for (int i = 0; i < themeDirs.count(); ++i) {
|
|
||||||
QDir themeQDir(themeDirs[i]);
|
|
||||||
themeQDir.setFilter(QDir::Dirs | QDir::NoDotAndDotDot);
|
|
||||||
themeQDir.setSorting(QDir::Name);
|
|
||||||
ls << themeQDir.entryList();
|
|
||||||
}
|
|
||||||
return ls;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticons::setTheme(const KEmoticonsTheme &theme)
|
|
||||||
{
|
|
||||||
setTheme(theme.themeName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticons::setTheme(const QString &theme)
|
|
||||||
{
|
|
||||||
KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "Emoticons");
|
|
||||||
config.writeEntry("emoticonsTheme", theme);
|
|
||||||
config.sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme KEmoticons::newTheme(const QString &name, const KService::Ptr &service)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider *provider = d->loadProvider(service);
|
|
||||||
KEmoticonsTheme theme(provider);
|
|
||||||
theme.setThemeName(name);
|
|
||||||
|
|
||||||
theme.createNew();
|
|
||||||
|
|
||||||
return theme;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList KEmoticons::installTheme(const QString &archiveName)
|
|
||||||
{
|
|
||||||
QStringList foundThemes;
|
|
||||||
KArchiveEntry *currentEntry = 0L;
|
|
||||||
KArchiveDirectory* currentDir = 0L;
|
|
||||||
KArchive *archive = 0L;
|
|
||||||
|
|
||||||
QString localThemesDir(KStandardDirs::locateLocal("emoticons", QString()));
|
|
||||||
|
|
||||||
if (localThemesDir.isEmpty()) {
|
|
||||||
kError() << "Could not find a suitable place in which to install the emoticon theme";
|
|
||||||
return QStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString currentBundleMimeType = KMimeType::findByPath(archiveName, 0, false)->name();
|
|
||||||
|
|
||||||
if (currentBundleMimeType == "application/zip" ||
|
|
||||||
currentBundleMimeType == "application/x-zip" ||
|
|
||||||
currentBundleMimeType == "application/x-zip-compressed") {
|
|
||||||
archive = new KZip(archiveName);
|
|
||||||
} else if (currentBundleMimeType == "application/x-compressed-tar" ||
|
|
||||||
currentBundleMimeType == "application/x-bzip-compressed-tar" ||
|
|
||||||
currentBundleMimeType == "application/x-lzma-compressed-tar" ||
|
|
||||||
currentBundleMimeType == "application/x-xz-compressed-tar" ||
|
|
||||||
currentBundleMimeType == "application/x-gzip" ||
|
|
||||||
currentBundleMimeType == "application/x-bzip" ||
|
|
||||||
currentBundleMimeType == "application/x-lzma" ||
|
|
||||||
currentBundleMimeType == "application/x-xz") {
|
|
||||||
archive = new KTar(archiveName);
|
|
||||||
} else if (archiveName.endsWith(QLatin1String("jisp")) || archiveName.endsWith(QLatin1String("zip"))) {
|
|
||||||
archive = new KZip(archiveName);
|
|
||||||
} else {
|
|
||||||
archive = new KTar(archiveName);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!archive || !archive->open(QIODevice::ReadOnly)) {
|
|
||||||
kError() << "Could not open" << archiveName << "for unpacking";
|
|
||||||
delete archive;
|
|
||||||
return QStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
const KArchiveDirectory* rootDir = archive->directory();
|
|
||||||
|
|
||||||
// iterate all the dirs looking for an emoticons.xml file
|
|
||||||
const QStringList entries = rootDir->entries();
|
|
||||||
for (QStringList::ConstIterator it = entries.begin(); it != entries.end(); ++it) {
|
|
||||||
currentEntry = const_cast<KArchiveEntry*>(rootDir->entry(*it));
|
|
||||||
|
|
||||||
if (currentEntry->isDirectory()) {
|
|
||||||
currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
|
|
||||||
|
|
||||||
for (int i = 0; i < d->m_loaded.size(); ++i) {
|
|
||||||
QString fName = d->m_loaded.at(i)->property("X-KDE-EmoticonsFileName").toString();
|
|
||||||
|
|
||||||
if (currentDir && currentDir->entry(fName) != NULL) {
|
|
||||||
foundThemes.append(currentDir->name());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundThemes.isEmpty()) {
|
|
||||||
kError() << "The file" << archiveName << "is not a valid emoticon theme archive";
|
|
||||||
archive->close();
|
|
||||||
delete archive;
|
|
||||||
return QStringList();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int themeIndex = 0; themeIndex < foundThemes.size(); ++themeIndex) {
|
|
||||||
const QString &theme = foundThemes[themeIndex];
|
|
||||||
|
|
||||||
currentEntry = const_cast<KArchiveEntry *>(rootDir->entry(theme));
|
|
||||||
if (currentEntry == 0) {
|
|
||||||
kDebug() << "couldn't get next archive entry";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentEntry->isDirectory()) {
|
|
||||||
currentDir = dynamic_cast<KArchiveDirectory*>(currentEntry);
|
|
||||||
|
|
||||||
if (currentDir == 0) {
|
|
||||||
kDebug() << "couldn't cast archive entry to KArchiveDirectory";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentDir->copyTo(localThemesDir + theme);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
archive->close();
|
|
||||||
delete archive;
|
|
||||||
|
|
||||||
return foundThemes;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticons::setParseMode(KEmoticonsTheme::ParseMode mode)
|
|
||||||
{
|
|
||||||
KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "Emoticons");
|
|
||||||
config.writeEntry("parseMode", int(mode));
|
|
||||||
config.sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme::ParseMode KEmoticons::parseMode()
|
|
||||||
{
|
|
||||||
KConfigGroup config(KSharedConfig::openConfig("kdeglobals"), "Emoticons");
|
|
||||||
return (KEmoticonsTheme::ParseMode) config.readEntry("parseMode", int(KEmoticonsTheme::RelaxedParse));
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_kemoticons.cpp"
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,139 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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_H
|
|
||||||
#define KEMOTICONS_H
|
|
||||||
|
|
||||||
#include "kemoticons_export.h"
|
|
||||||
#include "kemoticonstheme.h"
|
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
|
||||||
#include <QtCore/QHash>
|
|
||||||
|
|
||||||
#include <kservicetypetrader.h>
|
|
||||||
|
|
||||||
class KEmoticonsPrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class can be used to retrieve, install, create emoticons theme.
|
|
||||||
* For example if you want to get the current emoticon theme
|
|
||||||
* @code
|
|
||||||
* KEmoticons ke;
|
|
||||||
* KEmoticonsTheme et = ke.theme();
|
|
||||||
* //do whatever you want with the theme
|
|
||||||
* @endcode
|
|
||||||
* it can also be used to set the emoticon theme and the parse mode in the config file
|
|
||||||
* @author Carlo Segato (brandon.ml@gmail.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
class KEMOTICONS_EXPORT KEmoticons : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor
|
|
||||||
*/
|
|
||||||
KEmoticons();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destruct the object
|
|
||||||
*/
|
|
||||||
~KEmoticons();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the current emoticons theme
|
|
||||||
* @return the current KEmoticonsTheme
|
|
||||||
*/
|
|
||||||
KEmoticonsTheme theme();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the theme with name @p name
|
|
||||||
* @param name name of the theme
|
|
||||||
* @return the KEmoticonsTheme @p name
|
|
||||||
*/
|
|
||||||
KEmoticonsTheme theme(const QString &name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve the current emoticon theme name
|
|
||||||
*/
|
|
||||||
static QString currentThemeName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of installed theme
|
|
||||||
*/
|
|
||||||
static QStringList themeList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set @p theme as the current theme
|
|
||||||
* @param theme a pointer to a KEmoticonsTheme object
|
|
||||||
*/
|
|
||||||
static void setTheme(const KEmoticonsTheme &theme);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set @p theme as the current theme
|
|
||||||
* @param theme the name of a theme
|
|
||||||
*/
|
|
||||||
static void setTheme(const QString &theme);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new emoticons theme
|
|
||||||
* @code
|
|
||||||
* KEmoticonsTheme theme;
|
|
||||||
* KService::List srv = KServiceTypeTrader::self()->query("KEmoticons");
|
|
||||||
* for (int i = 0; i < srv.size(); ++i) {
|
|
||||||
* // we want to create a kde emoticons theme
|
|
||||||
* if (srv.at(i)->property("X-KDE-EmoticonsFileName").toString() == "emoticons.xml") {
|
|
||||||
* theme = KEmoticons().newTheme("test", srv.at(i));
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* @endcode
|
|
||||||
* @param name the name of the new emoticons theme
|
|
||||||
* @param service the kind of emoticon theme to create
|
|
||||||
*/
|
|
||||||
KEmoticonsTheme newTheme(const QString &name, const KService::Ptr &service);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Install all themes inside the archive @p archiveName
|
|
||||||
* @param archiveName path to the archive
|
|
||||||
* @return a list of installed themes
|
|
||||||
*/
|
|
||||||
QStringList installTheme(const QString &archiveName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the parse mode to @p mode
|
|
||||||
*/
|
|
||||||
static void setParseMode(KEmoticonsTheme::ParseMode mode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the current parse mode
|
|
||||||
*/
|
|
||||||
static KEmoticonsTheme::ParseMode parseMode();
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* Private class
|
|
||||||
*/
|
|
||||||
KEmoticonsPrivate * const d;
|
|
||||||
|
|
||||||
Q_PRIVATE_SLOT(d, void themeChanged(const QString &path))
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* KEMOTICONS_H */
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=ServiceType
|
|
||||||
X-KDE-ServiceType=KEmoticons
|
|
||||||
|
|
||||||
[PropertyDef::X-KDE-Priority]
|
|
||||||
Type=int
|
|
||||||
|
|
||||||
[PropertyDef::X-KDE-EmoticonsFileName]
|
|
||||||
Type=QString
|
|
|
@ -1,187 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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/>.*
|
|
||||||
* *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
#include "kemoticonsprovider.h"
|
|
||||||
#include "kemoticons.h"
|
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtGui/QTextDocument>
|
|
||||||
|
|
||||||
#include <kio/netaccess.h>
|
|
||||||
#include "kstandarddirs.h"
|
|
||||||
#include "kdebug.h"
|
|
||||||
|
|
||||||
class KEmoticonsProviderPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
KEmoticonsProviderPrivate();
|
|
||||||
QString m_themeName;
|
|
||||||
QString m_fileName;
|
|
||||||
QString m_themePath;
|
|
||||||
QHash<QString, QStringList> m_emoticonsMap;
|
|
||||||
QHash<QChar, QList<KEmoticonsProvider::Emoticon> > m_emoticonsIndex;
|
|
||||||
};
|
|
||||||
|
|
||||||
KEmoticonsProviderPrivate::KEmoticonsProviderPrivate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsProvider::KEmoticonsProvider(QObject *parent)
|
|
||||||
: QObject(parent), d(new KEmoticonsProviderPrivate)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsProvider::~KEmoticonsProvider()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KEmoticonsProvider::loadTheme(const QString &path)
|
|
||||||
{
|
|
||||||
QFileInfo info(path);
|
|
||||||
d->m_fileName = info.fileName();
|
|
||||||
d->m_themeName = info.dir().dirName();
|
|
||||||
d->m_themePath = info.absolutePath();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KEmoticonsProvider::removeEmoticon(const QString &emo)
|
|
||||||
{
|
|
||||||
Q_UNUSED(emo);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KEmoticonsProvider::addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option)
|
|
||||||
{
|
|
||||||
if (option == Copy) {
|
|
||||||
KIO::NetAccess::dircopy(KUrl(emo), KUrl(d->m_themePath));
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_UNUSED(text);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::save()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticonsProvider::themeName() const
|
|
||||||
{
|
|
||||||
return d->m_themeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::setThemeName(const QString &name)
|
|
||||||
{
|
|
||||||
d->m_themeName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticonsProvider::themePath() const
|
|
||||||
{
|
|
||||||
return d->m_themePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticonsProvider::fileName() const
|
|
||||||
{
|
|
||||||
return d->m_fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::clearEmoticonsMap()
|
|
||||||
{
|
|
||||||
d->m_emoticonsMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::addEmoticonsMap(QString key, QStringList value)
|
|
||||||
{
|
|
||||||
if (!value.isEmpty()) {
|
|
||||||
d->m_emoticonsMap.insert(key, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::removeEmoticonsMap(QString key)
|
|
||||||
{
|
|
||||||
d->m_emoticonsMap.remove(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash<QString, QStringList> KEmoticonsProvider::emoticonsMap() const
|
|
||||||
{
|
|
||||||
return d->m_emoticonsMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::createNew()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash<QChar, QList<KEmoticonsProvider::Emoticon> > KEmoticonsProvider::emoticonsIndex() const
|
|
||||||
{
|
|
||||||
return d->m_emoticonsIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::addEmoticonIndex(const QString &path, const QStringList &emoList)
|
|
||||||
{
|
|
||||||
foreach(const QString &s, emoList) {
|
|
||||||
KEmoticonsProvider::Emoticon e;
|
|
||||||
QPixmap p;
|
|
||||||
|
|
||||||
QString escaped = Qt::escape(s);
|
|
||||||
e.picPath = path;
|
|
||||||
p.load(path);
|
|
||||||
|
|
||||||
e.picHTMLCode = QString("<img align=\"center\" title=\"%1\" alt=\"%1\" src=\"%2\" width=\"%3\" height=\"%4\" />").arg(escaped).arg(path).arg(p.width()).arg(p.height());
|
|
||||||
|
|
||||||
e.matchTextEscaped = escaped;
|
|
||||||
e.matchText = s;
|
|
||||||
|
|
||||||
if (!s.isEmpty() && !escaped.isEmpty())
|
|
||||||
{
|
|
||||||
d->m_emoticonsIndex[escaped[0]].append(e);
|
|
||||||
d->m_emoticonsIndex[s[0]].append(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsProvider::removeEmoticonIndex(const QString &path, const QStringList &emoList)
|
|
||||||
{
|
|
||||||
foreach(const QString &s, emoList) {
|
|
||||||
QString escaped = Qt::escape(s);
|
|
||||||
|
|
||||||
if (s.isEmpty() || escaped.isEmpty())
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Emoticon> ls = d->m_emoticonsIndex.value(escaped[0]);
|
|
||||||
|
|
||||||
for (int i = 0; i < ls.size(); ++i) {
|
|
||||||
if (ls.at(i).picPath == path) {
|
|
||||||
ls.removeAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ls = d->m_emoticonsIndex.value(s[0]);
|
|
||||||
|
|
||||||
for (int i = 0; i < ls.size(); ++i) {
|
|
||||||
if (ls.at(i).picPath == path) {
|
|
||||||
ls.removeAt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,169 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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/QVariant>
|
|
||||||
#include <QtCore/QStringList>
|
|
||||||
#include <QtCore/QPair>
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
class KEmoticonsProviderPrivate;
|
|
||||||
struct Emoticon;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the base class for the emoticons 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();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load the theme inside the directory @p path
|
|
||||||
* @param path path to the directory
|
|
||||||
*/
|
|
||||||
virtual bool loadTheme(const QString &path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the emoticon @p emo, this will not delete the image file too
|
|
||||||
* @param emo the emoticon text to remove
|
|
||||||
* @return @c true if it can delete the emoticon
|
|
||||||
*/
|
|
||||||
virtual bool removeEmoticon(const QString &emo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the emoticon @p emo with text @p text
|
|
||||||
* @param emo path to the emoticon image
|
|
||||||
* @param text the text of the emoticon separated by space for multiple text
|
|
||||||
* @param copy whether or not copy @p emo into the theme directory
|
|
||||||
* @return @c true if it can add the emoticon
|
|
||||||
*/
|
|
||||||
virtual bool addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option = DoNotCopy);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save the emoticon theme
|
|
||||||
*/
|
|
||||||
virtual void save();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the theme name
|
|
||||||
*/
|
|
||||||
QString themeName() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the theme name
|
|
||||||
* @param name name of the theme
|
|
||||||
*/
|
|
||||||
void setThemeName(const QString &name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the theme path
|
|
||||||
*/
|
|
||||||
QString themePath() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the file name of the theme
|
|
||||||
*/
|
|
||||||
QString fileName() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a QHash that contains the emoticons 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;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new theme
|
|
||||||
*/
|
|
||||||
virtual void createNew();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
|
||||||
* Clears the emoticons map
|
|
||||||
*/
|
|
||||||
void clearEmoticonsMap();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Insert a new item in the emoticons map
|
|
||||||
*/
|
|
||||||
void addEmoticonsMap(QString key, QStringList value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove an item from the emoticons map
|
|
||||||
*/
|
|
||||||
void removeEmoticonsMap(QString key);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add an emoticon to the index
|
|
||||||
* @param path path to the emoticon
|
|
||||||
* @param emoList list of text associated with this emoticon
|
|
||||||
*/
|
|
||||||
void addEmoticonIndex(const QString &path, const QStringList &emoList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove an emoticon from the index
|
|
||||||
* @param path path to the emoticon
|
|
||||||
* @param emoList list of text associated with this emoticon
|
|
||||||
*/
|
|
||||||
void removeEmoticonIndex(const QString &path, const QStringList &emoList);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Private class
|
|
||||||
*/
|
|
||||||
KEmoticonsProviderPrivate * const d;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* KEMOTICONS_PROVIDER_H */
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,377 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* Copyright (C) 2008 by Carlo Segato <brandon.ml@gmail.com> *
|
|
||||||
* Copyright (c) 2002-2003 by Stefan Gehn <metz@gehn.net> *
|
|
||||||
* Kopete (c) 2002-2008 by the Kopete developers <kopete-devel@kde.org> *
|
|
||||||
* Copyright (c) 2005 by Engin AYDOGAN <engin@bzzzt.biz> *
|
|
||||||
* *
|
|
||||||
* 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/>.*
|
|
||||||
* *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
#include "kemoticonstheme.h"
|
|
||||||
#include "kemoticons.h"
|
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtCore/QDir>
|
|
||||||
#include <QtGui/QTextDocument>
|
|
||||||
#include <QtCore/qalgorithms.h>
|
|
||||||
|
|
||||||
#include <kio/netaccess.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
|
|
||||||
class KEmoticonsTheme::KEmoticonsThemeData : public QSharedData
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
KEmoticonsThemeData();
|
|
||||||
~KEmoticonsThemeData();
|
|
||||||
KEmoticonsProvider *provider;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
KEmoticonsTheme::KEmoticonsThemeData::KEmoticonsThemeData()
|
|
||||||
{
|
|
||||||
provider = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme::KEmoticonsThemeData::~KEmoticonsThemeData()
|
|
||||||
{
|
|
||||||
// delete provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme::KEmoticonsTheme()
|
|
||||||
{
|
|
||||||
d = new KEmoticonsThemeData;
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme::KEmoticonsTheme(const KEmoticonsTheme &ket)
|
|
||||||
{
|
|
||||||
d = ket.d;
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme::KEmoticonsTheme(KEmoticonsProvider *p)
|
|
||||||
{
|
|
||||||
d = new KEmoticonsThemeData;
|
|
||||||
d->provider = p;
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme::~KEmoticonsTheme()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KEmoticonsTheme::loadTheme(const QString &path)
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->provider->loadTheme(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KEmoticonsTheme::removeEmoticon(const QString &emo)
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->provider->removeEmoticon(emo);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KEmoticonsTheme::addEmoticon(const QString &emo, const QString &text, KEmoticonsProvider::AddEmoticonOption option)
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->provider->addEmoticon(emo, text, option);
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsTheme::save()
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->provider->save();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticonsTheme::themeName() const
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->provider->themeName();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsTheme::setThemeName(const QString &name)
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->provider->setThemeName(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticonsTheme::themePath() const
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->provider->themePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticonsTheme::fileName() const
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->provider->fileName();
|
|
||||||
}
|
|
||||||
|
|
||||||
QHash<QString, QStringList> KEmoticonsTheme::emoticonsMap() const
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return QHash<QString, QStringList>();
|
|
||||||
}
|
|
||||||
|
|
||||||
return d->provider->emoticonsMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoticonsTheme::createNew()
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
d->provider->createNew();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString KEmoticonsTheme::parseEmoticons(const QString &text, ParseMode mode, const QStringList &exclude) const
|
|
||||||
{
|
|
||||||
QList<Token> tokens = tokenize(text, mode | SkipHTML);
|
|
||||||
if (tokens.isEmpty() && !text.isEmpty())
|
|
||||||
return text;
|
|
||||||
|
|
||||||
QString result;
|
|
||||||
|
|
||||||
foreach(const Token &token , tokens) {
|
|
||||||
switch (token.type) {
|
|
||||||
case Text:
|
|
||||||
result += token.text;
|
|
||||||
break;
|
|
||||||
case Image:
|
|
||||||
if (!exclude.contains(token.text)) {
|
|
||||||
result += token.picHTMLCode;
|
|
||||||
} else {
|
|
||||||
result += token.text;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
kWarning() << "Unknown token type. Something's broken.";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool EmoticonCompareEscaped( const KEmoticonsProvider::Emoticon &s1, const KEmoticonsProvider::Emoticon &s2)
|
|
||||||
{
|
|
||||||
return s1.matchTextEscaped.length()>s2.matchTextEscaped.length();
|
|
||||||
}
|
|
||||||
bool EmoticonCompare( const KEmoticonsProvider::Emoticon &s1, const KEmoticonsProvider::Emoticon &s2)
|
|
||||||
{
|
|
||||||
return s1.matchText.length()>s2.matchText.length();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QList<KEmoticonsTheme::Token> KEmoticonsTheme::tokenize(const QString &message, ParseMode mode) const
|
|
||||||
{
|
|
||||||
if (!d->provider) {
|
|
||||||
return QList<KEmoticonsTheme::Token>();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(mode & (StrictParse | RelaxedParse))) {
|
|
||||||
//if none of theses two mode are selected, use the mode from the config
|
|
||||||
mode |= KEmoticons::parseMode();
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<Token> result;
|
|
||||||
|
|
||||||
/* previous char, in the firs iteration assume that it is space since we want
|
|
||||||
* to let emoticons at the beginning, the very first previous QChar must be a space. */
|
|
||||||
QChar p = ' ';
|
|
||||||
QChar c; /* current char */
|
|
||||||
QChar n;
|
|
||||||
|
|
||||||
/* This is the EmoticonNode container, it will represent each matched emoticon */
|
|
||||||
typedef QPair<KEmoticonsProvider::Emoticon, int> EmoticonNode;
|
|
||||||
QList<EmoticonNode> foundEmoticons;
|
|
||||||
/* First-pass, store the matched emoticon locations in foundEmoticons */
|
|
||||||
QList<KEmoticonsProvider::Emoticon> emoticonList;
|
|
||||||
QList<KEmoticonsProvider::Emoticon>::const_iterator it;
|
|
||||||
int pos;
|
|
||||||
|
|
||||||
bool inHTMLTag = false;
|
|
||||||
bool inHTMLLink = false;
|
|
||||||
bool inHTMLEntity = false;
|
|
||||||
QString needle; // search for this
|
|
||||||
|
|
||||||
for (pos = 0; pos < message.length(); ++pos) {
|
|
||||||
c = message[pos];
|
|
||||||
|
|
||||||
if (mode & SkipHTML) { // Shall we skip HTML ?
|
|
||||||
if (!inHTMLTag) { // Are we already in an HTML tag ?
|
|
||||||
if (c == '<') { // If not check if are going into one
|
|
||||||
inHTMLTag = true; // If we are, change the state to inHTML
|
|
||||||
p = c;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
} else { // We are already in a HTML tag
|
|
||||||
if (c == '>') { // Check if it ends
|
|
||||||
inHTMLTag = false; // If so, change the state
|
|
||||||
|
|
||||||
if (p == 'a') {
|
|
||||||
inHTMLLink = false;
|
|
||||||
}
|
|
||||||
} else if (c == 'a' && p == '<') { // check if we just entered an achor tag
|
|
||||||
inHTMLLink = true; // don't put smileys in urls
|
|
||||||
}
|
|
||||||
p = c;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inHTMLEntity) { // are we
|
|
||||||
if (c == '&') {
|
|
||||||
inHTMLEntity = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inHTMLLink) { // i can't think of any situation where a link address might need emoticons
|
|
||||||
p = c;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((mode & StrictParse) && !p.isSpace() && p != '>') { // '>' may mark the end of an html tag
|
|
||||||
p = c;
|
|
||||||
continue;
|
|
||||||
} /* strict requires space before the emoticon */
|
|
||||||
|
|
||||||
if (d->provider->emoticonsIndex().contains(c)) {
|
|
||||||
emoticonList = d->provider->emoticonsIndex().value(c);
|
|
||||||
if (mode & SkipHTML)
|
|
||||||
qSort(emoticonList.begin(),emoticonList.end(),EmoticonCompareEscaped);
|
|
||||||
else
|
|
||||||
qSort(emoticonList.begin(),emoticonList.end(),EmoticonCompare);
|
|
||||||
bool found = false;
|
|
||||||
for (it = emoticonList.constBegin(); it != emoticonList.constEnd(); ++it) {
|
|
||||||
// If this is an HTML, then search for the HTML form of the emoticon.
|
|
||||||
// For instance <o) => >o)
|
|
||||||
needle = (mode & SkipHTML) ? (*it).matchTextEscaped : (*it).matchText;
|
|
||||||
if (pos == message.indexOf(needle, pos)) {
|
|
||||||
if (mode & StrictParse) {
|
|
||||||
/* check if the character after this match is space or end of string*/
|
|
||||||
if (message.length() > pos + needle.length()) {
|
|
||||||
n = message[pos + needle.length()];
|
|
||||||
//<br/> marks the end of a line
|
|
||||||
if (n != '<' && !n.isSpace() && !n.isNull() && n != '&') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Perfect match */
|
|
||||||
foundEmoticons.append(EmoticonNode((*it), pos));
|
|
||||||
found = true;
|
|
||||||
/* Skip the matched emoticon's matchText */
|
|
||||||
pos += needle.length() - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
if (inHTMLEntity) {
|
|
||||||
// If we are in an HTML entitiy such as >
|
|
||||||
int htmlEnd = message.indexOf(';', pos);
|
|
||||||
// Search for where it ends
|
|
||||||
if (htmlEnd == -1) {
|
|
||||||
// Apparently this HTML entity isn't ended, something is wrong, try skip the '&'
|
|
||||||
// and continue
|
|
||||||
kDebug() << "Broken HTML entity, trying to recover.";
|
|
||||||
inHTMLEntity = false;
|
|
||||||
pos++;
|
|
||||||
} else {
|
|
||||||
pos = htmlEnd;
|
|
||||||
inHTMLEntity = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} /* else no emoticons begin with this character, so don't do anything */
|
|
||||||
p = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if no emoticons found just return the text */
|
|
||||||
if (foundEmoticons.isEmpty()) {
|
|
||||||
result.append(Token(Text, message));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Second-pass, generate tokens based on the matches */
|
|
||||||
|
|
||||||
pos = 0;
|
|
||||||
int length;
|
|
||||||
|
|
||||||
for (int i = 0; i < foundEmoticons.size(); ++i) {
|
|
||||||
EmoticonNode itFound = foundEmoticons.at(i);
|
|
||||||
needle = (mode & SkipHTML) ? itFound.first.matchTextEscaped : itFound.first.matchText;
|
|
||||||
|
|
||||||
if ((length = (itFound.second - pos))) {
|
|
||||||
result.append(Token(Text, message.mid(pos, length)));
|
|
||||||
result.append(Token(Image, itFound.first.matchTextEscaped, itFound.first.picPath, itFound.first.picHTMLCode));
|
|
||||||
pos += length + needle.length();
|
|
||||||
} else {
|
|
||||||
result.append(Token(Image, itFound.first.matchTextEscaped, itFound.first.picPath, itFound.first.picHTMLCode));
|
|
||||||
pos += needle.length();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.length() - pos) { // if there is remaining regular text
|
|
||||||
result.append(Token(Text, message.mid(pos)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KEmoticonsTheme::isNull() const
|
|
||||||
{
|
|
||||||
return d->provider ? false : true;
|
|
||||||
}
|
|
||||||
|
|
||||||
KEmoticonsTheme& KEmoticonsTheme::operator=(const KEmoticonsTheme &ket)
|
|
||||||
{
|
|
||||||
if (d == ket.d) {
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
d = ket.d;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,222 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* Copyright (C) 2008 by Carlo Segato <brandon.ml@gmail.com> *
|
|
||||||
* Copyright (c) 2002-2003 by Stefan Gehn <metz@gehn.net> *
|
|
||||||
* Kopete (c) 2002-2008 by the Kopete developers <kopete-devel@kde.org> *
|
|
||||||
* Copyright (c) 2005 by Engin AYDOGAN <engin@bzzzt.biz> *
|
|
||||||
* *
|
|
||||||
* 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_THEME_H
|
|
||||||
#define KEMOTICONS_THEME_H
|
|
||||||
|
|
||||||
#include "kemoticonsprovider.h"
|
|
||||||
|
|
||||||
#include <QtCore/qshareddata.h>
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class contains the emoticons theme
|
|
||||||
*/
|
|
||||||
class KEMOTICONS_EXPORT KEmoticonsTheme
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The possible parse modes
|
|
||||||
*/
|
|
||||||
enum ParseModeEnum {
|
|
||||||
DefaultParse = 0x0, /**< Use strict or relaxed according to the config */
|
|
||||||
StrictParse = 0x1, /**< Strict parsing requires a space between each emoticon */
|
|
||||||
RelaxedParse = 0x2, /**< Parse mode where all possible emoticon matches are allowed */
|
|
||||||
SkipHTML = 0x4 /**< Skip emoticons within HTML */
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(ParseMode, ParseModeEnum)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* TokenType, a token might be an image ( emoticon ) or text.
|
|
||||||
*/
|
|
||||||
enum TokenType {
|
|
||||||
Undefined, /**< Undefined, for completeness only */
|
|
||||||
Image, /**< Token contains a path to an image */
|
|
||||||
Text /**< Token contains text */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A token consists of a QString text which is either a regular text
|
|
||||||
* or a path to image depending on the type.
|
|
||||||
* If type is Image the text refers to an image path.
|
|
||||||
* If type is Text the text refers to a regular text.
|
|
||||||
*/
|
|
||||||
struct Token {
|
|
||||||
Token() : type(Undefined) {}
|
|
||||||
/**
|
|
||||||
* Create a Token of type @p t, and text @p m
|
|
||||||
*/
|
|
||||||
Token(TokenType t, const QString &m) : type(t), text(m) {}
|
|
||||||
/**
|
|
||||||
* Create a Token of type @p t, text @p m, image path @p p and html code @p html
|
|
||||||
*/
|
|
||||||
Token(TokenType t, const QString &m, const QString &p, const QString &html)
|
|
||||||
: type(t), text(m), picPath(p), picHTMLCode(html) {}
|
|
||||||
TokenType type; /**< type */
|
|
||||||
QString text; /**< text */
|
|
||||||
QString picPath; /**< path to the image */
|
|
||||||
QString picHTMLCode; /**< \<img> html code */
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor, it creates a null emoticons theme
|
|
||||||
* you should probably never use this, instead use KEmoticons::theme()
|
|
||||||
*/
|
|
||||||
KEmoticonsTheme();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Copy constructor
|
|
||||||
*/
|
|
||||||
KEmoticonsTheme(const KEmoticonsTheme &ket);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Another constructor where you set the KEmoticonsProvider @p p
|
|
||||||
* you should probably never use this, instead use KEmoticons::theme()
|
|
||||||
*/
|
|
||||||
KEmoticonsTheme(KEmoticonsProvider *p);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destructor
|
|
||||||
*/
|
|
||||||
~KEmoticonsTheme();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse emoticons in text @p text with ParseMode @p mode and optionally excluding emoticons from @p exclude
|
|
||||||
* @code
|
|
||||||
* KEmoticonsTheme theme = KEmoticons().theme();
|
|
||||||
* QString text = ":D hi :)";
|
|
||||||
* QStringList exclude(":)");
|
|
||||||
* QString parsed = theme.parseEmoticons(text, KEmoticonsTheme::DefaultParse, exclude);
|
|
||||||
* // parsed will be "<img align="center" title=":D" alt=":D" src="/path/to/:D.png" width="24" height="24" /> hi :)"
|
|
||||||
* @endcode
|
|
||||||
* @param text the text to parse
|
|
||||||
* @param mode how to parse the text
|
|
||||||
* @param exclude a list of emoticons to exclude from the parsing
|
|
||||||
* @return the text with emoticons replaced by html images
|
|
||||||
* @note SkipHTML is forced when using this function
|
|
||||||
*/
|
|
||||||
QString parseEmoticons(const QString &text, ParseMode mode = DefaultParse, const QStringList &exclude = QStringList()) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tokenize the message @p message with ParseMode @p mode
|
|
||||||
* @code
|
|
||||||
* KEmoticonsTheme theme = KEmoticons().theme();
|
|
||||||
* QString text = "hi :)";
|
|
||||||
* QList<Token> tokens = theme.tokenize(text, KEmoticonsTheme::DefaultParse);
|
|
||||||
* // tokens[0].text = "hi "
|
|
||||||
* // tokens[1].text = ":)"
|
|
||||||
* // tokens[1].picPath = "/path/to/:).png"
|
|
||||||
* // tokens[1].picHTMLCode = "<img align="center" title=":)" alt=":)" src="/path/to/:).png" width="24" height="24" />"
|
|
||||||
* @endcode
|
|
||||||
*/
|
|
||||||
QList<Token> tokenize(const QString &message, ParseMode mode = DefaultParse) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load the theme inside the directory @p path
|
|
||||||
* @param path path to the directory
|
|
||||||
*/
|
|
||||||
bool loadTheme(const QString &path);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the emoticon @p emo, this will not delete the image file too
|
|
||||||
* @code
|
|
||||||
* KEmoticonsTheme theme = KEmoticons().theme();
|
|
||||||
* theme.removeEmoticon(":)");
|
|
||||||
* @endcode
|
|
||||||
* @param emo the emoticon text to remove
|
|
||||||
* @return @c true if it can delete the emoticon
|
|
||||||
*/
|
|
||||||
bool removeEmoticon(const QString &emo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the emoticon @p emo with text @p text
|
|
||||||
* @code
|
|
||||||
* KEmoticonsTheme theme = KEmoticons().theme();
|
|
||||||
* theme.addEmoticon("/path/to/smiley.png", ":) :-)");
|
|
||||||
* @endcode
|
|
||||||
* @param emo path to the emoticon image
|
|
||||||
* @param text the text of the emoticon separated by space for multiple text
|
|
||||||
* @param copy whether or not copy @p emo into the theme directory
|
|
||||||
* @return @c true if it can add the emoticon
|
|
||||||
*/
|
|
||||||
bool addEmoticon(const QString &emo, const QString &text, KEmoticonsProvider::AddEmoticonOption option = KEmoticonsProvider::DoNotCopy);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Save the emoticon theme
|
|
||||||
*/
|
|
||||||
void save();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the theme name
|
|
||||||
*/
|
|
||||||
QString themeName() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the theme name
|
|
||||||
* @param name name of the theme
|
|
||||||
*/
|
|
||||||
void setThemeName(const QString &name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the theme path
|
|
||||||
*/
|
|
||||||
QString themePath() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the file name of the theme
|
|
||||||
*/
|
|
||||||
QString fileName() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a QHash that contains the emoticons path as keys and the text as values
|
|
||||||
*/
|
|
||||||
QHash<QString, QStringList> emoticonsMap() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new theme
|
|
||||||
*/
|
|
||||||
void createNew();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if the theme has a valid provider and it returns true if it can't find it
|
|
||||||
*/
|
|
||||||
bool isNull() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
KEmoticonsTheme& operator=(const KEmoticonsTheme &ket);
|
|
||||||
private:
|
|
||||||
class KEmoticonsThemeData;
|
|
||||||
/**
|
|
||||||
* Private class
|
|
||||||
*/
|
|
||||||
QSharedDataPointer<KEmoticonsThemeData> d;
|
|
||||||
};
|
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(KEmoticonsTheme::ParseMode)
|
|
||||||
|
|
||||||
#endif /* KEMOTICONS_THEME_H */
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,4 +0,0 @@
|
||||||
add_subdirectory(kde)
|
|
||||||
add_subdirectory(xmpp)
|
|
||||||
add_subdirectory(adium)
|
|
||||||
add_subdirectory(pidgin)
|
|
|
@ -1,25 +0,0 @@
|
||||||
include_directories(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
|
||||||
)
|
|
||||||
|
|
||||||
########### next target ###############
|
|
||||||
|
|
||||||
kde4_add_plugin(emoticonstheme_adium adium_emoticons.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(emoticonstheme_adium
|
|
||||||
kemoticons
|
|
||||||
${KDE4_KDEUI_LIBS}
|
|
||||||
${QT_QTXML_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
########### install files ###############
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS emoticonstheme_adium
|
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
FILES emoticonstheme_adium.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
|
||||||
)
|
|
|
@ -1,257 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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/>.*
|
|
||||||
* *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
#include "adium_emoticons.h"
|
|
||||||
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtGui/QImageReader>
|
|
||||||
|
|
||||||
#include <kpluginfactory.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(AdiumEmoticonsFactory, registerPlugin<AdiumEmoticons>();)
|
|
||||||
K_EXPORT_PLUGIN(AdiumEmoticonsFactory("AdiumEmoticons"))
|
|
||||||
|
|
||||||
AdiumEmoticons::AdiumEmoticons(QObject *parent, const QVariantList &args)
|
|
||||||
: KEmoticonsProvider(parent)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args)
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AdiumEmoticons::removeEmoticon(const QString &emo)
|
|
||||||
{
|
|
||||||
QString emoticon = QFileInfo(emoticonsMap().key(emo.split(' '))).fileName();
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("plist").firstChildElement("dict").firstChildElement("dict");
|
|
||||||
|
|
||||||
if (fce.isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNodeList nl = fce.childNodes();
|
|
||||||
// the lenght() method had a TODO which is done in Katie
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int i = 0; i < nl.length(); i++ )
|
|
||||||
#else
|
|
||||||
for (uint i = 0; i < nl.length(); i++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement de = nl.item(i).toElement();
|
|
||||||
if (!de.isNull() && de.tagName() == "key" && (de.text() == emoticon)) {
|
|
||||||
QDomElement dict = de.nextSiblingElement();
|
|
||||||
if (!dict.isNull() && dict.tagName() == "dict") {
|
|
||||||
fce.removeChild(dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
fce.removeChild(de);
|
|
||||||
removeEmoticonsMap(emoticonsMap().key(emo.split(' ')));
|
|
||||||
removeEmoticonIndex(emoticon, emo.split(' '));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AdiumEmoticons::addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::addEmoticon(emo, text, option);
|
|
||||||
|
|
||||||
const QStringList splitted = text.split(' ');
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("plist").firstChildElement("dict").firstChildElement("dict");
|
|
||||||
|
|
||||||
if (fce.isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomElement emoticon = m_themeXml.createElement("key");
|
|
||||||
emoticon.appendChild(m_themeXml.createTextNode(QFileInfo(emo).fileName()));
|
|
||||||
fce.appendChild(emoticon);
|
|
||||||
|
|
||||||
QDomElement dict = m_themeXml.createElement("dict");
|
|
||||||
QDomElement el = m_themeXml.createElement("key");
|
|
||||||
el.appendChild(m_themeXml.createTextNode("Equivalents"));
|
|
||||||
dict.appendChild(el);
|
|
||||||
|
|
||||||
QDomElement arr = m_themeXml.createElement("array");
|
|
||||||
|
|
||||||
foreach(const QString it, splitted) {
|
|
||||||
QDomElement emoText = m_themeXml.createElement("string");
|
|
||||||
QDomText txt = m_themeXml.createTextNode(it.trimmed());
|
|
||||||
emoText.appendChild(txt);
|
|
||||||
arr.appendChild(emoText);
|
|
||||||
}
|
|
||||||
|
|
||||||
dict.appendChild(arr);
|
|
||||||
|
|
||||||
el = m_themeXml.createElement("key");
|
|
||||||
el.appendChild(m_themeXml.createTextNode("Name"));
|
|
||||||
dict.appendChild(el);
|
|
||||||
|
|
||||||
el = m_themeXml.createElement("string");
|
|
||||||
el.appendChild(m_themeXml.createTextNode(QFileInfo(emo).baseName()));
|
|
||||||
dict.appendChild(el);
|
|
||||||
|
|
||||||
fce.appendChild(dict);
|
|
||||||
|
|
||||||
addEmoticonIndex(emo, splitted);
|
|
||||||
addEmoticonsMap(emo, splitted);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdiumEmoticons::save()
|
|
||||||
{
|
|
||||||
QFile fp(themePath() + '/' + fileName());
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << fp.fileName() << "doesn't exist!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream emoStream(&fp);
|
|
||||||
emoStream.setCodec( "UTF-8" );
|
|
||||||
emoStream << m_themeXml.toString(4);
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AdiumEmoticons::loadTheme(const QString &path)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::loadTheme(path);
|
|
||||||
|
|
||||||
QFile fp(path);
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << path << "doesn't exist!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::ReadOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open ReadOnly!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString error;
|
|
||||||
int eli, eco;
|
|
||||||
if (!m_themeXml.setContent(&fp, &error, &eli, &eco)) {
|
|
||||||
kWarning() << fp.fileName() << "can't copy to xml!";
|
|
||||||
kWarning() << error << "line:" << eli << "column:" << eco;
|
|
||||||
fp.close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp.close();
|
|
||||||
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("plist").firstChildElement("dict").firstChildElement("dict");
|
|
||||||
|
|
||||||
if (fce.isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNodeList nl = fce.childNodes();
|
|
||||||
|
|
||||||
clearEmoticonsMap();
|
|
||||||
QString name;
|
|
||||||
// the lenght() method had a TODO which is done in Katie
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int i = 0; i < nl.length(); i++ )
|
|
||||||
#else
|
|
||||||
for (uint i = 0; i < nl.length(); i++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement de = nl.item(i).toElement();
|
|
||||||
|
|
||||||
if (!de.isNull() && de.tagName() == "key") {
|
|
||||||
name = KGlobal::dirs()->findResource("emoticons", themeName() + '/' + de.text());
|
|
||||||
continue;
|
|
||||||
} else if (!de.isNull() && de.tagName() == "dict") {
|
|
||||||
QDomElement arr = de.firstChildElement("array");
|
|
||||||
QDomNodeList snl = arr.childNodes();
|
|
||||||
QStringList sl;
|
|
||||||
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int k = 0; k < snl.length(); k++ )
|
|
||||||
#else
|
|
||||||
for (uint k = 0; k < snl.length(); k++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement sde = snl.item(k).toElement();
|
|
||||||
|
|
||||||
if (!sde.isNull() && sde.tagName() == "string") {
|
|
||||||
sl << sde.text();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!name.isEmpty()) {
|
|
||||||
addEmoticonIndex(name, sl);
|
|
||||||
addEmoticonsMap(name, sl);
|
|
||||||
name.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdiumEmoticons::createNew()
|
|
||||||
{
|
|
||||||
QString path = KGlobal::dirs()->saveLocation("emoticons", themeName());
|
|
||||||
|
|
||||||
QFile fp(path + '/' + "Emoticons.plist");
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomDocumentType ty = QDomImplementation().createDocumentType("plist", "-//Apple Computer//DTD PLIST 1.0//EN", "http://www.apple.com/DTDs/PropertyList-1.0.dtd");
|
|
||||||
QDomDocument doc(ty);
|
|
||||||
doc.appendChild(doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""));
|
|
||||||
|
|
||||||
QDomElement plist = doc.createElement("plist");
|
|
||||||
plist.setAttribute("version", "1.0");
|
|
||||||
doc.appendChild(plist);
|
|
||||||
|
|
||||||
QDomElement dict = doc.createElement("dict");
|
|
||||||
plist.appendChild(dict);
|
|
||||||
|
|
||||||
QDomElement el = doc.createElement("key");
|
|
||||||
el.appendChild(doc.createTextNode("AdiumSetVersion"));
|
|
||||||
dict.appendChild(el);
|
|
||||||
|
|
||||||
el = doc.createElement("integer");
|
|
||||||
el.appendChild(doc.createTextNode("1"));
|
|
||||||
dict.appendChild(el);
|
|
||||||
|
|
||||||
el = doc.createElement("key");
|
|
||||||
el.appendChild(doc.createTextNode("Emoticons"));
|
|
||||||
dict.appendChild(el);
|
|
||||||
|
|
||||||
dict.appendChild(doc.createElement("dict"));
|
|
||||||
|
|
||||||
|
|
||||||
QTextStream emoStream(&fp);
|
|
||||||
emoStream.setCodec( "UTF-8" );
|
|
||||||
emoStream << doc.toString(4);
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,46 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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 ADIUM_EMOTICONS_H
|
|
||||||
#define ADIUM_EMOTICONS_H
|
|
||||||
|
|
||||||
#include <kemoticonsprovider.h>
|
|
||||||
|
|
||||||
#include <QtXml/qdom.h>
|
|
||||||
|
|
||||||
class AdiumEmoticons : public KEmoticonsProvider
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
AdiumEmoticons(QObject *parent, const QVariantList &args);
|
|
||||||
|
|
||||||
bool loadTheme(const QString &path);
|
|
||||||
|
|
||||||
bool removeEmoticon(const QString &emo);
|
|
||||||
bool addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option = DoNotCopy);
|
|
||||||
void save();
|
|
||||||
|
|
||||||
void createNew();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QDomDocument m_themeXml;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ADIUM_EMOTICONS_H */
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,164 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=Service
|
|
||||||
Name=Adium Emoticons Theme
|
|
||||||
Name[ar]=سمة ابتسامات Adium
|
|
||||||
Name[as]=Adium Emoticons থিম
|
|
||||||
Name[ast]=Tema d'emoticonos Adium
|
|
||||||
Name[be@latin]=Matyŭ smajlikaŭ dla „Adium”
|
|
||||||
Name[bg]=Тема с емоции Adium
|
|
||||||
Name[bn]=অ্যাডিয়াম ইমোট-আইকন থীম
|
|
||||||
Name[bn_IN]=Adium ইমো-আইকন থিম
|
|
||||||
Name[bs]=Adijumova tema emotikona
|
|
||||||
Name[ca]=Tema d'emoticones Adium
|
|
||||||
Name[ca@valencia]=Tema d'emoticones Adium
|
|
||||||
Name[cs]=Motiv emotikonů Adium
|
|
||||||
Name[csb]=Témë Adium emòtikónków
|
|
||||||
Name[da]=Adium emotikon-tema
|
|
||||||
Name[de]=Adium-Emoticon-Design
|
|
||||||
Name[el]=Θέμα εικονιδίων διάθεσης Adium
|
|
||||||
Name[en_GB]=Adium Emoticons Theme
|
|
||||||
Name[eo]=Adium Mien-etoso
|
|
||||||
Name[es]=Tema de emoticonos Adium
|
|
||||||
Name[et]=Adiumi emotikoniteema
|
|
||||||
Name[eu]=Adium-en aurpegiera gaiak
|
|
||||||
Name[fi]=Adium-hymiöteemat
|
|
||||||
Name[fr]=Thèmes d'émoticônes « Adium »
|
|
||||||
Name[fy]=Adium Emoticons tema
|
|
||||||
Name[ga]=Téama Straoiseog Adium
|
|
||||||
Name[gl]=Tema de emoticonas Adium
|
|
||||||
Name[gu]=એડિયમ ઇમોકેશન થીમ
|
|
||||||
Name[he]=ערכת פרצופונים של Adium
|
|
||||||
Name[hne]=एडियम चेहराचिनहा थीम
|
|
||||||
Name[hr]=Adiumova tema emotikona
|
|
||||||
Name[hsb]=Adium Emoticons Theme
|
|
||||||
Name[hu]=Adium emotikon-téma
|
|
||||||
Name[hy]=Ադիումի Էմոտիքոնների ոճ
|
|
||||||
Name[ia]=Thema de emoticones Adium
|
|
||||||
Name[id]=Tema Emoticon Adium
|
|
||||||
Name[is]=Adium broskallaþema
|
|
||||||
Name[it]=Tema faccine Adium
|
|
||||||
Name[ja]=Adium 感情アイコンテーマ
|
|
||||||
Name[kk]=Adium көңіл-күй белгілер нақышы
|
|
||||||
Name[km]=ស្បែកសញ្ញាអារម្មណ៍របស់ Adium
|
|
||||||
Name[kn]=ಏಡಿಯಮ್ ಭಾವನಾಚಿಹ್ನೆಗಳ (ಎಮೋಟಿಕಾನ್) ಪರಿಸರವಿನ್ಯಾಸ (ಥೀಮ್)
|
|
||||||
Name[ko]=Adium 이모티콘 테마
|
|
||||||
Name[ku]=Dirba Vegotinan yê Adium
|
|
||||||
Name[lt]=Adium jaustukų tema
|
|
||||||
Name[lv]=Adium emocijzīmju tēma
|
|
||||||
Name[mai]=एडियम भावचिन्ह प्रसंग
|
|
||||||
Name[ml]=അഡിയം ഇമോട്ടിക്കോണ് രംഗവിതാനം
|
|
||||||
Name[mr]=ऐडीयम भावप्रतिमा शैली
|
|
||||||
Name[nb]=Adium smilefjestema
|
|
||||||
Name[nds]=Snutensett Adium
|
|
||||||
Name[nl]=Adium-emoticonsthema
|
|
||||||
Name[nn]=Adium-fjesingtema
|
|
||||||
Name[or]=Adium Emoticons ପ୍ରସଙ୍ଗ
|
|
||||||
Name[pa]=ਅਡੀਉਮ ਈਮੋਸ਼ਨ ਥੀਮ
|
|
||||||
Name[pl]=Motyw emotikon Adium
|
|
||||||
Name[pt]=Tema de Ícones Emotivos do Adium
|
|
||||||
Name[pt_BR]=Tema de emoticons Adium
|
|
||||||
Name[ro]=Tematică de emoticoni Adium
|
|
||||||
Name[ru]=Набор смайликов Adium
|
|
||||||
Name[se]=Adium mojánfáddá
|
|
||||||
Name[sk]=Téma emotikonov Adium
|
|
||||||
Name[sl]=Tema izraznih ikon Adium
|
|
||||||
Name[sr]=Адијумова тема емотикона
|
|
||||||
Name[sr@ijekavian]=Адијумова тема емотикона
|
|
||||||
Name[sr@ijekavianlatin]=Adiumova tema emotikona
|
|
||||||
Name[sr@latin]=Adiumova tema emotikona
|
|
||||||
Name[sv]=Adium smilistema
|
|
||||||
Name[ta]=ஏடியம் உணர்வுருக்களுக்கான தோற்றம்
|
|
||||||
Name[tg]=Мавзӯъи Adium Emoticons
|
|
||||||
Name[th]=ภาพไอคอนสื่ออารมณ์ของ Adium
|
|
||||||
Name[tr]=Adium Duygu Simgesi Teması
|
|
||||||
Name[tt]=Adium көлчекләр җыелмасы
|
|
||||||
Name[ug]=Adium چىراي ئىپادە ئۆرنىكى
|
|
||||||
Name[uk]=Тема емоційок Adium
|
|
||||||
Name[vi]=Giao diện hình biểu cảm Adium
|
|
||||||
Name[wa]=Tinme di xhinêyes Adium
|
|
||||||
Name[x-test]=xxAdium Emoticons Themexx
|
|
||||||
Name[zh_CN]=Adium 表情主题
|
|
||||||
Name[zh_TW]=Adium 表情圖示主題
|
|
||||||
Comment=Library to use Adium emoticons theme
|
|
||||||
Comment[ar]=مكتبة لاستخدام سمة ابتسامات Adium
|
|
||||||
Comment[as]=Adium emoticons থিম ব্যৱহাৰ কৰা লাইব্ৰেৰী
|
|
||||||
Comment[ast]=Bibilioteca pa usar el tema d'emoticonos Adium
|
|
||||||
Comment[be@latin]=Biblijateka dla matyvaŭ smajlikaŭ „Adium”
|
|
||||||
Comment[bg]=Библиотека за темата с емоции Adium
|
|
||||||
Comment[bn]=অ্যাডিয়াম ইমোট-আইকন থীম ব্যবহার করার লাইব্রেরী
|
|
||||||
Comment[bn_IN]=Adium ইমো-আইকন থিম প্রয়োগ করতে ব্যবহৃত লাইব্রেরি
|
|
||||||
Comment[bs]=Biblioteka za Adijumovu temu emotikona
|
|
||||||
Comment[ca]=Biblioteca per a usar el tema d'emoticones Adium
|
|
||||||
Comment[ca@valencia]=Biblioteca per a usar el tema d'emoticones Adium
|
|
||||||
Comment[cs]=Knihovna pro použití motivu emotikonů Adium
|
|
||||||
Comment[csb]=Bibloteka do brëkòwaniô emòtikónków temë Adium
|
|
||||||
Comment[da]=Bibliotek til at bruge Adium emotikon-temaer
|
|
||||||
Comment[de]=Bibliothek zur Verwendung des Adium-Emoticon-Designs
|
|
||||||
Comment[el]=Βιβλιοθήκη για τη χρήση του θέματος εικονιδίων διάθεσης Adium
|
|
||||||
Comment[en_GB]=Library to use Adium emoticons theme
|
|
||||||
Comment[eo]=Biblioteko por uzi Adium mien-etoson
|
|
||||||
Comment[es]=Biblioteca para usar el tema de emoticonos Audium
|
|
||||||
Comment[et]=Teek Adiumi emotikoniteema kasutamiseks
|
|
||||||
Comment[eu]=Adium-en aurpegiera gaia erabiltzeko liburutegia
|
|
||||||
Comment[fi]=Kirjasto Adium-hymiöteemojen käyttämiseen
|
|
||||||
Comment[fr]=Bibliothèque permettant d'utiliser les thèmes d'émoticônes « Adium »
|
|
||||||
Comment[fy]=Biblioteek om Adium emoticons tema te brûken
|
|
||||||
Comment[ga]=Leabharlann le húsáid téama straoiseog Adium
|
|
||||||
Comment[gl]=Unha biblioteca para empregar o tema de emoticonas Adium
|
|
||||||
Comment[gu]=એડિયમ ઇમોકેશન થીમ ઉપયોગ કરવા માટેની લાઇબ્રેરી
|
|
||||||
Comment[he]=ספריה לשימוש בערכת הפרצופונים של Adium
|
|
||||||
Comment[hne]=एडियम चेहराचिनहा थीम उपयोग करे बर लाइब्रेरी
|
|
||||||
Comment[hr]=Biblioteka za korištenje Adiumove teme emotikona
|
|
||||||
Comment[hsb]=Biblioteka za Adium emoticons theme
|
|
||||||
Comment[hu]=Programkönyvtár az Adium emotikon-témához
|
|
||||||
Comment[hy]=Գրադարան որպեսզի Ադիումի էմոտիքոնների ոճը օգտագործել
|
|
||||||
Comment[ia]=Libreria per usar le thema de emoticones Adium
|
|
||||||
Comment[id]=Pustaka untuk menggunakan tema emoticon Adium
|
|
||||||
Comment[is]=Forritlingasafn til notkunar með Adium broskallaþema
|
|
||||||
Comment[it]=Libreria per usare il tema faccine Adium
|
|
||||||
Comment[ja]=Adium 感情アイコンテーマのライブラリ
|
|
||||||
Comment[kk]=Adium көңіл-күй белгілер нақышының жиыны
|
|
||||||
Comment[km]=បណ្ណាល័យត្រូវប្រើស្បែកសញ្ញាអារម្មណ៍ Adium
|
|
||||||
Comment[kn]=ಏಡಿಯಮ್ ಭಾವನಾಚಿಹ್ನೆಗಳ (ಎಮೋಟಿಕಾನ್) ಪರಿಸರವಿನ್ಯಾಸವನ್ನು (ಥೀಮ್) ಬಳಸಲು ಒಂದು ಭಂಡಾರ (ಲೈಬ್ರರಿ)
|
|
||||||
Comment[ko]=Adium 이모티콘 테마를 사용할 라이브러리
|
|
||||||
Comment[ku]=Pirtûkxane ji bo bi kar anîna Dirba Vegotinan yê Adium
|
|
||||||
Comment[lt]=Biblioteka, leidžianti naudoti adium jaustukų temą
|
|
||||||
Comment[lv]=Adium emocijzīmju tēmas bibliotēka
|
|
||||||
Comment[mai]=एडियम भावचिन्ह प्रसंगक प्रयोगक लेल लाइब्रेरी
|
|
||||||
Comment[ml]=അഡിയം ഇമോട്ടിക്കോണ് രംഗവിതാനം ഉപയോഗിയ്ക്കേണ്ട ലൈബ്രറി
|
|
||||||
Comment[mr]=ऐडीयम भावप्रतिमा शैली वापरण्याकरिता लायब्ररी
|
|
||||||
Comment[nb]=Bibliotek for å bruke Adium smilefjestema
|
|
||||||
Comment[nds]=Bibliotheek, mit de sik dat Snutensett Adium bruken lett
|
|
||||||
Comment[nl]=Bibliotheek voor het gebruiken van het Adium-emoticonsthema
|
|
||||||
Comment[nn]=Bibliotek for å bruka fjesingtema frå Adium
|
|
||||||
Comment[or]=Adium Emoticons ପ୍ରସଙ୍ଗକୁ ବ୍ୟବହାର କରିବା ପାଇଁ ଲାଇବ୍ରେରୀ
|
|
||||||
Comment[pa]=ਅਡੀਉਮ ਈਮੋਸ਼ਨ ਥੀਮ ਲਈ ਲਾਇਬਰੇਰੀ
|
|
||||||
Comment[pl]=Biblioteka do motywu emotikon Adium
|
|
||||||
Comment[pt]=Uma biblioteca para usar os temas de ícones emotivos do Adium
|
|
||||||
Comment[pt_BR]=Biblioteca para uso do tema de emoticons Adium
|
|
||||||
Comment[ro]=Bibliotecă de utilizat tematica de emoticoni Adium
|
|
||||||
Comment[ru]=Библиотека набора смайликов Adium
|
|
||||||
Comment[se]=Bibliotehka mii dulko Adium mojánfáttáid
|
|
||||||
Comment[sk]=Knižnica na použitie témy emotikonov Adium
|
|
||||||
Comment[sl]=Knjižnica za uporabo Adiumove teme izraznih ikon
|
|
||||||
Comment[sr]=Библиотека за Адијумову тему емотикона
|
|
||||||
Comment[sr@ijekavian]=Библиотека за Адијумову тему емотикона
|
|
||||||
Comment[sr@ijekavianlatin]=Biblioteka za Adiumovu temu emotikona
|
|
||||||
Comment[sr@latin]=Biblioteka za Adiumovu temu emotikona
|
|
||||||
Comment[sv]=Bibliotek för att använda Adium smilistema
|
|
||||||
Comment[ta]=ஏடியம் உணர்வுரு தோற்றத்திற்கான நிரலகம்
|
|
||||||
Comment[tg]=Китобхонаи мавзӯъи Adium emoticons
|
|
||||||
Comment[th]=ไลบรารีที่ใช้ภาพไอคอนสื่ออารมณ์ของ Adium
|
|
||||||
Comment[tr]=Adium Duygu Simgesi Temasını kullanmak için kitaplık
|
|
||||||
Comment[tt]=Adium көлчек җыелмасы өчен китапханә
|
|
||||||
Comment[ug]=Adium چىراي ئىپادە ئۆرنىكىنى ئىشلىتىدىغان ئامبار
|
|
||||||
Comment[uk]=Бібліотека для використання теми емоційок Adium
|
|
||||||
Comment[vi]=Thư viện để sử dụng giao diện hình biểu cảm Adium
|
|
||||||
Comment[wa]=Livreye pos eployî l' tinme di xhinêyes Adium
|
|
||||||
Comment[x-test]=xxLibrary to use Adium emoticons themexx
|
|
||||||
Comment[zh_CN]=使用 Adium 表情主题的类库
|
|
||||||
Comment[zh_TW]=使用 Adium 表情圖示主題的函式庫
|
|
||||||
X-KDE-ServiceTypes=KEmoticons
|
|
||||||
X-KDE-Library=emoticonstheme_adium
|
|
||||||
X-KDE-EmoticonsFileName=Emoticons.plist
|
|
||||||
X-KDE-Priority=8
|
|
|
@ -1,26 +0,0 @@
|
||||||
include_directories(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
|
||||||
)
|
|
||||||
|
|
||||||
########### next target ###############
|
|
||||||
|
|
||||||
kde4_add_plugin(emoticonstheme_kde kde_emoticons.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(emoticonstheme_kde
|
|
||||||
${KDE4_KDEUI_LIBS}
|
|
||||||
${KDE4_KEMOTICONS_LIBS}
|
|
||||||
${QT_QTXML_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
########### install files ###############
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS emoticonstheme_kde
|
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
install(
|
|
||||||
FILES emoticonstheme_kde.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
|
||||||
)
|
|
|
@ -1,152 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=Service
|
|
||||||
Name=KDE Emoticons Theme
|
|
||||||
Name[ar]=سمة ابتسامات كدي
|
|
||||||
Name[bg]=Тема с емоции KDE
|
|
||||||
Name[bn]=কে.ডি.ই. ইমোট-আইকনস থীম
|
|
||||||
Name[bs]=KDE‑ova tema emotikona
|
|
||||||
Name[ca]=Tema d'emoticones del KDE
|
|
||||||
Name[ca@valencia]=Tema d'emoticones del KDE
|
|
||||||
Name[cs]=Motiv emotikonů KDE
|
|
||||||
Name[da]=KDE emotikon-tema
|
|
||||||
Name[de]=KDE-Emoticon-Design
|
|
||||||
Name[el]=Θέμα εικονιδίων διάθεσης KDE
|
|
||||||
Name[en_GB]=KDE Emoticons Theme
|
|
||||||
Name[es]=Tema de emoticonos de KDE
|
|
||||||
Name[et]=KDE emotikoniteema
|
|
||||||
Name[eu]=KDE emotikono gaia
|
|
||||||
Name[fi]=KDE-hymiöteemat
|
|
||||||
Name[fr]=Thèmes d'émoticônes de KDE
|
|
||||||
Name[ga]=Téama Straoiseog KDE
|
|
||||||
Name[gl]=Tema de emoticonas de KDE
|
|
||||||
Name[gu]=KDE ઇમોકેશન થીમ
|
|
||||||
Name[he]=ערכת פרצופונים של KDE
|
|
||||||
Name[hr]=KDE-ova tema emotikanata
|
|
||||||
Name[hu]=KDE emotikon-téma
|
|
||||||
Name[hy]=KDE Էմոտիքոնների ոճ
|
|
||||||
Name[ia]=Thema de emoticones de KDE
|
|
||||||
Name[id]=Tema Emoticon KDE
|
|
||||||
Name[is]=KDE broskallaþema
|
|
||||||
Name[it]=Tema faccine di KDE
|
|
||||||
Name[ja]=KDE 感情アイコンテーマ
|
|
||||||
Name[kk]=KDE көңіл-күй белгілер нақышы
|
|
||||||
Name[km]=ស្បែកសញ្ញាអារម្មណ៍របស់ KDE
|
|
||||||
Name[ko]=KDE 이모티콘 테마
|
|
||||||
Name[ku]=Dirba Vegotinan yên Kde
|
|
||||||
Name[lt]=KDE jaustukų tema
|
|
||||||
Name[lv]=KDE emocijzīmju tēma
|
|
||||||
Name[mr]=केडीई भावप्रतिमा शैली
|
|
||||||
Name[nb]=KDE smilefjestema
|
|
||||||
Name[nds]=KDE-Snutensett
|
|
||||||
Name[nl]=KDE-emoticons-thema
|
|
||||||
Name[pa]=KDE ਈਮੋਸ਼ਨ ਥੀਮ
|
|
||||||
Name[pl]=Motyw emotikon KDE
|
|
||||||
Name[pt]=Tema de Ícones Emotivos do KDE
|
|
||||||
Name[pt_BR]=Tema de emoticons do KDE
|
|
||||||
Name[ro]=Tematică de emoticoni KDE
|
|
||||||
Name[ru]=Набор смайликов для KDE
|
|
||||||
Name[se]=KDE mojánfáddá
|
|
||||||
Name[si]=KDE Emoticons තේමාව
|
|
||||||
Name[sk]=Téma emotikonov KDE
|
|
||||||
Name[sl]=Tema izraznih ikon KDE
|
|
||||||
Name[sr]=КДЕ‑ова тема емотикона
|
|
||||||
Name[sr@ijekavian]=КДЕ‑ова тема емотикона
|
|
||||||
Name[sr@ijekavianlatin]=KDE‑ova tema emotikona
|
|
||||||
Name[sr@latin]=KDE‑ova tema emotikona
|
|
||||||
Name[sv]=KDE smilistema
|
|
||||||
Name[ta]=கேடியீ உணர்வுருக்கள் தோற்றம்
|
|
||||||
Name[tg]=Мавзӯъи KDE Emoticons
|
|
||||||
Name[th]=ภาพไอคอนสื่ออารมณ์ของ KDE
|
|
||||||
Name[tr]=Kde Duygu Simgesi Teması
|
|
||||||
Name[tt]=KDE көлчекләр җыелмасы
|
|
||||||
Name[ug]=KDE چىراي ئىپادە ئۆرنىكى
|
|
||||||
Name[uk]=Тема емоційок KDE
|
|
||||||
Name[vi]=Giao diện hình biểu cảm KDE
|
|
||||||
Name[wa]=Tinme di xhinêyes KDE
|
|
||||||
Name[x-test]=xxKDE Emoticons Themexx
|
|
||||||
Name[zh_CN]=KDE 表情主题
|
|
||||||
Name[zh_TW]=KDE 表情圖示主題
|
|
||||||
Comment=Library to use KDE emoticons theme
|
|
||||||
Comment[ar]=مكتبة لاستخدام سمة ابتسامات كدي
|
|
||||||
Comment[as]=KDE emoticons থিম ব্যৱহাৰ কৰা লাইব্ৰেৰী
|
|
||||||
Comment[ast]=Biblioteca pa usar el tema d'emoticonos KDE
|
|
||||||
Comment[be@latin]=Biblijateka dla matyvaŭ smajlikaŭ „KDE”
|
|
||||||
Comment[bg]=Библиотека за тема с емоции KDE
|
|
||||||
Comment[bn]=কে-ডি-ই ইমোট-আইকন থীম ব্যবহার করার লাইব্রেরী
|
|
||||||
Comment[bn_IN]=KDE ইমো-আইকন থিম প্রয়োগ করতে ব্যবহৃত লাইব্রেরি
|
|
||||||
Comment[bs]=Biblioteka za KDE‑ovu temu emotikona
|
|
||||||
Comment[ca]=Biblioteca per a usar el tema d'emoticones KDE
|
|
||||||
Comment[ca@valencia]=Biblioteca per a usar el tema d'emoticones KDE
|
|
||||||
Comment[cs]=Knihovna pro použití motivu emotikonů KDE
|
|
||||||
Comment[csb]=Bibloteka do brëkòwaniô emòtikónków temë KDE
|
|
||||||
Comment[da]=Bibliotek til at bruge KDE emotikon-temaer
|
|
||||||
Comment[de]=Bibliothek zur Verwendung des KDE-Emoticon-Designs
|
|
||||||
Comment[el]=Βιβλιοθήκη για τη χρήση του θέματος εικονιδίων διάθεσης KDE
|
|
||||||
Comment[en_GB]=Library to use KDE emoticons theme
|
|
||||||
Comment[eo]=Biblioteko por uzi KDE Mien-Etoson
|
|
||||||
Comment[es]=Biblioteca para usar el tema de emoticonos de KDE
|
|
||||||
Comment[et]=Teek KDE emotikoniteema kasutamiseks
|
|
||||||
Comment[eu]=KDEko aurpegiera gaia erabiltzeko liburutegia
|
|
||||||
Comment[fi]=Kirjasto KDE-hymiöteemojen käyttämiseen
|
|
||||||
Comment[fr]=Bibliothèque permettant d'utiliser les thèmes d'émoticônes de KDE
|
|
||||||
Comment[fy]=Biblioteek om KDE emoticons tema te brûken
|
|
||||||
Comment[ga]=Leabharlann le húsáid téama straoiseog KDE
|
|
||||||
Comment[gl]=Unha biblioteca para empregar temas de emoticonas de KDE
|
|
||||||
Comment[gu]=KDE ઇમોકેશન થીમ ઉપયોગ કરવા માટેની લાઇબ્રેરી
|
|
||||||
Comment[he]=ספרייה לשימוש בערכת הפרצופונים של KDE
|
|
||||||
Comment[hne]=केडीई चेहराचिनहा थीम ल उपयोग करे बर लाइब्रेरी
|
|
||||||
Comment[hr]=Biblioteka za korištenje KDE-ove teme emotikona
|
|
||||||
Comment[hsb]=Biblioteka za KDE emoticons theme
|
|
||||||
Comment[hu]=Programkönyvtár a KDE emotikon-témához
|
|
||||||
Comment[hy]=Գրադարան որպեսզի KDE-ի էմոտիքոնների ոճը օգտագործել
|
|
||||||
Comment[ia]=Libreria per usar le thema de emoticones de KDE
|
|
||||||
Comment[id]=Pustaka untuk menggunakan tema emoticon KDE
|
|
||||||
Comment[is]=Forritlingasafn til notkunar með KDE broskallaþema
|
|
||||||
Comment[it]=Libreria per usare il tema faccine di Kde
|
|
||||||
Comment[ja]=KDE 感情アイコンテーマのライブラリ
|
|
||||||
Comment[kk]=KDE көңіл-күй белгілер нақышының жиыны
|
|
||||||
Comment[km]=បណ្ណាល័យត្រូវប្រើស្បែកសញ្ញាអារម្មណ៍របស់ KDE
|
|
||||||
Comment[kn]=ಕೆಡಿಇ ಭಾವನಾಚಿಹ್ನೆಗಳ (ಎಮೋಟಿಕಾನ್) ಪರಿಸರವಿನ್ಯಾಸವನ್ನು (ಥೀಮ್) ಬಳಸಲು ಒಂದು ಭಂಡಾರ (ಲೈಬ್ರರಿ)
|
|
||||||
Comment[ko]=KDE 이모티콘 테마를 사용할 라이브러리
|
|
||||||
Comment[ku]=Pirtûkxane ji bo bi kar anîna Dirba Vegotinan yê KDE
|
|
||||||
Comment[lt]=Biblioteka, leidžianti naudoti kde jaustukų temą
|
|
||||||
Comment[lv]=KDE emocijzīmju tēmas bibliotēka
|
|
||||||
Comment[mai]=केडीई भावचिन्ह प्रसंगक प्रयोगक लेल लाइब्रेरी
|
|
||||||
Comment[ml]=കെഡിഇ ഇമോട്ടിക്കോണ് രംഗവിതാനം ഉപയോഗിയ്ക്കേണ്ട ലൈബ്രറി
|
|
||||||
Comment[mr]=केडीई भावप्रतिमा शैली वापरण्याकरिता लायब्ररी
|
|
||||||
Comment[nb]=Bibliotek for å bruke KDE smilefjestema
|
|
||||||
Comment[nds]=Bibliotheek, mit de sik dat KDE-Snutensett bruken lett
|
|
||||||
Comment[nl]=Bibliotheek voor het gebruik van het KDE-emoticonsthema
|
|
||||||
Comment[nn]=Bibliotek for å bruka fjesingtema frå KDE
|
|
||||||
Comment[or]=Kde Emoticons ପ୍ରସଙ୍ଗକୁ ବ୍ୟବହାର କରିବା ପାଇଁ ଲାଇବ୍ରେରୀ
|
|
||||||
Comment[pa]=ਕੇਡੀਈ ਈਮੋਸ਼ਨ ਥੀਮ ਵਰਤਣ ਲਈ ਲਾਈਬਰੇਰੀ
|
|
||||||
Comment[pl]=Biblioteka do motywu emotikon KDE
|
|
||||||
Comment[pt]=Uma biblioteca para usar os temas de ícones emotivos do KDE
|
|
||||||
Comment[pt_BR]=Biblioteca para uso do tema de emoticons do KDE
|
|
||||||
Comment[ro]=Bibliotecă de utilizat tematica de emoticoni KDE
|
|
||||||
Comment[ru]=Библиотека набора смайликов KDE
|
|
||||||
Comment[se]=Bibliotehka mii dulko KDE mojánfáttáid
|
|
||||||
Comment[si]=KDE emoticons තේමාව සඳහා භාවිත කළ යුතු පුස්තකාලය
|
|
||||||
Comment[sk]=Knižnica na použitie témy emotikonov KDE
|
|
||||||
Comment[sl]=Knjižnica za uporabo KDE-jeve teme izraznih ikon
|
|
||||||
Comment[sr]=Библиотека за КДЕ‑ову тему емотикона
|
|
||||||
Comment[sr@ijekavian]=Библиотека за КДЕ‑ову тему емотикона
|
|
||||||
Comment[sr@ijekavianlatin]=Biblioteka za KDE‑ovu temu emotikona
|
|
||||||
Comment[sr@latin]=Biblioteka za KDE‑ovu temu emotikona
|
|
||||||
Comment[sv]=Bibliotek för att använda KDE smilistema
|
|
||||||
Comment[ta]=நிரலகம் கேடியி உணர்வுரு தோற்றத்தை பயன்படுத்தும்
|
|
||||||
Comment[tg]=Китобхонаи мавзӯъи KDE emoticons
|
|
||||||
Comment[th]=ไลบรารีที่ใช้ภาพไอคอนสื่ออารมณ์ของ KDE
|
|
||||||
Comment[tr]=Kde Duygu Simgesi Temasını kullanmak için kitaplık
|
|
||||||
Comment[tt]=KDE көлчек җыелмасы өчен китапханә
|
|
||||||
Comment[ug]=KDE چىراي ئىپادە ئۆرنىكىنى ئىشلىتىدىغان ئامبار
|
|
||||||
Comment[uk]=Бібліотека для використання теми емоційок KDE
|
|
||||||
Comment[vi]=Thư viện để sử dụng giao diện hình biểu cảm KDE
|
|
||||||
Comment[wa]=Livreye pos eployî l' tinme di xhinêyes KDE
|
|
||||||
Comment[x-test]=xxLibrary to use KDE emoticons themexx
|
|
||||||
Comment[zh_CN]=使用 KDE 表情主题的类库
|
|
||||||
Comment[zh_TW]=使用 KDE 表情圖示主題的函式庫
|
|
||||||
X-KDE-ServiceTypes=KEmoticons
|
|
||||||
X-KDE-Library=emoticonstheme_kde
|
|
||||||
X-KDE-EmoticonsFileName=emoticons.xml
|
|
||||||
X-KDE-Priority=10
|
|
|
@ -1,219 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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/>.*
|
|
||||||
* *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
#include "kde_emoticons.h"
|
|
||||||
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtGui/QImageReader>
|
|
||||||
#include <QtGui/QTextDocument>
|
|
||||||
|
|
||||||
#include <kpluginfactory.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(KdeEmoticonsFactory, registerPlugin<KdeEmoticons>();)
|
|
||||||
K_EXPORT_PLUGIN(KdeEmoticonsFactory("KdeEmoticons"))
|
|
||||||
|
|
||||||
KdeEmoticons::KdeEmoticons(QObject *parent, const QVariantList &args)
|
|
||||||
: KEmoticonsProvider(parent)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KdeEmoticons::removeEmoticon(const QString &emo)
|
|
||||||
{
|
|
||||||
QString emoticon = QFileInfo(emoticonsMap().key(emo.split(' '))).fileName();
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("messaging-emoticon-map");
|
|
||||||
|
|
||||||
if (fce.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomNodeList nl = fce.childNodes();
|
|
||||||
// the lenght() method had a TODO which is done in Katie
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int i = 0; i < nl.length(); i++ )
|
|
||||||
#else
|
|
||||||
for (uint i = 0; i < nl.length(); i++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement de = nl.item(i).toElement();
|
|
||||||
if (!de.isNull() && de.tagName() == "emoticon" && (de.attribute("file") == emoticon || de.attribute("file") == QFileInfo(emoticon).baseName())) {
|
|
||||||
fce.removeChild(de);
|
|
||||||
removeEmoticonsMap(emoticonsMap().key(emo.split(' ')));
|
|
||||||
removeEmoticonIndex(emoticon, emo.split(' '));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KdeEmoticons::addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::addEmoticon(emo, text, option);
|
|
||||||
|
|
||||||
const QStringList splitted = text.split(' ');
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("messaging-emoticon-map");
|
|
||||||
|
|
||||||
if (fce.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomElement emoticon = m_themeXml.createElement("emoticon");
|
|
||||||
emoticon.setAttribute("file", QFileInfo(emo).fileName());
|
|
||||||
fce.appendChild(emoticon);
|
|
||||||
foreach (const QString it, splitted) {
|
|
||||||
QDomElement emoText = m_themeXml.createElement("string");
|
|
||||||
QDomText txt = m_themeXml.createTextNode(it.trimmed());
|
|
||||||
emoText.appendChild(txt);
|
|
||||||
emoticon.appendChild(emoText);
|
|
||||||
}
|
|
||||||
|
|
||||||
addEmoticonIndex(emo, splitted);
|
|
||||||
addEmoticonsMap(emo, splitted);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeEmoticons::save()
|
|
||||||
{
|
|
||||||
QFile fp(themePath() + '/' + fileName());
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << fp.fileName() << "doesn't exist!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream emoStream(&fp);
|
|
||||||
emoStream.setCodec( "UTF-8" );
|
|
||||||
emoStream << m_themeXml.toString(4);
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool KdeEmoticons::loadTheme(const QString &path)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::loadTheme(path);
|
|
||||||
|
|
||||||
QFile fp(path);
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << path << "doesn't exist!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::ReadOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open ReadOnly!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString error;
|
|
||||||
int eli, eco;
|
|
||||||
if (!m_themeXml.setContent(&fp, &error, &eli, &eco)) {
|
|
||||||
kWarning() << fp.fileName() << "can't copy to xml!";
|
|
||||||
kWarning() << error << "line:" << eli << "column:" << eco;
|
|
||||||
fp.close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp.close();
|
|
||||||
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("messaging-emoticon-map");
|
|
||||||
|
|
||||||
if (fce.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomNodeList nl = fce.childNodes();
|
|
||||||
|
|
||||||
clearEmoticonsMap();
|
|
||||||
|
|
||||||
// the lenght() method had a TODO which is done in Katie
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int i = 0; i < nl.length(); i++ )
|
|
||||||
#else
|
|
||||||
for (uint i = 0; i < nl.length(); i++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement de = nl.item(i).toElement();
|
|
||||||
|
|
||||||
if (!de.isNull() && de.tagName() == "emoticon") {
|
|
||||||
QDomNodeList snl = de.childNodes();
|
|
||||||
QStringList sl;
|
|
||||||
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int k = 0; k < snl.length(); k++ )
|
|
||||||
#else
|
|
||||||
for (uint k = 0; k < snl.length(); k++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement sde = snl.item(k).toElement();
|
|
||||||
|
|
||||||
if (!sde.isNull() && sde.tagName() == "string") {
|
|
||||||
sl << sde.text();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QString emo = KGlobal::dirs()->findResource("emoticons", themeName() + '/' + de.attribute("file"));
|
|
||||||
|
|
||||||
if (emo.isEmpty()) {
|
|
||||||
QList<QByteArray> ext = QImageReader::supportedImageFormats();
|
|
||||||
|
|
||||||
for (int j = 0; j < ext.size(); ++j) {
|
|
||||||
emo = KGlobal::dirs()->findResource("emoticons", themeName() + '/' + de.attribute("file") + '.' + ext.at(j));
|
|
||||||
if (!emo.isEmpty()) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emo.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addEmoticonIndex(emo, sl);
|
|
||||||
addEmoticonsMap(emo, sl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void KdeEmoticons::createNew()
|
|
||||||
{
|
|
||||||
QString path = KGlobal::dirs()->saveLocation("emoticons", themeName());
|
|
||||||
|
|
||||||
QFile fp(path + '/' + "emoticons.xml");
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomDocument doc;
|
|
||||||
doc.appendChild(doc.createProcessingInstruction("xml", "version=\"1.0\""));
|
|
||||||
doc.appendChild(doc.createElement("messaging-emoticon-map"));
|
|
||||||
|
|
||||||
QTextStream emoStream(&fp);
|
|
||||||
emoStream.setCodec( "UTF-8" );
|
|
||||||
emoStream << doc.toString(4);
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,46 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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 KDE_EMOTICONS_H
|
|
||||||
#define KDE_EMOTICONS_H
|
|
||||||
|
|
||||||
#include <kemoticonsprovider.h>
|
|
||||||
|
|
||||||
#include <QtXml/qdom.h>
|
|
||||||
|
|
||||||
class KdeEmoticons : public KEmoticonsProvider
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
KdeEmoticons(QObject *parent, const QVariantList &args);
|
|
||||||
|
|
||||||
bool loadTheme(const QString &path);
|
|
||||||
|
|
||||||
bool removeEmoticon(const QString &emo);
|
|
||||||
bool addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option = DoNotCopy);
|
|
||||||
void save();
|
|
||||||
|
|
||||||
void createNew();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QDomDocument m_themeXml;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* KDE_EMOTICONS_H */
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,24 +0,0 @@
|
||||||
include_directories(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
|
||||||
)
|
|
||||||
|
|
||||||
########### next target ###############
|
|
||||||
|
|
||||||
kde4_add_plugin(emoticonstheme_pidgin pidgin_emoticons.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(emoticonstheme_pidgin
|
|
||||||
${KDE4_KDEUI_LIBS}
|
|
||||||
${KDE4_KEMOTICONS_LIBS}
|
|
||||||
)
|
|
||||||
|
|
||||||
########### install files ###############
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS emoticonstheme_pidgin
|
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
FILES emoticonstheme_pidgin.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
|
||||||
)
|
|
|
@ -1,167 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=Service
|
|
||||||
Name=Pidgin Emoticons Theme
|
|
||||||
Name[ar]=سمة ابتسامات Pidgin
|
|
||||||
Name[as]=Pidgin Emoticons থিম
|
|
||||||
Name[ast]=Tema d'emoticonos Pidgin
|
|
||||||
Name[be@latin]=Matyŭ smajlikaŭ dla „Pidgin”
|
|
||||||
Name[bg]=Тема с емоции Pidgin
|
|
||||||
Name[bn]=পিজিন ইমোট-আইকন থীম
|
|
||||||
Name[bn_IN]=Pidgin ইমো-আইকন থিম
|
|
||||||
Name[bs]=Pidžinova tema emotikona
|
|
||||||
Name[ca]=Tema d'emoticones Pidgin
|
|
||||||
Name[ca@valencia]=Tema d'emoticones Pidgin
|
|
||||||
Name[cs]=Motiv emotikonů Pidgin
|
|
||||||
Name[csb]=Témë emòtikównków Pidgina
|
|
||||||
Name[da]=Pidgin emotikon-tema
|
|
||||||
Name[de]=Pidgin-Emoticon-Design
|
|
||||||
Name[el]=Θέμα εικονιδίων διάθεσης Pidgin
|
|
||||||
Name[en_GB]=Pidgin Emoticons Theme
|
|
||||||
Name[eo]=Pidgin Mien-Etoso
|
|
||||||
Name[es]=Tema de emoticonos Pidgin
|
|
||||||
Name[et]=Pidgini emotikoniteema
|
|
||||||
Name[eu]=Pidgin-en aurpegiera gaia
|
|
||||||
Name[fi]=Pidgin-hymiöteemat
|
|
||||||
Name[fr]=Thème d'émoticônes pour Pidgin
|
|
||||||
Name[fy]=Pidgin emoticons tema
|
|
||||||
Name[ga]=Téama Straoiseog Pidgin
|
|
||||||
Name[gl]=Tema de emoticonas de Pidgin
|
|
||||||
Name[gu]=પીડગીન ઇમોકેશન થીમ ઉપયોગ કરવા માટેની લાઇબ્રેરી
|
|
||||||
Name[he]=ערכת פרצופונים של Pidgin
|
|
||||||
Name[hi]=पिडजिन हँसमुख प्रसंग
|
|
||||||
Name[hne]=पिडगिन चेहराचिनहा थीम
|
|
||||||
Name[hr]=Pidginova tema emotikona
|
|
||||||
Name[hsb]=Pidgin Emoticons Theme
|
|
||||||
Name[hu]=Pidgin emotikon-téma
|
|
||||||
Name[hy]=Pidgin-ի էմոտիքոնների ոճ
|
|
||||||
Name[ia]=Thema de emoticones Pidgin
|
|
||||||
Name[id]=Tema Emoticon Pidgin
|
|
||||||
Name[is]=Pidgin broskallaþema
|
|
||||||
Name[it]=Tema faccine Pidgin
|
|
||||||
Name[ja]=Pidgin 感情アイコンテーマ
|
|
||||||
Name[kk]=Pidgin көңіл-күй белгілер нақышы
|
|
||||||
Name[km]=ស្បែកសញ្ញាអារម្មណ៍របស់ Pidgin
|
|
||||||
Name[kn]=ಪಿಡ್ಗಿನ್ (ಎಮೋಟಿಕಾನ್ಸ್) ಪರಿಸರವಿನ್ಯಾಸ (ಥೀಮ್)
|
|
||||||
Name[ko]=피진 이모티콘 테마
|
|
||||||
Name[ku]=Dirba Vegotinan yê Pidgin
|
|
||||||
Name[lt]=Pidgin jaustukų tema
|
|
||||||
Name[lv]=Pidgin emocijzīmju tēma
|
|
||||||
Name[mai]=पिजिन भावचिन्ह प्रसंग
|
|
||||||
Name[ml]=പിഡ്ജിന് ഇമോട്ടിക്കോണ് രംഗവിതാനം
|
|
||||||
Name[mr]=पिडगिन भावप्रतिमा शैली
|
|
||||||
Name[nb]=Pidgin smilefjestema
|
|
||||||
Name[nds]=Snutensett Pidgin
|
|
||||||
Name[nl]=Pidgin-emoticonsthema
|
|
||||||
Name[nn]=Pidgin-fjesingtema
|
|
||||||
Name[or]=Pidgin Emoticons ପ୍ରସଙ୍ଗ
|
|
||||||
Name[pa]=ਪਿਡਗਿਨ ਈਮੋਸ਼ਨ ਥੀਮ
|
|
||||||
Name[pl]=Motyw emotikon Pidgin
|
|
||||||
Name[pt]=Tema de Ícones Emotivos do Pidgin
|
|
||||||
Name[pt_BR]=Tema de emoticons do Pidgin
|
|
||||||
Name[ro]=Tematică de emoticoni Pidgin
|
|
||||||
Name[ru]=Набор смайликов Pidgin
|
|
||||||
Name[se]=Piding mojánfáddá
|
|
||||||
Name[si]=Pidgin Emoticons තේමාව
|
|
||||||
Name[sk]=Téma emotikonov Pidgin
|
|
||||||
Name[sl]=Tema izraznih ikon Pidgin
|
|
||||||
Name[sr]=Пиџинова тема емотикона
|
|
||||||
Name[sr@ijekavian]=Пиџинова тема емотикона
|
|
||||||
Name[sr@ijekavianlatin]=Pidginova tema emotikona
|
|
||||||
Name[sr@latin]=Pidginova tema emotikona
|
|
||||||
Name[sv]=Pidgin smilistema
|
|
||||||
Name[ta]=பிட்கின் உணர்வுருக்கள் தோற்றம்
|
|
||||||
Name[tg]=Мавзӯъи Pidgin Emoticons
|
|
||||||
Name[th]=ภาพไอคอนสื่ออารมณ์ของ Pidgin
|
|
||||||
Name[tr]=Pidgin Duygu Simgesi Teması
|
|
||||||
Name[tt]=Pidgin көлчекләр җыелмасы
|
|
||||||
Name[ug]=Pidgin چىراي ئىپادە ئۆرنىكى
|
|
||||||
Name[uk]=Тема емоційок Pidgin
|
|
||||||
Name[vi]=Giao diện hình biểu cảm Pidgin
|
|
||||||
Name[wa]=Tinme di xhinêyes Pidgin
|
|
||||||
Name[x-test]=xxPidgin Emoticons Themexx
|
|
||||||
Name[zh_CN]=Pidgin 表情主题
|
|
||||||
Name[zh_TW]=Pidgin 表情圖示主題
|
|
||||||
Comment=Library to use Pidgin emoticons theme
|
|
||||||
Comment[ar]=مكتبة لاستخدام سمة ابتسامات Pidgin
|
|
||||||
Comment[as]=Pidgin Emoticons থিম ব্যৱহাৰ কৰা লাইব্ৰেৰী
|
|
||||||
Comment[ast]=Biblioteca pa usar el tema d'emoticonos Pidgin
|
|
||||||
Comment[be@latin]=Biblijateka dla matyvaŭ smajlikaŭ „Pidgin”
|
|
||||||
Comment[bg]=Библиотека за темата с емоции Pidgin
|
|
||||||
Comment[bn]=পিজিন ইমোট-আইকন থীম ব্যবহার করার লাইব্রেরী
|
|
||||||
Comment[bn_IN]=Pidgin ইমো-আইকন থিম প্রয়োগ করতে ব্যবহৃত লাইব্রেরি
|
|
||||||
Comment[bs]=Biblioteka za Pidžinovu temu emotikona
|
|
||||||
Comment[ca]=Biblioteca per a usar el tema d'emoticones Pidgin
|
|
||||||
Comment[ca@valencia]=Biblioteca per a usar el tema d'emoticones Pidgin
|
|
||||||
Comment[cs]=Knihovna pro použití motivu emotikonů Pidgin
|
|
||||||
Comment[csb]=Bibloteka do brëkòwaniô emòtikónków temë Pidgina
|
|
||||||
Comment[da]=Bibliotek til at bruge Pidgin emotikon-temaer
|
|
||||||
Comment[de]=Bibliothek zur Verwendung des Pidgin-Emoticon-Designs
|
|
||||||
Comment[el]=Βιβλιοθήκη για τη χρήση του θέματος εικονιδίων διάθεσης Pidgin
|
|
||||||
Comment[en_GB]=Library to use Pidgin emoticons theme
|
|
||||||
Comment[eo]=Biblioteko por uzi Pidgin Mien-Etoson
|
|
||||||
Comment[es]=Biblioteca para usar el tema de emoticonos Pidgin
|
|
||||||
Comment[et]=Teek Pidgini emotikoniteema kasutamiseks
|
|
||||||
Comment[eu]=Pidgin-en aurpegiera gaia erabiltzeko liburutegia
|
|
||||||
Comment[fi]=Kirjasto Pidgin-hymiöteemojen käyttämiseen
|
|
||||||
Comment[fr]=Bibliothèque permettant d'utiliser les thèmes d'émoticônes de Pidgin
|
|
||||||
Comment[fy]=Biblioteek om Pidgin emoticons tema te brûken
|
|
||||||
Comment[ga]=Leabharlann le húsáid téama straoiseog Pidgin
|
|
||||||
Comment[gl]=Unha biblioteca para empregar temas de emoticonas de Pidgin
|
|
||||||
Comment[gu]=પીડગીન ઇમોકેશન થીમ ઉપયોગ કરવા માટેની લાઇબ્રેરી
|
|
||||||
Comment[he]=ספרייה לשימוש בערכת הפרצופונים של Pidgin
|
|
||||||
Comment[hne]=पिडगिन चेहराचिनहा थीम ल उपयोग करे बर लाइब्रेरी
|
|
||||||
Comment[hr]=Biblioteka za korištenje Pidginove teme emotikona
|
|
||||||
Comment[hsb]=Biblioteka za Pidgin emoticons theme
|
|
||||||
Comment[hu]=Programkönyvtár a Pidgin emotikon-témához
|
|
||||||
Comment[hy]=Գրադարան որպեսզի Pidgin-ի էմոտիքոնների ոճը օգտագործել
|
|
||||||
Comment[ia]=Libreria per usar le thema de emoticones Pidgin
|
|
||||||
Comment[id]=Pustaka untuk menggunakan tema emoticon Pidgin
|
|
||||||
Comment[is]=Forritlingasafn til notkunar með Pidgin broskallaþema
|
|
||||||
Comment[it]=Libreria per usare il tema faccine Pidgin
|
|
||||||
Comment[ja]=Pidgin 感情アイコンテーマのライブラリ
|
|
||||||
Comment[kk]=Pidgin көңіл-күй белгілер нақышының жиыны
|
|
||||||
Comment[km]=បណ្ណាល័យត្រូវប្រើស្បែកសញ្ញាអារម្មណ៍របស់ Pidgin
|
|
||||||
Comment[kn]=ಪಿಡ್ಗಿನ್ ಭಾವನಾಚಿಹ್ನೆಗಳ (ಎಮೋಟಿಕಾನ್) ಪರಿಸರವಿನ್ಯಾಸವನ್ನು (ಥೀಮ್) ಬಳಸಲು ಒಂದು ಭಂಡಾರ (ಲೈಬ್ರರಿ)
|
|
||||||
Comment[ko]=피진 이모티콘 테마를 사용할 라이브러리
|
|
||||||
Comment[ku]=Pirtûkxane ji bo bi kar anîna Dirba Vegotinan yê Pidgin
|
|
||||||
Comment[lt]=Biblioteka, leidžianti naudoti Pidgin jaustukų temą
|
|
||||||
Comment[lv]=Pidgin emocijzīmju tēmas bibliotēka
|
|
||||||
Comment[mai]=पिजिन भावचिन्ह प्रसंगक प्रयोगक लेल लाइब्रेरी
|
|
||||||
Comment[ml]=പിഡ്ജിന് ഇമോട്ടിക്കോണ് രംഗവിതാനം ഉപയോഗിയ്ക്കേണ്ട ലൈബ്രറി
|
|
||||||
Comment[mr]=पिडगिन भावप्रतिमा शैली वापरण्याकरिता लायब्ररी
|
|
||||||
Comment[nb]=Bibliotek for å bruke Pidgin smilefjestema
|
|
||||||
Comment[nds]=Bibliotheek, mit de sik dat Snutensett Pidgin bruken lett
|
|
||||||
Comment[nl]=Bibliotheek voor het gebruik van het Pidgin-emoticonsthema
|
|
||||||
Comment[nn]=Bibliotek for å bruka fjesingtema frå Pidgin
|
|
||||||
Comment[or]=Pidgin Emoticons ପ୍ରସଙ୍ଗକୁ ବ୍ୟବହାର କରିବା ପାଇଁ ଲାଇବ୍ରେରୀ
|
|
||||||
Comment[pa]=ਪਿਡਗਿਨ ਈਮੋਸ਼ਨ ਥੀਮ ਲਈ ਲਾਇਬਰੇਰੀ
|
|
||||||
Comment[pl]=Biblioteka do motywu emotikon Pidgin
|
|
||||||
Comment[pt]=Uma biblioteca para usar os temas de ícones emotivos do Pidgin
|
|
||||||
Comment[pt_BR]=Biblioteca para uso do tema de emoticons do Pidgin
|
|
||||||
Comment[ro]=Bibliotecă de utilizat tematica de emoticoni Pidgin
|
|
||||||
Comment[ru]=Библиотека набора смайликов Pidgin
|
|
||||||
Comment[se]=Bibliotehkta mii dulko Pidgin mojánfáttáid
|
|
||||||
Comment[si]=Pidgin Emoticons තේමාව තේමාව සඳහා භාවිත කළ යුතු පුස්තකාලය
|
|
||||||
Comment[sk]=Knižnica na použitie témy emotikonov Pidgin
|
|
||||||
Comment[sl]=Knjižnica za uporabo Pidginove teme izraznih ikon
|
|
||||||
Comment[sr]=Библиотека за Пиџинову тему емотикона
|
|
||||||
Comment[sr@ijekavian]=Библиотека за Пиџинову тему емотикона
|
|
||||||
Comment[sr@ijekavianlatin]=Biblioteka za Pidginovu temu emotikona
|
|
||||||
Comment[sr@latin]=Biblioteka za Pidginovu temu emotikona
|
|
||||||
Comment[sv]=Bibliotek för att använda Pidgin smilistema
|
|
||||||
Comment[ta]=நிரலகம் பிட்கின் உணர்வுரு தோற்றத்தை பயன்படுத்தும்
|
|
||||||
Comment[tg]=Китобхонаи мавзӯъи Pidgin emoticons
|
|
||||||
Comment[th]=ไลบรารีที่ใช้ภาพไอคอนสื่ออารมณ์ของ Pidgin
|
|
||||||
Comment[tr]=Pidgin Duygu Simgesi Temasını kullanmak için kitaplık
|
|
||||||
Comment[tt]=Pidgin көлчек җыелмасы өчен китапханә
|
|
||||||
Comment[ug]=Pidgin چىراي ئىپادە ئۆرنىكىنى ئىشلىتىدىغان ئامبار
|
|
||||||
Comment[uk]=Бібліотека для використання теми емоційок Pidgin
|
|
||||||
Comment[vi]=Thư viện để sử dụng giao diện hình biểu cảm Pidgin
|
|
||||||
Comment[wa]=Livreye pos eployî l' tinme di xhinêyes Pidgin
|
|
||||||
Comment[x-test]=xxLibrary to use Pidgin emoticons themexx
|
|
||||||
Comment[zh_CN]=使用 Pidgin 表情主题的类库
|
|
||||||
Comment[zh_TW]=使用 Pidgin 表情圖示主題的函式庫
|
|
||||||
X-KDE-ServiceTypes=KEmoticons
|
|
||||||
X-KDE-Library=emoticonstheme_pidgin
|
|
||||||
X-KDE-EmoticonsFileName=theme
|
|
||||||
X-KDE-Priority=7
|
|
|
@ -1,219 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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/>.*
|
|
||||||
* *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
#include "pidgin_emoticons.h"
|
|
||||||
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
|
|
||||||
#include <kpluginfactory.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(PidginEmoticonsFactory, registerPlugin<PidginEmoticons>();)
|
|
||||||
K_EXPORT_PLUGIN(PidginEmoticonsFactory("PidginEmoticons"))
|
|
||||||
|
|
||||||
PidginEmoticons::PidginEmoticons(QObject *parent, const QVariantList &args)
|
|
||||||
: KEmoticonsProvider(parent)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PidginEmoticons::removeEmoticon(const QString &emo)
|
|
||||||
{
|
|
||||||
QString emoticon = QFileInfo(emoticonsMap().key(emo.split(' '))).fileName();
|
|
||||||
|
|
||||||
bool start = false;
|
|
||||||
for (int i = 0; i < m_text.size(); ++i) {
|
|
||||||
QString line = m_text.at(i);
|
|
||||||
|
|
||||||
if (line.startsWith('#') || line.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRegExp re("^\\[(.*)\\]$");
|
|
||||||
int pos = re.indexIn(line.trimmed());
|
|
||||||
if (pos > -1) {
|
|
||||||
if (!re.cap(1).compare("default", Qt::CaseInsensitive)) {
|
|
||||||
start = true;
|
|
||||||
} else {
|
|
||||||
start = false;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!start) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList splitted = line.split(' ');
|
|
||||||
QString emoName;
|
|
||||||
|
|
||||||
if (splitted.at(0) == "!") {
|
|
||||||
emoName = splitted.at(1);
|
|
||||||
} else {
|
|
||||||
emoName = splitted.at(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (emoName == emoticon) {
|
|
||||||
m_text.removeAt(i);
|
|
||||||
removeEmoticonIndex(emoticon, emo.split(' '));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PidginEmoticons::addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::addEmoticon(emo, text, option);
|
|
||||||
|
|
||||||
const QStringList splitted = text.split(' ');
|
|
||||||
int i = m_text.indexOf(QRegExp("^\\[default\\]$", Qt::CaseInsensitive));
|
|
||||||
|
|
||||||
if (i == -1) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString emoticon = QString("%1 %2").arg(QFileInfo(emo).fileName()).arg(text);
|
|
||||||
m_text.insert(i + 1, emoticon);
|
|
||||||
|
|
||||||
addEmoticonIndex(emo, splitted);
|
|
||||||
addEmoticonsMap(emo, splitted);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PidginEmoticons::save()
|
|
||||||
{
|
|
||||||
QFile fp(themePath() + '/' + fileName());
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << fp.fileName() << "doesn't exist!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream emoStream(&fp);
|
|
||||||
|
|
||||||
if (m_text.indexOf(QRegExp("^Icon=.*", Qt::CaseInsensitive)) == -1) {
|
|
||||||
int i = m_text.indexOf(QRegExp("^Description=.*", Qt::CaseInsensitive));
|
|
||||||
QString file = QFileInfo(emoticonsMap().keys().value(0)).fileName();
|
|
||||||
m_text.insert(i + 1, "Icon=" + file);
|
|
||||||
}
|
|
||||||
|
|
||||||
emoStream << m_text.join("\n");
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PidginEmoticons::loadTheme(const QString &path)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::loadTheme(path);
|
|
||||||
|
|
||||||
QFile fp(path);
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << path << "doesn't exist!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::ReadOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open ReadOnly!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream str(&fp);
|
|
||||||
bool start = false;
|
|
||||||
m_text.clear();
|
|
||||||
while (!str.atEnd()) {
|
|
||||||
QString line = str.readLine();
|
|
||||||
m_text << line;
|
|
||||||
|
|
||||||
if (line.startsWith('#') || line.isEmpty()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QRegExp re("^\\[(.*)\\]$");
|
|
||||||
int pos = re.indexIn(line.trimmed());
|
|
||||||
if (pos > -1) {
|
|
||||||
if (!re.cap(1).compare("default", Qt::CaseInsensitive)) {
|
|
||||||
start = true;
|
|
||||||
} else {
|
|
||||||
start = false;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!start) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList splitted = line.split(QRegExp("\\s+"));
|
|
||||||
QString emo;
|
|
||||||
int i = 1;
|
|
||||||
if (splitted.at(0) == "!") {
|
|
||||||
i = 2;
|
|
||||||
emo = KGlobal::dirs()->findResource("emoticons", themeName() + '/' + splitted.at(1));
|
|
||||||
} else {
|
|
||||||
emo = KGlobal::dirs()->findResource("emoticons", themeName() + '/' + splitted.at(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
QStringList sl;
|
|
||||||
for (; i < splitted.size(); ++i) {
|
|
||||||
if (!splitted.at(i).isEmpty() && splitted.at(i) != " ") {
|
|
||||||
sl << splitted.at(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addEmoticonIndex(emo, sl);
|
|
||||||
addEmoticonsMap(emo, sl);
|
|
||||||
}
|
|
||||||
|
|
||||||
fp.close();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PidginEmoticons::createNew()
|
|
||||||
{
|
|
||||||
QString path = KGlobal::dirs()->saveLocation("emoticons", themeName());
|
|
||||||
|
|
||||||
QFile fp(path + '/' + "theme");
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream out(&fp);
|
|
||||||
out.setCodec( "UTF-8" );
|
|
||||||
|
|
||||||
out << "Name=" + themeName() << endl;
|
|
||||||
out << "Description=" + themeName() << endl;
|
|
||||||
out << "Author=" << endl;
|
|
||||||
out << endl;
|
|
||||||
out << "[default]" << endl;
|
|
||||||
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,44 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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 PIDGIN_EMOTICONS_H
|
|
||||||
#define PIDGIN_EMOTICONS_H
|
|
||||||
|
|
||||||
#include <kemoticonsprovider.h>
|
|
||||||
|
|
||||||
class PidginEmoticons : public KEmoticonsProvider
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
PidginEmoticons(QObject *parent, const QVariantList &args);
|
|
||||||
|
|
||||||
bool loadTheme(const QString &path);
|
|
||||||
|
|
||||||
bool removeEmoticon(const QString &emo);
|
|
||||||
bool addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option = DoNotCopy);
|
|
||||||
void save();
|
|
||||||
|
|
||||||
void createNew();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QStringList m_text;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* PIDGIN_EMOTICONS_H */
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,25 +0,0 @@
|
||||||
include_directories(
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../..
|
|
||||||
)
|
|
||||||
|
|
||||||
########### next target ###############
|
|
||||||
|
|
||||||
kde4_add_plugin(emoticonstheme_xmpp xmpp_emoticons.cpp)
|
|
||||||
|
|
||||||
target_link_libraries(emoticonstheme_xmpp
|
|
||||||
${KDE4_KDEUI_LIBS}
|
|
||||||
${KDE4_KEMOTICONS_LIBS}
|
|
||||||
${QT_QTXML_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
########### install files ###############
|
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS emoticonstheme_xmpp
|
|
||||||
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
|
|
||||||
)
|
|
||||||
install(
|
|
||||||
FILES emoticonstheme_xmpp.desktop
|
|
||||||
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
|
|
||||||
)
|
|
|
@ -1,166 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Type=Service
|
|
||||||
Name=XMPP Emoticons Theme
|
|
||||||
Name[ar]=سمة ابتسامات XMPP
|
|
||||||
Name[as]=XMPP Emoticons থিম
|
|
||||||
Name[ast]=Tema d'emoticonos XMPP
|
|
||||||
Name[be@latin]=Matyŭ smajlikaŭ dla „XMPP”
|
|
||||||
Name[bg]=Тема с емоции XMPP
|
|
||||||
Name[bn]=এক্স-এম-পি-পি ইমোট-আইকন থীম
|
|
||||||
Name[bn_IN]=XMPP ইমো-আইকন থিম
|
|
||||||
Name[bs]=XMPP tema emotikona
|
|
||||||
Name[ca]=Tema d'emoticones XMPP
|
|
||||||
Name[ca@valencia]=Tema d'emoticones XMPP
|
|
||||||
Name[cs]=Motiv emotikonů XMPP
|
|
||||||
Name[csb]=Témë emòtikównków XMPP
|
|
||||||
Name[da]=XMPP emotikon-tema
|
|
||||||
Name[de]=XMPP-Emoticon-Design
|
|
||||||
Name[el]=Θέμα εικονιδίων διάθεσης XMPP
|
|
||||||
Name[en_GB]=XMPP Emoticons Theme
|
|
||||||
Name[eo]=XMPP Mien-Etoso
|
|
||||||
Name[es]=Tema de emoticonos XMPP
|
|
||||||
Name[et]=XMPP emotikoniteema
|
|
||||||
Name[eu]=XMPP-ren aurpegiera gaia
|
|
||||||
Name[fi]=XMPP-hymiöteemat
|
|
||||||
Name[fr]=Thèmes d'émoticônes « XMPP »
|
|
||||||
Name[fy]=XMPP emoticons theme
|
|
||||||
Name[ga]=Téama Straoiseog XMPP
|
|
||||||
Name[gl]=Tema de emoticonas de XMPP
|
|
||||||
Name[gu]=XMPP ઇમોકેશન થીમ
|
|
||||||
Name[he]=ערכת פרצופונים של XMPP
|
|
||||||
Name[hne]=एक्सएमपीपी चेहराचिनहा थीम
|
|
||||||
Name[hr]=XMPP-ova tema emotikona
|
|
||||||
Name[hsb]=XMPP Emoticons Theme
|
|
||||||
Name[hu]=XMPP emotikon-téma
|
|
||||||
Name[hy]=XMPP էմոտիքոնների ոճ
|
|
||||||
Name[ia]=Thema de emoticones XMPP
|
|
||||||
Name[id]=Tema Emoticon XMPP
|
|
||||||
Name[is]=XMPP broskallaþema
|
|
||||||
Name[it]=Tema faccine XMPP
|
|
||||||
Name[ja]=XMPP 感情アイコンテーマ
|
|
||||||
Name[kk]=XMPP көңіл-күй белгілер нақышы
|
|
||||||
Name[km]=ស្បែកសញ្ញាអារម្មណ៍របស់ XMPP
|
|
||||||
Name[kn]=XMPP (ಎಮೋಟಿಕಾನ್ಸ್) ಪರಿಸರವಿನ್ಯಾಸ (ಥೀಮ್)
|
|
||||||
Name[ko]=XMPP 이모티콘 테마
|
|
||||||
Name[ku]=Dirba Vegotinan yê XMPP
|
|
||||||
Name[lt]=XMPP jaustukų tema
|
|
||||||
Name[lv]=XMPP emocijzīmju tēma
|
|
||||||
Name[mai]=एक्सएमपीपी भावचिन्ह प्रसंग
|
|
||||||
Name[ml]=എക്സ്എംപിപി ഇമോട്ടിക്കോണ് രംഗവിതാനം
|
|
||||||
Name[mr]=XMPP भावप्रतिमा शैली
|
|
||||||
Name[nb]=XMPP smilefjestema
|
|
||||||
Name[nds]=XMPP-Snutensett
|
|
||||||
Name[nl]=XMPP-emoticonsthema
|
|
||||||
Name[nn]=XMPP-fjesingtema
|
|
||||||
Name[or]=XMPP Emoticons ପ୍ରସଙ୍ଗ
|
|
||||||
Name[pa]=XMPP Emoticons Theme
|
|
||||||
Name[pl]=Motyw emotikon XMPP
|
|
||||||
Name[pt]=Tema de Ícones Emotivos do XMPP
|
|
||||||
Name[pt_BR]=Tema de emoticons XMPP
|
|
||||||
Name[ro]=Tematică de emoticoni XMPP
|
|
||||||
Name[ru]=Набор смайликов XMPP
|
|
||||||
Name[se]=XMPP mojánfáddá
|
|
||||||
Name[si]=XMPP Emoticons තේමාව
|
|
||||||
Name[sk]=Téma emotikonov XMPP
|
|
||||||
Name[sl]=Tema izraznih ikon XMPP
|
|
||||||
Name[sr]=ИксМПП тема емотикона
|
|
||||||
Name[sr@ijekavian]=ИксМПП тема емотикона
|
|
||||||
Name[sr@ijekavianlatin]=XMPP tema emotikona
|
|
||||||
Name[sr@latin]=XMPP tema emotikona
|
|
||||||
Name[sv]=XMPP smilistema
|
|
||||||
Name[ta]=XMPP உணர்வுருக்கள் தோற்றம்
|
|
||||||
Name[tg]=Мавзӯъи XMPP Emoticons
|
|
||||||
Name[th]=ภาพไอคอนสื่ออารมณ์ของ XMPP
|
|
||||||
Name[tr]=XMPP Duygu Simgesi Teması
|
|
||||||
Name[tt]=XMPP көлчекләр җыелмасы
|
|
||||||
Name[ug]=XMPP چىراي ئىپادە ئۆرنىكى
|
|
||||||
Name[uk]=Тема емоційок XMPP
|
|
||||||
Name[vi]=Giao diện hình biểu cảm XMPP
|
|
||||||
Name[wa]=Tinme di xhinêyes XMPP
|
|
||||||
Name[x-test]=xxXMPP Emoticons Themexx
|
|
||||||
Name[zh_CN]=XMPP 表情主题
|
|
||||||
Name[zh_TW]=XMPP 表情圖示主題
|
|
||||||
Comment=Library to use XMPP emoticons theme
|
|
||||||
Comment[ar]=مكتبة لاستخدام سمة ابتسامات XMPP
|
|
||||||
Comment[as]=XMPP Emoticons থিম ব্যৱহাৰ কৰা লাইব্ৰেৰী
|
|
||||||
Comment[ast]=Biblioteca pa usar el tema d'emoticonos XMPP
|
|
||||||
Comment[be@latin]=Biblijateka dla matyvaŭ smajlikaŭ „XMPP”
|
|
||||||
Comment[bg]=Библиотека за темата с емоции XMPP
|
|
||||||
Comment[bn]=এক্স-এম-পি-পি ইমোট-আইকন থীম ব্যবহার করার লাইব্রেরী
|
|
||||||
Comment[bn_IN]=XMPP ইমো-আইকন থিম প্রয়োগ করতে ব্যবহৃত লাইব্রেরি
|
|
||||||
Comment[bs]=Biblioteka za IksMPP temu emotikona
|
|
||||||
Comment[ca]=Biblioteca per a usar el tema d'emoticones XMPP
|
|
||||||
Comment[ca@valencia]=Biblioteca per a usar el tema d'emoticones XMPP
|
|
||||||
Comment[cs]=Knihovna pro použití motivu emotikonů XMPP
|
|
||||||
Comment[csb]=Bibloteka do brëkòwaniô emòtikónków temë XMPP
|
|
||||||
Comment[da]=Bibliotek til at bruge XMPP emotikon-temaer
|
|
||||||
Comment[de]=Bibliothek zur Verwendung des XMPP-Emoticon-Designs
|
|
||||||
Comment[el]=Βιβλιοθήκη για τη χρήση του θέματος εικονιδίων διάθεσης XMPP
|
|
||||||
Comment[en_GB]=Library to use XMPP emoticons theme
|
|
||||||
Comment[eo]=Biblioteko por uzi XMPP Mien-Etoson
|
|
||||||
Comment[es]=Biblioteca para usar el tema de emoticonos XMPP
|
|
||||||
Comment[et]=Teek XMPP emotikoniteema kasutamiseks
|
|
||||||
Comment[eu]=XMPP-ren aurpegiera gaia erabiltzeko liburutegia
|
|
||||||
Comment[fi]=Kirjasto XMPP-hymiöteemojen käyttämiseen
|
|
||||||
Comment[fr]=Bibliothèque permettant d'utiliser les thèmes d'émoticônes « XMPP »
|
|
||||||
Comment[fy]=Biblioteek om XMPP emoticons tema te brûken
|
|
||||||
Comment[ga]=Leabharlann le húsáid téama straoiseog XMPP
|
|
||||||
Comment[gl]=Unha biblioteca para empregar temas de emoticonas de XMPP
|
|
||||||
Comment[gu]=XMPP ઇમોકેશન થીમ ઉપયોગ કરવા માટેની લાઇબ્રેરી
|
|
||||||
Comment[he]=ספרייה לשימוש בערכת הפרצופונים של XMMP
|
|
||||||
Comment[hne]=एक्सएमपीपी चेहराचिनहा थीम ल उपयोग करे बर लाइब्रेरी
|
|
||||||
Comment[hr]=Biblioteka za korištenje XMPP-ove teme emotikona
|
|
||||||
Comment[hsb]=Biblioteka za XMPP emoticons theme
|
|
||||||
Comment[hu]=Programkönyvtár az XMPP emotikon-témához
|
|
||||||
Comment[hy]=Գրադարան որպեսզի XMPP-ի էմոտիքոնների ոճը օգտագործել
|
|
||||||
Comment[ia]=Libreria per usar le thema de emoticones XMPP
|
|
||||||
Comment[id]=Pustaka untuk menggunakan tema emoticon XMPP
|
|
||||||
Comment[is]=Forritlingasafn til notkunar með XMPP broskallaþema
|
|
||||||
Comment[it]=Libreria per usare il tema faccine XMPP
|
|
||||||
Comment[ja]=XMPP 感情アイコンテーマのライブラリ
|
|
||||||
Comment[kk]=XMPP көңіл-күй белгілер нақышының жиыны
|
|
||||||
Comment[km]=បណ្ណាល័យត្រូវប្រើស្បែកសញ្ញាអារម្មណ៍របស់ XMPP
|
|
||||||
Comment[kn]=XMPP ಭಾವನಾಚಿಹ್ನೆಗಳ (ಎಮೋಟಿಕಾನ್) ಪರಿಸರವಿನ್ಯಾಸವನ್ನು (ಥೀಮ್) ಬಳಸಲು ಒಂದು ಭಂಡಾರ (ಲೈಬ್ರರಿ)
|
|
||||||
Comment[ko]=XMPP 이모티콘 테마를 사용할 라이브러리
|
|
||||||
Comment[ku]=Pirtûkxane ji bo bi kar anîna Dirba Vegotinan yê XMPP
|
|
||||||
Comment[lt]=Biblioteka, leidžianti naudoti XMPP jaustukų temą
|
|
||||||
Comment[lv]=XMPP emocijzīmju tēmas bibliotēka
|
|
||||||
Comment[mai]=एक्सएमपीपी भावचिन्ह प्रसंगक प्रयोगक लेल लाइब्रेरी
|
|
||||||
Comment[ml]=എക്സ്എംപിപി ഇമോട്ടിക്കോണ് രംഗവിതാനം ഉപയോഗിയ്ക്കേണ്ട ലൈബ്രറി
|
|
||||||
Comment[mr]=XMPP भावप्रतिमा शैली वापरण्याकरिता लायब्ररी
|
|
||||||
Comment[nb]=Bibliotek for å bruke XMPP smilefjestema
|
|
||||||
Comment[nds]=Bibliotheek, mit de sik dat XMPP-Snutensett bruken lett
|
|
||||||
Comment[nl]=Bibliotheek voor het gebruik van het XMPP-emoticonsthema
|
|
||||||
Comment[nn]=Bibliotek for å bruka fjesingtema frå XMPP
|
|
||||||
Comment[or]=XMPP Emoticons ପ୍ରସଙ୍ଗକୁ ବ୍ୟବହାର କରିବା ପାଇଁ ଲାଇବ୍ରେରୀ
|
|
||||||
Comment[pa]=XMPP ਈਮੋਸ਼ਨ ਥੀਮ ਵਰਤਣ ਲਈ ਲਾਇਬਰੇਰੀ
|
|
||||||
Comment[pl]=Biblioteka do motywu emotikon XMPP
|
|
||||||
Comment[pt]=Uma biblioteca para usar os temas de ícones emotivos do XMPP
|
|
||||||
Comment[pt_BR]=Biblioteca para uso do tema de emoticons XMPP
|
|
||||||
Comment[ro]=Bibliotecă de utilizat tematica de emoticoni XMPP
|
|
||||||
Comment[ru]=Библиотека набора смайликов XMPP
|
|
||||||
Comment[se]=Bibliotehka mii dulko XMPP mojánfáttáid
|
|
||||||
Comment[si]=XMPP emoticons තේමාව සඳහා භාවිත කළ යුතු පුස්තකාලය
|
|
||||||
Comment[sk]=Knižnica na použitie témy emotikonov XMPP
|
|
||||||
Comment[sl]=Knjižnica za uporabo XMPP-jeve teme izraznih ikon
|
|
||||||
Comment[sr]=Библиотека за ИксМПП тему емотикона
|
|
||||||
Comment[sr@ijekavian]=Библиотека за ИксМПП тему емотикона
|
|
||||||
Comment[sr@ijekavianlatin]=Biblioteka za XMPP temu emotikona
|
|
||||||
Comment[sr@latin]=Biblioteka za XMPP temu emotikona
|
|
||||||
Comment[sv]=Bibliotek för att använda XMPP smilistema
|
|
||||||
Comment[ta]=நிரலகம் XMPP உணர்வுரு தோற்றத்தை பயன்படுத்தும்
|
|
||||||
Comment[tg]=Китобхонаи мавзӯъи XMPP emoticons
|
|
||||||
Comment[th]=ไลบรารีที่ใช้ภาพไอคอนสื่ออารมณ์ของ XMPP
|
|
||||||
Comment[tr]=XMPP Duygu Simgesi Temasını kullanmak için kitaplık
|
|
||||||
Comment[tt]=XMPP көлчек җыелмасы өчен китапханә
|
|
||||||
Comment[ug]=XMPP چىراي ئىپادە ئۆرنىكىنى ئىشلىتىدىغان ئامبار
|
|
||||||
Comment[uk]=Бібліотека для використання теми емоційок XMPP
|
|
||||||
Comment[vi]=Thư viện để sử dụng giao diện hình biểu cảm XMPP
|
|
||||||
Comment[wa]=Livreye pos eployî l' tinme di xhinêyes XMPP
|
|
||||||
Comment[x-test]=xxLibrary to use XMPP emoticons themexx
|
|
||||||
Comment[zh_CN]=使用 XMPP 表情主题的类库
|
|
||||||
Comment[zh_TW]=使用 XMPP 表情圖示主題的函式庫
|
|
||||||
X-KDE-ServiceTypes=KEmoticons
|
|
||||||
X-KDE-Library=emoticonstheme_xmpp
|
|
||||||
X-KDE-EmoticonsFileName=icondef.xml
|
|
||||||
X-KDE-Priority=9
|
|
|
@ -1,240 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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/>.*
|
|
||||||
* *
|
|
||||||
**********************************************************************************/
|
|
||||||
|
|
||||||
#include "xmpp_emoticons.h"
|
|
||||||
|
|
||||||
#include <QtCore/QFile>
|
|
||||||
#include <QtCore/QFileInfo>
|
|
||||||
#include <QtGui/QImageReader>
|
|
||||||
|
|
||||||
#include <kpluginfactory.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
#include <kmimetype.h>
|
|
||||||
|
|
||||||
K_PLUGIN_FACTORY(XmppEmoticonsFactory, registerPlugin<XmppEmoticons>();)
|
|
||||||
K_EXPORT_PLUGIN(XmppEmoticonsFactory("XmppEmoticons"))
|
|
||||||
|
|
||||||
XmppEmoticons::XmppEmoticons(QObject *parent, const QVariantList &args)
|
|
||||||
: KEmoticonsProvider(parent)
|
|
||||||
{
|
|
||||||
Q_UNUSED(args);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool XmppEmoticons::removeEmoticon(const QString &emo)
|
|
||||||
{
|
|
||||||
QString emoticon = QFileInfo(emoticonsMap().key(emo.split(' '))).fileName();
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("icondef");
|
|
||||||
|
|
||||||
if (fce.isNull())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
QDomNodeList nl = fce.childNodes();
|
|
||||||
// the lenght() method had a TODO which is done in Katie
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int i = 0; i < nl.length(); i++ )
|
|
||||||
#else
|
|
||||||
for (uint i = 0; i < nl.length(); i++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement de = nl.item(i).toElement();
|
|
||||||
if (!de.isNull() && de.tagName() == "icon") {
|
|
||||||
QDomNodeList snl = de.childNodes();
|
|
||||||
QStringList sl;
|
|
||||||
QStringList mime;
|
|
||||||
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int k = 0; k < nl.length(); k++ )
|
|
||||||
#else
|
|
||||||
for (uint k = 0; k < nl.length(); k++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement sde = snl.item(k).toElement();
|
|
||||||
|
|
||||||
if (!sde.isNull() && sde.tagName() == "object" && sde.text() == emoticon) {
|
|
||||||
fce.removeChild(de);
|
|
||||||
removeEmoticonsMap(emoticonsMap().key(emo.split(' ')));
|
|
||||||
removeEmoticonIndex(emoticon, emo.split(' '));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool XmppEmoticons::addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::addEmoticon(emo, text, option);
|
|
||||||
|
|
||||||
const QStringList splitted = text.split(' ');
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("icondef");
|
|
||||||
|
|
||||||
if (fce.isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomElement emoticon = m_themeXml.createElement("icon");
|
|
||||||
fce.appendChild(emoticon);
|
|
||||||
QStringList::const_iterator constIterator;
|
|
||||||
|
|
||||||
for (constIterator = splitted.begin(); constIterator != splitted.end(); ++constIterator) {
|
|
||||||
QDomElement emotext = m_themeXml.createElement("text");
|
|
||||||
QDomText txt = m_themeXml.createTextNode((*constIterator).trimmed());
|
|
||||||
emotext.appendChild(txt);
|
|
||||||
emoticon.appendChild(emotext);
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomElement emoElement = m_themeXml.createElement("object");
|
|
||||||
KMimeType::Ptr mimePtr = KMimeType::findByPath(emo, 0, true);
|
|
||||||
emoElement.setAttribute("mime", mimePtr->name());
|
|
||||||
QDomText txt = m_themeXml.createTextNode(QFileInfo(emo).fileName());
|
|
||||||
|
|
||||||
emoElement.appendChild(txt);
|
|
||||||
emoticon.appendChild(emoElement);
|
|
||||||
|
|
||||||
addEmoticonIndex(emo, splitted);
|
|
||||||
addEmoticonsMap(emo, splitted);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XmppEmoticons::save()
|
|
||||||
{
|
|
||||||
QFile fp(themePath() + '/' + fileName());
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << fp.fileName() << "doesn't exist!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QTextStream emoStream(&fp);
|
|
||||||
emoStream.setCodec( "UTF-8" );
|
|
||||||
emoStream << m_themeXml.toString(4);
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool XmppEmoticons::loadTheme(const QString &path)
|
|
||||||
{
|
|
||||||
KEmoticonsProvider::loadTheme(path);
|
|
||||||
|
|
||||||
QFile fp(path);
|
|
||||||
|
|
||||||
if (!fp.exists()) {
|
|
||||||
kWarning() << path << "doesn't exist!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::ReadOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open ReadOnly!";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString error;
|
|
||||||
int eli, eco;
|
|
||||||
if (!m_themeXml.setContent(&fp, &error, &eli, &eco)) {
|
|
||||||
kWarning() << fp.fileName() << "can't copy to xml!";
|
|
||||||
kWarning() << error << "line:" << eli << "column:" << eco;
|
|
||||||
fp.close();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fp.close();
|
|
||||||
|
|
||||||
QDomElement fce = m_themeXml.firstChildElement("icondef");
|
|
||||||
|
|
||||||
if (fce.isNull()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomNodeList nl = fce.childNodes();
|
|
||||||
|
|
||||||
clearEmoticonsMap();
|
|
||||||
|
|
||||||
// the lenght() method had a TODO which is done in Katie
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int i = 0; i < nl.length(); i++ )
|
|
||||||
#else
|
|
||||||
for (uint i = 0; i < nl.length(); i++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement de = nl.item(i).toElement();
|
|
||||||
|
|
||||||
if (!de.isNull() && de.tagName() == "icon") {
|
|
||||||
QDomNodeList snl = de.childNodes();
|
|
||||||
QStringList sl;
|
|
||||||
QString emo;
|
|
||||||
QStringList mime;
|
|
||||||
mime << "image/png" << "image/gif" << "image/bmp" << "image/jpeg";
|
|
||||||
|
|
||||||
// the lenght() method had a TODO which is done in Katie
|
|
||||||
#ifdef QT_KATIE
|
|
||||||
for (int k = 0; k < snl.length(); k++ )
|
|
||||||
#else
|
|
||||||
for (uint k = 0; k < snl.length(); k++ )
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
QDomElement sde = snl.item(k).toElement();
|
|
||||||
|
|
||||||
if (!sde.isNull() && sde.tagName() == "text") {
|
|
||||||
sl << sde.text();
|
|
||||||
} else if (!sde.isNull() && sde.tagName() == "object" && mime.contains(sde.attribute("mime"))) {
|
|
||||||
emo = sde.text();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
emo = KGlobal::dirs()->findResource("emoticons", themeName() + '/' + emo);
|
|
||||||
|
|
||||||
if (emo.isNull()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
addEmoticonIndex(emo, sl);
|
|
||||||
addEmoticonsMap(emo, sl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XmppEmoticons::createNew()
|
|
||||||
{
|
|
||||||
QString path = KGlobal::dirs()->saveLocation("emoticons", themeName());
|
|
||||||
|
|
||||||
QFile fp(path + '/' + "icondef.xml");
|
|
||||||
|
|
||||||
if (!fp.open(QIODevice::WriteOnly)) {
|
|
||||||
kWarning() << fp.fileName() << "can't open WriteOnly!";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDomDocument doc;
|
|
||||||
doc.appendChild(doc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""));
|
|
||||||
doc.appendChild(doc.createElement("icondef"));
|
|
||||||
|
|
||||||
QTextStream emoStream(&fp);
|
|
||||||
emoStream.setCodec( "UTF-8" );
|
|
||||||
emoStream << doc.toString(4);
|
|
||||||
fp.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,46 +0,0 @@
|
||||||
/**********************************************************************************
|
|
||||||
* 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 XMPP_EMOTICONS_H
|
|
||||||
#define XMPP_EMOTICONS_H
|
|
||||||
|
|
||||||
#include <kemoticonsprovider.h>
|
|
||||||
|
|
||||||
#include <QtXml/qdom.h>
|
|
||||||
|
|
||||||
class XmppEmoticons : public KEmoticonsProvider
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
XmppEmoticons(QObject *parent, const QVariantList &args);
|
|
||||||
|
|
||||||
bool loadTheme(const QString &path);
|
|
||||||
|
|
||||||
bool removeEmoticon(const QString &emo);
|
|
||||||
bool addEmoticon(const QString &emo, const QString &text, AddEmoticonOption option = DoNotCopy);
|
|
||||||
void save();
|
|
||||||
|
|
||||||
void createNew();
|
|
||||||
|
|
||||||
private:
|
|
||||||
QDomDocument m_themeXml;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* XMPP_EMOTICONS_H */
|
|
||||||
|
|
||||||
// kate: space-indent on; indent-width 4; replace-tabs on;
|
|
|
@ -1,19 +0,0 @@
|
||||||
include_directories(
|
|
||||||
${CMAKE_SOURCE_DIR}
|
|
||||||
../
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
kde4_add_manual_test(kutils-kemoticonstest main.cpp)
|
|
||||||
target_link_libraries(kutils-kemoticonstest
|
|
||||||
${KDE4_KDEUI_LIBS}
|
|
||||||
${KDE4_KEMOTICONS_LIBS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(kemoticontest2_SRCS kemoticontest.cpp)
|
|
||||||
kde4_add_test(kutils-kemoticontest2 ${kemoticontest2_SRCS})
|
|
||||||
target_link_libraries(kutils-kemoticontest2
|
|
||||||
${KDE4_KIO_LIBS}
|
|
||||||
${KDE4_KEMOTICONS_LIBS}
|
|
||||||
${QT_QTTEST_LIBRARY}
|
|
||||||
)
|
|
|
@ -1 +0,0 @@
|
||||||
:))
|
|
|
@ -1 +0,0 @@
|
||||||
:))
|
|
|
@ -1 +0,0 @@
|
||||||
:Ptesting:P
|
|
|
@ -1 +0,0 @@
|
||||||
:Ptesting:P
|
|
|
@ -1 +0,0 @@
|
||||||
In a sentence:practical example
|
|
|
@ -1 +0,0 @@
|
||||||
In a sentence:practical example
|
|
|
@ -1 +0,0 @@
|
||||||
:D and :-D are not the same as :d and :-d
|
|
|
@ -1 +0,0 @@
|
||||||
<img align="center" width="20" height="20" src="teeth.png" title=":D"/> and <img align="center" width="20" height="20" src="teeth.png" title=":-D"/> are not the same as :d and :-d
|
|
|
@ -1 +0,0 @@
|
||||||
4d:D>:)F:/>:-(:Pu:d9
|
|
|
@ -1 +0,0 @@
|
||||||
4d:D>:)F:/>:-(:Pu:d9
|
|
|
@ -1 +0,0 @@
|
||||||
<::pvar:: test=1>
|
|
|
@ -1 +0,0 @@
|
||||||
<::pvar:: test=1>
|
|
|
@ -1 +0,0 @@
|
||||||
-+-[-:-(-:-)-:-]-+-
|
|
|
@ -1 +0,0 @@
|
||||||
-+-[-:-(-:-)-:-]-+-
|
|
|
@ -1 +0,0 @@
|
||||||
::shrugs::
|
|
|
@ -1 +0,0 @@
|
||||||
::shrugs::
|
|
|
@ -1 +0,0 @@
|
||||||
:):)
|
|
|
@ -1 +0,0 @@
|
||||||
<img align="center" title=":)" alt=":)" src="smile.png" width="22" height="22" /><img align="center" title=":)" alt=":)" src="smile.png" width="22" height="22" />
|
|
|
@ -1 +0,0 @@
|
||||||
<img src="..." title=":-)" />
|
|
|
@ -1 +0,0 @@
|
||||||
<img src="..." title=":-)" />
|
|
|
@ -1 +0,0 @@
|
||||||
End of sentence:p
|
|
|
@ -1 +0,0 @@
|
||||||
End of sentence<img align="center" title=":p" alt=":p" src="tongue.png" width="22" height="22" />
|
|
|
@ -1 +0,0 @@
|
||||||
http://www.kde.org
|
|
|
@ -1 +0,0 @@
|
||||||
http://www.kde.org
|
|
|
@ -1 +0,0 @@
|
||||||
(&)
|
|
|
@ -1 +0,0 @@
|
||||||
<img align="center" title="(&)" alt="(&)" src="dog.png" width="22" height="22" />
|
|
|
@ -1 +0,0 @@
|
||||||
Bla ( )
|
|
|
@ -1 +0,0 @@
|
||||||
Bla ( )
|
|
|
@ -1 +0,0 @@
|
||||||
a non-breaking space ( ) character
|
|
|
@ -1 +0,0 @@
|
||||||
a non-breaking space ( ) character
|
|
|
@ -1,103 +0,0 @@
|
||||||
/*
|
|
||||||
Tests for Kopete::Message::parseEmoticons
|
|
||||||
|
|
||||||
Copyright (c) 2004 by Richard Smith <kde@metafoo.co.uk>
|
|
||||||
Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org>
|
|
||||||
|
|
||||||
Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@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. *
|
|
||||||
* *
|
|
||||||
*************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
// QTestLib for KDE
|
|
||||||
#include "kemoticontest.h"
|
|
||||||
#include "moc_kemoticontest.cpp"
|
|
||||||
#include <qtest_kde.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
#include <QFile>
|
|
||||||
#include <QTextStream>
|
|
||||||
|
|
||||||
#include <kglobal.h>
|
|
||||||
#include <kstandarddirs.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kemoticons.h>
|
|
||||||
|
|
||||||
QTEST_KDEMAIN(KEmoticonTest, GUI)
|
|
||||||
|
|
||||||
/*
|
|
||||||
There are three sets of tests, the Kopete 0.7 baseline with tests that were
|
|
||||||
working properly in Kopete 0.7.x. When these fail it's a real regression.
|
|
||||||
|
|
||||||
The second set are those known to work in the current codebase.
|
|
||||||
The last set is the set with tests that are known to fail right now.
|
|
||||||
|
|
||||||
the name convention is working|broken-number.input|output
|
|
||||||
*/
|
|
||||||
|
|
||||||
void KEmoticonTest::testEmoticonParser()
|
|
||||||
{
|
|
||||||
KEmoticonsTheme emo = KEmoticons().theme("kde4");
|
|
||||||
QString basePath = QString::fromLatin1(KDESRCDIR) + QString::fromLatin1("/emoticon-parser-testcases");
|
|
||||||
QDir testCasesDir(basePath);
|
|
||||||
|
|
||||||
QStringList inputFileNames = testCasesDir.entryList(QStringList(QLatin1String("*.input")));
|
|
||||||
Q_FOREACH (const QString& fileName, inputFileNames) {
|
|
||||||
kDebug() << "testcase: " << fileName;
|
|
||||||
QString outputFileName = fileName;
|
|
||||||
outputFileName.replace("input", "output");
|
|
||||||
// open the input file
|
|
||||||
QFile inputFile(basePath + QString::fromLatin1("/") + fileName);
|
|
||||||
QFile expectedFile(basePath + QString::fromLatin1("/") + outputFileName);
|
|
||||||
// check if the expected output file exists
|
|
||||||
// if it doesn't, skip the testcase
|
|
||||||
if (! expectedFile.exists()) {
|
|
||||||
QSKIP("Warning! expected output for testcase not found. Skiping testcase", SkipSingle);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (inputFile.open(QIODevice::ReadOnly) && expectedFile.open(QIODevice::ReadOnly)) {
|
|
||||||
const QString inputData = QString::fromLatin1(inputFile.readAll());
|
|
||||||
const QString expectedData = QString::fromLatin1(expectedFile.readAll());
|
|
||||||
|
|
||||||
inputFile.close();
|
|
||||||
expectedFile.close();
|
|
||||||
|
|
||||||
const QString path = KGlobal::dirs()->findResource("emoticons", "kde4/smile.png").remove("smile.png");
|
|
||||||
if (path.isEmpty())
|
|
||||||
QSKIP("Emoticons not installed, skipping. kdebase-runtime needed.", SkipAll);
|
|
||||||
|
|
||||||
QString result = emo.parseEmoticons(inputData, KEmoticonsTheme::RelaxedParse | KEmoticonsTheme::SkipHTML).replace(path, QString());
|
|
||||||
|
|
||||||
kDebug() << "Parse result: " << result;
|
|
||||||
|
|
||||||
// HACK to know the test case we applied, concatenate testcase name to both
|
|
||||||
// input and expected string. WIll remove when I can add some sort of metadata
|
|
||||||
// to a CHECK so debug its origin testcase
|
|
||||||
//result = fileName + QString::fromLatin1(": ") + result;
|
|
||||||
//expectedData = fileName + QString::fromLatin1(": ") + expectedData;
|
|
||||||
// if the test case begins with broken, we expect it to fail, then use XFAIL
|
|
||||||
// otherwise use CHECK
|
|
||||||
if (fileName.section("-", 0, 0) == QString::fromLatin1("broken")) {
|
|
||||||
kDebug() << "checking known-broken testcase: " << fileName;
|
|
||||||
QEXPECT_FAIL("", "Checking know-broken testcase", Continue);
|
|
||||||
QCOMPARE(result, expectedData);
|
|
||||||
} else {
|
|
||||||
kDebug() << "checking known-working testcase: " << fileName;
|
|
||||||
QCOMPARE(result, expectedData);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
QSKIP("Warning! can't open testcase files. Skiping testcase", SkipSingle);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
Tests for Kopete::Message::parseEmoticons
|
|
||||||
|
|
||||||
Copyright (c) 2004 by Richard Smith <kde@metafoo.co.uk>
|
|
||||||
Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org>
|
|
||||||
Copyright (c) 2006 by Michael Larouche <larouche@kde.org>
|
|
||||||
|
|
||||||
Kopete (c) 2002-2006 by the Kopete developers <kopete-devel@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. *
|
|
||||||
* *
|
|
||||||
*************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef KEMOTICON_TEST_H
|
|
||||||
#define KEMOTICON_TEST_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* QTestLib automatic test to test Emoticon parsing.
|
|
||||||
*/
|
|
||||||
class KEmoticonTest : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
private Q_SLOTS:
|
|
||||||
void testEmoticonParser();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -1,97 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* Copyright (C) 2008 by Carlo Segato <brandon.ml@gmail.com> *
|
|
||||||
* *
|
|
||||||
* 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 <kemoticons.h>
|
|
||||||
#include <kapplication.h>
|
|
||||||
#include <kcmdlineargs.h>
|
|
||||||
#include <kaboutdata.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <qstring.h>
|
|
||||||
#include <klineedit.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <kcombobox.h>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QTextDocument>
|
|
||||||
|
|
||||||
class KEmoTest : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
KEmoTest();
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
void changed();
|
|
||||||
void changeTheme(const QString&theme);
|
|
||||||
|
|
||||||
private:
|
|
||||||
KLineEdit kl;
|
|
||||||
QLabel lb;
|
|
||||||
KEmoticons e;
|
|
||||||
KEmoticonsTheme t;
|
|
||||||
KComboBox cb;
|
|
||||||
};
|
|
||||||
|
|
||||||
KEmoTest::KEmoTest()
|
|
||||||
{
|
|
||||||
QStringList tl = KEmoticons::themeList();
|
|
||||||
kDebug() << "ThemeList:" << tl;
|
|
||||||
|
|
||||||
t = e.theme();
|
|
||||||
|
|
||||||
cb.addItems(e.themeList());
|
|
||||||
cb.setCurrentIndex(e.themeList().indexOf(t.themeName()));
|
|
||||||
|
|
||||||
QVBoxLayout *vb = new QVBoxLayout;
|
|
||||||
vb->addWidget(&kl);
|
|
||||||
vb->addWidget(&cb);
|
|
||||||
vb->addWidget(&lb);
|
|
||||||
setLayout(vb);
|
|
||||||
|
|
||||||
connect(&kl, SIGNAL(textChanged(QString)), this, SLOT(changed()));
|
|
||||||
connect(&cb, SIGNAL(activated(QString)), this, SLOT(changeTheme(QString)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoTest::changed()
|
|
||||||
{
|
|
||||||
QStringList excl;
|
|
||||||
excl << ":)" << ":-)";
|
|
||||||
lb.setText(t.parseEmoticons(Qt::escape(kl.text()), KEmoticonsTheme::DefaultParse, excl));
|
|
||||||
}
|
|
||||||
|
|
||||||
void KEmoTest::changeTheme(const QString &theme)
|
|
||||||
{
|
|
||||||
t = e.theme(theme);
|
|
||||||
changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
KAboutData aboutData("kemoticonstest", 0, ki18n("KEmoticons Test"), "1.0");
|
|
||||||
|
|
||||||
KCmdLineArgs::init(argc, argv, &aboutData);
|
|
||||||
KApplication app;
|
|
||||||
|
|
||||||
KEmoTest kt;
|
|
||||||
|
|
||||||
kt.show();
|
|
||||||
|
|
||||||
return app.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "main.moc"
|
|
Loading…
Add table
Reference in a new issue