00001 /* 00002 This file is part of the Opie Project 00003 00004 Copyright (C) Opie Team <opie-devel@handhelds.org> 00005 =. 00006 .=l. 00007 .>+-= 00008 _;:, .> :=|. This program is free software; you can 00009 .> <`_, > . <= redistribute it and/or modify it under 00010 :`=1 )Y*s>-.-- : the terms of the GNU Library General Public 00011 .="- .-=="i, .._ License as published by the Free Software 00012 - . .-<_> .<> Foundation; either version 2 of the License, 00013 ._= =} : or (at your option) any later version. 00014 .%`+i> _;_. 00015 .i_,=:_. -<s. This program is distributed in the hope that 00016 + . -:. = it will be useful, but WITHOUT ANY WARRANTY; 00017 : .. .:, . . . without even the implied warranty of 00018 =_ + =;=|` MERCHANTABILITY or FITNESS FOR A 00019 _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU 00020 ..}^=.= = ; Library General Public License for more 00021 ++= -. .` .: details. 00022 : = ...= . :.=- 00023 -. .:....=;==+<; You should have received a copy of the GNU 00024 -_. . . )=. = Library General Public License along with 00025 -- :-=` this library; see the file COPYING.LIB. 00026 If not, write to the Free Software Foundation, 00027 Inc., 59 Temple Place - Suite 330, 00028 Boston, MA 02111-1307, USA. 00029 */ 00030 00031 #include "textviewshow.h" 00032 00033 using namespace Todo; 00034 00035 TextViewShow::TextViewShow( QWidget* parent, MainWindow* win) 00036 : QTextView( parent ), TodoShow(win) { 00037 00038 } 00039 TextViewShow::~TextViewShow() { 00040 } 00041 QString TextViewShow::type()const { 00042 return QString::fromLatin1("TextViewShow"); 00043 } 00044 void TextViewShow::slotShow( const OPimTodo& ev ) { 00045 setText( ev.toRichText() ); 00046 } 00047 QWidget* TextViewShow::widget() { 00048 return this; 00049 } 00050 void TextViewShow::keyPressEvent( QKeyEvent* event ) { 00051 switch( event->key() ) { 00052 case Qt::Key_Up: 00053 if ( ( visibleHeight() < contentsHeight() ) && 00054 ( verticalScrollBar()->value() > verticalScrollBar()->minValue() ) ) 00055 scrollBy( 0, -(visibleHeight()-20) ); 00056 else 00057 showPrev(); 00058 break; 00059 case Qt::Key_Down: 00060 if ( ( visibleHeight() < contentsHeight() ) && 00061 ( verticalScrollBar()->value() < verticalScrollBar()->maxValue() ) ) 00062 scrollBy( 0, visibleHeight()-20 ); 00063 else 00064 showNext(); 00065 break; 00066 case Qt::Key_Left: 00067 case Qt::Key_Right: 00068 case Qt::Key_F33: 00069 case Qt::Key_Enter: 00070 case Qt::Key_Return: 00071 case Qt::Key_Space: 00072 escapeView(); 00073 break; 00074 default: 00075 QTextView::keyPressEvent( event ); 00076 break; 00077 } 00078 }
1.4.2