connectionutilities/ConnectionDialogs/DisconnectDlg/inc/ConnectionModel.h
author Simon Howkins <simonh@symbian.org>
Thu, 18 Nov 2010 15:05:52 +0000
branchRCL_3
changeset 76 40780c2f3a6b
parent 58 83ca720e2b9a
permissions -rw-r--r--
Adjusted to avoid exports, etc, from a top-level bld.inf

/*
* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). 
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: 
*     The model of RConnectionMobitor.
*
*/


#ifndef DDLG_CONNECTIONMODEL_H
#define DDLG_CONNECTIONMODEL_H

// INCLUDES
#include <e32base.h>
#include <rconnmon.h>
#include <cdblen.h>

// FORWARD DECLARATIONS
class CConnectionInfo;
class CConnectionCArray;
class CDisconnectDialogUi;

// CLASS DECLARATION
/**
* Contains business logic of DisconnectDlg
*/
NONSHARABLE_CLASS( CConnectionModel ) : public CBase, 
                                        public MConnectionMonitorObserver
                                        
    {
    public:

        /**
        * @param CDisconnectDialogUi* notifier will be completed if 
        * @param TDisconnectConnectionPrefs& preferences of the 1st connection
        * connection is closed
        */
        static CConnectionModel* NewL(
                                    CDisconnectDialogUi* aDisconnectDialogUi,
                                    CConnectionInfo* aConnectionInfo );

        /**
        * Destructor.
        */
        virtual ~CConnectionModel();

    private:

        /**
        * Constructor.
        * @param CDisconnectDialogUi* notifier will be completed if 
        * connection is closed
        */
        CConnectionModel( CDisconnectDialogUi* aDisconnectDialogUi );

        /**
        * Constructor.
        * @param CConnectionInfo preferences of the first connection 
        */
        void ConstructL( CConnectionInfo* aConnectionInfo );
    
    protected:
        /**
        * Fills up connection array
        */
        void InitConnectionArrayL();


    public:

        /**
        * Display information note
        * @param aPromptResourceId - resuorce id to the text
        * @param aPrompt additional text
        */
        void InfoNoteL( const TInt aPromptResourceId, 
                        const TDesC* aPrompt = NULL );


        /**
        * Starts syncronous request to end the given connection.
        * @param aConnId connection index
        * @return the result of the request
        */
        TInt EndConnection( TUint aConnIndex );

        // Getter functions

        /**
        * Get the connection array.
        * @param -
        * @return pointer to the connection array
        */
        CConnectionCArray* GetConnArray() const;


        /**
        * Cancels Notification
        */
        void CancelNotification();
        

    public: // from MConnectionMonitorObserver

        /**
        * Event method is called every time an event occures.
        * @since 
        * @param aConnMonEvent The event information.
        * @return void
        */
        void EventL( const CConnMonEventBase &aConnMonEvent );

    private:
        /**
        * For get connection informations
        */
        RConnectionMonitor iMonitor;

        /**
        * Contains connection info instances
        */
        CConnectionCArray* iConnArray;   ///< Owned.

        TUint iClosingConnectionIndex;  ///< index of connection to be closed

        CDisconnectDialogUi* iDisconnectDialogUi;// Not Owned

        TBool iDeleting;
    };


#endif /* DDLG_CONNECTIONMODEL_H */

// End of File