~neon/kdenetwork/trunk

« back to all changes in this revision

Viewing changes to kopete/libkopete/kopeteplugin.cpp

  • Committer: uwolfer
  • Date: 2013-06-08 10:12:41 UTC
  • Revision ID: svn-v4:283d02a7-25f6-0310-bc7c-ecb5cbfe19da:trunk/KDE/kdenetwork:1357331
kdenetwork has moved to Git

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
    kopeteplugin.cpp - Kopete Plugin API
3
 
 
4
 
    Copyright (c) 2001-2002 by Duncan Mac-Vicar P. <duncan@kde.org>
5
 
    Copyright (c) 2002-2004 by Olivier Goffart  <ogoffart @tiscalinet.be>
6
 
 
7
 
    Copyright (c) 2002-2004 by the Kopete developers  <kopete-devel@kde.org>
8
 
 
9
 
    *************************************************************************
10
 
    *                                                                       *
11
 
    * This library is free software; you can redistribute it and/or         *
12
 
    * modify it under the terms of the GNU Lesser General Public            *
13
 
    * License as published by the Free Software Foundation; either          *
14
 
    * version 2 of the License, or (at your option) any later version.      *
15
 
    *                                                                       *
16
 
    *************************************************************************
17
 
*/
18
 
 
19
 
#include "kopeteplugin.h"
20
 
#include "kopetepluginmanager.h"
21
 
 
22
 
#include <kplugininfo.h>
23
 
#include <ksettings/dispatcher.h>
24
 
 
25
 
namespace Kopete {
26
 
 
27
 
class Plugin::Private
28
 
{
29
 
public:
30
 
        QStringList addressBookFields;
31
 
        QString indexField;
32
 
};
33
 
 
34
 
Plugin::Plugin( const KComponentData &instance, QObject *parent )
35
 
: QObject( parent ), KXMLGUIClient(), d(new Private)
36
 
{
37
 
        setComponentData( instance );
38
 
        KSettings::Dispatcher::registerComponent( instance, this, "settingsChanged" );
39
 
}
40
 
 
41
 
Plugin::~Plugin()
42
 
{
43
 
        delete d;
44
 
}
45
 
 
46
 
QString Plugin::pluginId() const
47
 
{
48
 
        return QString::fromLatin1( metaObject()->className() );
49
 
}
50
 
 
51
 
 
52
 
QString Plugin::displayName() const
53
 
{
54
 
        return pluginInfo().isValid() ? pluginInfo().name() : QString();
55
 
}
56
 
 
57
 
QString Plugin::pluginIcon() const
58
 
{
59
 
        return pluginInfo().isValid() ? pluginInfo().icon() : QString();
60
 
}
61
 
 
62
 
 
63
 
KPluginInfo Plugin::pluginInfo() const 
64
 
{
65
 
        return PluginManager::self()->pluginInfo( this );
66
 
}
67
 
 
68
 
bool Plugin::showCloseWindowMessage()
69
 
{
70
 
        return false;
71
 
}
72
 
 
73
 
bool Plugin::shouldExitOnclose()
74
 
{
75
 
        return true;
76
 
}
77
 
 
78
 
void Plugin::aboutToUnload()
79
 
{
80
 
        // Just make the unload synchronous by default
81
 
        emit readyForUnload();
82
 
}
83
 
 
84
 
 
85
 
void Plugin::deserialize( MetaContact * /* metaContact */,
86
 
        const QMap<QString, QString> & /* stream */ )
87
 
{
88
 
        // Do nothing in default implementation
89
 
}
90
 
 
91
 
 
92
 
 
93
 
void Kopete::Plugin::addAddressBookField( const QString &field, AddressBookFieldAddMode mode )
94
 
{
95
 
        d->addressBookFields.append( field );
96
 
        if( mode == MakeIndexField )
97
 
                d->indexField = field;
98
 
}
99
 
 
100
 
QStringList Kopete::Plugin::addressBookFields() const
101
 
{
102
 
        return d->addressBookFields;
103
 
}
104
 
 
105
 
QString Kopete::Plugin::addressBookIndexField() const
106
 
{
107
 
        return d->indexField;
108
 
}
109
 
 
110
 
} //END namespace Kopete
111
 
 
112
 
#include "kopeteplugin.moc"
113