summaryrefslogtreecommitdiffstats
path: root/kopete/plugins/latex
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/plugins/latex
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz
tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/plugins/latex')
-rw-r--r--kopete/plugins/latex/latexguiclient.cpp18
-rw-r--r--kopete/plugins/latex/latexguiclient.h4
-rw-r--r--kopete/plugins/latex/latexplugin.cpp88
-rw-r--r--kopete/plugins/latex/latexplugin.h14
-rw-r--r--kopete/plugins/latex/latexpreferences.cpp10
-rw-r--r--kopete/plugins/latex/latexpreferences.h4
6 files changed, 69 insertions, 69 deletions
diff --git a/kopete/plugins/latex/latexguiclient.cpp b/kopete/plugins/latex/latexguiclient.cpp
index 8d7cbf3e..ea9420fb 100644
--- a/kopete/plugins/latex/latexguiclient.cpp
+++ b/kopete/plugins/latex/latexguiclient.cpp
@@ -17,14 +17,14 @@
*************************************************************************
*/
-#include <qvariant.h>
+#include <tqvariant.h>
#include <kaction.h>
#include <klocale.h>
#include <kmessagebox.h>
-#include <qimage.h>
-#include <qregexp.h>
-#include <qstylesheet.h>
+#include <tqimage.h>
+#include <tqregexp.h>
+#include <tqstylesheet.h>
#include "kopetechatsession.h"
#include "kopeteview.h"
@@ -34,14 +34,14 @@
#include "latexguiclient.h"
LatexGUIClient::LatexGUIClient( Kopete::ChatSession *parent, const char *name )
-: QObject( parent, name ), KXMLGUIClient( parent )
+: TQObject( parent, name ), KXMLGUIClient( parent )
{
setInstance( LatexPlugin::plugin()->instance() );
- connect( LatexPlugin::plugin(), SIGNAL( destroyed( QObject * ) ), this, SLOT( deleteLater() ) );
+ connect( LatexPlugin::plugin(), TQT_SIGNAL( destroyed( TQObject * ) ), this, TQT_SLOT( deleteLater() ) );
m_manager = parent;
- new KAction( i18n( "Preview Latex Images" ), "latex", CTRL + Key_L, this, SLOT( slotPreview() ), actionCollection(), "latexPreview" );
+ new KAction( i18n( "Preview Latex Images" ), "latex", CTRL + Key_L, this, TQT_SLOT( slotPreview() ), actionCollection(), "latexPreview" );
setXMLFile( "latexchatui.rc" );
}
@@ -56,10 +56,10 @@ void LatexGUIClient::slotPreview()
return;
Kopete::Message msg = m_manager->view()->currentMessage();
- QString messageText = msg.plainBody();
+ TQString messageText = msg.plainBody();
if(!messageText.contains("$$")) //we haven't found any latex strings
{
- KMessageBox::sorry(reinterpret_cast<QWidget*>(m_manager->view()) , i18n("There are no latex in the message you are typing. The latex formula must be included between $$ and $$ "), i18n("No Latex Formula") );
+ KMessageBox::sorry(reinterpret_cast<TQWidget*>(m_manager->view()) , i18n("There are no latex in the message you are typing. The latex formula must be included between $$ and $$ "), i18n("No Latex Formula") );
return;
}
diff --git a/kopete/plugins/latex/latexguiclient.h b/kopete/plugins/latex/latexguiclient.h
index c8ca9e99..03fdbd9e 100644
--- a/kopete/plugins/latex/latexguiclient.h
+++ b/kopete/plugins/latex/latexguiclient.h
@@ -20,7 +20,7 @@
#ifndef TRANSLATORGUICLIENT_H
#define TRANSLATORGUICLIENT_H
-#include <qobject.h>
+#include <tqobject.h>
#include <kxmlguiclient.h>
#include <kio/job.h>
@@ -34,7 +34,7 @@ namespace Kopete { class ChatSession; }
* @author Olivier Goffart <ogoffart @ kde.org>
*/
-class LatexGUIClient : public QObject , public KXMLGUIClient
+class LatexGUIClient : public TQObject , public KXMLGUIClient
{
Q_OBJECT
diff --git a/kopete/plugins/latex/latexplugin.cpp b/kopete/plugins/latex/latexplugin.cpp
index 7ceab209..11537aba 100644
--- a/kopete/plugins/latex/latexplugin.cpp
+++ b/kopete/plugins/latex/latexplugin.cpp
@@ -16,11 +16,11 @@
*************************************************************************
*/
-#include <qregexp.h>
-#include <qimage.h>
-#include <qbuffer.h>
-#include <qcstring.h>
-#include <qstylesheet.h>
+#include <tqregexp.h>
+#include <tqimage.h>
+#include <tqbuffer.h>
+#include <tqcstring.h>
+#include <tqstylesheet.h>
#include <kgenericfactory.h>
#include <kdebug.h>
#include <kstandarddirs.h>
@@ -41,7 +41,7 @@
typedef KGenericFactory<LatexPlugin> LatexPluginFactory;
K_EXPORT_COMPONENT_FACTORY( kopete_latex, LatexPluginFactory( "kopete_latex" ) )
-LatexPlugin::LatexPlugin( QObject *parent, const char *name, const QStringList &/*args*/ )
+LatexPlugin::LatexPlugin( TQObject *parent, const char *name, const TQStringList &/*args*/ )
: Kopete::Plugin( LatexPluginFactory::instance(), parent, name )
{
// kdDebug() << k_funcinfo << endl;
@@ -49,18 +49,18 @@ LatexPlugin::LatexPlugin( QObject *parent, const char *name, const QStringList &
s_pluginStatic = this;
mMagickNotFoundShown = false;
- connect( Kopete::ChatSessionManager::self(), SIGNAL( aboutToDisplay( Kopete::Message & ) ), SLOT( slotMessageAboutToShow( Kopete::Message & ) ) );
- connect( Kopete::ChatSessionManager::self(), SIGNAL( aboutToSend(Kopete::Message& ) ), this, SLOT(slotMessageAboutToSend(Kopete::Message& ) ) );
- connect ( this , SIGNAL( settingsChanged() ) , this , SLOT( slotSettingsChanged() ) );
- connect( Kopete::ChatSessionManager::self(), SIGNAL( chatSessionCreated( Kopete::ChatSession * ) ),
- this, SLOT( slotNewChatSession( Kopete::ChatSession * ) ) );
+ connect( Kopete::ChatSessionManager::self(), TQT_SIGNAL( aboutToDisplay( Kopete::Message & ) ), TQT_SLOT( slotMessageAboutToShow( Kopete::Message & ) ) );
+ connect( Kopete::ChatSessionManager::self(), TQT_SIGNAL( aboutToSend(Kopete::Message& ) ), this, TQT_SLOT(slotMessageAboutToSend(Kopete::Message& ) ) );
+ connect ( this , TQT_SIGNAL( settingsChanged() ) , this , TQT_SLOT( slotSettingsChanged() ) );
+ connect( Kopete::ChatSessionManager::self(), TQT_SIGNAL( chatSessionCreated( Kopete::ChatSession * ) ),
+ this, TQT_SLOT( slotNewChatSession( Kopete::ChatSession * ) ) );
m_convScript = KStandardDirs::findExe("kopete_latexconvert.sh");
slotSettingsChanged();
//Add GUI action to all already existing kmm (if the plugin is launched when kopete already rining)
- QValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions();
- for (QValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it)
+ TQValueList<Kopete::ChatSession*> sessions = Kopete::ChatSessionManager::self()->sessions();
+ for (TQValueListIterator<Kopete::ChatSession*> it= sessions.begin(); it!=sessions.end() ; ++it)
slotNewChatSession( *it );
}
@@ -84,7 +84,7 @@ void LatexPlugin::slotNewChatSession( Kopete::ChatSession *KMM )
void LatexPlugin::slotMessageAboutToShow( Kopete::Message& msg )
{
- QString mMagick = KStandardDirs::findExe("convert");
+ TQString mMagick = KStandardDirs::findExe("convert");
if ( mMagick.isEmpty() )
{
// show just once
@@ -100,7 +100,7 @@ void LatexPlugin::slotMessageAboutToShow( Kopete::Message& msg )
return;
}
- QString messageText = msg.plainBody();
+ TQString messageText = msg.plainBody();
if( !messageText.contains("$$"))
return;
@@ -110,14 +110,14 @@ void LatexPlugin::slotMessageAboutToShow( Kopete::Message& msg )
// \$\$.+?\$\$
// this searches for $$formula$$
- QRegExp rg("\\$\\$.+\\$\\$");
+ TQRegExp rg("\\$\\$.+\\$\\$");
rg.setMinimal(true);
// this searches for [latex]formula[/latex]
- //QRegExp rg("\\[([^]\]).*?\\[/$1\\]");
+ //TQRegExp rg("\\[([^]\]).*?\\[/$1\\]");
int pos = 0;
- QMap<QString, QString> replaceMap;
+ TQMap<TQString, TQString> replaceMap;
while (pos >= 0 && (unsigned int)pos < messageText.length())
{
// kdDebug() << k_funcinfo << " searching pos: " << pos << endl;
@@ -125,27 +125,27 @@ void LatexPlugin::slotMessageAboutToShow( Kopete::Message& msg )
if (pos >= 0 )
{
- QString match = rg.cap(0);
+ TQString match = rg.cap(0);
pos += rg.matchedLength();
- QString formul=match;
+ TQString formul=match;
if(!securityCheck(formul))
continue;
- QString fileName=handleLatex(formul.replace("$$",""));
+ TQString fileName=handleLatex(formul.replace("$$",""));
// get the image and encode it with base64
#if ENCODED_IMAGE_MODE
- QImage renderedImage( fileName );
+ TQImage renderedImage( fileName );
imagePxWidth = renderedImage.width();
imagePxHeight = renderedImage.height();
if ( !renderedImage.isNull() )
{
- QByteArray ba;
- QBuffer buffer( ba );
+ TQByteArray ba;
+ TQBuffer buffer( ba );
buffer.open( IO_WriteOnly );
renderedImage.save( &buffer, "PNG" );
- QString imageURL = QString::fromLatin1("data:image/png;base64,%1").arg( KCodecs::base64Encode( ba ) );
+ TQString imageURL = TQString::fromLatin1("data:image/png;base64,%1").arg( KCodecs::base64Encode( ba ) );
replaceMap[match] = imageURL;
}
#else
@@ -160,15 +160,15 @@ void LatexPlugin::slotMessageAboutToShow( Kopete::Message& msg )
messageText= msg.escapedBody();
int imagePxWidth,imagePxHeight;
- for (QMap<QString,QString>::ConstIterator it = replaceMap.begin(); it != replaceMap.end(); ++it)
+ for (TQMap<TQString,TQString>::ConstIterator it = replaceMap.begin(); it != replaceMap.end(); ++it)
{
- QImage theImage(*it);
+ TQImage theImage(*it);
if(theImage.isNull())
continue;
imagePxWidth = theImage.width();
imagePxHeight = theImage.height();
- QString escapedLATEX=QStyleSheet::escape(it.key()).replace("\"","&quot;"); //we need the escape quotes because that string will be in a title="" argument, but not the \n
- messageText.replace(Kopete::Message::escape(it.key()), " <img width=\"" + QString::number(imagePxWidth) + "\" height=\"" + QString::number(imagePxHeight) + "\" src=\"" + (*it) + "\" alt=\"" + escapedLATEX +"\" title=\"" + escapedLATEX +"\" /> ");
+ TQString escapedLATEX=TQStyleSheet::escape(it.key()).replace("\"","&quot;"); //we need the escape quotes because that string will be in a title="" argument, but not the \n
+ messageText.replace(Kopete::Message::escape(it.key()), " <img width=\"" + TQString::number(imagePxWidth) + "\" height=\"" + TQString::number(imagePxHeight) + "\" src=\"" + (*it) + "\" alt=\"" + escapedLATEX +"\" title=\"" + escapedLATEX +"\" /> ");
}
msg.setBody( messageText, Kopete::Message::RichText );
@@ -186,62 +186,62 @@ void LatexPlugin::slotMessageAboutToSend( Kopete::Message& msg)
if(!config->readBoolEntry("ParseOutgoing", false))
return;
- QString messageText = msg.plainBody();
+ TQString messageText = msg.plainBody();
if( !messageText.contains("$$"))
return;
/* if( msg.from()->protocol()->pluginId()!="MSNProtocol" )
return;*/
// this searches for $$formula$$
- QRegExp rg("^\\s*\\$\\$([^$]+)\\$\\$\\s*$");
+ TQRegExp rg("^\\s*\\$\\$([^$]+)\\$\\$\\s*$");
if( rg.search(messageText) != -1 )
{
- QString latexFormula = rg.cap(1);
+ TQString latexFormula = rg.cap(1);
if(!securityCheck( latexFormula ))
return;
- QString url = handleLatex(latexFormula);
+ TQString url = handleLatex(latexFormula);
if(!url.isNull())
{
- QString escapedLATEX= QStyleSheet::escape(messageText).replace("\"","&quot;");
- QString messageText="<img src=\"" + url + "\" alt=\"" + escapedLATEX + "\" title=\"" + escapedLATEX +"\" />";
+ TQString escapedLATEX= TQStyleSheet::escape(messageText).replace("\"","&quot;");
+ TQString messageText="<img src=\"" + url + "\" alt=\"" + escapedLATEX + "\" title=\"" + escapedLATEX +"\" />";
msg.setBody( messageText, Kopete::Message::RichText );
}
}
#endif
}
-QString LatexPlugin::handleLatex(const QString &latexFormula)
+TQString LatexPlugin::handleLatex(const TQString &latexFormula)
{
KTempFile *tempFile=new KTempFile( locateLocal( "tmp", "kopetelatex-" ), ".png" );
tempFile->setAutoDelete(true);
m_tempFiles.append(tempFile);
m_tempFiles.setAutoDelete(true);
- QString fileName = tempFile->name();
+ TQString fileName = tempFile->name();
KProcess p;
- QString argumentRes = "-r %1x%2";
- QString argumentOut = "-o %1";
- //QString argumentFormat = "-fgif"; //we uses gif format because MSN only handle gif
+ TQString argumentRes = "-r %1x%2";
+ TQString argumentOut = "-o %1";
+ //TQString argumentFormat = "-fgif"; //we uses gif format because MSN only handle gif
int hDPI, vDPI;
hDPI = LatexConfig::self()->horizontalDPI();
vDPI = LatexConfig::self()->verticalDPI();
- p << m_convScript << argumentRes.arg(QString::number(hDPI), QString::number(vDPI)) << argumentOut.arg(fileName) /*<< argumentFormat*/ << latexFormula ;
+ p << m_convScript << argumentRes.arg(TQString::number(hDPI), TQString::number(vDPI)) << argumentOut.arg(fileName) /*<< argumentFormat*/ << latexFormula ;
- kdDebug() << k_funcinfo << " Rendering " << m_convScript << " " << argumentRes.arg(QString::number(hDPI), QString::number(vDPI)) << " " << argumentOut.arg(fileName) << endl;
+ kdDebug() << k_funcinfo << " Rendering " << m_convScript << " " << argumentRes.arg(TQString::number(hDPI), TQString::number(vDPI)) << " " << argumentOut.arg(fileName) << endl;
// FIXME our sucky sync filter API limitations :-)
p.start(KProcess::Block);
return fileName;
}
-bool LatexPlugin::securityCheck(const QString &latexFormula)
+bool LatexPlugin::securityCheck(const TQString &latexFormula)
{
- return !latexFormula.contains(QRegExp("\\\\(def|let|futurelet|newcommand|renewcomment|else|fi|write|input|include"
+ return !latexFormula.contains(TQRegExp("\\\\(def|let|futurelet|newcommand|renewcomment|else|fi|write|input|include"
"|chardef|catcode|makeatletter|noexpand|toksdef|every|errhelp|errorstopmode|scrollmode|nonstopmode|batchmode"
"|read|csname|newhelp|relax|afterground|afterassignment|expandafter|noexpand|special|command|loop|repeat|toks"
"|output|line|mathcode|name|item|section|mbox|DeclareRobustCommand)[^a-zA-Z]"));
diff --git a/kopete/plugins/latex/latexplugin.h b/kopete/plugins/latex/latexplugin.h
index a0fcd7fd..ebff5f8d 100644
--- a/kopete/plugins/latex/latexplugin.h
+++ b/kopete/plugins/latex/latexplugin.h
@@ -21,8 +21,8 @@
#ifndef LATEXPLUGIN_H
#define LATEXPLUGIN_H
-#include <qobject.h>
-#include <qstring.h>
+#include <tqobject.h>
+#include <tqstring.h>
#include <ktempfile.h>
@@ -46,7 +46,7 @@ class LatexPlugin : public Kopete::Plugin
public:
static LatexPlugin *plugin();
- LatexPlugin( QObject *parent, const char *name, const QStringList &args );
+ LatexPlugin( TQObject *parent, const char *name, const TQStringList &args );
~LatexPlugin();
public slots:
@@ -59,19 +59,19 @@ public:
/**
* gives a latex formula, and return the filename of the file where the latex is stored.
*/
- QString handleLatex(const QString &latex);
+ TQString handleLatex(const TQString &latex);
/**
* return false if the latex formula may contains malicious commands
*/
- bool securityCheck(const QString & formula);
+ bool securityCheck(const TQString & formula);
private:
static LatexPlugin* s_pluginStatic;
- QString m_convScript;
+ TQString m_convScript;
bool mMagickNotFoundShown;
- QPtrList<KTempFile> m_tempFiles;
+ TQPtrList<KTempFile> m_tempFiles;
};
#endif
diff --git a/kopete/plugins/latex/latexpreferences.cpp b/kopete/plugins/latex/latexpreferences.cpp
index 1727ae49..ff02c831 100644
--- a/kopete/plugins/latex/latexpreferences.cpp
+++ b/kopete/plugins/latex/latexpreferences.cpp
@@ -15,7 +15,7 @@
*************************************************************************
*/
-#include <qlayout.h>
+#include <tqlayout.h>
#include <kparts/componentfactory.h>
#include <klocale.h>
#include <kgenericfactory.h>
@@ -30,17 +30,17 @@
typedef KGenericFactory<LatexPreferences> LatexPreferencesFactory;
K_EXPORT_COMPONENT_FACTORY( kcm_kopete_latex, LatexPreferencesFactory( "kcm_kopete_latex" ) )
-LatexPreferences::LatexPreferences(QWidget *parent, const char* /*name*/, const QStringList &args)
+LatexPreferences::LatexPreferences(TQWidget *parent, const char* /*name*/, const TQStringList &args)
: KCModule(LatexPreferencesFactory::instance(), parent, args)
{
- ( new QVBoxLayout( this ) )->setAutoAdd( true );
+ ( new TQVBoxLayout( this ) )->setAutoAdd( true );
m_preferencesDialog = new LatexPrefsUI(this);
// connect widget signals here
m_preferencesDialog->horizontalDPI->setMinValue(1);
m_preferencesDialog->verticalDPI->setMinValue(1);
- connect(m_preferencesDialog->horizontalDPI, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
- connect(m_preferencesDialog->verticalDPI, SIGNAL(valueChanged(int)), this, SLOT(slotModified()));
+ connect(m_preferencesDialog->horizontalDPI, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotModified()));
+ connect(m_preferencesDialog->verticalDPI, TQT_SIGNAL(valueChanged(int)), this, TQT_SLOT(slotModified()));
load();
}
diff --git a/kopete/plugins/latex/latexpreferences.h b/kopete/plugins/latex/latexpreferences.h
index c08b35b5..5bfc2f8f 100644
--- a/kopete/plugins/latex/latexpreferences.h
+++ b/kopete/plugins/latex/latexpreferences.h
@@ -19,7 +19,7 @@
#define LatexPREFERENCES_H
#include <kcmodule.h>
-#include <qstring.h>
+#include <tqstring.h>
class LatexPrefsUI;
class QListViewItem;
@@ -33,7 +33,7 @@ class LatexPreferences : public KCModule
Q_OBJECT
public:
- LatexPreferences(QWidget *parent = 0, const char* name = 0, const QStringList &args = QStringList());
+ LatexPreferences(TQWidget *parent = 0, const char* name = 0, const TQStringList &args = TQStringList());
~LatexPreferences();
virtual void save();