From 47c8a359c5276062c4bc17f0e82410f29081b502 Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:48:06 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kopete/plugins/latex/latexguiclient.cpp | 18 +++---- kopete/plugins/latex/latexguiclient.h | 4 +- kopete/plugins/latex/latexplugin.cpp | 88 +++++++++++++++---------------- kopete/plugins/latex/latexplugin.h | 14 ++--- kopete/plugins/latex/latexpreferences.cpp | 10 ++-- kopete/plugins/latex/latexpreferences.h | 4 +- 6 files changed, 69 insertions(+), 69 deletions(-) (limited to 'kopete/plugins/latex') 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 +#include #include #include #include -#include -#include -#include +#include +#include +#include #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(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(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 +#include #include #include @@ -34,7 +34,7 @@ namespace Kopete { class ChatSession; } * @author Olivier Goffart */ -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 -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include @@ -41,7 +41,7 @@ typedef KGenericFactory 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 sessions = Kopete::ChatSessionManager::self()->sessions(); - for (QValueListIterator it= sessions.begin(); it!=sessions.end() ; ++it) + TQValueList sessions = Kopete::ChatSessionManager::self()->sessions(); + for (TQValueListIterator 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 replaceMap; + TQMap 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::ConstIterator it = replaceMap.begin(); it != replaceMap.end(); ++it) + for (TQMap::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("\"","""); //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()), " \"" "); + TQString escapedLATEX=TQStyleSheet::escape(it.key()).replace("\"","""); //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()), " \"" "); } 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("\"","""); - QString messageText="\"""; + TQString escapedLATEX= TQStyleSheet::escape(messageText).replace("\"","""); + TQString messageText="\"""; 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 -#include +#include +#include #include @@ -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 m_tempFiles; + TQPtrList 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 +#include #include #include #include @@ -30,17 +30,17 @@ typedef KGenericFactory 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 -#include +#include 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(); -- cgit v1.2.1