23#include <tqobjectlist.h>
25#include <dcopclient.h>
26#include <tdeaboutdata.h>
28#include <tdeparts/componentfactory.h>
30#include <tdeinstance.h>
36using namespace Kontact;
42 DCOPClient *dcopClient;
43 TQPtrList<TDEAction> *newActions;
44 TQPtrList<TDEAction> *syncActions;
48 TQString executableName;
49 TQCString partLibraryName;
51 KParts::ReadOnlyPart *part;
56Plugin::Plugin(
Kontact::Core *core, TQObject *parent,
const char *name )
57 : KXMLGUIClient( core ), TQObject( parent, name ), d( new Private )
59 core->factory()->addClient(
this );
60 TDEGlobal::locale()->insertCatalogue(name);
63 d->dcopClient =
nullptr;
64 d->newActions =
new TQPtrList<TDEAction>;
65 d->syncActions =
new TQPtrList<TDEAction>;
111 d->executableName = bin;
116 return d->executableName;
121 d->partLibraryName = libName;
124KParts::ReadOnlyPart *Plugin::loadPart()
126 return core()->createPart( d->partLibraryName );
131 kdDebug(5601) <<
"Plugin::aboutData(): libname: " << d->partLibraryName << endl;
133 const TDEInstance *instance =
134 KParts::Factory::partInstanceFromLibrary( d->partLibraryName );
137 return instance->aboutData();
139 kdError() <<
"Plugin::aboutData(): Can't load instance for "
150 connect( d->part, TQ_SIGNAL( destroyed() ), TQ_SLOT( partDestroyed() ) );
151 core()->partLoaded(
this, d->part );
165 if ( !d->dcopClient ) {
166 d->dcopClient =
new DCOPClient();
170 d->dcopClient->registerAs( name(),
false );
173 return d->dcopClient;
178 d->newActions->append( action );
183 d->syncActions->append( action );
188 return d->newActions;
193 return d->syncActions;
209void Plugin::partDestroyed()
221 if (!d->executableName.isEmpty())
222 KRun::runCommand(d->executableName);
232 d->hasPart = hasPart;
235void Kontact::Plugin::setDisabled(
bool disabled )
237 d->disabled = disabled;
240bool Kontact::Plugin::disabled()
const
245void Kontact::Plugin::loadProfile(
const TQString& )
249void Kontact::Plugin::saveToProfile(
const TQString& )
const
253void Plugin::virtual_hook(
int,
void* ) {
This class provides the interface to the Kontact core for the plugins.
virtual const TDEAboutData * aboutData()
Reimplement this method if you want to add your credits to the Kontact about dialog.
KParts::ReadOnlyPart * part()
You can use this method if you need to access the current part.
DCOPClient * dcopClient() const
Retrieve the current DCOP Client for the plugin.
TQString executableName() const
Returns the name of the binary (if existant).
TQString title() const
Returns the localized title.
void slotConfigUpdated()
internal usage
void insertNewAction(TDEAction *action)
Insert "New" action.
virtual bool showInSideBar() const
Returns whether the plugin provides a part that should be shown in the sidebar.
void setTitle(const TQString &title)
Sets the localized title.
void setIcon(const TQString &icon)
Sets the icon name.
TQPtrList< TDEAction > * syncActions() const
FIXME: write API doc for Kontact::Plugin::syncActions().
virtual void bringToForeground()
Reimplement this method if your application needs a different approach to be brought in the foregroun...
void setPartLibraryName(const TQCString &)
Set name of library which contains the KPart used by this plugin.
void setIdentifier(const TQString &identifier)
Sets the identifier.
void insertSyncAction(TDEAction *action)
Insert "Sync" action.
virtual TQString tipFile() const
Reimplement this method and return the a path relative to "data" to the tips file.
virtual void select()
This function is called when the plugin is selected by the user before the widget of the KPart belong...
TQString identifier() const
Returns the identifier.
TQString icon() const
Returns the icon name.
virtual KParts::ReadOnlyPart * createPart()=0
Reimplement and return the part here.
virtual void configUpdated()
This function is called whenever the config dialog has been closed successfully.
void setShowInSideBar(bool hasPart)
Set if the plugin provides a part that should be shown in the sidebar.
TQPtrList< TDEAction > * newActions() const
FIXME: write API doc for Kontact::Plugin::newActions().
void setExecutableName(const TQString &bin)
Sets the name of executable (if existant).