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