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 BTABSTRACTDELEGATE_H |
|
19 #define BTABSTRACTDELEGATE_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QVariant> |
|
23 #include <QModelIndex> |
|
24 |
|
25 class BtSettingModel; |
|
26 class BtDeviceModel; |
|
27 |
|
28 #ifdef BUILD_BTUIDELEGATE |
|
29 #define BTUIDELEGATE_IMEXPORT Q_DECL_EXPORT |
|
30 #else |
|
31 #define BTUIDELEGATE_IMEXPORT Q_DECL_IMPORT |
|
32 #endif |
|
33 |
|
34 |
|
35 /*! |
|
36 \class BtAbstractDelegate |
|
37 \brief the base class for handling user requests from BT application. |
|
38 |
|
39 |
|
40 \\sa btuidelegate |
|
41 */ |
|
42 class BTUIDELEGATE_IMEXPORT BtAbstractDelegate : public QObject |
|
43 { |
|
44 Q_OBJECT |
|
45 |
|
46 public: |
|
47 explicit BtAbstractDelegate( BtSettingModel* settingModel, |
|
48 BtDeviceModel* deviceModel, QObject *parent = 0 ); |
|
49 |
|
50 virtual ~BtAbstractDelegate(); |
|
51 |
|
52 virtual void exec( const QVariant ¶ms ) = 0; |
|
53 |
|
54 virtual void cancel(); |
|
55 |
|
56 signals: |
|
57 void commandCompleted(int status, QVariant params = QVariant() ); |
|
58 |
|
59 protected: |
|
60 |
|
61 BtSettingModel *getSettingModel(); |
|
62 BtDeviceModel *getDeviceModel(); |
|
63 |
|
64 bool isBtPowerOn(); |
|
65 |
|
66 public slots: |
|
67 |
|
68 private: |
|
69 |
|
70 // pointer to models. do not own. |
|
71 BtSettingModel *mSettingModel; |
|
72 BtDeviceModel *mDeviceModel; |
|
73 |
|
74 Q_DISABLE_COPY(BtAbstractDelegate) |
|
75 |
|
76 }; |
|
77 |
|
78 Q_DECLARE_METATYPE(QModelIndex) |
|
79 |
|
80 #endif // BTABSTRACTDELEGATE_H |
|