diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:46:43 +0000 |
commit | ffe8a83e053396df448e9413828527613ca3bd46 (patch) | |
tree | a73d4169e02df4a50f9a12cb165fcd0ab5bac7c6 /kparts/plugin.cpp | |
parent | 682bf3bfdcbcbb1fca85e8a36ed03e062e0555d5 (diff) | |
download | tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.tar.gz tdelibs-ffe8a83e053396df448e9413828527613ca3bd46.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1157647 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kparts/plugin.cpp')
-rw-r--r-- | kparts/plugin.cpp | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/kparts/plugin.cpp b/kparts/plugin.cpp index f0764fd0f..c9b0d2e36 100644 --- a/kparts/plugin.cpp +++ b/kparts/plugin.cpp @@ -25,9 +25,9 @@ #include <assert.h> -#include <qfile.h> -#include <qobjectlist.h> -#include <qfileinfo.h> +#include <tqfile.h> +#include <tqobjectlist.h> +#include <tqfileinfo.h> #include <klibloader.h> #include <kinstance.h> @@ -46,11 +46,11 @@ public: PluginPrivate() : m_parentInstance( 0 ) {} const KInstance *m_parentInstance; - QString m_library; // filename of the library + TQString m_library; // filename of the library }; -Plugin::Plugin( QObject* parent, const char* name ) - : QObject( parent, name ) +Plugin::Plugin( TQObject* parent, const char* name ) + : TQObject( parent, name ) { //kdDebug() << className() << endl; d = new PluginPrivate(); @@ -61,65 +61,65 @@ Plugin::~Plugin() delete d; } -QString Plugin::xmlFile() const +TQString Plugin::xmlFile() const { - QString path = KXMLGUIClient::xmlFile(); + TQString path = KXMLGUIClient::xmlFile(); if ( !d->m_parentInstance || ( path.length() > 0 && path[ 0 ] == '/' ) ) return path; - QString absPath = locate( "data", QString::fromLatin1( d->m_parentInstance->instanceName() ) + '/' + path ); + TQString absPath = locate( "data", TQString::fromLatin1( d->m_parentInstance->instanceName() ) + '/' + path ); assert( !absPath.isEmpty() ); return absPath; } -QString Plugin::localXMLFile() const +TQString Plugin::localXMLFile() const { - QString path = KXMLGUIClient::xmlFile(); + TQString path = KXMLGUIClient::xmlFile(); if ( !d->m_parentInstance || ( path.length() > 0 && path[ 0 ] == '/' ) ) return path; - QString absPath = locateLocal( "data", QString::fromLatin1( d->m_parentInstance->instanceName() ) + '/' + path ); + TQString absPath = locateLocal( "data", TQString::fromLatin1( d->m_parentInstance->instanceName() ) + '/' + path ); assert( !absPath.isEmpty() ); return absPath; } //static -QValueList<Plugin::PluginInfo> Plugin::pluginInfos( const KInstance * instance ) +TQValueList<Plugin::PluginInfo> Plugin::pluginInfos( const KInstance * instance ) { if ( !instance ) kdError(1000) << "No instance ???" << endl; - QValueList<PluginInfo> plugins; + TQValueList<PluginInfo> plugins; // KDE4: change * into *.rc and remove test for .desktop from the for loop below. - const QStringList pluginDocs = instance->dirs()->findAllResources( + const TQStringList pluginDocs = instance->dirs()->findAllResources( "data", instance->instanceName()+"/kpartplugins/*", true, false ); - QMap<QString,QStringList> sortedPlugins; + TQMap<TQString,TQStringList> sortedPlugins; - QStringList::ConstIterator pIt = pluginDocs.begin(); - QStringList::ConstIterator pEnd = pluginDocs.end(); + TQStringList::ConstIterator pIt = pluginDocs.begin(); + TQStringList::ConstIterator pEnd = pluginDocs.end(); for (; pIt != pEnd; ++pIt ) { - QFileInfo fInfo( *pIt ); - if ( fInfo.extension() == QString::fromLatin1( "desktop" ) ) + TQFileInfo fInfo( *pIt ); + if ( fInfo.extension() == TQString::fromLatin1( "desktop" ) ) continue; - QMap<QString,QStringList>::Iterator mapIt = sortedPlugins.find( fInfo.fileName() ); + TQMap<TQString,TQStringList>::Iterator mapIt = sortedPlugins.find( fInfo.fileName() ); if ( mapIt == sortedPlugins.end() ) - mapIt = sortedPlugins.insert( fInfo.fileName(), QStringList() ); + mapIt = sortedPlugins.insert( fInfo.fileName(), TQStringList() ); mapIt.data().append( *pIt ); } - QMap<QString,QStringList>::ConstIterator mapIt = sortedPlugins.begin(); - QMap<QString,QStringList>::ConstIterator mapEnd = sortedPlugins.end(); + TQMap<TQString,TQStringList>::ConstIterator mapIt = sortedPlugins.begin(); + TQMap<TQString,TQStringList>::ConstIterator mapEnd = sortedPlugins.end(); for (; mapIt != mapEnd; ++mapIt ) { PluginInfo info; - QString doc; + TQString doc; info.m_absXMLFileName = KXMLGUIClient::findMostRecentXMLFile( mapIt.data(), doc ); if ( info.m_absXMLFileName.isEmpty() ) continue; @@ -138,23 +138,23 @@ QValueList<Plugin::PluginInfo> Plugin::pluginInfos( const KInstance * instance ) return plugins; } -void Plugin::loadPlugins( QObject *parent, const KInstance *instance ) +void Plugin::loadPlugins( TQObject *parent, const KInstance *instance ) { loadPlugins( parent, pluginInfos( instance ), instance ); } -void Plugin::loadPlugins( QObject *parent, const QValueList<PluginInfo> &pluginInfos, const KInstance *instance ) +void Plugin::loadPlugins( TQObject *parent, const TQValueList<PluginInfo> &pluginInfos, const KInstance *instance ) { - QValueList<PluginInfo>::ConstIterator pIt = pluginInfos.begin(); - QValueList<PluginInfo>::ConstIterator pEnd = pluginInfos.end(); + TQValueList<PluginInfo>::ConstIterator pIt = pluginInfos.begin(); + TQValueList<PluginInfo>::ConstIterator pEnd = pluginInfos.end(); for (; pIt != pEnd; ++pIt ) { - QString library = (*pIt).m_document.documentElement().attribute( "library" ); + TQString library = (*pIt).m_document.documentElement().attribute( "library" ); if ( library.isEmpty() || hasPlugin( parent, library ) ) continue; - Plugin *plugin = loadPlugin( parent, QFile::encodeName(library) ); + Plugin *plugin = loadPlugin( parent, TQFile::encodeName(library) ); if ( plugin ) { @@ -167,13 +167,13 @@ void Plugin::loadPlugins( QObject *parent, const QValueList<PluginInfo> &pluginI } -void Plugin::loadPlugins( QObject *parent, const QValueList<PluginInfo> &pluginInfos ) +void Plugin::loadPlugins( TQObject *parent, const TQValueList<PluginInfo> &pluginInfos ) { loadPlugins(parent, pluginInfos, 0); } // static -Plugin* Plugin::loadPlugin( QObject * parent, const char* libname ) +Plugin* Plugin::loadPlugin( TQObject * parent, const char* libname ) { Plugin* plugin = ComponentFactory::createInstanceFromLibrary<Plugin>( libname, parent, libname ); if ( !plugin ) @@ -182,16 +182,16 @@ Plugin* Plugin::loadPlugin( QObject * parent, const char* libname ) return plugin; } -QPtrList<KParts::Plugin> Plugin::pluginObjects( QObject *parent ) +TQPtrList<KParts::Plugin> Plugin::pluginObjects( TQObject *parent ) { - QPtrList<KParts::Plugin> objects; + TQPtrList<KParts::Plugin> objects; if (!parent ) return objects; - QObjectList *plugins = parent->queryList( "KParts::Plugin", 0, false, false ); + TQObjectList *plugins = parent->queryList( "KParts::Plugin", 0, false, false ); - QObjectListIt it( *plugins ); + TQObjectListIt it( *plugins ); for ( ; it.current() ; ++it ) { objects.append( static_cast<Plugin *>( it.current() ) ); @@ -202,10 +202,10 @@ QPtrList<KParts::Plugin> Plugin::pluginObjects( QObject *parent ) return objects; } -bool Plugin::hasPlugin( QObject* parent, const QString& library ) +bool Plugin::hasPlugin( TQObject* parent, const TQString& library ) { - QObjectList *plugins = parent->queryList( "KParts::Plugin", 0, false, false ); - QObjectListIt it( *plugins ); + TQObjectList *plugins = parent->queryList( "KParts::Plugin", 0, false, false ); + TQObjectListIt it( *plugins ); for ( ; it.current() ; ++it ) { if ( static_cast<Plugin *>( it.current() )->d->m_library == library ) @@ -224,22 +224,22 @@ void Plugin::setInstance( KInstance *instance ) KXMLGUIClient::setInstance( instance ); } -void Plugin::loadPlugins( QObject *parent, KXMLGUIClient* parentGUIClient, KInstance* instance, bool enableNewPluginsByDefault ) +void Plugin::loadPlugins( TQObject *parent, KXMLGUIClient* parentGUIClient, KInstance* instance, bool enableNewPluginsByDefault ) { KConfigGroup cfgGroup( instance->config(), "KParts Plugins" ); - QValueList<PluginInfo> plugins = pluginInfos( instance ); - QValueList<PluginInfo>::ConstIterator pIt = plugins.begin(); - QValueList<PluginInfo>::ConstIterator pEnd = plugins.end(); + TQValueList<PluginInfo> plugins = pluginInfos( instance ); + TQValueList<PluginInfo>::ConstIterator pIt = plugins.begin(); + TQValueList<PluginInfo>::ConstIterator pEnd = plugins.end(); for (; pIt != pEnd; ++pIt ) { - QDomElement docElem = (*pIt).m_document.documentElement(); - QString library = docElem.attribute( "library" ); + TQDomElement docElem = (*pIt).m_document.documentElement(); + TQString library = docElem.attribute( "library" ); if ( library.isEmpty() ) continue; // Check configuration - const QString name = docElem.attribute( "name" ); + const TQString name = docElem.attribute( "name" ); bool pluginEnabled = enableNewPluginsByDefault; if ( cfgGroup.hasKey( name + "Enabled" ) ) @@ -248,11 +248,11 @@ void Plugin::loadPlugins( QObject *parent, KXMLGUIClient* parentGUIClient, KInst } else { // no user-setting, load plugin default setting - QString relPath = QString( instance->instanceName() ) + "/" + (*pIt).m_relXMLFileName; + TQString relPath = TQString( instance->instanceName() ) + "/" + (*pIt).m_relXMLFileName; relPath.truncate( relPath.findRev( '.' ) ); // remove extension relPath += ".desktop"; //kdDebug(1000) << "looking for " << relPath << endl; - const QString desktopfile = instance->dirs()->findResource( "data", relPath ); + const TQString desktopfile = instance->dirs()->findResource( "data", relPath ); if( !desktopfile.isEmpty() ) { //kdDebug(1000) << "loadPlugins found desktop file for " << name << ": " << desktopfile << endl; @@ -268,8 +268,8 @@ void Plugin::loadPlugins( QObject *parent, KXMLGUIClient* parentGUIClient, KInst } // search through already present plugins - QObjectList *pluginList = parent->queryList( "KParts::Plugin", 0, false, false ); - QObjectListIt it( *pluginList ); + TQObjectList *pluginList = parent->queryList( "KParts::Plugin", 0, false, false ); + TQObjectListIt it( *pluginList ); bool pluginFound = false; for ( ; it.current() ; ++it ) { @@ -298,7 +298,7 @@ void Plugin::loadPlugins( QObject *parent, KXMLGUIClient* parentGUIClient, KInst continue; kdDebug( 1000 ) << "load plugin " << name << endl; - Plugin *plugin = loadPlugin( parent, QFile::encodeName(library) ); + Plugin *plugin = loadPlugin( parent, TQFile::encodeName(library) ); if ( plugin ) { |