30 #include <hbmainwindow.h> |
30 #include <hbmainwindow.h> |
31 #include <hbview.h> |
31 #include <hbview.h> |
32 #include <hbtransparentwindow.h> |
32 #include <hbtransparentwindow.h> |
33 #include <hbstackedlayout.h> |
33 #include <hbstackedlayout.h> |
34 #if defined (Q_OS_SYMBIAN) |
34 #if defined (Q_OS_SYMBIAN) |
|
35 #include <QFile> |
|
36 #include <QDir> |
35 #include <aknappui.h> |
37 #include <aknappui.h> |
36 #include <eikenv.h> |
38 #include <eikenv.h> |
37 #include <apgwgnam.h> |
39 #include <apgwgnam.h> |
38 #include <hbdevicedialogserverdefs_p.h> |
40 #include <hbdevicedialogserverdefs_p.h> |
39 #include "hbddappfactorysymbian_p.h" |
41 #include "hbddappfactorysymbian_p.h" |
184 #if defined (Q_OS_SYMBIAN) |
186 #if defined (Q_OS_SYMBIAN) |
185 // Server is created, client may connect |
187 // Server is created, client may connect |
186 RProcess::Rendezvous(KErrNone); |
188 RProcess::Rendezvous(KErrNone); |
187 #endif // Q_OS_SYMBIAN |
189 #endif // Q_OS_SYMBIAN |
188 |
190 |
189 int returnValue = app.exec(); |
191 // Unhandled exceptions mostly do not end up here. Instead they |
|
192 // go to Symbian exception handler which crashes the server. |
|
193 int returnValue = 0; |
|
194 bool hadException = true; |
|
195 try { |
|
196 returnValue = app.exec(); |
|
197 hadException = false; |
|
198 } catch (const std::bad_alloc &) { |
|
199 returnValue = 1; |
|
200 } catch (...) { |
|
201 returnValue = 2; |
|
202 } |
|
203 |
|
204 TRACE_EXIT_ARGS("excep =" << hadException << "ret =" << returnValue); |
|
205 |
|
206 #if defined (Q_OS_SYMBIAN) |
|
207 // Server exit is abnormal. Log event of it. |
|
208 QString logPath("c:/logs"); |
|
209 QDir logDir; |
|
210 if (!logDir.exists(logPath)) { |
|
211 logDir.mkpath(logPath); |
|
212 } |
|
213 QFile logFile(logPath + "/hbdevdlgsrv.txt"); |
|
214 if (logFile.open(QIODevice::WriteOnly | QIODevice::Text)) { |
|
215 logFile.write(QString().setNum(returnValue).insert(0, hadException ? 'E':'R').toAscii()); |
|
216 logFile.close(); |
|
217 } |
|
218 #endif // Q_OS_SYMBIAN |
190 |
219 |
191 UNINSTALL_MESSAGE_HANDLER |
220 UNINSTALL_MESSAGE_HANDLER |
192 |
221 |
193 return returnValue; |
222 return returnValue; |
194 } |
223 } |