• 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
kopeteaccountmanager.cpp
Go to the documentation of this file.
1 /*
2  kopeteaccountmanager.cpp - Kopete Account Manager
3 
4  Copyright (c) 2002-2003 by Martijn Klingens <klingens@kde.org>
5  Copyright (c) 2003-2004 by Olivier Goffart <ogoffart@kde.org>
6 
7  Kopete (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 "kopeteaccountmanager.h"
20 
21 #include <QtGui/QApplication>
22 #include <QtCore/QRegExp>
23 #include <QtCore/QTimer>
24 #include <QtCore/QHash>
25 #include <QtDBus/QDBusInterface>
26 
27 #include <ksharedconfig.h>
28 #include <kdebug.h>
29 #include <kglobal.h>
30 #include <kplugininfo.h>
31 #include <kconfiggroup.h>
32 #include <solid/networking.h>
33 #include <solid/powermanagement.h>
34 
35 #include "kopeteaccount.h"
36 #include "kopetebehaviorsettings.h"
37 #include "kopeteprotocol.h"
38 #include "kopetecontact.h"
39 #include "kopetecontactlist.h"
40 #include "kopeteidentitymanager.h"
41 #include "kopetepluginmanager.h"
42 #include "kopetestatusitems.h"
43 #include "kopeteonlinestatus.h"
44 #include "kopeteonlinestatusmanager.h"
45 #include "kopetemetacontact.h"
46 #include "kopetegroup.h"
47 #include "kopetestatusmanager.h"
48 
49 
50 namespace Kopete {
51 
52 static int compareAccountsByPriority( Account *a, Account *b )
53 {
54  uint priority1 = a->priority();
55  uint priority2 = b->priority();
56 
57  if( a==b ) //two account are equal only if they are equal :-)
58  return 0; // remember than an account can be only once on the list, but two account may have the same priority when loading
59  else if( priority1 > priority2 )
60  return 1;
61  else
62  return -1;
63 }
64 
65 class AccountManager::Private
66 {
67 public:
68  QList<Account *> accounts;
69  QList<Account *> accountsToBeRemoved;
70  bool suspended;
71  Kopete::StatusMessage suspendedStatusMessage;
72  uint suspendedStatusCategory;
73 };
74 
75 AccountManager * AccountManager::s_self = 0L;
76 
77 AccountManager * AccountManager::self()
78 {
79  if ( !s_self )
80  s_self = new AccountManager;
81 
82  return s_self;
83 }
84 
85 
86 AccountManager::AccountManager()
87 : QObject( qApp ), d(new Private())
88 {
89  setObjectName( "KopeteAccountManager" );
90  connect( Solid::Networking::notifier(), SIGNAL(shouldConnect()), this, SLOT(networkConnected()) );
91  connect( Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), this, SLOT(networkDisconnected()) );
92  connect( Solid::PowerManagement::notifier(), SIGNAL(resumingFromSuspend()), this, SLOT(resume()) );
93 #ifdef __GNUC__
94 #warning TODO: Switch to a org.kde.Solid.PowerManagement Sleeping/Suspending signal when available.
95 #endif
96  QDBusConnection::systemBus().connect( "org.freedesktop.UPower", "/org/freedesktop/UPower", "", "Sleeping", this, SLOT( suspend() ) );
97  d->suspended = false;
98 }
99 
100 
101 AccountManager::~AccountManager()
102 {
103  s_self = 0L;
104 
105  delete d;
106 }
107 
108 bool AccountManager::isAnyAccountConnected() const
109 {
110  foreach( Account *a , d->accounts )
111  {
112  if( a->isConnected() )
113  return true;
114  }
115 
116  return false;
117 }
118 
119 void AccountManager::setOnlineStatus( uint category, const Kopete::StatusMessage &statusMessage, uint flags, bool forced )
120 {
121  kDebug() << "category: " << category << "status title: " << statusMessage.title() << "status message: " << statusMessage.message();
122  OnlineStatusManager::Categories categories
123  = (OnlineStatusManager::Categories)category;
124  const bool onlyChangeConnectedAccounts = ( !forced && isAnyAccountConnected() );
125  d->suspended = false;
126 
127  foreach( Account *account, d->accounts )
128  {
129  Kopete::OnlineStatus status = OnlineStatusManager::self()->onlineStatus( account->protocol(), categories );
130  // Going offline is always respected
131  if ( category & Kopete::OnlineStatusManager::Offline ) {
132  account->setOnlineStatus( status, statusMessage );
133  continue;
134  }
135 
136  if ( onlyChangeConnectedAccounts ) { //If global status is offline, change all account to new status
137  if ( account->isConnected() || ( ( (flags & ConnectIfOffline) || Kopete::StatusManager::self()->globalStatusCategory() == Kopete::OnlineStatusManager::Offline ) && !account->excludeConnect() ) )
138  account->setOnlineStatus( status, statusMessage );
139  }
140  else {
141  if ( !account->excludeConnect() )
142  account->setOnlineStatus( status, statusMessage );
143  }
144  }
145  // mark ourselves as globally away if appropriate
146  Kopete::StatusManager::self()->setGlobalStatus( category, statusMessage );
147 }
148 
149 void AccountManager::setOnlineStatus( uint category, const Kopete::StatusMessage &statusMessage, uint flags )
150 {
151  setOnlineStatus(category, statusMessage, flags, false);
152 }
153 
154 void AccountManager::setStatusMessage(const QString &message)
155 {
156  foreach( Account *account, d->accounts )
157  {
158  account->setStatusMessage(message);
159  }
160 }
161 
162 void AccountManager::suspend()
163 {
164  if ( d->suspended )
165  return;
166 
167  d->suspended = true;
168  d->suspendedStatusMessage = Kopete::StatusManager::self()->globalStatusMessage();
169  d->suspendedStatusCategory = Kopete::StatusManager::self()->globalStatusCategory();
170 
171  Kopete::StatusMessage statusMessage( i18n( "Offline" ), "" );
172  QList <Kopete::Status::StatusItem *> statusList = Kopete::StatusManager::self()->getRootGroup()->childList();
173  //find first Status for OffineStatus
174  for ( QList <Kopete::Status::StatusItem *>::ConstIterator it = statusList.constBegin(); it != statusList.constEnd(); ++it )
175  {
176  if ( ! (*it)->isGroup() && (*it)->category() == Kopete::OnlineStatusManager::Offline )
177  {
178  QString message, title;
179  title = (*it)->title();
180  message = (static_cast <Kopete::Status::Status*> (*it))->message(); //if it is not group, it's status
181  statusMessage.setTitle( title );
182  statusMessage.setMessage( message );
183  break;
184  }
185  }
186 
187  foreach( Account *account, d->accounts )
188  {
189  account->suspend( statusMessage );
190  }
191  Kopete::StatusManager::self()->setGlobalStatus( Kopete::OnlineStatusManager::Offline, statusMessage );
192 }
193 
194 bool AccountManager::resume()
195 {
196  bool networkAvailable = ( Solid::Networking::status() == Solid::Networking::Unknown || Solid::Networking::status() == Solid::Networking::Connected );
197  if ( !d->suspended || !networkAvailable )
198  return false;
199 
200  foreach( Account *account, d->accounts )
201  {
202  account->resume();
203  }
204  Kopete::StatusManager::self()->setGlobalStatus( d->suspendedStatusCategory, d->suspendedStatusMessage );
205  d->suspended = false;
206  return true;
207 }
208 
209 QColor AccountManager::guessColor( Protocol *protocol ) const
210 {
211  // In a perfect wold, we should check if the color is actually not used by the account.
212  // Anyway, this is not really required, It would be a difficult job for about nothing more.
213  // -- Olivier
214  int protocolCount = 0;
215 
216  for ( QListIterator<Account *> it( d->accounts ); it.hasNext(); )
217  {
218  Account *a = it.next();
219  if ( a->protocol()->pluginId() == protocol->pluginId() )
220  protocolCount++;
221  }
222 
223  // let's figure a color
224  QColor color;
225  switch ( protocolCount % 7 )
226  {
227  case 0:
228  color = QColor();
229  break;
230  case 1:
231  color = Qt::red;
232  break;
233  case 2:
234  color = Qt::green;
235  break;
236  case 3:
237  color = Qt::blue;
238  break;
239  case 4:
240  color = Qt::yellow;
241  break;
242  case 5:
243  color = Qt::magenta;
244  break;
245  case 6:
246  color = Qt::cyan;
247  break;
248  }
249 
250  return color;
251 }
252 
253 Account* AccountManager::registerAccount( Account *account )
254 {
255  if( !account || d->accounts.contains( account ) )
256  return account;
257 
258  if( account->accountId().isEmpty() )
259  {
260  account->deleteLater();
261  return 0L;
262  }
263 
264  // If this account already exists, do nothing
265  QListIterator<Account *> it( d->accounts );
266  while ( it.hasNext() )
267  {
268  Account *curracc = it.next();
269  if ( ( account->protocol() == curracc->protocol() ) && ( account->accountId() == curracc->accountId() ) )
270  {
271  account->deleteLater();
272  return 0L;
273  }
274  }
275 
276  d->accounts.append( account );
277  qSort( d->accounts.begin(), d->accounts.end(), compareAccountsByPriority );
278 
279  // Connect to the account's status changed signal
280  connect(account->myself(), SIGNAL(onlineStatusChanged(Kopete::Contact *,
281  const Kopete::OnlineStatus &, const Kopete::OnlineStatus &)),
282  this, SLOT(slotAccountOnlineStatusChanged(Kopete::Contact *,
283  const Kopete::OnlineStatus &, const Kopete::OnlineStatus &)));
284 
285  connect(account, SIGNAL(accountDestroyed(const Kopete::Account*)) , this, SLOT(unregisterAccount(const Kopete::Account*)));
286 
287  if ( !account->identity() )
288  {
289  // the account's Identity must be set here instead of in the Kopete::Account ctor, because there the
290  // identity cannot pick up any state set in the derived Account ctor
291  Identity *identity = Kopete::IdentityManager::self()->findIdentity( account->configGroup()->readEntry("Identity", QString()) );
292  // if the identity was not found, use the default one which will for sure exist
293  // FIXME: get rid of this, the account's identity should always exist at this point
294  if (!identity)
295  {
296  kWarning( 14010 ) << "No identity for account " << account->accountId() << ": falling back to default";
297  identity = Kopete::IdentityManager::self()->defaultIdentity();
298  }
299  account->setIdentity( identity );
300  }
301 
302  emit accountRegistered( account );
303  return account;
304 }
305 
306 void AccountManager::unregisterAccount( const Account *account )
307 {
308  kDebug( 14010 ) << "Unregistering account " << account->accountId();
309  d->accounts.removeAll( const_cast<Account*>(account) );
310  emit accountUnregistered( account );
311 }
312 
313 const QList<Account *>& AccountManager::accounts() const
314 {
315  return d->accounts;
316 }
317 
318 QList<Account*> AccountManager::accounts( Protocol* protocol ) const
319 {
320  QList<Account*> protocolAccounts;
321  foreach( Account* acct, d->accounts )
322  {
323  if ( acct->protocol() == protocol )
324  protocolAccounts.append( acct );
325  }
326  return protocolAccounts;
327 }
328 
329 Account * AccountManager::findAccount( const QString &protocolId, const QString &accountId )
330 {
331  for ( QListIterator<Account *> it( d->accounts ); it.hasNext(); )
332  {
333  Account *a = it.next();
334  if ( a->protocol()->pluginId() == protocolId && a->accountId() == accountId )
335  return a;
336  }
337  return 0L;
338 }
339 
340 void AccountManager::removeAccount( Account *account )
341 {
342  if( !account->removeAccount() )
343  return;
344 
345  if ( !account->isConnected() )
346  {
347  d->accountsToBeRemoved.append( account );
348  QTimer::singleShot( 0, this, SLOT(removeAccountInternal()) );
349  }
350  else
351  {
352  kDebug( 14010 ) << account->accountId() << " is still connected, disconnecting...";
353  connect( account, SIGNAL(isConnectedChanged()), this, SLOT(removeAccountConnectedChanged()) );
354  account->disconnect();
355  }
356 }
357 
358 void AccountManager::save()
359 {
360  //kDebug( 14010 ) ;
361  qSort( d->accounts.begin(), d->accounts.end(), compareAccountsByPriority );
362 
363  for ( QListIterator<Account *> it( d->accounts ); it.hasNext(); )
364  {
365  Account *a = it.next();
366  KConfigGroup *config = a->configGroup();
367 
368  config->writeEntry( "Protocol", a->protocol()->pluginId() );
369  config->writeEntry( "AccountId", a->accountId() );
370  }
371 
372  KGlobal::config()->sync();
373 }
374 
375 void AccountManager::load()
376 {
377  connect( PluginManager::self(), SIGNAL(pluginLoaded(Kopete::Plugin*)),
378  this, SLOT(slotPluginLoaded(Kopete::Plugin*)) );
379 
380  // Iterate over all groups that start with "Account_" as those are accounts
381  // and load the required protocols if the account is enabled.
382  // Don't try to optimize duplicate calls out, the plugin queue is smart enough
383  // (and fast enough) to handle that without adding complexity here
384  KSharedConfig::Ptr config = KGlobal::config();
385  QStringList accountGroups = config->groupList().filter( QRegExp( QString::fromLatin1( "^Account_" ) ) );
386  for ( QStringList::Iterator it = accountGroups.begin(); it != accountGroups.end(); ++it )
387  {
388  KConfigGroup cg( config, *it );
389  KConfigGroup pluginConfig( config, QLatin1String("Plugins") );
390 
391  QString protocol = cg.readEntry( "Protocol", QString() );
392  if ( protocol.endsWith( QString::fromLatin1( "Protocol" ) ) )
393  protocol = QString::fromLatin1( "kopete_" ) + protocol.toLower().remove( QString::fromLatin1( "protocol" ) );
394 
395  if ( cg.readEntry( "Enabled", true ) && pluginConfig.readEntry(protocol + QLatin1String("Enabled"), true) )
396  PluginManager::self()->loadPlugin( protocol, PluginManager::LoadAsync );
397  }
398 }
399 
400 void AccountManager::slotPluginLoaded( Plugin *plugin )
401 {
402  Protocol* protocol = dynamic_cast<Protocol*>( plugin );
403  if ( !protocol )
404  return;
405 
406  // Iterate over all groups that start with "Account_" as those are accounts
407  // and parse them if they are from this protocol
408  KSharedConfig::Ptr config = KGlobal::config();
409  const QStringList accountGroups = config->groupList().filter( QRegExp( QString::fromLatin1( "^Account_" ) ) );
410  for ( QStringList::ConstIterator it = accountGroups.constBegin(); it != accountGroups.constEnd(); ++it )
411  {
412  KConfigGroup cg( config, *it );
413 
414  if ( cg.readEntry( "Protocol" ) != protocol->pluginId() )
415  continue;
416 
417  // There's no GUI for this, but developers may want to disable an account.
418  if ( !cg.readEntry( "Enabled", true ) )
419  continue;
420 
421  QString accountId = cg.readEntry( "AccountId", QString() );
422  if ( accountId.isEmpty() )
423  {
424  kWarning( 14010 ) <<
425  "Not creating account for empty accountId." << endl;
426  continue;
427  }
428 
429  kDebug( 14010 ) <<
430  "Creating account for '" << accountId << "'" << endl;
431 
432  Account *account = 0L;
433  account = registerAccount( protocol->createNewAccount( accountId ) );
434  if ( !account )
435  {
436  kWarning( 14010 ) <<
437  "Failed to create account for '" << accountId << "'" << endl;
438  continue;
439  }
440  }
441 }
442 
443 void AccountManager::slotAccountOnlineStatusChanged(Contact *c,
444  const OnlineStatus &oldStatus, const OnlineStatus &newStatus)
445 {
446  Account *account = c->account();
447  if (!account)
448  return;
449 
450  //kDebug(14010) ;
451  emit accountOnlineStatusChanged(account, oldStatus, newStatus);
452 }
453 
454 void AccountManager::networkConnected()
455 {
456  if( !resume() )
457  setOnlineStatus( Kopete::StatusManager::self()->globalStatusCategory(), Kopete::StatusManager::self()->globalStatusMessage(), 0, true);
458 }
459 
460 
461 void AccountManager::networkDisconnected()
462 {
463  suspend();
464 }
465 
466 void AccountManager::removeAccountConnectedChanged()
467 {
468  Account *account = qobject_cast<Account*>(sender());
469  Q_ASSERT( account );
470 
471  if ( !account->isConnected() )
472  {
473  disconnect( account, SIGNAL(isConnectedChanged()), this, SLOT(removeAccountConnectedChanged()) );
474  // Use singleShot so we don't delete the account when we use it.
475  d->accountsToBeRemoved.append( account );
476  QTimer::singleShot( 0, this, SLOT(removeAccountInternal()) );
477  }
478 }
479 
480 void AccountManager::removeAccountInternal()
481 {
482  if ( d->accountsToBeRemoved.isEmpty() )
483  return;
484 
485  Account* account = d->accountsToBeRemoved.takeFirst();
486  if ( account->isConnected() )
487  {
488  kWarning( 14010 ) << "Error, trying to remove connected account " << account->accountId();
489  return;
490  }
491 
492  Protocol *protocol = account->protocol();
493 
494  KConfigGroup *configgroup = account->configGroup();
495 
496  // Clean up the contact list
497  const QHash<QString, Kopete::Contact*> contactList = account->contacts();
498  QHash<QString, Kopete::Contact*>::ConstIterator it, itEnd = contactList.constEnd();
499 
500  for ( it = contactList.constBegin(); it != itEnd; ++it )
501  {
502  Contact* c = it.value();
503  if ( !c )
504  continue;
505 
506  MetaContact* mc = c->metaContact();
507  mc->removeContact( c );
508  c->deleteLater();
509  if ( mc->contacts().count() == 0 ) //we can delete the metacontact
510  {
511  //get the first group and it's members
512  Group* group = mc->groups().first();
513  MetaContact::List groupMembers = group->members();
514  ContactList::self()->removeMetaContact( mc );
515  if ( groupMembers.count() == 1 && groupMembers.indexOf( mc ) != -1 )
516  ContactList::self()->removeGroup( group );
517  }
518  }
519 
520  // Clean up the account list
521  d->accounts.removeAll( account );
522 
523  // Clean up configuration
524  configgroup->deleteGroup();
525  configgroup->sync();
526 
527  delete account;
528 
529  foreach( Account *account , d->accounts )
530  {
531  if( account->protocol() == protocol )
532  return;
533  }
534  //there is nomore account from the protocol, we can unload it
535 
536  // FIXME: pluginId() should return the internal name and not the class name, so
537  // we can get rid of this hack - Olivier/Martijn
538  QString protocolName = protocol->pluginId().remove( QString::fromLatin1( "Protocol" ) ).toLower();
539 
540  PluginManager::self()->setPluginEnabled( protocolName, false );
541  PluginManager::self()->unloadPlugin( protocolName );
542 }
543 
544 } //END namespace Kopete
545 
546 #include "kopeteaccountmanager.moc"
547 // vim: set noet ts=4 sts=4 sw=4:
548 // kate: tab-width 4; indent-mode csands;
kopetemetacontact.h
Kopete::ContactList::self
static ContactList * self()
The contact list is a singleton object.
Definition: kopetecontactlist.cpp:71
Kopete::Account::setIdentity
virtual bool setIdentity(Kopete::Identity *ident)
Sets the identity this account belongs to.
Definition: kopeteaccount.cpp:519
Kopete::OnlineStatus
Definition: kopeteonlinestatus.h:68
Kopete::Account::protocol
Protocol * protocol() const
Definition: kopeteaccount.cpp:216
status
OnlineStatus::StatusType status
Definition: kopeteonlinestatus.cpp:103
Kopete::Account::disconnect
virtual void disconnect()=0
Go offline for this service.
Kopete::StatusManager::setGlobalStatus
void setGlobalStatus(uint category, const Kopete::StatusMessage &statusMessage=Kopete::StatusMessage())
Remember current global status.
Definition: kopetestatusmanager.cpp:309
Kopete::Account::myself
Contact * myself() const
Retrieve the 'myself' contact.
Definition: kopeteaccount.cpp:537
Kopete::Account::priority
uint priority
Definition: kopeteaccount.h:84
Kopete::PluginManager::setPluginEnabled
bool setPluginEnabled(const QString &name, bool enabled=true)
Enable a plugin.
Definition: kopetepluginmanager.cpp:481
kopetestatusmanager.h
QListIterator::next
const T & next()
kopeteaccount.h
Kopete::IdentityManager::defaultIdentity
Identity * defaultIdentity()
Returs the default identity to be used.
Definition: kopeteidentitymanager.cpp:130
Kopete::Status::StatusGroup::childList
QList< StatusItem * > childList() const
Returns list of all childes.
Definition: kopetestatusitems.h:159
Kopete::ContactList::removeGroup
void removeGroup(Kopete::Group *)
Remove a group this method delete the group.
Definition: kopetecontactlist.cpp:312
Kopete::Status::Status
Status represents a status which has title, message and category.
Definition: kopetestatusitems.h:212
kopeteidentitymanager.h
QObject::sender
QObject * sender() const
Kopete::StatusMessage
This class encapsulate a status message.
Definition: kopetestatusmessage.h:48
Kopete::StatusManager::self
static StatusManager * self()
Get the only instance of StatusManager.
Definition: kopetestatusmanager.cpp:145
Kopete::Protocol
base class of every protocol.
Definition: kopeteprotocol.h:62
Kopete::Account::isConnected
bool isConnected
Definition: kopeteaccount.h:81
Kopete::PluginManager::loadPlugin
Plugin * loadPlugin(const QString &pluginId, PluginLoadMode mode=LoadSync)
Load a single plugin by plugin name.
Definition: kopetepluginmanager.cpp:340
Kopete::compareAccountsByPriority
static int compareAccountsByPriority(Account *a, Account *b)
Definition: kopeteaccountmanager.cpp:52
QDBusConnection::systemBus
QDBusConnection systemBus()
kopetegroup.h
Kopete::AccountManager::ConnectIfOffline
Definition: kopeteaccountmanager.h:125
kopeteonlinestatus.h
Kopete::OnlineStatusManager::onlineStatus
OnlineStatus onlineStatus(Protocol *protocol, Categories category) const
return the status of the protocol which is in the category category
Definition: kopeteonlinestatusmanager.cpp:89
QString::remove
QString & remove(int position, int n)
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
Kopete::AccountManager::self
static AccountManager * self()
Retrieve the instance of AccountManager.
Definition: kopeteaccountmanager.cpp:77
Kopete::Account::removeAccount
virtual bool removeAccount()
Remove the account from the server.
Definition: kopeteaccount.cpp:662
NetworkStatus::Connected
Definition: networkstatuscommon.h:10
Kopete::AccountManager::accountOnlineStatusChanged
void accountOnlineStatusChanged(Kopete::Account *account, const Kopete::OnlineStatus &oldStatus, const Kopete::OnlineStatus &newStatus)
An account has changed its onlinestatus Technically this monitors Account::myself() onlinestatus chan...
Kopete::AccountManager::registerAccount
Account * registerAccount(Account *account)
Register the account.
Definition: kopeteaccountmanager.cpp:253
QRegExp
Kopete::AccountManager::findAccount
Account * findAccount(const QString &protocolId, const QString &accountId)
Return the account asked.
Definition: kopeteaccountmanager.cpp:329
Kopete::Account::setStatusMessage
virtual void setStatusMessage(const Kopete::StatusMessage &statusMessage)=0
Reimplement this function to set the status message(with metadata).
QList::append
void append(const T &value)
Kopete::StatusMessage::setTitle
void setTitle(const QString &title)
Set a new status title.
Definition: kopetestatusmessage.cpp:104
QHash::constEnd
const_iterator constEnd() const
kopetestatusitems.h
QHash< QString, Kopete::Contact * >
QObject
Kopete::Account::accountId
QString accountId
Definition: kopeteaccount.h:77
Kopete::Plugin::pluginId
QString pluginId() const
Get the plugin id.
Definition: kopeteplugin.cpp:46
Kopete::PluginManager::unloadPlugin
bool unloadPlugin(const QString &pluginName)
Unload the plugin specified by pluginName.
Definition: kopetepluginmanager.cpp:405
Kopete::Account::setOnlineStatus
virtual void setOnlineStatus(const Kopete::OnlineStatus &status, const Kopete::StatusMessage &reason=Kopete::StatusMessage(), const OnlineStatusOptions &options=None)=0
Reimplement this function to set the online status.
Kopete::AccountManager::~AccountManager
~AccountManager()
Definition: kopeteaccountmanager.cpp:101
Kopete::AccountManager::resume
bool resume()
Resumes all accounts.
Definition: kopeteaccountmanager.cpp:194
kopeteprotocol.h
Kopete::AccountManager
AccountManager manages all defined accounts in Kopete.
Definition: kopeteaccountmanager.h:47
Kopete::StatusMessage::message
QString message() const
Return the current status message.
Definition: kopetestatusmessage.cpp:75
QObject::setObjectName
void setObjectName(const QString &name)
QString::isEmpty
bool isEmpty() const
Kopete::Account::configGroup
KConfigGroup * configGroup() const
Return the KConfigGroup used to write and read special properties.
Definition: kopeteaccount.cpp:282
kopetecontactlist.h
QString::endsWith
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
QList::Iterator
typedef Iterator
QObject::deleteLater
void deleteLater()
QString
Kopete::AccountManager::guessColor
QColor guessColor(Protocol *protocol) const
Guess the color for a new account.
Definition: kopeteaccountmanager.cpp:209
QList
Kopete::Account::excludeConnect
bool excludeConnect
Definition: kopeteaccount.h:78
QColor
Kopete::StatusManager::globalStatusMessage
Kopete::StatusMessage globalStatusMessage() const
Get current global status message.
Definition: kopetestatusmanager.cpp:348
Kopete::Account::identity
Identity * identity() const
Retrieve the identity this account belongs to.
Definition: kopeteaccount.cpp:514
Kopete::PluginManager::LoadAsync
Definition: kopetepluginmanager.h:129
Kopete::Contact
Definition: kopetecontact.h:58
QStringList
Kopete::Plugin
Base class for all plugins or protocols.
Definition: kopeteplugin.h:84
QList::end
iterator end()
QString::toLower
QString toLower() const
QHash::value
const T value(const Key &key) const
Kopete::AccountManager::setStatusMessage
void setStatusMessage(const QString &message)
Set the given status message for all online accounts.
Definition: kopeteaccountmanager.cpp:154
Kopete::PluginManager::self
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
Kopete::AccountManager::suspend
void suspend()
Suspends all accounts.
Definition: kopeteaccountmanager.cpp:162
Kopete::Account::suspend
bool suspend(const Kopete::StatusMessage &reason=Kopete::StatusMessage())
Disconnects account, required before resume() Returns false if account is already suspended...
Definition: kopeteaccount.cpp:601
Kopete::AccountManager::removeAccount
void removeAccount(Account *account)
Delete the account and clean the config data.
Definition: kopeteaccountmanager.cpp:340
QHash::constBegin
const_iterator constBegin() const
Kopete::StatusManager::globalStatusCategory
uint globalStatusCategory() const
Get current global status category.
Definition: kopetestatusmanager.cpp:353
Kopete::AccountManager::isAnyAccountConnected
bool isAnyAccountConnected() const
Check if there is at least one account connected.
Definition: kopeteaccountmanager.cpp:108
QLatin1String
kopeteaccountmanager.h
Kopete::AccountManager::accountRegistered
void accountRegistered(Kopete::Account *account)
Signals when an account is ready for use.
Kopete::AccountManager::setOnlineStatus
void setOnlineStatus(uint category, const Kopete::StatusMessage &statusMessage, uint flags, bool forced)
Set all accounts a status in the specified category.
Definition: kopeteaccountmanager.cpp:119
QList::ConstIterator
typedef ConstIterator
Kopete::IdentityManager::self
static IdentityManager * self()
Retrieve the instance of IdentityManager.
Definition: kopeteidentitymanager.cpp:46
Kopete::ContactList::removeMetaContact
void removeMetaContact(Kopete::MetaContact *contact)
Remove a metacontact from the contact list.
Definition: kopetecontactlist.cpp:251
Kopete::IdentityManager::findIdentity
Identity * findIdentity(const QString &identityId)
Return the identity asked.
Definition: kopeteidentitymanager.cpp:120
Kopete::Account::resume
bool resume()
Sets account to the online status that was active when suspend() was called.
Definition: kopeteaccount.cpp:614
Kopete::AccountManager::accounts
const QList< Account * > & accounts() const
Retrieve the list of accounts.
Definition: kopeteaccountmanager.cpp:313
QString::fromLatin1
QString fromLatin1(const char *str, int size)
QListIterator
Kopete::OnlineStatusManager::self
static OnlineStatusManager * self()
Definition: kopeteonlinestatusmanager.cpp:49
Kopete::AccountManager::load
void load()
Definition: kopeteaccountmanager.cpp:375
QStringList::filter
QStringList filter(const QString &str, Qt::CaseSensitivity cs) const
QList::constEnd
const_iterator constEnd() const
Kopete::Protocol::createNewAccount
virtual Account * createNewAccount(const QString &accountId)=0
Create an empty Account.
QList::constBegin
const_iterator constBegin() const
QDBusConnection::connect
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
Kopete::OnlineStatusManager::Offline
Definition: kopeteonlinestatusmanager.h:68
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
kopetebehaviorsettings.h
Kopete::Account
The Kopete::Account class handles one account.
Definition: kopeteaccount.h:72
Kopete::Identity
Definition: kopeteidentity.h:41
Kopete::MetaContact::List
QList< MetaContact * > List
Definition: kopetemetacontact.h:70
Kopete::AccountManager::save
void save()
Definition: kopeteaccountmanager.cpp:358
QList::begin
iterator begin()
kopetepluginmanager.h
Kopete::AccountManager::accountUnregistered
void accountUnregistered(const Kopete::Account *account)
Signals when an account has been unregistered.
kopetecontact.h
kopeteonlinestatusmanager.h
Kopete::StatusMessage::setMessage
void setMessage(const QString &message)
Set a new status message.
Definition: kopetestatusmessage.cpp:70
Kopete::StatusMessage::title
QString title() const
Return the current status title.
Definition: kopetestatusmessage.cpp:109
QTimer::singleShot
singleShot
Kopete::StatusManager::getRootGroup
Status::StatusGroup * getRootGroup() const
Get current status data tree.
Definition: kopetestatusmanager.cpp:167
QListIterator::hasNext
bool hasNext() const
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