kopete/libkopete
kopeteplugin.cpp
Go to the documentation of this file.00001 /* 00002 kopeteplugin.cpp - Kopete Plugin API 00003 00004 Copyright (c) 2001-2002 by Duncan Mac-Vicar P. <duncan@kde.org> 00005 Copyright (c) 2002-2004 by Olivier Goffart <ogoffart @tiscalinet.be> 00006 00007 Copyright (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org> 00008 00009 ************************************************************************* 00010 * * 00011 * This library is free software; you can redistribute it and/or * 00012 * modify it under the terms of the GNU Lesser General Public * 00013 * License as published by the Free Software Foundation; either * 00014 * version 2 of the License, or (at your option) any later version. * 00015 * * 00016 ************************************************************************* 00017 */ 00018 00019 #include "kopeteplugin.h" 00020 #include "kopetepluginmanager.h" 00021 00022 #include <kplugininfo.h> 00023 #include <ksettings/dispatcher.h> 00024 00025 namespace Kopete { 00026 00027 class Plugin::Private 00028 { 00029 public: 00030 QStringList addressBookFields; 00031 QString indexField; 00032 }; 00033 00034 Plugin::Plugin( const KComponentData &instance, QObject *parent ) 00035 : QObject( parent ), KXMLGUIClient(), d(new Private) 00036 { 00037 setComponentData( instance ); 00038 KSettings::Dispatcher::registerComponent( instance, this, "settingsChanged" ); 00039 } 00040 00041 Plugin::~Plugin() 00042 { 00043 delete d; 00044 } 00045 00046 QString Plugin::pluginId() const 00047 { 00048 return QString::fromLatin1( metaObject()->className() ); 00049 } 00050 00051 00052 QString Plugin::displayName() const 00053 { 00054 return pluginInfo().isValid() ? pluginInfo().name() : QString(); 00055 } 00056 00057 QString Plugin::pluginIcon() const 00058 { 00059 return pluginInfo().isValid() ? pluginInfo().icon() : QString(); 00060 } 00061 00062 00063 KPluginInfo Plugin::pluginInfo() const 00064 { 00065 return PluginManager::self()->pluginInfo( this ); 00066 } 00067 00068 void Plugin::aboutToUnload() 00069 { 00070 // Just make the unload synchronous by default 00071 emit readyForUnload(); 00072 } 00073 00074 00075 void Plugin::deserialize( MetaContact * /* metaContact */, 00076 const QMap<QString, QString> & /* stream */ ) 00077 { 00078 // Do nothing in default implementation 00079 } 00080 00081 00082 00083 void Kopete::Plugin::addAddressBookField( const QString &field, AddressBookFieldAddMode mode ) 00084 { 00085 d->addressBookFields.append( field ); 00086 if( mode == MakeIndexField ) 00087 d->indexField = field; 00088 } 00089 00090 QStringList Kopete::Plugin::addressBookFields() const 00091 { 00092 return d->addressBookFields; 00093 } 00094 00095 QString Kopete::Plugin::addressBookIndexField() const 00096 { 00097 return d->indexField; 00098 } 00099 00100 } //END namespace Kopete 00101 00102 #include "kopeteplugin.moc" 00103
KDE 4.2 API Reference