You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdenetwork/kopete/kopete/config/plugins/kopetepluginconfig.cpp

118 lines
3.0 KiB

/*
kopetepluginconfig.cpp - Configure the Kopete plugins
Copyright (c) 2003 by Martijn Klingens <klingens@kde.org>
Kopete (c) 2001-2003 by the Kopete developers <kopete-devel@kde.org>
*************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
*************************************************************************
*/
#include "kopetepluginconfig.h"
#include <tqlayout.h>
#include <tqtimer.h>
#include <kdebug.h>
#include <tdelocale.h>
#include <kpluginselector.h>
#include <ksettings/dispatcher.h>
#include "kopetepluginmanager.h"
class KopetePluginConfigPrivate
{
public:
KPluginSelector *pluginSelector;
bool isChanged;
};
KopetePluginConfig::~KopetePluginConfig()
{
delete d;
}
KopetePluginConfig::KopetePluginConfig( TQWidget *parent, const char *name )
: KDialogBase( Plain, i18n( "Configure Plugins" ), /*Help |*/ Cancel | Apply | Ok | User1,
Ok, parent, name, false, true, KGuiItem( i18n( "&Reset" ), "edit-undo" ) )
{
d = new KopetePluginConfigPrivate;
showButton( User1, false );
setChanged( false );
// FIXME: Implement this - Martijn
enableButton( KDialogBase::Help, false );
setInitialSize( TQSize( 640, 480 ) );
( new TQVBoxLayout( plainPage(), 0, 0 ) )->setAutoAdd( true );
d->pluginSelector = new KPluginSelector( plainPage() );
setMainWidget( d->pluginSelector );
connect( d->pluginSelector, TQT_SIGNAL( changed( bool ) ), this, TQT_SLOT( setChanged( bool ) ) );
connect( d->pluginSelector, TQT_SIGNAL( configCommitted( const TQCString & ) ),
KSettings::Dispatcher::self(), TQT_SLOT( reparseConfiguration( const TQCString & ) ) );
d->pluginSelector->addPlugins( Kopete::PluginManager::self()->availablePlugins( "Plugins" ), i18n( "General Plugins" ), "Plugins" );
}
void KopetePluginConfig::setChanged( bool c )
{
d->isChanged = c;
enableButton( Apply, c );
}
void KopetePluginConfig::slotDefault()
{
d->pluginSelector->defaults();
setChanged( false );
}
void KopetePluginConfig::slotUser1()
{
d->pluginSelector->load();
setChanged( false );
}
void KopetePluginConfig::apply()
{
if( d->isChanged )
{
d->pluginSelector->save();
Kopete::PluginManager::self()->loadAllPlugins();
setChanged( false );
}
}
void KopetePluginConfig::slotApply()
{
apply();
}
void KopetePluginConfig::slotOk()
{
emit okClicked();
apply();
accept();
}
void KopetePluginConfig::slotHelp()
{
kdWarning() << k_funcinfo << "FIXME: Implement!" << endl;
}
void KopetePluginConfig::show()
{
d->pluginSelector->load();
KDialogBase::show();
}
#include "kopetepluginconfig.moc"