main.cpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include <QtGui/QApplication>
  2. #include "mainwindow.h"
  3. #include <QDebug>
  4. #include <QSymbianEvent>
  5. #include <QWebFrame>
  6. #ifdef Q_OS_SYMBIAN
  7. #include <W32STD.H>
  8. #include <aknappui.h>
  9. #include <avkon.rsg>
  10. #endif
  11. class HybridFWApplication : public QApplication
  12. {
  13. public:
  14. HybridFWApplication(int & argc, char ** argv ) : QApplication(argc, argv) {}
  15. #ifdef Q_OS_SYMBIAN
  16. bool symbianEventFilter ( const QSymbianEvent *event )
  17. {
  18. // TODO: Refactor this to use signals.
  19. if(event && event->windowServerEvent() && m_webFrame)
  20. {
  21. if( event->windowServerEvent()->Type() == EEventFocusLost)
  22. m_webFrame->evaluateJavaScript("widgetOnHide()");
  23. else if( event->windowServerEvent()->Type() == EEventFocusGained)
  24. m_webFrame->evaluateJavaScript("widgetOnShow()");
  25. }
  26. return false;
  27. }
  28. #endif
  29. void setWebFrame(QWebFrame *webFrame) { m_webFrame = webFrame; }
  30. private:
  31. QWebFrame *m_webFrame;
  32. };
  33. int main(int argc, char *argv[])
  34. {
  35. HybridFWApplication a(argc, argv);
  36. #ifdef Q_OS_SYMBIAN
  37. CEikStatusPane* statusPane = STATIC_CAST( CAknAppUi*, CEikonEnv::Static()->EikAppUi())->StatusPane();
  38. statusPane->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_EMPTY);
  39. #endif
  40. MainWindow w;
  41. a.setWebFrame(w.webFrame());
  42. w.showMaximized();
  43. return a.exec();
  44. }