|
1 /* |
|
2 * Copyright (c) 2009 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: stub hbaction |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef HBACTION_H |
|
19 #define HBACTION_H |
|
20 |
|
21 #include <QObject> |
|
22 #include <QString> |
|
23 #include <qpointer.h> |
|
24 #include <qaction.h> |
|
25 #include "hbnamespace.h" |
|
26 #include "hbicon.h" |
|
27 #include "hbmenu.h" |
|
28 |
|
29 #include "xqserviceutilstub.h" |
|
30 #include "xqserviceproviderstub.h" |
|
31 |
|
32 class HbAction : public QAction |
|
33 { |
|
34 Q_OBJECT |
|
35 |
|
36 public: |
|
37 |
|
38 /** |
|
39 * Constructor |
|
40 */ |
|
41 explicit HbAction(QObject *parent = 0) |
|
42 : QAction(parent), |
|
43 mMenu(0) |
|
44 { |
|
45 Q_UNUSED(parent); |
|
46 initializeCount++; |
|
47 mTriggeredCount = 0; |
|
48 } |
|
49 |
|
50 /** |
|
51 * Contructor. |
|
52 */ |
|
53 explicit HbAction(const QString &txt, QObject *parent = 0) |
|
54 : QAction(txt, parent), |
|
55 mMenu(0) |
|
56 { |
|
57 Q_UNUSED(parent); |
|
58 initializeCount++; |
|
59 mTriggeredCount = 0; |
|
60 } |
|
61 |
|
62 /** |
|
63 * Contructor. |
|
64 */ |
|
65 explicit HbAction(Hb::SoftKeyAction actType, QObject *parent = 0) |
|
66 : QAction(parent), |
|
67 mMenu(0) |
|
68 { |
|
69 Q_UNUSED(parent); |
|
70 Q_UNUSED(actType); |
|
71 initializeCount++; |
|
72 mTriggeredCount = 0; |
|
73 } |
|
74 |
|
75 explicit HbAction(Hb::NavigationAction action, QObject* parent = 0) |
|
76 : QAction(parent), |
|
77 mMenu(0) |
|
78 { |
|
79 Q_UNUSED(parent); |
|
80 Q_UNUSED(action); |
|
81 initializeCount++; |
|
82 mNavAction = action; |
|
83 mTriggeredCount = 0; |
|
84 } |
|
85 |
|
86 /** |
|
87 * destructor |
|
88 */ |
|
89 virtual ~HbAction(){initializeCount--;} |
|
90 |
|
91 /** |
|
92 * icon |
|
93 */ |
|
94 void setIcon(const HbIcon &icon) { mIcon = icon; } |
|
95 |
|
96 /** |
|
97 * icon |
|
98 */ |
|
99 HbIcon icon() const { return mIcon; } |
|
100 |
|
101 /** |
|
102 * menu |
|
103 */ |
|
104 void setMenu(HbMenu* menu) { mMenu = menu; } |
|
105 |
|
106 /** |
|
107 * menu |
|
108 */ |
|
109 HbMenu *menu() const { return mMenu; } |
|
110 |
|
111 /** |
|
112 * Trigger stub |
|
113 */ |
|
114 void trigger() |
|
115 { |
|
116 mTriggeredCount++; |
|
117 QAction::trigger(); |
|
118 } |
|
119 |
|
120 public: // data |
|
121 |
|
122 /** |
|
123 * counter to make sure alloc dealloc match |
|
124 */ |
|
125 static int initializeCount; |
|
126 |
|
127 /** |
|
128 * Hb navigation action type. |
|
129 */ |
|
130 static Hb::NavigationAction mNavAction; |
|
131 |
|
132 /** |
|
133 * Count how many times this was triggered. |
|
134 */ |
|
135 int mTriggeredCount; |
|
136 |
|
137 /** |
|
138 * icon |
|
139 */ |
|
140 HbIcon mIcon; |
|
141 |
|
142 /** |
|
143 * menu |
|
144 */ |
|
145 HbMenu* mMenu; |
|
146 |
|
147 }; |
|
148 |
|
149 #endif |