kopete/libkopete
kopeteaccountmanager.cpp
Go to the documentation of this file.
57 return 0; // remember than an account can be only once on the list, but two account may have the same priority when loading
89 connect( Solid::Networking::notifier(), SIGNAL(shouldConnect()), this, SLOT(networkConnected()) );
90 connect( Solid::Networking::notifier(), SIGNAL(shouldDisconnect()), this, SLOT(networkDisconnected()) );
92 #warning TODO: Switch to a org.kde.Solid.PowerManagement Sleeping/Suspending signal when available.
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() ) );
118 void AccountManager::setOnlineStatus( uint category, const Kopete::StatusMessage &statusMessage, uint flags, bool forced )
120 kDebug() << "category: " << category << "status title: " << statusMessage.title() << "status message: " << statusMessage.message();
128 Kopete::OnlineStatus status = OnlineStatusManager::self()->onlineStatus( account->protocol(), categories );
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() ) )
148 void AccountManager::setOnlineStatus( uint category, const Kopete::StatusMessage &statusMessage, uint flags )
171 QList <Kopete::Status::StatusItem *> statusList = Kopete::StatusManager::self()->getRootGroup()->childList();
173 for ( QList <Kopete::Status::StatusItem *>::ConstIterator it = statusList.constBegin(); it != statusList.constEnd(); ++it )
179 message = (static_cast <Kopete::Status::Status*> (*it))->message(); //if it is not group, it's status
190 Kopete::StatusManager::self()->setGlobalStatus( Kopete::OnlineStatusManager::Offline, statusMessage );
195 bool networkAvailable = ( Solid::Networking::status() == Solid::Networking::Unknown || Solid::Networking::status() == Solid::Networking::Connected );
203 Kopete::StatusManager::self()->setGlobalStatus( d->suspendedStatusCategory, d->suspendedStatusMessage );
268 if ( ( account->protocol() == curracc->protocol() ) && ( account->accountId() == curracc->accountId() ) )
284 connect(account, SIGNAL(accountDestroyed(const Kopete::Account*)) , this, SLOT(unregisterAccount(const Kopete::Account*)));
288 // the account's Identity must be set here instead of in the Kopete::Account ctor, because there the
290 Identity *identity = Kopete::IdentityManager::self()->findIdentity( account->configGroup()->readEntry("Identity", QString()) );
295 kWarning( 14010 ) << "No identity for account " << account->accountId() << ": falling back to default";
384 QStringList accountGroups = config->groupList().filter( QRegExp( QString::fromLatin1( "^Account_" ) ) );
392 protocol = QString::fromLatin1( "kopete_" ) + protocol.toLower().remove( QString::fromLatin1( "protocol" ) );
394 if ( cg.readEntry( "Enabled", true ) && pluginConfig.readEntry(protocol + QLatin1String("Enabled"), true) )
408 const QStringList accountGroups = config->groupList().filter( QRegExp( QString::fromLatin1( "^Account_" ) ) );
409 for ( QStringList::ConstIterator it = accountGroups.constBegin(); it != accountGroups.constEnd(); ++it )
456 setOnlineStatus( Kopete::StatusManager::self()->globalStatusCategory(), Kopete::StatusManager::self()->globalStatusMessage(), 0, true);
472 disconnect( account, SIGNAL(isConnectedChanged()), this, SLOT(removeAccountConnectedChanged()) );
537 QString protocolName = protocol->pluginId().remove( QString::fromLatin1( "Protocol" ) ).toLower();
static ContactList * self()
The contact list is a singleton object.
Definition: kopetecontactlist.cpp:71
virtual bool setIdentity(Kopete::Identity *ident)
Sets the identity this account belongs to.
Definition: kopeteaccount.cpp:517
Definition: kopeteonlinestatus.h:68
void setGlobalStatus(uint category, const Kopete::StatusMessage &statusMessage=Kopete::StatusMessage())
Remember current global status.
Definition: kopetestatusmanager.cpp:309
bool setPluginEnabled(const QString &name, bool enabled=true)
Enable a plugin.
Definition: kopetepluginmanager.cpp:481
Identity * defaultIdentity()
Returs the default identity to be used.
Definition: kopeteidentitymanager.cpp:130
QList< StatusItem * > childList() const
Returns list of all childes.
Definition: kopetestatusitems.h:159
void removeGroup(Kopete::Group *)
Remove a group this method delete the group.
Definition: kopetecontactlist.cpp:312
Status represents a status which has title, message and category.
Definition: kopetestatusitems.h:212
static StatusManager * self()
Get the only instance of StatusManager.
Definition: kopetestatusmanager.cpp:145
Plugin * loadPlugin(const QString &pluginId, PluginLoadMode mode=LoadSync)
Load a single plugin by plugin name.
Definition: kopetepluginmanager.cpp:340
static int compareAccountsByPriority(Account *a, Account *b)
Definition: kopeteaccountmanager.cpp:51
OnlineStatus onlineStatus(Protocol *protocol, Categories category) const
return the status of the protocol which is in the category category
Definition: kopeteonlinestatusmanager.cpp:89
static AccountManager * self()
Retrieve the instance of AccountManager.
Definition: kopeteaccountmanager.cpp:76
Definition: networkstatuscommon.h:10
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...
Account * registerAccount(Account *account)
Register the account.
Definition: kopeteaccountmanager.cpp:252
Account * findAccount(const QString &protocolId, const QString &accountId)
Return the account asked.
Definition: kopeteaccountmanager.cpp:328
virtual void setStatusMessage(const Kopete::StatusMessage &statusMessage)=0
Reimplement this function to set the status message(with metadata).
bool unloadPlugin(const QString &pluginName)
Unload the plugin specified by pluginName.
Definition: kopetepluginmanager.cpp:405
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.
AccountManager manages all defined accounts in Kopete.
Definition: kopeteaccountmanager.h:47
KConfigGroup * configGroup() const
Return the KConfigGroup used to write and read special properties.
Definition: kopeteaccount.cpp:280
QColor guessColor(Protocol *protocol) const
Guess the color for a new account.
Definition: kopeteaccountmanager.cpp:208
Kopete::StatusMessage globalStatusMessage() const
Get current global status message.
Definition: kopetestatusmanager.cpp:348
Identity * identity() const
Retrieve the identity this account belongs to.
Definition: kopeteaccount.cpp:512
Definition: kopetecontact.h:58
void setStatusMessage(const QString &message)
Set the given status message for all online accounts.
Definition: kopeteaccountmanager.cpp:153
static PluginManager * self()
Retrieve the plugin loader instance.
Definition: kopetepluginmanager.cpp:104
bool suspend(const Kopete::StatusMessage &reason=Kopete::StatusMessage())
Disconnects account, required before resume() Returns false if account is already suspended...
Definition: kopeteaccount.cpp:599
void removeAccount(Account *account)
Delete the account and clean the config data.
Definition: kopeteaccountmanager.cpp:339
uint globalStatusCategory() const
Get current global status category.
Definition: kopetestatusmanager.cpp:353
bool isAnyAccountConnected() const
Check if there is at least one account connected.
Definition: kopeteaccountmanager.cpp:107
void accountRegistered(Kopete::Account *account)
Signals when an account is ready for use.
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
static IdentityManager * self()
Retrieve the instance of IdentityManager.
Definition: kopeteidentitymanager.cpp:46
void removeMetaContact(Kopete::MetaContact *contact)
Remove a metacontact from the contact list.
Definition: kopetecontactlist.cpp:251
Identity * findIdentity(const QString &identityId)
Return the identity asked.
Definition: kopeteidentitymanager.cpp:120
bool resume()
Sets account to the online status that was active when suspend() was called.
Definition: kopeteaccount.cpp:612
const QList< Account * > & accounts() const
Retrieve the list of accounts.
Definition: kopeteaccountmanager.cpp:312
static OnlineStatusManager * self()
Definition: kopeteonlinestatusmanager.cpp:49
virtual Account * createNewAccount(const QString &accountId)=0
Create an empty Account.
Definition: kopeteidentity.h:41
void accountUnregistered(const Kopete::Account *account)
Signals when an account has been unregistered.
void setMessage(const QString &message)
Set a new status message.
Definition: kopetestatusmessage.cpp:70
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
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.