home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kopete / managedconnectionaccount.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-09-10  |  3.3 KB  |  80 lines

  1. /*
  2.     managedconnectionaccount.h - Kopete Account that uses a  manager to
  3.     control its connection and respond to connection events
  4.  
  5.     Copyright (c) 2005      by Will Stephenson <lists@stevello.free-online.co.uk>
  6.     Kopete    (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
  7.  
  8.     *************************************************************************
  9.     *                                                                       *
  10.     * This library is free software; you can redistribute it and/or         *
  11.     * modify it under the terms of the GNU Lesser General Public            *
  12.     * License as published by the Free Software Foundation; either          *
  13.     * version 2 of the License, or (at your option) any later version.      *
  14.     *                                                                       *
  15.     *************************************************************************
  16. */
  17.  
  18. #ifndef MANAGEDCONNECTIONACCOUNT_H
  19. #define MANAGEDCONNECTIONACCOUNT_H
  20.  
  21. #include "networkstatuscommon.h"
  22.  
  23. #include "kopetepasswordedaccount.h"
  24.  
  25. namespace Kopete
  26. {
  27. class Protocol;
  28.  
  29. /**
  30.  * A ManagedConnectionAccount queries the NetworkStatus KDED Module before trying to connect using 
  31.  * connectwithPassword, starting a network connection if needed.  If the network is not available, 
  32.  * it delays calling performConnectWithPassword until it receives notification from the daemon 
  33.  * that the network is up.  The account receiveds notifications from the daemon of network failures
  34.  * and calls disconnect to set the account offline in a timely manner.
  35.  */
  36. class KOPETE_EXPORT ManagedConnectionAccount : public PasswordedAccount
  37. {
  38.     Q_OBJECT
  39.     public:
  40.         /**
  41.         * @brief ManagedConnectionAccount constructor.
  42.         * @param parent The protocol this account connects via
  43.         * @param acctId The ID of this account - should be unique within this protocol
  44.         * @param maxPasswordLength The maximum length for passwords for this account, or 0 for no limit
  45.         * @param name The name for this QObject
  46.         */
  47.         ManagedConnectionAccount( Protocol *parent, const QString &acctId, uint maxPasswordLength = 0, const char *name = 0 );
  48.     public slots:
  49.         /**
  50.          * @brief Begin the connection process, by checking if the connection is available with the ConnectionManager.
  51.          * This method is called by PasswordedAccount::connect()
  52.          * @param password the password to connect with.
  53.          */
  54.         void connectWithPassword( const QString &password );
  55.     protected:
  56.         /** 
  57.          * @brief Connect to the server, once the network is available.
  58.          * This method is called by the ManagedConnectionAccount once the network is available. In this method you should set up your 
  59.          * network connection and connect to the server.
  60.          */
  61.         virtual void performConnectWithPassword( const QString & password ) = 0;
  62.     protected slots:
  63.         /**
  64.          * @brief Handle a change in the network connection
  65.          * Called by the ConnectionManager when the network comes up or fails.  
  66.          * The default implementation calls performConnectWithPassword when the network goes online and connectWithPassword() was
  67.          * previously called, and calls disconnect() when the connection goes down.
  68.          * @param host For future expansion.
  69.          * @param status the new status of the network
  70.          */
  71.         virtual void slotConnectionStatusChanged( const QString & host, NetworkStatus::EnumStatus status );
  72.     private:
  73.         QString m_password;
  74.         bool m_waitingForConnection;
  75. };
  76.  
  77. }
  78.  
  79. #endif
  80.