summaryrefslogtreecommitdiffstats
path: root/libkdepim/komposer/core/pluginmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkdepim/komposer/core/pluginmanager.cpp')
-rw-r--r--libkdepim/komposer/core/pluginmanager.cpp132
1 files changed, 66 insertions, 66 deletions
diff --git a/libkdepim/komposer/core/pluginmanager.cpp b/libkdepim/komposer/core/pluginmanager.cpp
index 82e7f0e9b..c7cf74927 100644
--- a/libkdepim/komposer/core/pluginmanager.cpp
+++ b/libkdepim/komposer/core/pluginmanager.cpp
@@ -24,11 +24,11 @@
#include "plugin.h"
-#include <qapplication.h>
-#include <qfile.h>
-#include <qregexp.h>
-#include <qtimer.h>
-#include <qvaluestack.h>
+#include <tqapplication.h>
+#include <tqfile.h>
+#include <tqregexp.h>
+#include <tqtimer.h>
+#include <tqvaluestack.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -48,11 +48,11 @@ class PluginManager::Private
{
public:
// All available plugins, regardless of category, and loaded or not
- QValueList<KPluginInfo*> plugins;
+ TQValueList<KPluginInfo*> plugins;
// Dict of all currently loaded plugins, mapping the KPluginInfo to
// a plugin
- QMap<KPluginInfo*, Plugin*> loadedPlugins;
+ TQMap<KPluginInfo*, Plugin*> loadedPlugins;
// The plugin manager's mode. The mode is StartingUp until loadAllPlugins()
// has finished loading the plugins, after which it is set to Running.
@@ -63,11 +63,11 @@ public:
KSharedConfig::Ptr config;
// Plugins pending for loading
- QValueStack<QString> pluginsToLoad;
+ TQValueStack<TQString> pluginsToLoad;
};
-PluginManager::PluginManager( QObject *parent )
- : QObject( parent )
+PluginManager::PluginManager( TQObject *parent )
+ : TQObject( parent )
{
d = new Private;
@@ -79,11 +79,11 @@ PluginManager::PluginManager( QObject *parent )
d->shutdownMode = Private::StartingUp;
KSettings::Dispatcher::self()->registerInstance( KGlobal::instance(),
- this, SLOT( loadAllPlugins() ) );
+ this, TQT_SLOT( loadAllPlugins() ) );
d->plugins = KPluginInfo::fromServices(
- KTrader::self()->query( QString::fromLatin1( "Komposer/Plugin" ),
- QString::fromLatin1( "[X-Komposer-Version] == 1" ) ) );
+ KTrader::self()->query( TQString::fromLatin1( "Komposer/Plugin" ),
+ TQString::fromLatin1( "[X-Komposer-Version] == 1" ) ) );
}
PluginManager::~PluginManager()
@@ -100,11 +100,11 @@ PluginManager::~PluginManager()
}
// Quick cleanup of the remaining plugins, hope it helps
- QMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); /* EMPTY */ )
{
// Remove causes the iterator to become invalid, so pre-increment first
- QMap<KPluginInfo*, Plugin*>::ConstIterator nextIt( it );
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator nextIt( it );
++nextIt;
kdWarning() << k_funcinfo << "Deleting stale plugin '"
<< it.data()->name() << "'" << endl;
@@ -115,14 +115,14 @@ PluginManager::~PluginManager()
delete d;
}
-QValueList<KPluginInfo*>
-PluginManager::availablePlugins( const QString &category ) const
+TQValueList<KPluginInfo*>
+PluginManager::availablePlugins( const TQString &category ) const
{
if ( category.isEmpty() )
return d->plugins;
- QValueList<KPluginInfo*> result;
- QValueList<KPluginInfo*>::ConstIterator it;
+ TQValueList<KPluginInfo*> result;
+ TQValueList<KPluginInfo*>::ConstIterator it;
for ( it = d->plugins.begin(); it != d->plugins.end(); ++it )
{
if ( ( *it )->category() == category )
@@ -132,11 +132,11 @@ PluginManager::availablePlugins( const QString &category ) const
return result;
}
-QMap<KPluginInfo*, Plugin*>
-PluginManager::loadedPlugins( const QString &category ) const
+TQMap<KPluginInfo*, Plugin*>
+PluginManager::loadedPlugins( const TQString &category ) const
{
- QMap<KPluginInfo*, Plugin*> result;
- QMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ TQMap<KPluginInfo*, Plugin*> result;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
{
if ( category.isEmpty() || it.key()->category() == category )
@@ -158,27 +158,27 @@ PluginManager::shutdown()
if ( d->loadedPlugins.empty() ) {
d->shutdownMode = Private::DoneShutdown;
} else {
- QMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); /* EMPTY */ )
{
// Remove causes the iterator to become invalid, so pre-increment first
- QMap<KPluginInfo*, Plugin*>::ConstIterator nextIt( it );
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator nextIt( it );
++nextIt;
it.data()->aboutToUnload();
it = nextIt;
}
}
- QTimer::singleShot( 3000, this, SLOT(slotShutdownTimeout()) );
+ TQTimer::singleShot( 3000, this, TQT_SLOT(slotShutdownTimeout()) );
}
void
PluginManager::slotPluginReadyForUnload()
{
- // Using QObject::sender() is on purpose here, because otherwise all
+ // Using TQObject::sender() is on purpose here, because otherwise all
// plugins would have to pass 'this' as parameter, which makes the API
// less clean for plugin authors
- Plugin* plugin = dynamic_cast<Plugin*>( const_cast<QObject*>( sender() ) );
+ Plugin* plugin = dynamic_cast<Plugin*>( const_cast<TQObject*>( sender() ) );
if ( !plugin )
{
kdWarning() << k_funcinfo << "Calling object is not a plugin!" << endl;
@@ -198,14 +198,14 @@ PluginManager::slotShutdownTimeout()
return;
#ifndef NDEBUG
- QStringList remaining;
- for ( QMap<KPluginInfo*, Plugin*>::ConstIterator it = d->loadedPlugins.begin();
+ TQStringList remaining;
+ for ( TQMap<KPluginInfo*, Plugin*>::ConstIterator it = d->loadedPlugins.begin();
it != d->loadedPlugins.end(); ++it )
remaining.append( it.key()->pluginName() );
kdWarning() << k_funcinfo << "Some plugins didn't shutdown in time!" << endl
<< "Remaining plugins: "
- << remaining.join( QString::fromLatin1( ", " ) ) << endl
+ << remaining.join( TQString::fromLatin1( ", " ) ) << endl
<< "Forcing Komposer shutdown now." << endl;
#endif
@@ -228,19 +228,19 @@ PluginManager::loadAllPlugins()
if ( !d->config )
d->config = KSharedConfig::openConfig( "komposerrc" );
- QMap<QString, QString> entries = d->config->entryMap(
- QString::fromLatin1( "Plugins" ) );
+ TQMap<TQString, TQString> entries = d->config->entryMap(
+ TQString::fromLatin1( "Plugins" ) );
- QMap<QString, QString>::Iterator it;
+ TQMap<TQString, TQString>::Iterator it;
for ( it = entries.begin(); it != entries.end(); ++it )
{
- QString key = it.key();
- if ( key.endsWith( QString::fromLatin1( "Enabled" ) ) )
+ TQString key = it.key();
+ if ( key.endsWith( TQString::fromLatin1( "Enabled" ) ) )
{
key.setLength( key.length() - 7 );
//kdDebug() << k_funcinfo << "Set " << key << " to " << it.data() << endl;
- if ( it.data() == QString::fromLatin1( "true" ) )
+ if ( it.data() == TQString::fromLatin1( "true" ) )
{
if ( !plugin( key ) )
d->pluginsToLoad.push( key );
@@ -257,7 +257,7 @@ PluginManager::loadAllPlugins()
}
// Schedule the plugins to load
- QTimer::singleShot( 0, this, SLOT( slotLoadNextPlugin() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( slotLoadNextPlugin() ) );
}
void PluginManager::slotLoadNextPlugin()
@@ -272,31 +272,31 @@ void PluginManager::slotLoadNextPlugin()
return;
}
- QString key = d->pluginsToLoad.pop();
+ TQString key = d->pluginsToLoad.pop();
loadPluginInternal( key );
// Schedule the next run unconditionally to avoid code duplication on the
// allPluginsLoaded() signal's handling. This has the added benefit that
// the signal is delayed one event loop, so the accounts are more likely
// to be instantiated.
- QTimer::singleShot( 0, this, SLOT( slotLoadNextPlugin() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( slotLoadNextPlugin() ) );
}
Plugin*
-PluginManager::loadPlugin( const QString &pluginId,
+PluginManager::loadPlugin( const TQString &pluginId,
PluginLoadMode mode /* = LoadSync */ )
{
if ( mode == LoadSync ) {
return loadPluginInternal( pluginId );
} else {
d->pluginsToLoad.push( pluginId );
- QTimer::singleShot( 0, this, SLOT( slotLoadNextPlugin() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( slotLoadNextPlugin() ) );
return 0;
}
}
Plugin*
-PluginManager::loadPluginInternal( const QString &pluginId )
+PluginManager::loadPluginInternal( const TQString &pluginId )
{
KPluginInfo* info = infoForPluginId( pluginId );
if ( !info ) {
@@ -310,18 +310,18 @@ PluginManager::loadPluginInternal( const QString &pluginId )
int error = 0;
Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery<Komposer::Plugin>(
- QString::fromLatin1( "Komposer/Plugin" ),
- QString::fromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).arg( pluginId ),
- this, 0, QStringList(), &error );
+ TQString::fromLatin1( "Komposer/Plugin" ),
+ TQString::fromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).arg( pluginId ),
+ this, 0, TQStringList(), &error );
if ( plugin ) {
d->loadedPlugins.insert( info, plugin );
info->setPluginEnabled( true );
- connect( plugin, SIGNAL(destroyed(QObject*)),
- this, SLOT(slotPluginDestroyed(QObject*)) );
- connect( plugin, SIGNAL(readyForUnload()),
- this, SLOT(slotPluginReadyForUnload()) );
+ connect( plugin, TQT_SIGNAL(destroyed(TQObject*)),
+ this, TQT_SLOT(slotPluginDestroyed(TQObject*)) );
+ connect( plugin, TQT_SIGNAL(readyForUnload()),
+ this, TQT_SLOT(slotPluginReadyForUnload()) );
kdDebug() << k_funcinfo << "Successfully loaded plugin '"
<< pluginId << "'" << endl;
@@ -365,9 +365,9 @@ PluginManager::loadPluginInternal( const QString &pluginId )
}
bool
-PluginManager::unloadPlugin( const QString &spec )
+PluginManager::unloadPlugin( const TQString &spec )
{
- QMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
{
if ( it.key()->pluginName() == spec )
@@ -381,9 +381,9 @@ PluginManager::unloadPlugin( const QString &spec )
}
void
-PluginManager::slotPluginDestroyed( QObject *plugin )
+PluginManager::slotPluginDestroyed( TQObject *plugin )
{
- QMap<KPluginInfo*, Plugin*>::Iterator it;
+ TQMap<KPluginInfo*, Plugin*>::Iterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
{
if ( it.data() == plugin )
@@ -397,12 +397,12 @@ PluginManager::slotPluginDestroyed( QObject *plugin )
{
// Use a timer to make sure any pending deleteLater() calls have
// been handled first
- QTimer::singleShot( 0, this, SLOT(slotShutdownDone()) );
+ TQTimer::singleShot( 0, this, TQT_SLOT(slotShutdownDone()) );
}
}
Plugin*
-PluginManager::plugin( const QString &pluginId ) const
+PluginManager::plugin( const TQString &pluginId ) const
{
KPluginInfo *info = infoForPluginId( pluginId );
if ( !info )
@@ -417,46 +417,46 @@ PluginManager::plugin( const QString &pluginId ) const
QString
PluginManager::pluginName( const Plugin *plugin ) const
{
- QMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
{
if ( it.data() == plugin )
return it.key()->name();
}
- return QString::fromLatin1( "Unknown" );
+ return TQString::fromLatin1( "Unknown" );
}
QString
PluginManager::pluginId( const Plugin *plugin ) const
{
- QMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
{
if ( it.data() == plugin )
return it.key()->pluginName();
}
- return QString::fromLatin1( "unknown" );
+ return TQString::fromLatin1( "unknown" );
}
QString
PluginManager::pluginIcon( const Plugin *plugin ) const
{
- QMap<KPluginInfo*, Plugin*>::ConstIterator it;
+ TQMap<KPluginInfo*, Plugin*>::ConstIterator it;
for ( it = d->loadedPlugins.begin(); it != d->loadedPlugins.end(); ++it )
{
if ( it.data() == plugin )
return it.key()->icon();
}
- return QString::fromLatin1( "Unknown" );
+ return TQString::fromLatin1( "Unknown" );
}
KPluginInfo*
-PluginManager::infoForPluginId( const QString &pluginId ) const
+PluginManager::infoForPluginId( const TQString &pluginId ) const
{
- QValueList<KPluginInfo*>::ConstIterator it;
+ TQValueList<KPluginInfo*>::ConstIterator it;
for ( it = d->plugins.begin(); it != d->plugins.end(); ++it )
{
if ( ( *it )->pluginName() == pluginId )
@@ -467,7 +467,7 @@ PluginManager::infoForPluginId( const QString &pluginId ) const
}
bool
-PluginManager::setPluginEnabled( const QString &pluginId, bool enabled /* = true */ )
+PluginManager::setPluginEnabled( const TQString &pluginId, bool enabled /* = true */ )
{
if ( !d->config )
d->config = KSharedConfig::openConfig( "komposerrc" );
@@ -478,7 +478,7 @@ PluginManager::setPluginEnabled( const QString &pluginId, bool enabled /* = true
if ( !infoForPluginId( pluginId ) )
return false;
- d->config->writeEntry( pluginId + QString::fromLatin1( "Enabled" ), enabled );
+ d->config->writeEntry( pluginId + TQString::fromLatin1( "Enabled" ), enabled );
d->config->sync();
return true;