diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-18 17:00:31 +0000 |
commit | 395a904bff7b4d6ead445c342f7ac0c5fbf29121 (patch) | |
tree | 9829cadb79d2cc7c29a940627fadb28b11e54150 /konq-plugins/babelfish/plugin_babelfish.cpp | |
parent | 399f47c376fdf4d19192732a701ea9578d11619d (diff) | |
download | tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.tar.gz tdeaddons-395a904bff7b4d6ead445c342f7ac0c5fbf29121.zip |
TQt4 port kdeaddons
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdeaddons@1237404 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'konq-plugins/babelfish/plugin_babelfish.cpp')
-rw-r--r-- | konq-plugins/babelfish/plugin_babelfish.cpp | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/konq-plugins/babelfish/plugin_babelfish.cpp b/konq-plugins/babelfish/plugin_babelfish.cpp index fc7a80e..bf2e7da 100644 --- a/konq-plugins/babelfish/plugin_babelfish.cpp +++ b/konq-plugins/babelfish/plugin_babelfish.cpp @@ -34,9 +34,9 @@ typedef KGenericFactory<PluginBabelFish> BabelFishFactory; static const KAboutData aboutdata("babelfish", I18N_NOOP("Translate Web Page") , "1.0" ); K_EXPORT_COMPONENT_FACTORY( libbabelfishplugin, BabelFishFactory( &aboutdata ) ) -PluginBabelFish::PluginBabelFish( TQObject* parent, const char* name, +PluginBabelFish::PluginBabelFish( TQObject* tqparent, const char* name, const TQStringList & ) - : Plugin( parent, name ) + : Plugin( tqparent, name ) { setInstance(BabelFishFactory::instance()); @@ -178,9 +178,9 @@ PluginBabelFish::PluginBabelFish( TQObject* parent, const char* name, m_menu->setEnabled( true ); // TODO: we could also support plain text viewers... - if ( parent && parent->inherits( "KHTMLPart" ) ) + if ( tqparent && tqparent->inherits( "KHTMLPart" ) ) { - KParts::ReadOnlyPart* part = static_cast<KParts::ReadOnlyPart *>(parent); + KParts::ReadOnlyPart* part = static_cast<KParts::ReadOnlyPart *>(tqparent); connect( part, TQT_SIGNAL(started(KIO::Job*)), this, TQT_SLOT(slotStarted(KIO::Job*)) ); } @@ -193,9 +193,9 @@ PluginBabelFish::~PluginBabelFish() void PluginBabelFish::slotStarted( KIO::Job* ) { - if ( parent()->inherits("KHTMLPart") && + if ( tqparent()->inherits("KHTMLPart") && // Babelfish wants http URLs only. No https. - static_cast<KParts::ReadOnlyPart *>(parent())->url().protocol().lower() == "http" ) + static_cast<KParts::ReadOnlyPart *>(tqparent())->url().protocol().lower() == "http" ) { m_menu->setEnabled( true ); } @@ -211,8 +211,8 @@ void PluginBabelFish::translateURL() if ( !sender() ) return; - // The parent is assumed to be a KHTMLPart - if ( !parent()->inherits("KHTMLPart") ) + // The tqparent is assumed to be a KHTMLPart + if ( !tqparent()->inherits("KHTMLPart") ) { TQString title = i18n( "Cannot Translate Source" ); TQString text = i18n( "Only web pages can be translated using " @@ -224,10 +224,10 @@ void PluginBabelFish::translateURL() // Select engine KConfig cfg( "translaterc", true ); - TQString engine = cfg.readEntry( sender()->name(), "babelfish" ); + TQString engine = cfg.readEntry( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name(), "babelfish" ); // Get URL - KHTMLPart *part = dynamic_cast<KHTMLPart *>(parent()); + KHTMLPart *part = dynamic_cast<KHTMLPart *>(tqparent()); if ( !part ) return; @@ -262,33 +262,33 @@ void PluginBabelFish::translateURL() TQString query; if( engine == "freetranslation" ) { query = "sequence=core&Submit=FREE Translation&language="; - if( sender()->name() == TQString( "en_es" ) ) + if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_es" ) ) query += "English/Spanish"; - else if( sender()->name() == TQString( "en_de" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_de" ) ) query += "English/German"; - else if( sender()->name() == TQString( "en_it" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_it" ) ) query += "English/Italian"; - else if( sender()->name() == TQString( "en_nl" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_nl" ) ) query += "English/Dutch"; - else if( sender()->name() == TQString( "en_pt" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_pt" ) ) query += "English/Portuguese"; - else if( sender()->name() == TQString( "en_no" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_no" ) ) query += "English/Norwegian"; - else if( sender()->name() == TQString( "en_zh" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_zh" ) ) query += "English/SimplifiedChinese"; - else if( sender()->name() == TQString( "en_zhTW" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_zhTW" ) ) query += "English/TraditionalChinese"; - else if( sender()->name() == TQString( "es_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "es_en" ) ) query += "Spanish/English"; - else if( sender()->name() == TQString( "fr_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "fr_en" ) ) query += "French/English"; - else if( sender()->name() == TQString( "de_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "de_en" ) ) query += "German/English"; - else if( sender()->name() == TQString( "it_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "it_en" ) ) query += "Italian/English"; - else if( sender()->name() == TQString( "nl_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "nl_en" ) ) query += "Dutch/English"; - else if( sender()->name() == TQString( "pt_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "pt_en" ) ) query += "Portuguese/English"; else // Should be en_fr query += "English/French"; @@ -313,21 +313,21 @@ void PluginBabelFish::translateURL() } else if( engine == "reverso" ) { result = KURL( "http://www.reverso.net/url/frame.asp" ); query = "autotranslate=on&templates=0&x=0&y=0&directions="; - if( sender()->name() == TQString( "de_fr" ) ) + if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "de_fr" ) ) query += "524292"; - else if( sender()->name() == TQString( "fr_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "fr_en" ) ) query += "65544"; - else if( sender()->name() == TQString( "fr_de" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "fr_de" ) ) query += "262152"; - else if( sender()->name() == TQString( "de_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "de_en" ) ) query += "65540"; - else if( sender()->name() == TQString( "en_de" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_de" ) ) query += "262145"; - else if( sender()->name() == TQString( "en_es" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_es" ) ) query += "2097153"; - else if( sender()->name() == TQString( "es_en" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "es_en" ) ) query += "65568"; - else if( sender()->name() == TQString( "fr_es" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "fr_es" ) ) query += "2097160"; else // "en_fr" query += "524289"; @@ -336,20 +336,20 @@ void PluginBabelFish::translateURL() } else if( engine == "tsail" ) { result = KURL( "http://www.t-mail.com/cgi-bin/tsail" ); query = "sail=full&lp="; - if( sender()->name() == TQString( "zhTW_en" ) ) + if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "zhTW_en" ) ) query += "tw-en"; - else if( sender()->name() == TQString( "en_zhTW" ) ) + else if( TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name() == TQString( "en_zhTW" ) ) query += "en-tw"; else { - query += sender()->name(); + query += TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name(); query[15] = '-'; } query += totrans; } else if( engine == "voila" ) { result = KURL( "http://trans.voila.fr/voila" ); query = "systran_id=Voila-fr&systran_lp="; - query += sender()->name(); + query += TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name(); if ( part->hasSelection() ) query += "&systran_charset=utf-8&systran_text="; else @@ -359,7 +359,7 @@ void PluginBabelFish::translateURL() // Using the altavista babelfish engine result = KURL( "http://babelfish.altavista.com/babelfish/tr" ); query = "lp="; - query += sender()->name(); + query += TQT_TQOBJECT(const_cast<TQT_BASE_OBJECT_NAME*>(sender()))->name(); if ( part->hasSelection() ) query += "&text="; else |