/***********************************************************************
**
**   cumulusqpeapplication.cpp
**
**   This file is part of Cumulus
**
************************************************************************
**
**   Copyright (c): 2005 by Axel Pauli (axel@kflog.org)
**
**   This program is free software; you can redistribute it and/or modify
**   it under the terms of the GNU General Public License as published by
**   the Free Software Foundation; either version 2 of the License, or
**   (at your option) any later version.
**
**   $Id: cumulusqpeapplication.cpp,v 1.1 2005/02/18 17:28:18 axel Exp $
**
**   Description:
**
**   This class overwrites the buggy method qwsEventFilter from
**   QPEApplication in a simple kind. It makes always a return false,
**   so that the event is forwarded to the QT classes, which has
**   subscribed. Two problems were solved by this handling.
**
**   a) routing of hardware key events to QApplication under Opie
**   b) routing of focus key events to QApplication, which sometimes
**      have caused a deadlock
**
***********************************************************************/

#include <qwsevent_qws.h>
#include "cumulusqpeapplication.h"

CumulusQPEApplication::CumulusQPEApplication( int& argc, char **argv ) :
  QPEApplication( argc, argv )
{
  // qDebug( "CumulusQPEApplication::CumulusQPEApplication() is called" );
  return;
}

CumulusQPEApplication::~CumulusQPEApplication()
{
  // qDebug( "CumulusQPEApplication::~CumulusQPEApplication() is called" );
  return;
}

/*! Note, written to QApplication::qwsEventFilter:

  This virtual function is only implemented under Qt/Embedded.

  If you create an application that inherits QApplication and
  reimplement this function, you get direct access to all QWS
  (Q Window System) events that the are received from the QWS
  master process.

  Return TRUE if you want to stop the event from being processed, or
  return FALSE for normal event dispatching.
*/

bool CumulusQPEApplication::qwsEventFilter( QWSEvent *e )
{
  // Forward all events to QT classes, which has subscribed. That will
  // bypass qwsEventFilter of QPEApplication, that makes this
  // sometimes very wrong.

  int type = e->type;

  // qDebug("CumulusQPEApplication::qwsEventFilter() is called with event type %d", type );

  return false;
}
