• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kopete/libkopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • libkopete
kopeteplugin.cpp
Go to the documentation of this file.
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 
QObject::className
const char * className() const
Kopete::Plugin::shouldExitOnclose
Q_INVOKABLE bool shouldExitOnclose()
Called when the application is about to exit.
Definition: kopeteplugin.cpp:73
Kopete::Plugin::displayName
QString displayName() const
Returns the display name of this plugin.
Definition: kopeteplugin.cpp:52
QMap
QObject::metaObject
virtual const QMetaObject * metaObject() const
Kopete::Plugin::pluginInfo
KPluginInfo pluginInfo() const
Returns the KPluginInfo object associated with this plugin.
Definition: kopeteplugin.cpp:63
Kopete::Plugin::addressBookFields
QStringList addressBookFields() const
Return the list of all keys from the address book in which the plugin is interested.
Definition: kopeteplugin.cpp:100
Kopete::Plugin::AddressBookFieldAddMode
AddressBookFieldAddMode
Mode for an address book field as used by addAddressBookField()
Definition: kopeteplugin.h:139
Kopete::Plugin::addressBookIndexField
QString addressBookIndexField() const
Return the index field as set by addAddressBookField()
Definition: kopeteplugin.cpp:105
Kopete::Plugin::~Plugin
virtual ~Plugin()
Definition: kopeteplugin.cpp:41
QObject
Kopete::Plugin::pluginId
QString pluginId() const
Get the plugin id.
Definition: kopeteplugin.cpp:46
Kopete::Plugin::showCloseWindowMessage
Q_INVOKABLE bool showCloseWindowMessage()
Called when user is about to close the main-window.
Definition: kopeteplugin.cpp:68
QString
Kopete::Plugin::pluginIcon
QString pluginIcon() const
Get the name of the icon for this plugin.
Definition: kopeteplugin.cpp:57
Kopete::PluginManager::pluginInfo
KPluginInfo pluginInfo(const Kopete::Plugin *plugin) const
Definition: kopetepluginmanager.cpp:153
QStringList
Kopete::Plugin::readyForUnload
void readyForUnload()
Indicate when we're ready for unload.
Kopete::Plugin::addAddressBookField
void addAddressBookField(const QString &field, AddressBookFieldAddMode mode=AddOnly)
Add a field to the list of address book fields.
Definition: kopeteplugin.cpp:93
Kopete::Plugin::Plugin
Plugin(const KComponentData &instance, QObject *parent)
Definition: kopeteplugin.cpp:34
Kopete::PluginManager::self
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
Kopete::Plugin::deserialize
virtual void deserialize(MetaContact *metaContact, const QMap< QString, QString > &data)
deserialize() and tell the plugin to apply the previously stored data again.
Definition: kopeteplugin.cpp:85
kopeteplugin.h
Kopete::MetaContact
Definition: kopetemetacontact.h:54
QString::fromLatin1
QString fromLatin1(const char *str, int size)
Kopete::Plugin::aboutToUnload
virtual void aboutToUnload()
Prepare for unloading a plugin.
Definition: kopeteplugin.cpp:78
kopetepluginmanager.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/libkopete

Skip menu "kopete/libkopete"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal