bluetoothengine/btui/btuimodel/btlocalsetting.h
changeset 19 43824b19ee35
child 31 a0ea99b6fa53
equal deleted inserted replaced
17:f05641c183ff 19:43824b19ee35
       
     1 /*
       
     2 * ============================================================================
       
     3 *  Name        : btuimsettings.h
       
     4 *  Part of     : BluetoothUI / bluetoothuimodel       *** Info from the SWAD
       
     5 *  Description : Declaration of the class representing the Bluetooth
       
     6 *                settings source data.
       
     7 *
       
     8 *  Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     9 *  All rights reserved.
       
    10 *  This component and the accompanying materials are made available
       
    11 *  under the terms of "Eclipse Public License v1.0"
       
    12 *  which accompanies this distribution, and is available
       
    13 *  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    14 *
       
    15 *  Initial Contributors:
       
    16 *  Nokia Corporation - initial contribution.
       
    17 *
       
    18 *  Contributors:
       
    19 *  Nokia Corporation
       
    20 * ============================================================================
       
    21 * Template version: 4.2
       
    22 */
       
    23 
       
    24 #ifndef BTLOCALSETTING_H
       
    25 #define BTLOCALSETTING_H
       
    26 
       
    27 #include <qglobal.h>
       
    28 #include <e32base.h>
       
    29 #include <e32property.h>
       
    30 #include <btengsettings.h>
       
    31 #include <btservices/btsimpleactive.h>
       
    32 
       
    33 #include "btuimodel.h"
       
    34 
       
    35 /*!
       
    36     \class BtuimSettings
       
    37     \brief class for handling local Bluetooth setting updates.
       
    38 
       
    39     BtLocalSetting class is responsible for providing the latest information
       
    40     regarding the local Bluetooth settings such as device name and power state.
       
    41 
       
    42     \\sa bluetoothuimodel
       
    43  */
       
    44 class BtLocalSetting : public QObject,
       
    45                       public MBTEngSettingsObserver,
       
    46                       public MBtSimpleActiveObserver
       
    47 {
       
    48     Q_OBJECT
       
    49 
       
    50 public:
       
    51     explicit BtLocalSetting( BtuiModel& model, QObject *parent = 0 );
       
    52     
       
    53     virtual ~BtLocalSetting();
       
    54     
       
    55     bool isValid( int col) const;
       
    56     
       
    57     int itemCount() const;
       
    58         
       
    59     void data(QVariant& val, int col, int role ) const;
       
    60     
       
    61     BtuiModelDataItem itemData( int col ) const;
       
    62 
       
    63 signals:
       
    64 
       
    65     void settingDataChanged( int row, int column, void *parent );    
       
    66     
       
    67 private:
       
    68     // from MBTEngSettingsObserver
       
    69     
       
    70     void PowerStateChanged( TBTPowerStateValue state );
       
    71     
       
    72     void VisibilityModeChanged( TBTVisibilityMode state );
       
    73     
       
    74     // from MBtSimpleActiveObserver
       
    75     
       
    76     void RequestCompletedL( CBtSimpleActive* active, TInt status );
       
    77 
       
    78     void CancelRequest( TInt requestId );
       
    79 
       
    80     void HandleError( CBtSimpleActive* active, TInt error );
       
    81     
       
    82 
       
    83     
       
    84 public slots:
       
    85     //void activeRequestCompleted( int status, int id );
       
    86 
       
    87 private:
       
    88 
       
    89     void setVisibilityMode( TBTVisibilityMode state );
       
    90     void updateDeviceName( const QString &name );
       
    91     
       
    92     void setPowerSetting( TBTPowerStateValue state );
       
    93     
       
    94     //void setOfflineSetting( bool state );
       
    95     //void setBtConnectionsSetting( int connections );
       
    96     
       
    97     void getNameFromRegistry( QString &name );
       
    98 
       
    99 private:
       
   100     BtuiModelDataSource mData;
       
   101     
       
   102     BtuiModel& mModel;
       
   103     
       
   104     CBTEngSettings *mBtengSetting;
       
   105     
       
   106     // For monitoring local device name change
       
   107     RProperty mLocalDeviceKey;
       
   108     CBtSimpleActive *mLocalDeviceWatcher;
       
   109     
       
   110     //RProperty mBtLinkCountKey;
       
   111     //CBTEngActive *mBtLinkCountWatcher;
       
   112     Q_DISABLE_COPY(BtLocalSetting)
       
   113 
       
   114 };
       
   115 
       
   116 #endif // BTLOCALSETTING_H