Blokkal::Account Class Reference
This class provides the interface for a bloggging account. More...
#include <blokkalaccount.h>
Public Types | |
enum | ConnectionStatus { Connected = 1, Connecting = 2, Disconnected = 3 } |
enum | DisconnectReason { UserDisconnect = 1, IOErrorDisconnect = 2, OtherDisconnect = 3, AuthenticationDisconnect = 4 } |
Public Slots | |
Blokkal::Io::CategoryManager * | categoryManager (void) const |
virtual void | connectAccount (void)=0 |
virtual void | disconnectAccount (Blokkal::Account::DisconnectReason reason=UserDisconnect, const QString &reasonString=0) |
void | restoreBlogs (void) |
Signals | |
void | accountDestroyed (Blokkal::Account *account) |
void | blogRegistered (Blokkal::Blog *blog) |
void | blogUnregistered (Blokkal::Blog *blog) |
void | connectionStatusChanged (Blokkal::Account *account) |
Public Member Functions | |
virtual QList< QAction * > | actionList (void) |
bool | autoConnect (void) const |
Blokkal::Blog * | blog (const QString &id) const |
QList< Blokkal::Blog * > | blogs (void) const |
KUrl | connectAddress (void) const |
Blokkal::Account::ConnectionStatus | connectionStatus (void) const |
QString | dataDirectory (void) const |
virtual KIcon | icon (void) const |
QString | id (void) const |
bool | isConnected (void) const |
bool | isDisconnected (void) const |
Blokkal::Protocol * | protocol (void) const |
virtual void | removeAccount (void) |
QString | serverName (void) const |
void | setAutoConnect (bool enable) const |
void | setConnectAddress (const QString &address) |
void | setServerName (const QString &serverName) |
void | setUserName (const QString &user) |
void | setUsesDefaultConnectAddress (bool useDefault) |
QString | userName (void) const |
bool | usesDefaultConnectAddress (void) const |
virtual | ~Account (void) |
Protected Slots | |
Blokkal::Blog * | registerBlog (Blokkal::Blog *blog) |
void | unregisterBlog (Blokkal::Blog *blog) |
Protected Member Functions | |
Account (Blokkal::Protocol *protocol, const QString &id=0) | |
QDomElement | blogNode (const QString &id) |
Blokkal::AccountConfig * | config (void) const |
virtual Blokkal::Blog * | restoreBlog (Blokkal::BlogConfig *config)=0 |
void | setConnectionStatus (Blokkal::Account::ConnectionStatus status) |
Friends | |
class | BlogConfig |
Detailed Description
This class provides the interface for a bloggging account.This class provides the interface for a bloggging account.
Definition at line 52 of file blokkalaccount.h.
Member Enumeration Documentation
Enumeration for the connection state.
- Enumerator:
-
Connected Account is connected. Connecting Account is connecting. Disconnected Account is disconnected.
Definition at line 59 of file blokkalaccount.h.
Enumeration for disconnect reasons
- Enumerator:
-
UserDisconnect Disconnected due to user action. IOErrorDisconnect Disconnected due to some IO error. OtherDisconnect Disconnected for some other reason.
Definition at line 68 of file blokkalaccount.h.
Constructor & Destructor Documentation
Blokkal::Account::~Account | ( | void | ) | [virtual] |
Destroys the object. The configuration will not be removed. If you want to destroy this account permanently, use removeAccount()
Definition at line 80 of file blokkalaccount.cpp.
Blokkal::Account::Account | ( | Blokkal::Protocol * | protocol, | |
const QString & | id = 0 | |||
) | [protected] |
Creates a new account for protocol protocol, with name id
- Parameters:
-
protocol the procotol of this account id the id of this account
Definition at line 69 of file blokkalaccount.cpp.
Member Function Documentation
void Blokkal::Account::accountDestroyed | ( | Blokkal::Account * | account | ) | [signal] |
This signal is emitted when the account object is destroyed
QList< QAction * > Blokkal::Account::actionList | ( | void | ) | [virtual] |
Returns a list of custom actions for context menus. The default implementation returns an empty list.
- Returns:
- a list of custom actions
Definition at line 472 of file blokkalaccount.cpp.
bool Blokkal::Account::autoConnect | ( | void | ) | const |
Returns whether this account may be connected automatically.
- Returns:
- whether this account may be connected automatically
Definition at line 348 of file blokkalaccount.cpp.
Blokkal::Blog * Blokkal::Account::blog | ( | const QString & | id | ) | const |
Returns the blog with the internal id id or 0 if no such blog has been registered.
- Returns:
- the blog
Definition at line 227 of file blokkalaccount.cpp.
QDomElement Blokkal::Account::blogNode | ( | const QString & | id | ) | [protected] |
Returns the node of the blog with name blogName if it exists. If it does not exist, a new node for this blog will be created, but not inserted in the tree. This method is used by the BlogConfig constructor.
- Parameters:
-
id get the node for this blog.
- Returns:
- the configuration node
Definition at line 287 of file blokkalaccount.cpp.
void Blokkal::Account::blogRegistered | ( | Blokkal::Blog * | blog | ) | [signal] |
This signal is emitted, when a blog is registered by the account
QList< Blokkal::Blog * > Blokkal::Account::blogs | ( | void | ) | const |
Returns a list of currently registered blogs.
- Returns:
- current blogs
Definition at line 190 of file blokkalaccount.cpp.
void Blokkal::Account::blogUnregistered | ( | Blokkal::Blog * | blog | ) | [signal] |
This signal is emitted, when a blog is unregistered from the account.
Blokkal::Io::CategoryManager * Blokkal::Account::categoryManager | ( | void | ) | const [slot] |
Returns the category manager for this account.
- Returns:
- the category manager for this account
Definition at line 358 of file blokkalaccount.cpp.
Blokkal::AccountConfig * Blokkal::Account::config | ( | void | ) | const [protected] |
Returns the account config object for this account.
- Returns:
- the account config
Definition at line 89 of file blokkalaccount.cpp.
virtual void Blokkal::Account::connectAccount | ( | void | ) | [pure virtual, slot] |
This method is called to prepare any succeeding actions. You are required to gather any required information (e.g. blogs accessible for the user ) and emit connectionStatusChanged(). Do not forget to set the new connection status with setConnectionStatus()
Implemented in Blokkal::PasswordedAccount.
KUrl Blokkal::Account::connectAddress | ( | void | ) | const |
Returns the address this account connects to.
- Returns:
- the address this account connects to
Definition at line 104 of file blokkalaccount.cpp.
Blokkal::Account::ConnectionStatus Blokkal::Account::connectionStatus | ( | void | ) | const |
Returns the connection state of the account.
- See also:
- setConnectionStatus
- Returns:
- the current connection status
Definition at line 135 of file blokkalaccount.cpp.
void Blokkal::Account::connectionStatusChanged | ( | Blokkal::Account * | account | ) | [signal] |
This signals is emitted when the connection status changes.
- Parameters:
-
account the account that has a new connection status
QString Blokkal::Account::dataDirectory | ( | void | ) | const |
Returns the data directory, where an account may store its private data.
- Returns:
- the account data directory
Definition at line 236 of file blokkalaccount.cpp.
void Blokkal::Account::disconnectAccount | ( | Blokkal::Account::DisconnectReason | reason = UserDisconnect , |
|
const QString & | reasonString = 0 | |||
) | [virtual, slot] |
This method is called to close the current session. The default implementation just calls setConnectionStatus() and emits connectionStatusChanged(). If reason indicates that the account was not disconnected at behalf of the user a notification will be generated.
- Note:
- It is good practice to override this method, so that any pending connections and connection attempts are canceled.
- Parameters:
-
reason the reaon for the disconnect reasonString to use instead of a generic error message
Reimplemented in Blokkal::PasswordedAccount.
Definition at line 149 of file blokkalaccount.cpp.
KIcon Blokkal::Account::icon | ( | void | ) | const [virtual] |
Returns the icon for this account
- Returns:
- the icon for this account
Definition at line 119 of file blokkalaccount.cpp.
QString Blokkal::Account::id | ( | void | ) | const |
Returns the unique id of this account.
- Returns:
- the unique id of this account
Definition at line 109 of file blokkalaccount.cpp.
bool Blokkal::Account::isConnected | ( | void | ) | const |
This is equal to connectionStatus() == Connected
- Returns:
- TRUE if connectionStatus() == Connected
Definition at line 277 of file blokkalaccount.cpp.
bool Blokkal::Account::isDisconnected | ( | void | ) | const |
This is equal to connectionStatus() == Disconnected
- Returns:
- TRUE if connectionStatus() == Disconnected
Definition at line 282 of file blokkalaccount.cpp.
Blokkal::Protocol * Blokkal::Account::protocol | ( | void | ) | const |
Returns the protocol owning this account.
- Returns:
- the account's protocol
Definition at line 94 of file blokkalaccount.cpp.
Blokkal::Blog * Blokkal::Account::registerBlog | ( | Blokkal::Blog * | blog | ) | [protected, slot] |
Checks that blog does not already exists and registers it. If it tries to take over an already registered blog, blog will be deleted. If a registered blog is deleted it will be unregistered automatically
- Parameters:
-
blog the new blog
- Returns:
- blog or 0 if it was not registered
- See also:
- unregisterBlog()
Definition at line 195 of file blokkalaccount.cpp.
void Blokkal::Account::removeAccount | ( | void | ) | [virtual] |
Removes the account from the configuration and deletes this object. You need to override this method only to delete additional configuration data.
Reimplemented in Blokkal::PasswordedAccount.
Definition at line 124 of file blokkalaccount.cpp.
virtual Blokkal::Blog* Blokkal::Account::restoreBlog | ( | Blokkal::BlogConfig * | config | ) | [protected, pure virtual] |
Restores the blog according to the information in config. If you do not want or are unable to restore the blog for some reason return 0.
- Parameters:
-
config restore the blog with this configuration
- Returns:
- the restored blog or 0 if the blog was not restored
- See also:
- Blokkal::Blog::saveProperties()
void Blokkal::Account::restoreBlogs | ( | void | ) | [slot] |
Restores the blogs
Definition at line 317 of file blokkalaccount.cpp.
QString Blokkal::Account::serverName | ( | void | ) | const |
Returns the server name this account uses. The key in the config is "servername".
- Returns:
- the server name
- See also:
- connectAddress()
Definition at line 99 of file blokkalaccount.cpp.
void Blokkal::Account::setAutoConnect | ( | bool | enable | ) | const |
Sets whether this account may be connected automatically.
- Parameters:
-
enable TRUE allow this account to be connected automatically
Definition at line 353 of file blokkalaccount.cpp.
void Blokkal::Account::setConnectAddress | ( | const QString & | address | ) |
Sets the connect address.
- Parameters:
-
address the connect address
Definition at line 262 of file blokkalaccount.cpp.
void Blokkal::Account::setConnectionStatus | ( | Blokkal::Account::ConnectionStatus | status | ) | [protected] |
Sets the value returned by connectionStatus. Emits connectionStatusChanged().
- Parameters:
-
status the new connection status
Definition at line 140 of file blokkalaccount.cpp.
void Blokkal::Account::setServerName | ( | const QString & | serverName | ) |
Sets the server name.
- Parameters:
-
serverName the new server name
Definition at line 257 of file blokkalaccount.cpp.
void Blokkal::Account::setUserName | ( | const QString & | user | ) |
Sets the username used by this account.
- Parameters:
-
user the username used by this account.
Definition at line 272 of file blokkalaccount.cpp.
void Blokkal::Account::setUsesDefaultConnectAddress | ( | bool | useDefault | ) |
Determines whether the connect address for this account is the default one or not
- Parameters:
-
useDefault TRUE if this account uses the default address
Definition at line 267 of file blokkalaccount.cpp.
void Blokkal::Account::unregisterBlog | ( | Blokkal::Blog * | blog | ) | [protected, slot] |
Unregisters a blog.
- Parameters:
-
blog blog to unregister
- See also:
- registerBlog()
Definition at line 219 of file blokkalaccount.cpp.
QString Blokkal::Account::userName | ( | void | ) | const |
Returns the user name this account uses. The key in the config is "username".
- Returns:
- the user name this account uses
Definition at line 114 of file blokkalaccount.cpp.
bool Blokkal::Account::usesDefaultConnectAddress | ( | void | ) | const |
Returns the whether this account uses the default address or not.
- Returns:
- TRUE if the default address is used
Definition at line 130 of file blokkalaccount.cpp.
The documentation for this class was generated from the following files: