00001 // Copyright (c) 2007-2009 Google Inc. 00002 // Copyright (c) 2006-2007 Jaiku Ltd. 00003 // Copyright (c) 2002-2006 Mika Raento and Renaud Petit 00004 // 00005 // This software is licensed at your choice under either 1 or 2 below. 00006 // 00007 // 1. MIT License 00008 // 00009 // Permission is hereby granted, free of charge, to any person obtaining a copy 00010 // of this software and associated documentation files (the "Software"), to deal 00011 // in the Software without restriction, including without limitation the rights 00012 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00013 // copies of the Software, and to permit persons to whom the Software is 00014 // furnished to do so, subject to the following conditions: 00015 // 00016 // The above copyright notice and this permission notice shall be included in 00017 // all copies or substantial portions of the Software. 00018 // 00019 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00020 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00021 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00022 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00023 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00024 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00025 // THE SOFTWARE. 00026 // 00027 // 2. Gnu General Public license 2.0 00028 // 00029 // This program is free software; you can redistribute it and/or 00030 // modify it under the terms of the GNU General Public License 00031 // as published by the Free Software Foundation; either version 2 00032 // of the License, or (at your option) any later version. 00033 // 00034 // This program is distributed in the hope that it will be useful, 00035 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00036 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00037 // GNU General Public License for more details. 00038 // 00039 // You should have received a copy of the GNU General Public License 00040 // along with this program; if not, write to the Free Software 00041 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00042 // 00043 // 00044 // This file is part of the JaikuEngine mobile client. 00045 00046 #include "keyevents/serveranim.h" 00047 00048 // ***************************************************************************** 00049 // CKeyEventsAnim 00050 00051 // ----------------------------------------------------------------------------- 00052 // CAnim 00053 00054 void CKeyEventsAnim::ConstructL(TAny* args, TBool) { 00055 TKeyServerArgs* property_definition = reinterpret_cast<TKeyServerArgs*>(args); 00056 User::LeaveIfError(keyevent_notification_property_.Attach( 00057 TUid::Uid(property_definition->category_uid), 00058 property_definition->key_id, EOwnerThread)); 00059 iFunctions->GetRawEvents(ETrue); 00060 } 00061 00062 void CKeyEventsAnim::Redraw() { 00063 } 00064 00065 void CKeyEventsAnim::FocusChanged(TBool) { 00066 } 00067 00068 00069 void CKeyEventsAnim::Animate(TDateTime*) { 00070 } 00071 00072 TInt CKeyEventsAnim::CommandReplyL(TInt, TAny*) { 00073 return KErrNone; 00074 } 00075 00076 void CKeyEventsAnim::Command(TInt, TAny*) { 00077 } 00078 00079 CKeyEventsAnim::CKeyEventsAnim() { 00080 } 00081 00082 CKeyEventsAnim::~CKeyEventsAnim() { 00083 keyevent_notification_property_.Close(); 00084 } 00085 00086 // ----------------------------------------------------------------------------- 00087 // MEventHandler via CAnim 00088 00089 TBool CKeyEventsAnim::OfferRawEvent(const TRawEvent &raw_event) { 00090 if (raw_event.Type() == TRawEvent::EKeyDown) { 00091 ++event_count_; 00092 // A failure here is in theory a programming error, since 00093 // the only documented errors are due to either not having 00094 // access to the key or it having being defined as something else 00095 // than an int. Recovery would then be to delete and redefine the key, 00096 // but the above should only hold if somebody else has defined 00097 // the key. Don't really want to panic the client either, so we 00098 // just ignore any errors. 00099 // TODO(mikie): Check for errors, store an indicator in the object, 00100 // have a command that returns the indicator, poll periodically 00101 // from the client. 00102 keyevent_notification_property_.Set(event_count_); 00103 } 00104 return EFalse; 00105 }
ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:49:56 2011 by Doxygen 1.6.1