summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/kopeteplugin.cpp
blob: 9b6a7dc123cb26f8939ebded06ea63573520cf8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
    kopeteplugin.cpp - Kopete Plugin API

    Copyright (c) 2001-2002 by Duncan Mac-Vicar P. <duncan@kde.org>
    Copyright (c) 2002-2004 by Olivier Goffart  <ogoffart @tiscalinet.be>

    Copyright (c) 2002-2004 by the Kopete developers  <kopete-devel@kde.org>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/

#include "kopeteplugin.h"
#include "kopetepluginmanager.h"

#include <kplugininfo.h>
#include <ksettings/dispatcher.h>
#include <kplugininfo.h>

namespace Kopete {

class Plugin::Private
{
public:
	TQStringList addressBookFields;
	TQString indexField;
};

Plugin::Plugin( KInstance *instance, TQObject *parent, const char *name )
: TQObject( parent, name ), KXMLGUIClient(), d(new Private)
{
	setInstance( instance );
	KSettings::Dispatcher::self()->registerInstance( instance, this, TQT_SIGNAL( settingsChanged() ) );
}

Plugin::~Plugin()
{
	delete d;
}

TQString Plugin::pluginId() const
{
	return TQString::fromLatin1( className() );
}


TQString Plugin::displayName() const
{
	return pluginInfo() ? pluginInfo()->name() : TQString();
}

TQString Plugin::pluginIcon() const
{
	return pluginInfo() ? pluginInfo()->icon() : TQString();
}


KPluginInfo *Plugin::pluginInfo() const 
{
	return PluginManager::self()->pluginInfo( this );
}

void Plugin::aboutToUnload()
{
	// Just make the unload synchronous by default
	emit readyForUnload();
}


void Plugin::deserialize( MetaContact * /* metaContact */,
	const TQMap<TQString, TQString> & /* stream */ )
{
	// Do nothing in default implementation
}



void Kopete::Plugin::addAddressBookField( const TQString &field, AddressBookFieldAddMode mode )
{
	d->addressBookFields.append( field );
	if( mode == MakeIndexField )
		d->indexField = field;
}

TQStringList Kopete::Plugin::addressBookFields() const
{
	return d->addressBookFields;
}

TQString Kopete::Plugin::addressBookIndexField() const
{
	return d->indexField;
	
}


void Plugin::virtual_hook( uint, void * ) { }

} //END namespace Kopete


#include "kopeteplugin.moc"