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