kopete/libkopete
kopeteaccountmanager.cpp
Go to the documentation of this file.
58 return 0; // remember than an account can be only once on the list, but two account may have the same priority when loading
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()) );
94 #warning TODO: Switch to a org.kde.Solid.PowerManagement Sleeping/Suspending signal when available.
96 QDBusConnection::systemBus().connect( "org.freedesktop.UPower", "/org/freedesktop/UPower", "", "Sleeping", this, SLOT( suspend() ) );
119 void AccountManager::setOnlineStatus( uint category, const Kopete::StatusMessage &statusMessage, uint flags, bool forced )
121 kDebug() << "category: " << category << "status title: " << statusMessage.title() << "status message: " << statusMessage.message();
129 Kopete::OnlineStatus status = OnlineStatusManager::self()->onlineStatus( account->protocol(), categories );
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() ) )
149 void AccountManager::setOnlineStatus( uint category, const Kopete::StatusMessage &statusMessage, uint flags )
172 QList <Kopete::Status::StatusItem *> statusList = Kopete::StatusManager::self()->getRootGroup()->childList();
174 for ( QList <Kopete::Status::StatusItem *>::ConstIterator it = statusList.constBegin(); it != statusList.constEnd(); ++it )
180 message = (static_cast <Kopete::Status::Status*> (*it))->message(); //if it is not group, it's status
191 Kopete::StatusManager::self()->setGlobalStatus( Kopete::OnlineStatusManager::Offline, statusMessage );
196 bool networkAvailable = ( Solid::Networking::status() == Solid::Networking::Unknown || Solid::Networking::status() == Solid::Networking::Connected );
204 Kopete::StatusManager::self()->setGlobalStatus( d->suspendedStatusCategory, d->suspendedStatusMessage );
269 if ( ( account->protocol() == curracc->protocol() ) && ( account->accountId() == curracc->accountId() ) )
285 connect(account, SIGNAL(accountDestroyed(const Kopete::Account*)) , this, SLOT(unregisterAccount(const Kopete::Account*)));
289 // the account's Identity must be set here instead of in the Kopete::Account ctor, because there the
291 Identity *identity = Kopete::IdentityManager::self()->findIdentity( account->configGroup()->readEntry("Identity", QString()) );
296 kWarning( 14010 ) << "No identity for account " << account->accountId() << ": falling back to default";
385 QStringList accountGroups = config->groupList().filter( QRegExp( QString::fromLatin1( "^Account_" ) ) );
393 protocol = QString::fromLatin1( "kopete_" ) + protocol.toLower().remove( QString::fromLatin1( "protocol" ) );
395 if ( cg.readEntry( "Enabled", true ) && pluginConfig.readEntry(protocol + QLatin1String("Enabled"), true) )
409 const QStringList accountGroups = config->groupList().filter( QRegExp( QString::fromLatin1( "^Account_" ) ) );
410 for ( QStringList::ConstIterator it = accountGroups.constBegin(); it != accountGroups.constEnd(); ++it )
457 setOnlineStatus( Kopete::StatusManager::self()->globalStatusCategory(), Kopete::StatusManager::self()->globalStatusMessage(), 0, true);
473 disconnect( account, SIGNAL(isConnectedChanged()), this, SLOT(removeAccountConnectedChanged()) );
538 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:519
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
const T & next()
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
QObject * sender() const
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:52
QDBusConnection systemBus()
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(int position, int n)
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
static AccountManager * self()
Retrieve the instance of AccountManager.
Definition: kopeteaccountmanager.cpp:77
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:253
Account * findAccount(const QString &protocolId, const QString &accountId)
Return the account asked.
Definition: kopeteaccountmanager.cpp:329
virtual void setStatusMessage(const Kopete::StatusMessage &statusMessage)=0
Reimplement this function to set the status message(with metadata).
void append(const T &value)
const_iterator constEnd() const
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
void setObjectName(const QString &name)
bool isEmpty() const
KConfigGroup * configGroup() const
Return the KConfigGroup used to write and read special properties.
Definition: kopeteaccount.cpp:282
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
typedef Iterator
void deleteLater()
QColor guessColor(Protocol *protocol) const
Guess the color for a new account.
Definition: kopeteaccountmanager.cpp:209
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:514
Definition: kopetecontact.h:58
iterator end()
QString toLower() const
const T value(const Key &key) const
void setStatusMessage(const QString &message)
Set the given status message for all online accounts.
Definition: kopeteaccountmanager.cpp:154
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:601
void removeAccount(Account *account)
Delete the account and clean the config data.
Definition: kopeteaccountmanager.cpp:340
const_iterator constBegin() const
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:108
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:119
typedef ConstIterator
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:614
const QList< Account * > & accounts() const
Retrieve the list of accounts.
Definition: kopeteaccountmanager.cpp:313
QString fromLatin1(const char *str, int size)
static OnlineStatusManager * self()
Definition: kopeteonlinestatusmanager.cpp:49
QStringList filter(const QString &str, Qt::CaseSensitivity cs) const
const_iterator constEnd() const
virtual Account * createNewAccount(const QString &accountId)=0
Create an empty Account.
const_iterator constBegin() const
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
Definition: kopeteidentity.h:41
iterator begin()
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
singleShot
Status::StatusGroup * getRootGroup() const
Get current status data tree.
Definition: kopetestatusmanager.cpp:167
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
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.