35 #include "hbindicatorbutton_p.h" |
35 #include "hbindicatorbutton_p.h" |
36 #include "hbindicatorbutton_p_p.h" |
36 #include "hbindicatorbutton_p_p.h" |
37 #include "hbstyleoptionindicatorbutton_p.h" |
37 #include "hbstyleoptionindicatorbutton_p.h" |
38 |
38 |
39 #if defined(Q_OS_SYMBIAN) |
39 #if defined(Q_OS_SYMBIAN) |
|
40 #include <e32property.h> |
40 #include "hbindicatorsym_p.h" |
41 #include "hbindicatorsym_p.h" |
|
42 #include "hbdevicedialogsym_p.h" |
|
43 const TUid PropertyCategoryUid = {0x20022FC5}; |
|
44 const TUint EventKey = 'nEvt'; |
41 #else |
45 #else |
42 #include "hbindicatorwin32_p.h" |
46 #include "hbindicatorwin32_p.h" |
43 #endif // defined(Q_OS_SYMBIAN) |
47 #endif // defined(Q_OS_SYMBIAN) |
44 |
48 |
45 static const char noteIndicatorType[] = {"com.nokia.hb.indicatormenu/1.0"}; |
49 static const char noteIndicatorType[] = {"com.nokia.hb.indicatormenu/1.0"}; |
|
50 |
|
51 #if defined(Q_OS_SYMBIAN) |
|
52 |
|
53 class HbIndicatorButtonStatusPrivate : public CActive |
|
54 { |
|
55 public: |
|
56 HbIndicatorButtonStatusPrivate(HbIndicatorButtonPrivate* indicatorButtonPrivate); |
|
57 ~HbIndicatorButtonStatusPrivate(); |
|
58 |
|
59 public: // from CActive |
|
60 void RunL(); |
|
61 void DoCancel(); |
|
62 |
|
63 private: |
|
64 HbIndicatorButtonPrivate* mIndicatorButtonPrivate; |
|
65 RProperty mProperty; |
|
66 }; |
|
67 |
|
68 HbIndicatorButtonStatusPrivate::HbIndicatorButtonStatusPrivate( |
|
69 HbIndicatorButtonPrivate* indicatorButtonPrivate) : CActive(CActive::EPriorityStandard), |
|
70 mIndicatorButtonPrivate(indicatorButtonPrivate) |
|
71 { |
|
72 CActiveScheduler::Add(this); |
|
73 iStatus = KRequestPending; |
|
74 mProperty.Attach(PropertyCategoryUid, EventKey); |
|
75 mProperty.Subscribe(iStatus); |
|
76 SetActive(); |
|
77 } |
|
78 |
|
79 HbIndicatorButtonStatusPrivate::~HbIndicatorButtonStatusPrivate() |
|
80 { |
|
81 Cancel(); |
|
82 mProperty.Close(); |
|
83 } |
|
84 |
|
85 void HbIndicatorButtonStatusPrivate::RunL() |
|
86 { |
|
87 int newValue(0); |
|
88 if (mProperty.Get(newValue) == KErrNone) { |
|
89 mIndicatorButtonPrivate->setNewEvent(newValue == 0 ? false : true); |
|
90 } |
|
91 mProperty.Subscribe(iStatus); |
|
92 SetActive(); |
|
93 } |
|
94 |
|
95 void HbIndicatorButtonStatusPrivate::DoCancel() |
|
96 { |
|
97 mProperty.Cancel(); |
|
98 } |
|
99 |
|
100 #endif // defined(Q_OS_SYMBIAN) |
46 |
101 |
47 HbIndicatorButtonPrivate::HbIndicatorButtonPrivate() : |
102 HbIndicatorButtonPrivate::HbIndicatorButtonPrivate() : |
48 mHandleIcon(0), mDefaultAction(0), mNewEventAction(0), mProgressAction(0), mDeviceDialog(0), |
103 mHandleIcon(0), mDefaultAction(0), mNewEventAction(0), mProgressAction(0), mDeviceDialog(0), |
49 mProgressAnimationFound(false), mNewEventIcon(0), mNewEvent(false), mStyle(0), mIndicatorMenuOpen(false), |
104 mProgressAnimationFound(false), mNewEventIcon(0), mNewEvent(false), mStyle(0), mIndicatorMenuOpen(false), |
50 mTouchArea(0) |
105 mTouchArea(0) |
53 } |
108 } |
54 |
109 |
55 HbIndicatorButtonPrivate::~HbIndicatorButtonPrivate() |
110 HbIndicatorButtonPrivate::~HbIndicatorButtonPrivate() |
56 { |
111 { |
57 delete mDeviceDialog; |
112 delete mDeviceDialog; |
|
113 |
|
114 #if defined(Q_OS_SYMBIAN) |
|
115 delete mIndicatorButtonStatusPrivate; |
|
116 #endif // defined(Q_OS_SYMBIAN) |
58 } |
117 } |
59 |
118 |
60 void HbIndicatorButtonPrivate::init() |
119 void HbIndicatorButtonPrivate::init() |
61 { |
120 { |
62 Q_Q(HbIndicatorButton); |
121 Q_Q(HbIndicatorButton); |
63 setBackgroundVisible(false); |
122 setBackgroundVisible(false); |
64 mProgressAnimationFound = HbIconAnimationManager::global()->addDefinitionFile( |
123 mProgressAnimationFound = HbIconAnimationManager::global()->addDefinitionFile( |
65 "qtg_anim_mono_loading.axml"); |
124 "qtg_anim_mono_loading.axml"); |
66 |
125 |
67 // add default actions |
126 // add default actions |
68 mDefaultAction = new HbAction(HbIcon("qtg_mono_options_menu"), "IndicatorMenu", q); |
127 mDefaultAction = new HbAction(HbIcon("qtg_mono_options_menu"), "", q); |
69 mNewEventAction = new HbAction(HbIcon("qtg_mono_new_event"), "IndicatorMenu", q); |
128 mNewEventAction = new HbAction(HbIcon("qtg_mono_new_event"), "", q); |
70 |
129 |
71 QString iconName("qtg_anim_mono_loading_1"); |
130 QString iconName("qtg_anim_mono_loading_1"); |
72 if (mProgressAnimationFound) { |
131 if (mProgressAnimationFound) { |
73 iconName = "qtg_anim_mono_loading"; |
132 iconName = "qtg_anim_mono_loading"; |
74 } |
133 } |
75 HbIcon icon(iconName); |
134 HbIcon icon(iconName); |
76 icon.setFlags(HbIcon::Colorized); |
135 icon.setFlags(HbIcon::Colorized); |
77 mProgressAction = new HbAction(icon, "IndicatorMenu", q); |
136 mProgressAction = new HbAction(icon, "", q); |
78 } |
137 } |
79 |
138 |
80 void HbIndicatorButtonPrivate::showIndicatorMenu() |
139 void HbIndicatorButtonPrivate::showIndicatorMenu() |
81 { |
140 { |
82 QVariantMap parametersMap; |
141 QVariantMap parametersMap; |
86 mDeviceDialog->show(noteType, parametersMap); |
145 mDeviceDialog->show(noteType, parametersMap); |
87 mNewEvent = false; |
146 mNewEvent = false; |
88 mIndicatorMenuOpen = true; |
147 mIndicatorMenuOpen = true; |
89 |
148 |
90 updateIcon(); |
149 updateIcon(); |
|
150 |
|
151 #if defined(Q_OS_SYMBIAN) |
|
152 RProperty::Set(PropertyCategoryUid, EventKey, 0); |
|
153 #endif // defined(Q_OS_SYMBIAN) |
91 } |
154 } |
92 |
155 |
93 void HbIndicatorButtonPrivate::addIndicators(const QList<IndicatorClientInfo> &clientInfo) |
156 void HbIndicatorButtonPrivate::addIndicators(const QList<IndicatorClientInfo> &clientInfo) |
94 { |
157 { |
95 for (int i = 0; i < clientInfo.size(); ++i) { |
158 for (int i = 0; i < clientInfo.size(); ++i) { |
204 { |
273 { |
205 Q_D(HbIndicatorButton); |
274 Q_D(HbIndicatorButton); |
206 |
275 |
207 connect(this, SIGNAL(pressed()), this, SLOT(handlePress())); |
276 connect(this, SIGNAL(pressed()), this, SLOT(handlePress())); |
208 connect(this, SIGNAL(released()), this, SLOT(handleRelease())); |
277 connect(this, SIGNAL(released()), this, SLOT(handleRelease())); |
209 |
278 |
210 d->mDeviceDialog = new HbDeviceDialog(HbDeviceDialog::ImmediateResourceReservationFlag); |
279 |
|
280 d->mDeviceDialog = new HbDeviceDialog(); |
|
281 #if defined(Q_OS_SYMBIAN) |
|
282 ((HbDeviceDialogPrivate*)HbDeviceDialogPrivate::d_ptr(d->mDeviceDialog))->connect(); |
|
283 #endif |
211 connect(d->mDeviceDialog, SIGNAL(deviceDialogClosed()), this, SLOT(resetBackground())); |
284 connect(d->mDeviceDialog, SIGNAL(deviceDialogClosed()), this, SLOT(resetBackground())); |
212 |
285 |
213 connect(d->mDefaultAction, SIGNAL(triggered()), this, SLOT(showIndicatorMenu())); |
286 connect(d->mDefaultAction, SIGNAL(triggered()), this, SLOT(showIndicatorMenu())); |
214 connect(d->mNewEventAction, SIGNAL(triggered()), this, SLOT(showIndicatorMenu())); |
287 connect(d->mNewEventAction, SIGNAL(triggered()), this, SLOT(showIndicatorMenu())); |
215 connect(d->mProgressAction, SIGNAL(triggered()), this, SLOT(showIndicatorMenu())); |
288 connect(d->mProgressAction, SIGNAL(triggered()), this, SLOT(showIndicatorMenu())); |
|
289 |
|
290 #if defined(Q_OS_SYMBIAN) |
|
291 d->mIndicatorButtonStatusPrivate = new HbIndicatorButtonStatusPrivate(d); |
|
292 #endif // defined(Q_OS_SYMBIAN) |
216 } |
293 } |
217 |
294 |
218 void HbIndicatorButton::showHandleIndication(bool show) |
295 void HbIndicatorButton::showHandleIndication(bool show) |
219 { |
296 { |
220 Q_D(HbIndicatorButton); |
297 Q_D(HbIndicatorButton); |