29 LogsMainWindow::LogsMainWindow() |
29 LogsMainWindow::LogsMainWindow() |
30 : HbMainWindow(), mForeground(false), mLocaleChanged(false) |
30 : HbMainWindow(), mForeground(false), mLocaleChanged(false) |
31 { |
31 { |
32 qApp->installEventFilter(this); |
32 qApp->installEventFilter(this); |
33 mKeyCapture = new XQKeyCapture; |
33 mKeyCapture = new XQKeyCapture; |
|
34 connect( this, SIGNAL(obscured()), this, SLOT(obscuredCalled()) ); |
|
35 connect( this, SIGNAL(revealed()), this, SLOT(revealedCalled()) ); |
34 } |
36 } |
35 |
37 |
36 // ----------------------------------------------------------------------------- |
38 // ----------------------------------------------------------------------------- |
37 // |
39 // |
38 // ----------------------------------------------------------------------------- |
40 // ----------------------------------------------------------------------------- |
99 bool LogsMainWindow::eventFilter(QObject *obj, QEvent *event) |
101 bool LogsMainWindow::eventFilter(QObject *obj, QEvent *event) |
100 { |
102 { |
101 if (event->type() == QEvent::ApplicationActivate) { |
103 if (event->type() == QEvent::ApplicationActivate) { |
102 LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationActivate" ); |
104 LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationActivate" ); |
103 startKeyCapture(); |
105 startKeyCapture(); |
104 mForeground = true; |
|
105 if (mLocaleChanged) { |
|
106 LOGS_QDEBUG( "logs [UI] -> locale changed when we were on BG" ); |
|
107 emit localeChanged(); |
|
108 mLocaleChanged = false; |
|
109 } |
|
110 emit appGainedForeground(); |
|
111 } else if (event->type() == QEvent::ApplicationDeactivate ) { |
106 } else if (event->type() == QEvent::ApplicationDeactivate ) { |
112 LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationDeactivate" ); |
107 LOGS_QDEBUG( "logs [UI] -> eventFilter(), QEvent::ApplicationDeactivate" ); |
113 stopKeyCapture(); |
108 stopKeyCapture(); |
114 mForeground = false; |
|
115 } else if (event->type() == QEvent::LocaleChange) { |
109 } else if (event->type() == QEvent::LocaleChange) { |
116 if (mForeground) { |
110 if (mForeground) { |
117 emit localeChanged(); |
111 emit localeChanged(); |
118 } else { |
112 } else { |
119 mLocaleChanged = true; |
113 mLocaleChanged = true; |
120 } |
114 } |
121 } |
115 } |
122 |
116 |
123 return HbMainWindow::eventFilter(obj,event); |
117 return HbMainWindow::eventFilter(obj,event); |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 void LogsMainWindow::obscuredCalled() |
|
125 { |
|
126 LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::obscuredCalled" ); |
|
127 mForeground = false; |
|
128 emit appLostForeground(); |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 void LogsMainWindow::revealedCalled() |
|
136 { |
|
137 LOGS_QDEBUG( "logs [UI] -> LogsMainWindow::revealedCalled" ); |
|
138 mForeground = true; |
|
139 if (mLocaleChanged) { |
|
140 LOGS_QDEBUG( "logs [UI] -> locale changed when we were on BG" ); |
|
141 emit localeChanged(); |
|
142 mLocaleChanged = false; |
|
143 } |
|
144 emit appGainedForeground(); |
124 } |
145 } |
125 |
146 |
126 // ----------------------------------------------------------------------------- |
147 // ----------------------------------------------------------------------------- |
127 // |
148 // |
128 // ----------------------------------------------------------------------------- |
149 // ----------------------------------------------------------------------------- |