13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <QDebug> |
|
19 #include <bacntf.h> |
18 #include <bacntf.h> |
20 #include "nmhswidgetdatetimeobserver.h" |
19 #include "nmhswidgetdatetimeobserver.h" |
21 #include "nmhswidgetdatetimeobserver_p.h" |
20 #include "nmhswidgetdatetimeobserver_p.h" |
|
21 #include "emailtrace.h" |
22 |
22 |
23 /*! |
23 /*! |
24 \fn NmHsWidgetDateTimeObserverPrivate::NmHsWidgetDateTimeObserverPrivate() |
24 \fn NmHsWidgetDateTimeObserverPrivate::NmHsWidgetDateTimeObserverPrivate() |
25 |
25 |
26 /param q pointer to public interface |
26 /param q pointer to public interface |
27 /post Observer listens to environment change events via callback |
27 /post Observer listens to environment change events via callback |
28 */ |
28 */ |
29 NmHsWidgetDateTimeObserverPrivate::NmHsWidgetDateTimeObserverPrivate(NmHsWidgetDateTimeObserver *q) : |
29 NmHsWidgetDateTimeObserverPrivate::NmHsWidgetDateTimeObserverPrivate(NmHsWidgetDateTimeObserver *q) : |
30 q_ptr(q) |
30 q_ptr(q) |
31 { |
31 { |
32 qDebug() << "NmHsWidgetDateTimeObserverPrivate::NmHsWidgetDateTimeObserverPrivate --> IN" ; |
32 NM_FUNCTION; |
33 TCallBack callback( LocaleChangeCallback, this ); |
33 TCallBack callback( LocaleChangeCallback, this ); |
34 //TODO: Handle leave properly |
34 //TODO: Handle leave properly |
35 TRAP_IGNORE(iLocaleNotifier = CEnvironmentChangeNotifier::NewL( CActive::EPriorityStandard, callback )); |
35 TRAP_IGNORE(iLocaleNotifier = CEnvironmentChangeNotifier::NewL( CActive::EPriorityStandard, callback )); |
36 iLocaleNotifier->Start(); |
36 iLocaleNotifier->Start(); |
37 qDebug() << "NmHsWidgetDateTimeObserverPrivate::NmHsWidgetDateTimeObserverPrivate <-- OUT" ; |
|
38 } |
37 } |
39 |
38 |
40 /*! |
39 /*! |
41 \fn NmHsWidgetDateTimeObserverPrivate::~NmHsWidgetDateTimeObserverPrivate() |
40 \fn NmHsWidgetDateTimeObserverPrivate::~NmHsWidgetDateTimeObserverPrivate() |
42 |
41 |
43 Destructor |
42 Destructor |
44 */ |
43 */ |
45 NmHsWidgetDateTimeObserverPrivate::~NmHsWidgetDateTimeObserverPrivate() |
44 NmHsWidgetDateTimeObserverPrivate::~NmHsWidgetDateTimeObserverPrivate() |
46 { |
45 { |
47 qDebug() << "NmHsWidgetDateTimeObserverPrivate::~NmHsWidgetDateTimeObserverPrivate --> IN" ; |
46 NM_FUNCTION; |
48 if(iLocaleNotifier){ |
47 delete iLocaleNotifier; |
49 delete iLocaleNotifier; |
48 iLocaleNotifier = NULL; |
50 iLocaleNotifier = NULL; |
|
51 } |
|
52 qDebug() << "NmHsWidgetDateTimeObserverPrivate::~NmHsWidgetDateTimeObserverPrivate <-- OUT" ; |
|
53 } |
49 } |
54 |
50 |
55 /*! |
51 /*! |
56 \fn TInt NmHsWidgetDateTimeObserverPrivate::HandleLocaleChange() |
52 \fn TInt NmHsWidgetDateTimeObserverPrivate::HandleLocaleChange() |
57 |
53 |
59 indicates poblic interface about the change |
55 indicates poblic interface about the change |
60 /return Returns count of handled change events |
56 /return Returns count of handled change events |
61 */ |
57 */ |
62 TInt NmHsWidgetDateTimeObserverPrivate::HandleLocaleChange() |
58 TInt NmHsWidgetDateTimeObserverPrivate::HandleLocaleChange() |
63 { |
59 { |
64 qDebug() << "NmHsWidgetDateTimeObserverPrivate::HandleLocaleChange"; |
60 NM_FUNCTION; |
65 TInt handled = 0; |
61 TInt handled = 0; |
66 if( iLocaleNotifier->Change() & ( EChangesSystemTime | EChangesLocale | EChangesMidnightCrossover )) |
62 if( iLocaleNotifier->Change() & ( EChangesSystemTime | EChangesLocale | EChangesMidnightCrossover )) |
67 { |
63 { |
68 q_ptr->handleCompletion(); |
64 q_ptr->handleCompletion(); |
69 handled = 1; |
65 handled = 1; |
77 /post Event is checked and handled if valid change |
73 /post Event is checked and handled if valid change |
78 /return Returns count of handled change events |
74 /return Returns count of handled change events |
79 */ |
75 */ |
80 TInt NmHsWidgetDateTimeObserverPrivate::LocaleChangeCallback(TAny* aThisPtr) |
76 TInt NmHsWidgetDateTimeObserverPrivate::LocaleChangeCallback(TAny* aThisPtr) |
81 { |
77 { |
82 qDebug() << "NmHsWidgetDateTimeObserverPrivate::LocaleChangeCallback" ; |
78 NM_FUNCTION; |
83 TInt ret = static_cast<NmHsWidgetDateTimeObserverPrivate*>(aThisPtr)->HandleLocaleChange(); |
79 TInt ret = static_cast<NmHsWidgetDateTimeObserverPrivate*>(aThisPtr)->HandleLocaleChange(); |
84 return ret; |
80 return ret; |
85 } |
81 } |