summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/private/kopeteemoticons.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/libkopete/private/kopeteemoticons.cpp')
-rw-r--r--kopete/libkopete/private/kopeteemoticons.cpp170
1 files changed, 85 insertions, 85 deletions
diff --git a/kopete/libkopete/private/kopeteemoticons.cpp b/kopete/libkopete/private/kopeteemoticons.cpp
index 0b234deb..a2d33341 100644
--- a/kopete/libkopete/private/kopeteemoticons.cpp
+++ b/kopete/libkopete/private/kopeteemoticons.cpp
@@ -21,11 +21,11 @@
#include "kopeteprefs.h"
-#include <qdom.h>
-#include <qfile.h>
-#include <qstylesheet.h>
-#include <qimage.h>
-#include <qdatetime.h>
+#include <tqdom.h>
+#include <tqfile.h>
+#include <tqstylesheet.h>
+#include <tqimage.h>
+#include <tqdatetime.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -50,10 +50,10 @@ struct Emoticons::Emoticon
Emoticon(){}
/* sort by longest to shortest matchText */
bool operator< (const Emoticon &e){ return matchText.length() > e.matchText.length(); }
- QString matchText;
- QString matchTextEscaped;
+ TQString matchText;
+ TQString matchTextEscaped;
QString picPath;
- QString picHTMLCode;
+ TQString picHTMLCode;
};
/* This is the object we will store each emoticon match in */
@@ -67,13 +67,13 @@ struct Emoticons::EmoticonNode {
class Emoticons::Private
{
public:
- QMap<QChar, QValueList<Emoticon> > emoticonMap;
- QMap<QString, QStringList> emoticonAndPicList;
+ TQMap<TQChar, TQValueList<Emoticon> > emoticonMap;
+ TQMap<TQString, TQStringList> emoticonAndPicList;
/**
* The current icon theme from KopetePrefs
*/
- QString theme;
+ TQString theme;
};
@@ -89,19 +89,19 @@ Emoticons *Emoticons::self()
}
-QString Emoticons::parseEmoticons(const QString& message, ParseMode mode ) //static
+TQString Emoticons::parseEmoticons(const TQString& message, ParseMode mode ) //static
{
return self()->parse( message, mode );
}
-QValueList<Emoticons::Token> Emoticons::tokenizeEmoticons( const QString& message, ParseMode mode ) // static
+TQValueList<Emoticons::Token> Emoticons::tokenizeEmoticons( const TQString& message, ParseMode mode ) // static
{
return self()->tokenize( message, mode );
}
-QValueList<Emoticons::Token> Emoticons::tokenize( const QString& message, uint mode )
+TQValueList<Emoticons::Token> Emoticons::tokenize( const TQString& message, uint mode )
{
- QValueList<Token> result;
+ TQValueList<Token> result;
if ( !KopetePrefs::prefs()->useEmoticons() )
{
result.append( Token( Text, message ) );
@@ -115,23 +115,23 @@ QValueList<Emoticons::Token> Emoticons::tokenize( const QString& message, uint m
}
/* 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; /* next character after a match candidate, if strict this should be QChar::null or space */
+ * to let emoticons at the beginning, the very first previous TQChar must be a space. */
+ TQChar p = ' ';
+ TQChar c; /* current char */
+ TQChar n; /* next character after a match candidate, if strict this should be TQChar::null or space */
/* This is the EmoticonNode container, it will represent each matched emoticon */
- QValueList<EmoticonNode> foundEmoticons;
- QValueList<EmoticonNode>::const_iterator found;
+ TQValueList<EmoticonNode> foundEmoticons;
+ TQValueList<EmoticonNode>::const_iterator found;
/* First-pass, store the matched emoticon locations in foundEmoticons */
- QValueList<Emoticon> emoticonList;
- QValueList<Emoticon>::const_iterator it;
+ TQValueList<Emoticon> emoticonList;
+ TQValueList<Emoticon>::const_iterator it;
size_t pos;
bool inHTMLTag = false;
bool inHTMLLink = false;
bool inHTMLEntity = false;
- QString needle; // search for this
+ TQString needle; // search for this
for ( pos = 0; pos < message.length(); pos++ )
{
c = message[ pos ];
@@ -271,14 +271,14 @@ QValueList<Emoticons::Token> Emoticons::tokenize( const QString& message, uint m
return result;
}
-Emoticons::Emoticons( const QString &theme ) : QObject( kapp, "KopeteEmoticons" )
+Emoticons::Emoticons( const TQString &theme ) : TQObject( kapp, "KopeteEmoticons" )
{
// kdDebug(14010) << "KopeteEmoticons::KopeteEmoticons" << endl;
d=new Private;
if(theme.isNull())
{
initEmoticons();
- connect( KopetePrefs::prefs(), SIGNAL(saved()), this, SLOT(initEmoticons()) );
+ connect( KopetePrefs::prefs(), TQT_SIGNAL(saved()), this, TQT_SLOT(initEmoticons()) );
}
else
{
@@ -294,32 +294,32 @@ Emoticons::~Emoticons( )
-void Emoticons::addIfPossible( const QString& filenameNoExt, const QStringList &emoticons )
+void Emoticons::addIfPossible( const TQString& filenameNoExt, const TQStringList &emoticons )
{
KStandardDirs *dir = KGlobal::dirs();
- QString pic;
+ TQString pic;
//maybe an extension was given, so try to find the exact file
- pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt );
+ pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt );
if( pic.isNull() )
- pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt + QString::fromLatin1( ".mng" ) );
+ pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".mng" ) );
if ( pic.isNull() )
- pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt + QString::fromLatin1( ".png" ) );
+ pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".png" ) );
if ( pic.isNull() )
- pic = dir->findResource( "emoticons", d->theme + QString::fromLatin1( "/" ) + filenameNoExt + QString::fromLatin1( ".gif" ) );
+ pic = dir->findResource( "emoticons", d->theme + TQString::fromLatin1( "/" ) + filenameNoExt + TQString::fromLatin1( ".gif" ) );
if( !pic.isNull() ) // only add if we found one file
{
- QPixmap p;
- QString result;
+ TQPixmap p;
+ TQString result;
d->emoticonAndPicList.insert( pic, emoticons );
- for ( QStringList::const_iterator it = emoticons.constBegin(), end = emoticons.constEnd();
+ for ( TQStringList::const_iterator it = emoticons.constBegin(), end = emoticons.constEnd();
it != end; ++it )
{
- QString matchEscaped=QStyleSheet::escape(*it);
+ TQString matchEscaped=TQStyleSheet::escape(*it);
Emoticon e;
e.picPath = pic;
@@ -328,15 +328,15 @@ void Emoticons::addIfPossible( const QString& filenameNoExt, const QStringList &
// Unless we do so, ChatMessagePart::slotScrollView does not work properly and causing
// HTMLPart not to be scrolled to the very last message.
p.load( e.picPath );
- result = QString::fromLatin1( "<img align=\"center\" src=\"" ) +
+ result = TQString::fromLatin1( "<img align=\"center\" src=\"" ) +
e.picPath +
- QString::fromLatin1( "\" title=\"" ) +
+ TQString::fromLatin1( "\" title=\"" ) +
matchEscaped +
- QString::fromLatin1( "\" width=\"" ) +
- QString::number( p.width() ) +
- QString::fromLatin1( "\" height=\"" ) +
- QString::number( p.height() ) +
- QString::fromLatin1( "\" />" );
+ TQString::fromLatin1( "\" width=\"" ) +
+ TQString::number( p.width() ) +
+ TQString::fromLatin1( "\" height=\"" ) +
+ TQString::number( p.height() ) +
+ TQString::fromLatin1( "\" />" );
e.picHTMLCode = result;
e.matchTextEscaped = matchEscaped;
@@ -347,7 +347,7 @@ void Emoticons::addIfPossible( const QString& filenameNoExt, const QStringList &
}
}
-void Emoticons::initEmoticons( const QString &theme )
+void Emoticons::initEmoticons( const TQString &theme )
{
if(theme.isNull())
{
@@ -365,43 +365,43 @@ void Emoticons::initEmoticons( const QString &theme )
d->emoticonAndPicList.clear();
d->emoticonMap.clear();
- QString filename= KGlobal::dirs()->findResource( "emoticons", d->theme + QString::fromLatin1( "/emoticons.xml" ) );
+ TQString filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::fromLatin1( "/emoticons.xml" ) );
if(!filename.isEmpty())
return initEmoticon_emoticonsxml( filename );
- filename= KGlobal::dirs()->findResource( "emoticons", d->theme + QString::fromLatin1( "/icondef.xml" ) );
+ filename= KGlobal::dirs()->findResource( "emoticons", d->theme + TQString::fromLatin1( "/icondef.xml" ) );
if(!filename.isEmpty())
return initEmoticon_JEP0038( filename );
kdWarning(14010) << k_funcinfo << "emotiucon XML theme description not found" <<endl;
}
-void Emoticons::initEmoticon_emoticonsxml( const QString & filename)
+void Emoticons::initEmoticon_emoticonsxml( const TQString & filename)
{
- QDomDocument emoticonMap( QString::fromLatin1( "messaging-emoticon-map" ) );
+ TQDomDocument emoticonMap( TQString::fromLatin1( "messaging-emoticon-map" ) );
- QFile mapFile( filename );
+ TQFile mapFile( filename );
mapFile.open( IO_ReadOnly );
emoticonMap.setContent( &mapFile );
- QDomElement list = emoticonMap.documentElement();
- QDomNode node = list.firstChild();
+ TQDomElement list = emoticonMap.documentElement();
+ TQDomNode node = list.firstChild();
while( !node.isNull() )
{
- QDomElement element = node.toElement();
+ TQDomElement element = node.toElement();
if( !element.isNull() )
{
- if( element.tagName() == QString::fromLatin1( "emoticon" ) )
+ if( element.tagName() == TQString::fromLatin1( "emoticon" ) )
{
- QString emoticon_file = element.attribute(
- QString::fromLatin1( "file" ), QString::null );
- QStringList items;
+ TQString emoticon_file = element.attribute(
+ TQString::fromLatin1( "file" ), TQString::null );
+ TQStringList items;
- QDomNode emoticonNode = node.firstChild();
+ TQDomNode emoticonNode = node.firstChild();
while( !emoticonNode.isNull() )
{
- QDomElement emoticonElement = emoticonNode.toElement();
+ TQDomElement emoticonElement = emoticonNode.toElement();
if( !emoticonElement.isNull() )
{
- if( emoticonElement.tagName() == QString::fromLatin1( "string" ) )
+ if( emoticonElement.tagName() == TQString::fromLatin1( "string" ) )
{
items << emoticonElement.text();
}
@@ -430,42 +430,42 @@ void Emoticons::initEmoticon_emoticonsxml( const QString & filename)
}
-void Emoticons::initEmoticon_JEP0038( const QString & filename)
+void Emoticons::initEmoticon_JEP0038( const TQString & filename)
{
- QDomDocument emoticonMap( QString::fromLatin1( "icondef" ) );
+ TQDomDocument emoticonMap( TQString::fromLatin1( "icondef" ) );
- QFile mapFile( filename );
+ TQFile mapFile( filename );
mapFile.open( IO_ReadOnly );
emoticonMap.setContent( &mapFile );
- QDomElement list = emoticonMap.documentElement();
- QDomNode node = list.firstChild();
+ TQDomElement list = emoticonMap.documentElement();
+ TQDomNode node = list.firstChild();
while( !node.isNull() )
{
- QDomElement element = node.toElement();
+ TQDomElement element = node.toElement();
if( !element.isNull() )
{
- if( element.tagName() == QString::fromLatin1( "icon" ) )
+ if( element.tagName() == TQString::fromLatin1( "icon" ) )
{
- QStringList items;
- QString emoticon_file;
+ TQStringList items;
+ TQString emoticon_file;
- QDomNode emoticonNode = node.firstChild();
+ TQDomNode emoticonNode = node.firstChild();
while( !emoticonNode.isNull() )
{
- QDomElement emoticonElement = emoticonNode.toElement();
+ TQDomElement emoticonElement = emoticonNode.toElement();
if( !emoticonElement.isNull() )
{
- if( emoticonElement.tagName() == QString::fromLatin1( "text" ) )
+ if( emoticonElement.tagName() == TQString::fromLatin1( "text" ) )
{
//TODO xml:lang
items << emoticonElement.text();
}
- else if( emoticonElement.tagName() == QString::fromLatin1( "object" ) && emoticon_file.isEmpty() )
+ else if( emoticonElement.tagName() == TQString::fromLatin1( "object" ) && emoticon_file.isEmpty() )
{
- QString mime= emoticonElement.attribute(
- QString::fromLatin1( "mime" ), QString::fromLatin1("image/*") );
- if(mime.startsWith(QString::fromLatin1("image/")) && !mime.endsWith(QString::fromLatin1("/svg+xml")))
+ TQString mime= emoticonElement.attribute(
+ TQString::fromLatin1( "mime" ), TQString::fromLatin1("image/*") );
+ if(mime.startsWith(TQString::fromLatin1("image/")) && !mime.endsWith(TQString::fromLatin1("/svg+xml")))
{
emoticon_file = emoticonElement.text();
}
@@ -503,11 +503,11 @@ void Emoticons::sortEmoticons()
{
/* sort strings in order of longest to shortest to provide convenient input for
greedy matching in the tokenizer */
- QValueList<QChar> keys = d->emoticonMap.keys();
- for ( QValueList<QChar>::const_iterator it = keys.begin(); it != keys.end(); ++it )
+ TQValueList<TQChar> keys = d->emoticonMap.keys();
+ for ( TQValueList<TQChar>::const_iterator it = keys.begin(); it != keys.end(); ++it )
{
- QChar key = (*it);
- QValueList<Emoticon> keyValues = d->emoticonMap[key];
+ TQChar key = (*it);
+ TQValueList<Emoticon> keyValues = d->emoticonMap[key];
qHeapSort(keyValues.begin(), keyValues.end());
d->emoticonMap[key] = keyValues;
}
@@ -516,21 +516,21 @@ void Emoticons::sortEmoticons()
-QMap<QString, QStringList> Emoticons::emoticonAndPicList()
+TQMap<TQString, TQStringList> Emoticons::emoticonAndPicList()
{
return d->emoticonAndPicList;
}
-QString Emoticons::parse( const QString &message, ParseMode mode )
+TQString Emoticons::parse( const TQString &message, ParseMode mode )
{
if ( !KopetePrefs::prefs()->useEmoticons() )
return message;
- QValueList<Token> tokens = tokenize( message, mode );
- QValueList<Token>::const_iterator token;
- QString result;
- QPixmap p;
+ TQValueList<Token> tokens = tokenize( message, mode );
+ TQValueList<Token>::const_iterator token;
+ TQString result;
+ TQPixmap p;
for ( token = tokens.begin(); token != tokens.end(); ++token )
{
switch ( (*token).type )